-
Notifications
You must be signed in to change notification settings - Fork 145
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #510 from owallet-io/feat/owallet-mobile
Add OWallet Mobile to Wallet-Kit
- Loading branch information
Showing
31 changed files
with
862 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,105 @@ | ||
import { WalletManager, Logger } from "@cosmos-kit/core"; | ||
import { useMemo, useState } from 'react' | ||
import { useMemo, useState } from "react"; | ||
import { wallets as leapWallets } from "@cosmos-kit/leap"; | ||
import { wallets as stationWallets } from "@cosmos-kit/station"; | ||
import { wallets as keplrWallets } from "@cosmos-kit/keplr"; | ||
import { wallets as oWallets } from "@cosmos-kit/owallet"; | ||
import { assets } from "chain-registry"; | ||
import { Button } from "components/button"; | ||
export default () => { | ||
const walletManager = useMemo(() => { | ||
return new WalletManager( | ||
["cosmoshub", "juno", "stargaze"], [ | ||
keplrWallets[0], leapWallets[0], stationWallets[0] | ||
], new Logger('NONE'), false, | ||
undefined, undefined, assets | ||
["cosmoshub", "juno", "stargaze"], | ||
[keplrWallets[0], leapWallets[0], oWallets[0], stationWallets[0]], | ||
new Logger("NONE"), | ||
false, | ||
undefined, | ||
undefined, | ||
assets | ||
); | ||
}, []) | ||
}, []); | ||
|
||
const [_, forceUpdate] = useState(0) | ||
const [_, forceUpdate] = useState(0); | ||
|
||
const mainWallets = walletManager.mainWallets | ||
const mainWallets = walletManager.mainWallets; | ||
|
||
return ( | ||
<div> | ||
Main Wallets | ||
<table className="text-xs table-auto"> | ||
<thead> | ||
<tr> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">Wallet</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">Connect</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">Disconnect</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">Chain</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">Address</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
Wallet | ||
</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
Connect | ||
</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
Disconnect | ||
</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
Chain | ||
</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
Address | ||
</td> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{mainWallets.map(mainWallet => { | ||
const chainWallets = mainWallet.getChainWalletList(false) | ||
{mainWallets.map((mainWallet) => { | ||
const chainWallets = mainWallet.getChainWalletList(false); | ||
return chainWallets.map((w, index) => { | ||
return ( | ||
<tr> | ||
{index === 0 && ( | ||
<> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap" rowSpan={chainWallets.length}>{w.walletName}</td> | ||
<td className="border p-2 w-60" rowSpan={chainWallets.length}> | ||
<Button onClick={async () => { await mainWallet.connectAll(false); forceUpdate(i => i + 1) }}>MainWallets Connect All</Button> | ||
<td | ||
className="border p-2 break-words w-16 overflow-wrap text-wrap" | ||
rowSpan={chainWallets.length} | ||
> | ||
{w.walletName} | ||
</td> | ||
<td className="border p-2 w-64" rowSpan={chainWallets.length}> | ||
<Button onClick={async () => { await mainWallet.disconnectAll(false); forceUpdate(i => i + 1) }}>MainWallets Disconnect All</Button> | ||
<td | ||
className="border p-2 w-60" | ||
rowSpan={chainWallets.length} | ||
> | ||
<Button | ||
onClick={async () => { | ||
await mainWallet.connectAll(false); | ||
forceUpdate((i) => i + 1); | ||
}} | ||
> | ||
MainWallets Connect All | ||
</Button> | ||
</td> | ||
<td | ||
className="border p-2 w-64" | ||
rowSpan={chainWallets.length} | ||
> | ||
<Button | ||
onClick={async () => { | ||
await mainWallet.disconnectAll(false); | ||
forceUpdate((i) => i + 1); | ||
}} | ||
> | ||
MainWallets Disconnect All | ||
</Button> | ||
</td> | ||
</> | ||
)} | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">{w.chainName}</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap">{w.address}</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
{w.chainName} | ||
</td> | ||
<td className="border p-2 break-words w-16 overflow-wrap text-wrap"> | ||
{w.address} | ||
</td> | ||
</tr> | ||
) | ||
}) | ||
); | ||
}); | ||
})} | ||
</tbody> | ||
</table> | ||
</div > | ||
) | ||
} | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.