CoolWallet APTOS SDK
![Version](https://img.shields.io/npm/v/@coolwallet/aptos)
Typescript library with support for the integration of APTOS for third party application, include the functionalities of generation of addresses and signed transactions.
Install
npm i @coolwallet/aptos
Usage
import Aptos from '@coolwallet/aptos';
import { crypto } from '@coolwallet/core';
import { createTransport } from '@coolwallet/transport-web-ble';
const appId = 'appId that had been registered by wallet';
const transport = await createTransport();
const { privateKey: appPrivateKey } = crypto.key.generateKeyPair();
const aptos = new Aptos();
const keyIndex = 0;
const authKey = await aptos.getAuthKey(transport, appPrivateKey, appId, keyIndex);
const options: Options = { transport, appPrivateKey, appId };
const transaction = {
keyIndex,
sender,
receiver,
sequence,
amount,
gasLimit,
gasPrice,
expiration,
};
const signedTx = await aptos.signTransaction(transaction, options);
Methods
getAuthKey
Description
Derivation Path: BIP39 > SLIP0010 > EDDSA.
m/44'/637'/0'/0'/${keyIndex}'
async getAuthKey(
transport: Transport,
appPrivateKey: string,
appId: string
keyIndex: number
): Promise<string>
signTransaction
Description
interface Options {
transport: Transport;
appPrivateKey: string;
appId: string;
confirmCB?: Function;
authorizedCB?: Function;
}
interface Transaction {
keyIndex: number;
sender: string;
sequence: Integer;
receiver: string;
amount: Integer;
gasLimit: Integer;
gasPrice: Integer;
expiration: Integer;
}
getFakeSignedTx = async (transaction: Transaction, options: Options): Promise<string> => {
signTransaction = async (transaction: Transaction, options: Options): Promise<string> => {