debridge-finance / debridge-validator-signatures-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

debridge-validator-signatures-sdk

SDK for finding all signatures by submission ID in the Arweave network (stored by Bunldr) or in debridge api if not exists in arweave and performing web3 erecover() for validating the signatures. The SDK supports searching only for transactions that were created by specific addresses. The same for searching new assets by tokenName, deployId, debridgeId.

How to use

const client = new DebridgeValidatorSignaturesClient();
await client.init({
  arweaveNode: 'https://arweave.net', //default https://arweave.net
  arweaveTxOwners: undefined, //default addreses from https://raw.githubusercontent.com/debridge-finance/list-validators/main/validators.json
  debridgeApi: 'https://api.debridge.finance', default, //default https://api.debridge.finance
});

Example of receiving arweaveTxOwners from git:

const gitResponse = await fetch('https://raw.githubusercontent.com/debridge-finance/list-validators/main/validators.json');
const arweaveTxOwners = (await gitResponse.json()).map(item => item.arweave);

For using a sdk you should have a context that contains logger(see types).

Get signatures by submission id:

client.getSubmissionConfirmations('0xcaa800ead1e369cae024dda4b46716674f88807416e7581a939d4f05db4002f4', context)

Returns

signature: string;
validator: string;
submissionId: string;
txHash?: string;
chainIdFrom?: string;
nonce?: string;
chainIdTo?: string;
bundlrTransactionId?: string;
validatorName?: string;

txHash, chainIdFrom, nonce, chainIdTo, bundlrTransactionId, validatorName are not presented in records from debridge api.

Get signatures by debridgeId:

client.getNewAssetConfirmationsByDebridgeId('0x15db45753160f76964dfa867510c9ede0ac87ac9ce24771de7efa0dab8251c1a', context)

Returns

signature: string;
validator: string;
deployId: string;
debridgeId: string;
nativeChainId: string;
tokenDecimals: string;
tokenName: string;
tokenSymbol: string;
tokenAddress: string;
validatorName?: string;
bundlrTransactionId?: string;

bundlrTransactionId, validatorName are not presented in records from debridge api.

About


Languages

Language:TypeScript 90.9%Language:JavaScript 9.1%