-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85f5fb2
commit 356a845
Showing
6 changed files
with
172 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,59 @@ | ||
# Bridge SDK | ||
|
||
## Basic usage | ||
|
||
Connect station: | ||
|
||
```js | ||
import { StationWallet, ChainType, BridgeType } from 'bridge-sdk' | ||
|
||
const wallet = new StationWallet() | ||
|
||
if (!wallet.isSupported()) { | ||
console.log( | ||
`${wallet.description.name} is not supported on your device, please try from a different wallet.`, | ||
) | ||
} else if (!wallet.isInstalled()) { | ||
console.log(`You can install ${wallet.description.name} here: ${wallet.description.installLink}`) | ||
} | ||
|
||
wallet | ||
.connect(ChainType.terra) | ||
.then(({ address }) => console.log(address)) | ||
``` | ||
|
||
Get the balance (wallet must be already connected): | ||
```js | ||
wallet | ||
.getBalance('uluna') | ||
.then((res) => { | ||
res.success | ||
? console.log(`Balance: ${res.data} uluna`) | ||
: console.log(`Error: ${res.error}` | ||
}) | ||
``` | ||
Send tx from station (wallet must be already connected): | ||
```js | ||
wallet | ||
.transfer({ | ||
src: ChainType.terra, | ||
dst: ChainType.osmosis, | ||
bridge: BridgeType.ibc, | ||
address: 'osmo1...', | ||
coin: { | ||
amount: 100_000, | ||
denom: 'uluna', | ||
}, | ||
}) | ||
.then((res) => { | ||
res.success | ||
? console.log(`TX hash: ${res.txhash}`) | ||
: console.log(`Error: ${res.error}` | ||
}) | ||
``` | ||
> You can use the same functions on the `KeplrWallet` and `MetaMaskWallet` to send a tx from those wallets | ||
> | ||
> You can find more info about the available functions on the [Wallet inteface](/src/wallets/Wallet.ts#25) |
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
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