Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WalletAPI

A class interface that allows for easy interaction with the wallet-api service

Hierarchy

  • HTTPClient
    • WalletAPI

Index

Constructors

constructor

  • new WalletAPI(password: string, host?: undefined | string, port?: undefined | number, timeout?: undefined | number, ssl?: undefined | false | true, userAgent?: undefined | string, keepAlive?: undefined | false | true, defaultMixin?: undefined | number, decimalDivisor?: undefined | number, defaultFeePerByte?: undefined | number, defaultUnlockTime?: undefined | number): WalletAPI
  • Initializes a new WalletAPI interface

    Parameters

    • password: string

      the API password for the WalletAPI instance

    • Optional host: undefined | string

      the address of the daemon

    • Optional port: undefined | number

      the port of the daemon

    • Optional timeout: undefined | number

      the timeout to wait for each request in ms

    • Optional ssl: undefined | false | true

      whether the daemon uses SSL (HTTPS) or not

    • Optional userAgent: undefined | string

      the user agent string to use with requests

    • Optional keepAlive: undefined | false | true

      whether the underlying HTTP(s) connection should be kept alive and reused

    • Optional defaultMixin: undefined | number

      the default mixin used for generated transactions

    • Optional decimalDivisor: undefined | number

      the decimal divisor to use in converting between atomic units and human readable values

    • Optional defaultFeePerByte: undefined | number

      the default fee per byte to use in generating transactions

    • Optional defaultUnlockTime: undefined | number

      the default unlock time to use in generating transaction

    Returns WalletAPI

Methods

addresses

  • addresses(): Promise<string[]>
  • Retrieves a list of the addresses in the wallet container

    Returns Promise<string[]>

alive

  • alive(): Promise<boolean>
  • Returns if the Wallet-API service is reachable

    Returns Promise<boolean>

balance

  • Retrieves the balance for the entire wallet container or the specified wallet address

    Parameters

    • Optional address: undefined | string

      the wallet address to check or undefined for the entire container

    Returns Promise<IWalletBalance>

balances

close

  • close(): Promise<void>
  • Closes the wallet container that is currently open

    Returns Promise<void>

create

  • create(filename: string, password: string, daemonHost?: string, daemonPort?: number, daemonSSL?: boolean): Promise<void>
  • Creates a new wallet container using the specified parameters

    Parameters

    • filename: string

      the filename of the wallet container

    • password: string

      the password of the wallet container

    • Default value daemonHost: string = "127.0.0.1"

      the node to use for the wallet container

    • Default value daemonPort: number = 11898

      the node port to use for the wallet container

    • Default value daemonSSL: boolean = false

      whether the node uses SSL or not

    Returns Promise<void>

createAddress

  • createAddress(): Promise<IWallet>

createIntegratedAddress

  • createIntegratedAddress(address: string, paymentId: string): Promise<string>
  • Creates an integrated address forom the given address and payment ID

    Parameters

    • address: string

      the address to use to generate the integrated address

    • paymentId: string

      the payment ID to use to generate the integrated address

    Returns Promise<string>

deleteAddress

  • deleteAddress(address: string): Promise<void>
  • Deletes the given subwallet from the container

    Parameters

    • address: string

      the address of the subwallet to delete

    Returns Promise<void>

deletePreparedTransaction

  • deletePreparedTransaction(hash: string): Promise<void>
  • t * Deletes a previous prepared transaction

    Parameters

    • hash: string

      the hash of the prepared transaction

    Returns Promise<void>

getNode

  • getNode(): Promise<INode>
  • Retrieves the node, address, port, fee, and fee address of the connected node

    Returns Promise<INode>

importAddress

  • importAddress(privateSpendKey: string, scanHeight?: number): Promise<string>
  • Imports a subwallet with the given private spend key starting at the specified can height

    Parameters

    • privateSpendKey: string

      the private spend key of the subwallet to import

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the subwallet

    Returns Promise<string>

importDeterministic

  • importDeterministic(walletIndex?: number, scanHeight?: number): Promise<string>
  • Imports a deterministic subwallet with the given wallet index number

    Parameters

    • Default value walletIndex: number = 0

      the index of the deterministic subwallet

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the subwallet

    Returns Promise<string>

importKey

  • importKey(filename: string, password: string, privateViewKey: string, privateSpendKey: string, scanHeight?: number, daemonHost?: undefined | string, daemonPort?: undefined | number, daemonSSL?: undefined | false | true): Promise<void>
  • Imports a new wallet container using the specified keys and optional params

    Parameters

    • filename: string

      the filename of the wallet container

    • password: string

      the password of the wallet container

    • privateViewKey: string

      the private view key of the wallet

    • privateSpendKey: string

      the private spend key of the wallet

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the wallet

    • Optional daemonHost: undefined | string

      the node to use for the wallet container

    • Optional daemonPort: undefined | number

      the node port to use for the wallet container

    • Optional daemonSSL: undefined | false | true

      whether the node uses SSL or not

    Returns Promise<void>

importSeed

  • importSeed(filename: string, password: string, mnemonicSeed: string, scanHeight?: number, daemonHost?: undefined | string, daemonPort?: undefined | number, daemonSSL?: undefined | false | true): Promise<void>
  • Imports a new wallet container using the specified mnemonic seed and optional params

    Parameters

    • filename: string

      the filename of the wallet container

    • password: string

      the password of the wallet container

    • mnemonicSeed: string

      the mnemonic seed of the wallet to import

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the wallet

    • Optional daemonHost: undefined | string

      the node to use for the wallet container

    • Optional daemonPort: undefined | number

      the node port to use for the wallet container

    • Optional daemonSSL: undefined | false | true

      whether the node uses SSL or not

    Returns Promise<void>

importViewAddress

  • importViewAddress(publicSpendKey: string, scanHeight?: number): Promise<string>
  • Imports a view only subwallet with the given public spend key

    Parameters

    • publicSpendKey: string

      the public spend key of the subwallet

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the subwallet

    Returns Promise<string>

importViewOnly

  • importViewOnly(filename: string, password: string, privateViewKey: string, address: string, scanHeight?: number, daemonHost?: undefined | string, daemonPort?: undefined | number, daemonSSL?: undefined | false | true): Promise<void>
  • Imports a new view only wallet container using the specified mnemonic seed and optional params

    Parameters

    • filename: string

      the filename of the wallet container

    • password: string

      the password of the wallet container

    • privateViewKey: string

      the private view key of the wallet

    • address: string

      the public wallet address

    • Default value scanHeight: number = 0

      the height to start scanning from upon import of the wallet

    • Optional daemonHost: undefined | string

      the node to use for the wallet container

    • Optional daemonPort: undefined | number

      the node port to use for the wallet container

    • Optional daemonSSL: undefined | false | true

      whether the node uses SSL or not

    Returns Promise<void>

keys

  • keys(address?: undefined | string): Promise<string | IWallet>
  • Retrieves the wallet container's shared private view key, or if an address is specified, returns the public and private spend keys for the given address

    Parameters

    • Optional address: undefined | string

      the wallet address

    Returns Promise<string | IWallet>

keysMnemonic

  • keysMnemonic(address: string): Promise<string>
  • Retrieves the menemonic seed for the given address if possible

    Parameters

    • address: string

      the wallet address

    Returns Promise<string>

newDestination

  • Creates a new output destination object

    Parameters

    • address: string

      the address of the recipient

    • amount: number

      the human readable amount to send to the recipient

    Returns ITransferDestination

open

  • open(filename: string, password: string, daemonHost?: undefined | string, daemonPort?: undefined | number, daemonSSL?: undefined | false | true): Promise<void>
  • Opens an existing wallet container

    Parameters

    • filename: string

      the filename of the wallet container

    • password: string

      the password of the wallet container

    • Optional daemonHost: undefined | string

      the node to use for the wallet container

    • Optional daemonPort: undefined | number

      the node port to use for the wallet container

    • Optional daemonSSL: undefined | false | true

      whether the node uses SSL or not

    Returns Promise<void>

prepareAdvanced

  • prepareAdvanced(destinations: ITransferDestination[], mixin?: undefined | number, fee?: IFeeType, sourceAddresses?: string[], paymentId?: undefined | string, changeAddress?: undefined | string, unlockTime?: undefined | number, extraData?: any | string): Promise<ISendTransactionResult>
  • Prepares an advanced transaction

    Parameters

    • destinations: ITransferDestination[]

      the destination(s) of the transaction

    • Optional mixin: undefined | number

      the number of mixins to use

    • Optional fee: IFeeType

      the transaction fee to pay

    • Optional sourceAddresses: string[]

      the source addresses, if any, of the funds for the transaction

    • Optional paymentId: undefined | string

      the payment ID to include with the transactions

    • Optional changeAddress: undefined | string

      the address to send transaction change to

    • Optional unlockTime: undefined | number

      the unlock time of the new transaction

    • Optional extraData: any | string

      any extra data to be included in the TX_EXTRA field of the transaction

    Returns Promise<ISendTransactionResult>

prepareBasic

  • prepareBasic(address: string, amount: number, paymentId?: undefined | string): Promise<ISendTransactionResult>
  • Prepares a basic transaction

    Parameters

    • address: string

      the address to send funds to

    • amount: number

      the amount to send in the transaction

    • Optional paymentId: undefined | string

      the payment ID to include with the transaction

    Returns Promise<ISendTransactionResult>

primaryAddress

  • primaryAddress(): Promise<string>
  • Retrieves the primary public wallet address of the container

    Returns Promise<string>

reset

  • reset(scanHeight?: number): Promise<void>
  • Resets and saves the wallet container, beginning scanning from the height given, if any

    Parameters

    • Default value scanHeight: number = 0

      the scan height at which to begin scanning

    Returns Promise<void>

save

  • save(): Promise<void>
  • Saves the wallet container currently open to disk

    Returns Promise<void>

sendAdvanced

  • sendAdvanced(destinations: ITransferDestination[], mixin?: undefined | number, fee?: IFeeType, sourceAddresses?: string[], paymentId?: undefined | string, changeAddress?: undefined | string, unlockTime?: undefined | number, extraData?: any | string): Promise<ISendTransactionResult>
  • Sends an advanced transaction

    Parameters

    • destinations: ITransferDestination[]

      the destination(s) of the transaction

    • Optional mixin: undefined | number

      the number of mixins to use

    • Optional fee: IFeeType

      the transaction fee to pay

    • Optional sourceAddresses: string[]

      the source addresses, if any, of the funds for the transaction

    • Optional paymentId: undefined | string

      the payment ID to include with the transactions

    • Optional changeAddress: undefined | string

      the address to send transaction change to

    • Optional unlockTime: undefined | number

      the unlock time of the new transaction

    • Optional extraData: any | string

      any extra data to be included in the TX_EXTRA field of the transaction

    Returns Promise<ISendTransactionResult>

sendBasic

  • Sends a basic transaction

    Parameters

    • address: string

      the address to send funds to

    • amount: number

      the amount to send in the transaction

    • Optional paymentId: undefined | string

      the payment ID to include with the transaction

    Returns Promise<ISendTransactionResult>

sendFusionAdvanced

  • sendFusionAdvanced(address: string, mixin?: undefined | number, sourceAddresses?: string[]): Promise<string>
  • Sends an advanced fusion transaction

    Parameters

    • address: string

      the address to send the fusion transaction to

    • Optional mixin: undefined | number

      the number of mixins to use in the fusion transaction

    • Optional sourceAddresses: string[]

      the source addresses, if any, of the funds for the fusion transaction

    Returns Promise<string>

sendFusionBasic

  • sendFusionBasic(): Promise<string>

sendPrepared

  • sendPrepared(transactionHash: string): Promise<void>
  • Sends a previously prepared transaction

    Parameters

    • transactionHash: string

      the hash of the prepared transaction

    Returns Promise<void>

setNode

  • setNode(daemonHost?: undefined | string, daemonPort?: undefined | number, daemonSSL?: boolean): Promise<void>
  • Opens an existing wallet container

    Parameters

    • Optional daemonHost: undefined | string

      the node to use for the wallet container

    • Optional daemonPort: undefined | number

      the node port to use for the wallet container

    • Default value daemonSSL: boolean = false

      whether the node uses SSL or not

    Returns Promise<void>

status

transactionByHash

transactionPrivateKey

  • transactionPrivateKey(hash: string): Promise<string>
  • Retrieves the transaction private key that can be used to audit a transaction

    Parameters

    • hash: string

    Returns Promise<string>

transactions

  • transactions(startHeight?: undefined | number, endHeight?: undefined | number): Promise<ITransactionInfo[]>
  • Retrieves a list of all transactions in the wallet container and/or within the supplied constraints

    Parameters

    • Optional startHeight: undefined | number

      the height to return transfers from

    • Optional endHeight: undefined | number

      the height to return transactions until

    Returns Promise<ITransactionInfo[]>

transactionsByAddress

  • transactionsByAddress(address: string, startHeight?: number, endHeight?: undefined | number): Promise<ITransactionInfo[]>
  • Retrieves a list of all transactions in the wallet container by address and/or within the supplied constraints

    Parameters

    • address: string

      the wallet address

    • Default value startHeight: number = 0

      the height to return transfers from

    • Optional endHeight: undefined | number

      the height to return transactions until

    Returns Promise<ITransactionInfo[]>

unconfirmedTransactions

  • unconfirmedTransactions(address?: undefined | string): Promise<ITransactionInfo[]>
  • Retrieves a list of all unconfirmed outgoing transactions in the wallet container

    Parameters

    • Optional address: undefined | string

    Returns Promise<ITransactionInfo[]>

validateAddress

Generated using TypeDoc