A representation of a blockchain address, which is a wallet-controlled account on a network.

Hierarchy (view full)

Constructors

Properties

_reputation?: AddressReputation
id: string
key?: Wallet
model: Address
networkId: string

Methods

  • Private

    A helper function that broadcasts the signed payload.

    Parameters

    • stakingOperationID: string

      The staking operation id related to the signed payload.

    • signedPayload: string

      The payload that's being broadcasted.

    • transactionIndex: number

      The index of the transaction in the array from the staking operation.

    Returns Promise<StakingOperation>

    An updated staking operation with the broadcasted transaction.

  • Returns whether the Address has a private key backing it to sign transactions.

    Returns boolean

    Whether the Address has a private key backing it to sign transactions.

  • Get the claimable balance for the supplied asset.

    Parameters

    • asset_id: string

      The asset to check claimable balance for.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for getting the claimable balance.

      • [key: string]: string

    Returns Promise<Decimal>

    The claimable balance.

  • Private

    Create a shallow copy of given options.

    Parameters

    • Optional options: {
          [key: string]: string;
      }

      The supplied options to be copied

      • [key: string]: string

    Returns {
        [key: string]: string;
    }

    A copy of the options.

    • [key: string]: string
  • Creates a staking operation to claim stake.

    Parameters

    • amount: Amount

      The amount to claim stake.

    • assetId: string

      The asset to claim stake.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for the claim stake operation.

      A. Shared ETH Staking

      • integrator_contract_address (optional): The contract address to which the claim stake operation is directed to. Defaults to the integrator contract address associated with CDP account (if available) or else defaults to a shared integrator contract address for that network.
      • [key: string]: string
    • timeoutSeconds: number = 600

      The amount to wait for the transaction to complete when broadcasted.

    • intervalSeconds: number = 0.2

      The amount to check each time for a successful broadcast.

    Returns Promise<StakingOperation>

    The staking operation after it's completed successfully.

  • Creates a contract invocation with the given data.

    Parameters

    • contractAddress: string

      The address of the contract the method will be invoked on.

    • method: string

      The method to invoke on the contract.

    • abi: object

      The ABI of the contract.

    • args: object

      The arguments to pass to the contract method invocation. The keys should be the argument names and the values should be the argument values.

    • Optional atomicAmount: string

      The atomic amount of the native asset to send to a payable contract method.

    Returns Promise<ContractInvocation>

    The ContractInvocation object.

    Throws

    if the API request to create a contract invocation fails.

  • Creates a Payload Signature.

    Parameters

    • unsignedPayload: string

      The Unsigned Payload to sign.

    Returns Promise<PayloadSignature>

    A promise that resolves to the Payload Signature object.

    Throws

    if the API request to create a Payload Signature fails.

    Throws

    if the address does not have a private key loaded or an associated Server-Signer.

  • Creates a staking operation to stake.

    Parameters

    • amount: Amount

      The amount to stake.

    • assetId: string

      The asset to stake.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for the stake operation:

      A. Shared ETH Staking

      • integrator_contract_address (optional): The contract address to which the stake operation is directed to. Defaults to the integrator contract address associated with CDP account (if available) or else defaults to a shared integrator contract address for that network.

      B. Dedicated ETH Staking

      • funding_address (optional): Ethereum address for funding the stake operation. Defaults to the address initiating the stake operation.
      • withdrawal_address (optional): Ethereum address for receiving rewards and withdrawal funds. Defaults to the address initiating the stake operation.
      • fee_recipient_address (optional): Ethereum address for receiving transaction fees. Defaults to the address initiating the stake operation.
      • [key: string]: string
    • timeoutSeconds: number = 600

      The amount to wait for the transaction to complete when broadcasted.

    • intervalSeconds: number = 0.2

      The amount to check each time for a successful broadcast.

    Returns Promise<StakingOperation>

    The staking operation after it's completed successfully.

  • Creates a staking operation to stake, signs it, and broadcasts it on the blockchain.

    Parameters

    • amount: Amount

      The amount for the staking operation.

    • assetId: string

      The asset to the staking operation.

    • action: string

      The type of staking action to perform.

    • mode: StakeOptionsMode

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      }

      Additional options such as setting the mode for the staking action.

      • [key: string]: string
    • timeoutSeconds: number

      The amount to wait for the transaction to complete when broadcasted.

    • intervalSeconds: number

      The amount to check each time for a successful broadcast.

    Returns Promise<StakingOperation>

    The staking operation after it's completed fully.

    Throws

    if the API request to create or broadcast staking operation fails.

    Throws

    if the amount is less than zero.

  • Private

    A helper function that creates the staking operation.

    Parameters

    • amount: Amount

      The amount for the staking operation.

    • assetId: string

      The asset for the staking operation.

    • action: string

      The type of staking action to perform.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options such as setting the mode for the staking action.

      • [key: string]: string

    Returns Promise<StakingOperation>

    The created staking operation.

    Throws

    if the API request to create staking operation fails.

  • Trades the given amount of the given Asset for another Asset. Only same-network Trades are supported.

    Parameters

    Returns Promise<Trade>

    The Trade object.

    Throws

    if the API request to create or broadcast a Trade fails.

    Throws

    if the Trade times out.

  • Creates a trade model for the specified amount and assets.

    Parameters

    • amount: Amount

      The amount of the Asset to send.

    • fromAsset: Asset

      The Asset to trade from.

    • toAsset: Asset

      The Asset to trade to.

    Returns Promise<Trade>

    A promise that resolves to a Trade object representing the new trade.

  • Transfers the given amount of the given Asset to the given address. Only same-Network Transfers are supported. This returns a Transfer object that has been signed and broadcasted, you can wait for this to land on-chain (or fail) by calling transfer.wait().

    Parameters

    Returns Promise<Transfer>

    The transfer object.

    Throws

    if the API request to create a Transfer fails.

    Throws

    if the API request to broadcast a Transfer fails.

  • Creates a staking operation to unstake.

    Parameters

    • amount: Amount

      The amount to unstake.

    • assetId: string

      The asset to unstake.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for the unstake operation:

      A. Shared ETH Staking

      • integrator_contract_address (optional): The contract address to which the unstake operation is directed to. Defaults to the integrator contract address associated with CDP account (if available) or else defaults to a shared integrator contract address for that network.

      B. Dedicated ETH Staking

      • immediate (optional): Set this to "true" to unstake immediately i.e. leverage "Coinbase managed unstake" process . Defaults to "false" i.e. "User managed unstake" process.
      • validator_pub_keys (optional): List of comma separated validator public keys to unstake. Defaults to validators being picked up on your behalf corresponding to the unstake amount.
      • [key: string]: string
    • timeoutSeconds: number = 600

      The amount to wait for the transaction to complete when broadcasted.

    • intervalSeconds: number = 0.2

      The amount to check each time for a successful broadcast.

    Returns Promise<StakingOperation>

    The staking operation after it's completed successfully.

  • Requests faucet funds for the address. Only supported on testnet networks.

    Parameters

    • Optional assetId: string

      The ID of the asset to transfer from the faucet.

    Returns Promise<FaucetTransaction>

    The faucet transaction object.

    Throws

    If the request does not return a transaction hash.

    Throws

    If the request fails.

  • Returns the balance of the provided asset.

    Parameters

    • assetId: string

      The asset ID.

    Returns Promise<Decimal>

    The balance of the asset.

  • Returns the address and network ID of the given destination.

    Parameters

    • destination: Destination

      The destination to get the address and network ID of.

    Returns Promise<[string, string]>

    The address and network ID of the destination.

  • Gets a Payload Signature.

    Parameters

    • payloadSignatureId: string

      The ID of the Payload Signature to fetch.

    Returns Promise<PayloadSignature>

    A promise that resolves to the Payload Signature object.

    Throws

    if the API request to get the Payload Signature fails.

  • Get the pending claimable balance for the supplied asset.

    Parameters

    • asset_id: string

      The asset to check pending claimable balance for.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for getting the pending claimable balance.

      • [key: string]: string

    Returns Promise<Decimal>

    The pending claimable balance.

  • Sets the private key.

    Parameters

    • key: Wallet

      The ethers.js SigningKey the Address uses to sign data.

    Returns void

    Throws

    If the private key is already set.

  • Get the stakeable balance for the supplied asset.

    Parameters

    • asset_id: string

      The asset to check the stakeable balance for.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for getting the stakeable balance.

      • [key: string]: string

    Returns Promise<Decimal>

    The stakeable balance.

  • Lists the staking rewards for the address.

    Parameters

    • assetId: string

      The asset ID.

    • startTime: string = ...

      The start time.

    • endTime: string = ...

      The end time.

    • format: StakingRewardFormat = StakingRewardFormat.USD

      The format to return the rewards in. (usd, native). Defaults to usd.

    Returns Promise<StakingReward[]>

    The staking rewards.

  • Get the unstakeable balance for the supplied asset.

    Parameters

    • asset_id: string

      The asset to check the unstakeable balance for.

    • mode: StakeOptionsMode = StakeOptionsMode.DEFAULT

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      } = {}

      Additional options for getting the unstakeable balance. A. Dedicated ETH Staking

      • validator_pub_keys (optional): List of comma separated validator public keys to retrieve unstakeable balance for. Defaults to all validators.
      • [key: string]: string

    Returns Promise<Decimal>

    The unstakeable balance.

  • Private

    Validate if the operation is able to claim stake with the supplied input.

    Parameters

    • amount: Amount

      The amount of the asset to claim stake.

    • assetId: string

      The asset to claim stake.

    • mode: StakeOptionsMode

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      }

      Additional options for the claim stake operation.

      • [key: string]: string

    Returns Promise<void>

    Throws

    If the supplied input is not able to create a claim stake operation.

  • Private

    Validate if the operation is able to stake with the supplied input.

    Parameters

    • amount: Amount

      The amount of the asset to stake.

    • assetId: string

      The asset to stake.

    • mode: StakeOptionsMode

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      }

      Additional options for the stake operation.

      • [key: string]: string

    Returns Promise<void>

    Throws

    If the supplied input is not able to create a stake operation.

  • Checks if trading is possible and raises an error if not.

    Parameters

    • amount: Amount

      The amount of the Asset to send.

    • fromAssetId: string

      The ID of the Asset to trade from. For Ether, eth, gwei, and wei are supported.

    Returns Promise<void>

    Throws

    If the private key is not loaded, or if the asset IDs are unsupported, or if there are insufficient funds.

  • Private

    Validate if the operation is able to unstake with the supplied input.

    Parameters

    • amount: Amount

      The amount of the asset to unstake.

    • assetId: string

      The asset to unstake.

    • mode: StakeOptionsMode

      The staking mode. Defaults to DEFAULT.

    • options: {
          [key: string]: string;
      }

      Additional options for the unstake operation.

      • [key: string]: string

    Returns Promise<void>

    Throws

    If the supplied input is not able to create an unstake operation.