-
Notifications
You must be signed in to change notification settings - Fork 8
Examples
yaaccount edited this page Oct 22, 2019
·
12 revisions
There is a typescript project directly in this wiki repository with all the example sources - you can check it out and inspect:
-
git clone https://github.com/proximax-storage/tsjs-xpx-chain-sdk.wiki
- see folder
files/demo/src/demo
- see folder
(those are referenced from other examples through Network
class)
- Get generationHash from block 1 (class
NetworkProperties
)- you need it as a mandatory parameter for every transaction signing
- Wait for a transaction to be confirmed (method
announceAndWaitForConfirmation
) - Put all the http api endpoint classes into a single wrapper (class
ApiEndpoint
)
- Generates new Keypair.
- Generates a Keypair from a private key.
- Generate Account struct.
- Generate address from a public key.
- Generate address from a private key.
- Get AccountInfo for an account.
- Get AccountsInfo for different accounts.
- Get confirmed transactions information.
- Get incoming transactions information.
- Get outgoing transactions information.
- Get unconfirmed transactions information.
- Get aggregate bonded transactions information.
- Get multisig account information.
- Get multisig account graph information.
- Get transaction information of transactionId or transactionHash.
- Get transaction information for a given set of transactionId or transactionHash.
- Get transaction status of transactionId or transactionHash.
- Get an array of transaction statuses for a given set of transactionId or transactionHash.
- Get mosaic information.
- Get information for a set of mosaics.
- Get readable names for a set of mosaics.
- Get an array of MosaicInfo from mosaics created under provided namespace.
- Get namespace information.
- Get namespaces an account owns.
- Get readable names for a set of namespaces.
- Get an array of NamespaceInfo for a given set of addresses.
- Get BlockInfo for a given block height.
- Get transactions from a block.
- Get the current height of the chain.
- Get the current score of the chain.
- Get the storage information.
- Get an array of BlockInfo for a given block height and limit.
- Get the current network type of the chain.
- Create a transfer transaction
- Create a root namespace
- Create a sub namespace
- Create a mosaic definition transaction
- Create a mosaic supply change transaction
- Create a modify multisig account transaction
- Scenario:
- Seed account sends funds to both Alice and Bob in single aggregate complete transaction
- Alice prepares and signs aggregate bonded transaction containing two inner transactions - one alice-to-bob and one bob-to-alice
- Alice prepares and announces lock funds transactions for the above prepared aggregate bonded transaction
- Alice announces the above prepared aggregate bonded transaction
- Bob cosigns the aggregate bonded transaction from Alice and announces aggregate cosignature transaction
- finally, the aggregate bonded transaction gets confirmed
- Scenario:
- precondition: Alice and Bob have a shared secret
- Alice announces secret lock transaction using a hash of the shared secret (only hash of the secret is visible to the network)
- Bob announces secret proof transaction using the same shared secret (secret is revealed, Bob proves he knows the same secret as Alice)
- Subscribe a block channel
- Subscribe a confirmedAdded channel
- Subscribe a unconfirmedAdded channel
- Subscribe a unconfirmedRemoved channel
- Subscribe a partialAdded channel
- Subscribe a partialRemoved channel
- Subscribe a cosignature channel
- Subscribe a status channel