Changelog
The HTTP Rewrite
August 20th, 2024 The SDK with the HTTP rewrite of thedemos object is published at @kynesyslabs/demosdk-http on NPM.
Connecting to a node
To connect to a node, use theconnect method.
true if the rpc is found, or throw an error. Once connected, you can now make unauthenticated requests (node calls).
Connecting a wallet
To make authenticated calls to the node (eg. confirming or broadcasting transactions), you need to connect a keypair to the demos object.The process of converting a mnemonic to a keypair is defined at
Cryptography.newFromSeed (in @/encryption/Cryptography.ts).You can get the address of the connected wallet using the
demos.getAddress() method.Resetting the demos object
Once you’re done, you can reset the demos object.Decoupling DemosWebAuth from the websdk
August 30th, 2024 We’ve decoupled theDemosWebAuth from the helper methods and objects in the websdk. That simply means that you’ll now need to pass the keypair to the methods that need it, instead of them reference the global DemosWebAuth instance.
Here’s a list of affected methods:
1. DemosTransactions.sign
This method was previously using the globalDemosWebAuth instance to sign transactions. Now you need to pass the keypair to the method.
You can use the keypair connected to the demos object with
DemosTransactions.sign you can call demos.tx.sign(tx) instead.2. prepareWeb2Payload
TheprepareWeb2Payload method now requires payload parameters and a keypair for signing the Transaction.
To use the keypair connected to the demos object with
prepareWeb2Payload, you can call demos.web2.preparePayload(params) instead.3. prepareXMPayload
TheprepareXMPayload method now requires a XMScript and a keypair for signing the Transaction.
To use the keypair connected to the demos object with
prepareXMPayload, you can call demos.xm.preparePayload(xm_payload) instead.