Code Examples

Snippets from these example are used in the Functions in the Fsn Class descriptions. Basic example showing how to get the current block height. Simple example to get the FSN balance of an account. Buying a ticket, checking to see if autobuy ticket is on. Listing all tickets and their block heights on the blockchain and showing the totalNumberOfTickets function. Also shows usage of the ticketPrice and getStakeInfo functions. Listing tickets for an account, including their start and end times. Send FSN with a raw transaction and show getTransactionCount and getTransaction. Show how to get asset information from the fsnapi. Get asset information, given the asset name (only for whitelisted and enabled assets - ‘verified’). Get asset information about any asset on the blockchain, given its asset ID or asset name (shows getAssetId function). Show how to create an asset. Show how to increase or decrease the supply of an asset (if it can be changed). Demonstrate how to send an asset on the blockchain to another wallet. Get all the timelocks for all assets from an account. Get timelock inforamtion about one asset ID. Sending assets to and from timelock. Sending assets to another address as timelock. Change the timelock on an asset. Get information on all swaps in the Quantum Swap Marketplace. Create a new swap and then recall it. Take all or part of a swap. Example also shows getSwap. Generate a new USAN for an account and then show how to get the public key for it (and vice-versa). Show how to separate out the preparation of transactions from actaully signing and transmitting them.