1.0.7 • Published 1 year ago
tabla-client v1.0.7
TablaClient
A class for interacting with the Tabla ComplianceSigner contract.
Installation
To install the required packages:
npm install;
Usage
- Import Tabla client library
import {TablaClient} from 'tabla-client';
- Create client instance.
Where:
- token - provider access token
- provider - provider address
const client = new TablaClient(<token>, <provider>);
- Request transaction object
const transaction = await client.requestTransaction(<provider>, <KYCdata>, <network>, <dev>?);
Where:
- provider - platform provider address
- KYCdata - JSON that contains KYC Data { 'fullName', 'dateOfBirth', 'country', 'postal_code', 'residence_address', 'region', 'walletAddress', 'status' }
- network - name of network (celo or eth)
- dev - boolean optional value. If true will use testnet contracts depending on provided chain
The response will be transaction object {to: "0xproviderSigner"; data: "0xcalldata"}
Calling provider contract
import { ethers } from 'ethers';
import { TablaClient } from 'tabla-client';
const KYCData = {
'fullName' : 'John Doe',
'dateOfBirth' : '1970-01-01',
'country' : 'US',
'postal_code' : '12000',
'residence_address' : '1230 Ocean Avenue',
'region' : '',
'walletAddress' : '0xd67952680485f9E55b7acaFac54E9ec7874F1211',
'status' : 'accredited'
}
const client = new TablaClient(token, providerAddress);
const rpcProvider = new ethers.providers.JsonRpcProvider(ethNodeUrl);
const wallet = new ethers.Wallet(privateKey, rpcProvider);
const transaction = await client.requestTransaction(providerAddress, KYCData, network);
await wallet.sendTransaction(transaction);
Here is the example of smart contract instance creation and calling setProperty() using ethers.js on ethereum mainnet