0.12.1 • Published 2 years ago

@horizonx/aptos-wallet-connector v0.12.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

aptos-wallet-connector

Detail

Provides a common interface for aptos wallets in a minimal package.

FunctionDescriptionArguments
connectconnect wallet-
accountreturns current account-
networkreturns current network name-
chainIdreturns current chainId-
isConnectedreturns connected or not-
disconnectdisconnect wallet-
signAndSubmitTransactioncall connected wallet to sign and submit transctionpayload: Transaction Payload (optional) options: TransactionOptions
onAccountChangedadd listener callback on account changedlistener: (address: string | undefined) => VoidFunction (removeListener)
onNetworkChangedadd listener callback on network changedlistener: (payload: { network: string, chainId?: number}) => VoidFunction (removeListener)

Installation

yarn add @horizonx/aptos-wallet-connector

or

npm install @horizonx/aptos-wallet-connector
  • Blocto

    Dependencies:

    @blocto/sdk

    Example:

    import BloctoSDK from '@blocto/sdk'
    import { connect, WalletInterface, WalletType } from '@horizonx/aptos-wallet-connector'
    
    const walletClient: WalletInterface = await connect('blocto', new BloctoSDK({ aptos: { chainId: 1 } }).aptos!)

How to Use

import { connect, connectWalletWithProvider, WalletInterface, WalletType } from '@horizonx/aptos-wallet-connector'

const type: WalletType = 'aptos' // 'aptos'(petra) | 'fewcha' | 'martian' | 'pontem'
const walletClient: WalletInterface = await connect(type)

// If an external provider is required, it must be passed as the second argument.
const type: WalletType = 'blocto' // 'blocto'
const walletClient: WalletInterface = await connect(type, provider)

See code example.

Features

FunctionDescriptionArguments
connectconnect a wallettype: Wallet Typeprovider?: External Provider
isSupportedWalletTypereturns passed arg is supported wallet type or notarg: any
lastConnectedWalletTypereturns last connected wallet type-
ConstantDescriptiontype
SUPPORTED_WALLETSarray of supported wallet type strsWalletType[]
ERRORSdictionary of errorsRecord<ErrorType, string>

Errors

ErrorTypeDescription
NOT_INSTALLEDwallet not installed
NOT_CONNECTEDwallet not connected
CANCELLEDrequest cancelled by user

Supported Wallets

PetraFewchaMartianPontemBlocto
version1.0.50.4.81.1.42.1.10.3.9-beta
connect:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
account:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
network:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
chainId:heavy_minus_sign::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
isConnected:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
disconnect:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
signAndSubmitTransaction:white_check_mark::white_check_mark::white_check_mark::white_check_mark::white_check_mark:
onAccountChanged:white_check_mark::heavy_minus_sign::white_check_mark::white_check_mark::heavy_minus_sign:
onNetworkChanged:white_check_mark::heavy_minus_sign::white_check_mark::white_check_mark::heavy_minus_sign:
0.10.0

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.9.0

2 years ago

0.12.0

2 years ago

0.8.0

2 years ago

0.12.1

2 years ago

0.9.2

2 years ago

0.9.1

2 years ago

0.7.1

2 years ago

0.7.0

2 years ago

0.6.0

2 years ago

0.5.1

2 years ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago