redeemeum-blockchain-service
v0.0.1
Published
Redeemeum Blockhain service
Downloads
1
Readme
Redemeum Frontend Blockchain Service
Installation
npm install redeemeum-blockchain-service --save
Prerequisites
You have to have Metamask extension installed on your browser in order this package to work properly.
Description
In order to interact with the Blockchain you would need to set the contract addresses in your .env
file in the following manner:
TOKEN_CONTRACT=0x...
VOUCHER_KERNEL_CONTRACT=0x...
CASHIER_CONTRACT=0x...
Here are all the functions the Service currently provides and some useful information:
async getSigner()
returns JsonRpcSignerasync getUserAddress()
-> returns current logged user eth addressasync signMessage(signer, nonce)
-> returns signature which later will be used by the API service to authenticate the userasync requestCreateOrder(contractArgs: Array, value)
-> Broadcast tx to the blockchain. Returns parsed event from the BC transactionasync commitToBuy(contractArgs: Array, value)
-> Broadcast tx to the blockchain. Returns parsed event from the BC transactionasync refund(voucherID)
-> Broadcast tx to the blockchain. Returns parsed event from the BC transactionasync complain(voucherID)
-> Broadcast tx to the blockchain. Returns parsed event from the BC transactionasync cancelOrFault(voucherID)
-> Broadcast tx to the blockchain. Returns parsed event from the BC transaction