0.0.21 • Published 2 years ago

manta-signer-interface v0.0.21

Weekly downloads
-
License
GPL-3.0-only
Repository
-
Last release
2 years ago

Manta Signer Interface

An interface to simplify interacting with Manta Signer

Installation

yarn add manta-signer-interface

Usage

Initialization

// get an instance of polkadot.js api
import { ApiPromise, WsProvider } from '@polkadot/api';
const api = new ApiPromise({ provider, types, rpc: jsonrpc });
await api.isReady;

// Get some subclass of AddressStore depending on use case
// Browser address store for web app, memory address store for cli testing, or your own implementation
import { MemoryAddressStore };
const addressStore = MemoryAddressStore.testnet();

const signerInterface = new SignerInterface(api, addressStore);

Recovering (or refreshing) a wallet

// returns an array of ClientAsset
const myRecoveredAssets =  signerInterface.recoverAccount();

Doing a private transfer (or reclaim, similarly)

// The transfer you want to do
const assetId = 1;
const targetValue = 100;
const receivingAddress = "AAAAAAABBBBBBCCCCCCCDDDDDD...";


// install 'manta-coin-selection' with yarn
import { selectCoins, CoinSelection } from 'manta-coin-selection';

// returns a `CoinSelection`, which contains the selected coins and associated metadata
const coinSelection = selectCoins(
  targetValue, myRecoveredAssets.filter(asset => asset.assetId === assetId)
);

const transaction = await signerInterface.buildExternalPrivateTransferTxs(
  receivingAddress, coinSelection
);

// Submit the transaction using polkadot.js

// wait ...

// If transaction fails, run:
signerInterface.cleanupTxFailure();

// If transaction succeeds, run:
signerInterface.cleanupTxSuccess();
0.0.20

2 years ago

0.0.21

2 years ago

0.1.0

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 years ago

0.0.9

3 years ago

0.0.16

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

0.0.0

3 years ago