βοΈSelect functions to use
All functions are packed into window.a2n object.
Init Read Contract:
window.a2n.initReadContract()Create an A2N smart contract instance to read/get data only. Methods of this instance do not require customers' wallet account permission.
Init Write Contract:
window.a2n.initWriteContract()Developers can use this method to send transactions to A2N smart contract.
Get a product by ID from A2N Smart Contract:
window.a2n.getProductByIdFromSM(readContractInstance, productId)To get a product and its subscription plans from A2N smart contract.
Get a product by ID from A2N cloud database:
window.a2n.getProductByIdFromDB(productId)Get a product with additional information, such as description, image. and external link...
Get my subscribers:
window.a2n.getMySubscribers(readContractInstance, accountAddress)Get all subscribers of an account address.
Get my subscriptions:
Get all subscriptions of an account address.
Subscribe/purchase a subscription product:
Send a transaction to A2N smart contract and complete a payment process.
Get current account:
Get a customer's connected account on your website.
Insert a subscription product into your website:
Insert subscription product information into an HTML tag.
To see more details, you can check here: https://github.com/a2nfinance/app/blob/master/sdk/index.js
Last updated