New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@coolwallet/aptos

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@coolwallet/aptos

Coolwallet APTOS sdk

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

CoolWallet APTOS SDK

Version

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();

// Initialize
const aptos = new Aptos();

// Get Public Key and Authentication Key
const keyIndex = 0;
const authKey = await aptos.getAuthKey(transport, appPrivateKey, appId, keyIndex);

// Sign Transaction
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;
}

// return fake signed tx for estimating gas fee
getFakeSignedTx = async (transaction: Transaction, options: Options): Promise<string> => {

// return tx hash
signTransaction = async (transaction: Transaction, options: Options): Promise<string> => {

Keywords

FAQs

Package last updated on 05 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc