Verida meta-transaction-server provide Http GET & POST endpoints for interactions to smart contracts of Verida. Every contract developers in Verida can create supports for his contract.
This package depends on the following Verida packages
@verida/types@verida/vda-common
Verida smart contracts should be deployed to support meta transactions. Once deployed, you will get contract address & contract abi file.
Create a folder named by contract name inside "contracts" directory.
- Copy contract abi file (from step 1) to newly created directory. ABI file must be named as
abi.json. - Create
config.tsfile inside directory and set up necessary functions.
Ex: You can see abi.json and config.ts files inside "contracts/VeridaDIDRegistry/".
- Create a test code inside "src" directory
EX: Please refer "tests/vda-did-registry.test.ts".
After clone this repo, please run following command inside project directory:
yarn install
You can start server by following command:
yarn start
Server will be hosted at https://localhost:5021/
- Test for all contracts: You can test all test codes by following command:
yarn tests
- Test for individual contract
yarn test <testcode file name>
Ex: yarn test tests/vda-did-registry.test.ts
To host meta-transaction-server, we need company wallet account that will pay gas fees on meta transactions.
This is an private key of wallet. This account is in charge of paying fees for transactions. We should replace this with private key of company wallet account.
PRIVATE_KEY = "35...7de"
RPC_TARGET_NET = "RPC_URL_POLYGON_TESTNET"
RPC_URL_POLYGON_MAINNET="https://polygon-rpc.com"
RPC_URL_POLYGON_TESTNET="https://rpc-mumbai.maticvigil.com"
RPC_TARGET_NET is the chain that this server send transactions. The value should be one of following:
RPC_URL_POLYGON_MAINNET
RPC_URL_POLYGON_TESTNET
-
Ensure timeout is set to
30seconds for API gateway and the lambda. Otherwise you may seeService Unavailableor weirdInvalid signatureerrors when things timeout. -
Make sure the SSL certificate is created in us-east-1 even if deploying elsewhere.
All endpoints returns JSON object. JSON object are a bit different between success & failed.
{success: true, data: <necessary data or transaction hash>}
{success: fail, error: <error message>}
All end-points for VDA-DID-Registry contracts has prefix of "/VeridaDIDRegistry" in its path:
https://hosting-server-url/VeridaDIDRegistry/...
All end-points for NameRegistry contracts has prefix of "/NameRegistry" in its path:
https://hosting-server-url/NameRegistry/...
All end-points for VDA-DID-Linkage contracts has prefix of "/VeridaDIDLinkage" in its path:
https://hosting-server-url/VeridaDIDLinkage/...
All end-points for SBT contracts has prefix of "/VeridaDIDLinkage" in its path:
https://hosting-server-url/SoulboundNFT/...
Some functions of SBT contract can't be called via meta-transaction-server.
For example, getClaimedSBTList() & burnSBT() functions should be called by only the owner of the SBTs. If you called these functions via meta-transaction-server, it'd be always failed.