Last active
March 18, 2021 13:40
-
-
Save Sajjon/999c214052e9ee348cc96eec1a8e91e1 to your computer and use it in GitHub Desktop.
Radix API sneakpeak
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
it('radix flow', async (done) => { | |
const subs = new Subscription() | |
const loadKeystoreFN = () => Promise.resolve(keystoreForTest.keystore) | |
const password = keystoreForTest.password | |
const walletResult = await Wallet.byLoadingAndDecryptingKeystore({ | |
password, | |
load: loadKeystoreFN | |
}) | |
if (walletResult.isErr()) { | |
done(new Error('Failed to decrypt wallet')) | |
return | |
} | |
const wallet = walletResult.value | |
const radix = Radix.create() | |
radix.node.subscribe( | |
n => console.log(`✅💻 Did connect to node: ${n.url.toString()}`) | |
).add(subs) | |
radix.wallet.subscribe( | |
w => console.log(`✅ 💷 Got wallet`) | |
).add(subs) | |
radix.activeAddress.subscribe( | |
address => { | |
console.log(`🙋🏽♀️ my active address is: ${address.toString()}`) | |
done() | |
} | |
).add(subs) | |
radix | |
.withWallet(wallet) | |
.connect(new URL('https://api.radixdlt.com')) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment