Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Wallet

Mintbase Wallet. Main entry point for users to sign and interact with NEAR and Mintbase infrastructure.

Hierarchy

  • Wallet

Index

Constructors

constructor

  • Mintbase wallet constructor. Creates an instance of a Mintbase wallet.

    Returns Wallet

    the wallet instance

Properties

Optional activeAccount

activeAccount: Account

Optional activeNearConnection

activeNearConnection: Near

Optional activeWallet

activeWallet: WalletConnection

api

api: undefined | API

chain

chain: near = ...

constants

constants: Constants

keyStore

keyStore: undefined | KeyStore

minter

minter: undefined | Minter

nearConfig

nearConfig: undefined | NEARConfig

networkName

networkName: Network = ...

Methods

acceptAndTransfer

batchChangeMinters

  • batchChangeMinters(grantMinters: string[], revokeMinters: string[], contractName: string, options?: OptionalMethodArgs): Promise<ResponseData<boolean>>

batchList

  • batchList(tokenId: string[], storeId: string, price: string, options?: OptionalMethodArgs & { autotransfer?: boolean; marketAddress?: string }): Promise<ResponseData<boolean>>
  • List an item for sale in the market.

    Parameters

    • tokenId: string[]

      The token id list.

    • storeId: string

      The token store id (contract name).

    • price: string

      The listing price.

    • Optional options: OptionalMethodArgs & { autotransfer?: boolean; marketAddress?: string }

    Returns Promise<ResponseData<boolean>>

batchMakeOffer

  • batchMakeOffer(tokenIds: string[], prices: string[], options?: OptionalMethodArgs & { marketAddress?: string; timeout?: number }): Promise<ResponseData<boolean>>
  • Make an offer to multiple tokens.

    Parameters

    • tokenIds: string[]
    • prices: string[]
    • Optional options: OptionalMethodArgs & { marketAddress?: string; timeout?: number }

    Returns Promise<ResponseData<boolean>>

burn

  • Burn one or more tokens from the same contract.

    Parameters

    • tokenIds: string[]

      An array containing token ids to be burnt.

    • contractAddress: string
    • Optional options: OptionalMethodArgs

    Returns Promise<ResponseData<boolean>>

connect

connectTo

  • connectTo(accountId: string): Promise<ResponseData<boolean>>
  • Connects to a wallet stored on local storage.

    Parameters

    • accountId: string

      the account identifier to connect.

    Returns Promise<ResponseData<boolean>>

    whether connection was successful or not.

createTransaction

  • createTransaction(__namedParameters: { actions: Action[]; nonceOffset: number; receiverId: any }): Promise<Transaction>
  • Parameters

    • __namedParameters: { actions: Action[]; nonceOffset: number; receiverId: any }
      • actions: Action[]
      • nonceOffset: number
      • receiverId: any

    Returns Promise<Transaction>

deployStore

  • deployStore(storeId: string, symbol: string, options?: OptionalMethodArgs & { attachedDeposit?: string; icon?: string }): Promise<ResponseData<boolean>>
  • Creates a store

    Parameters

    • storeId: string

      Store name

    • symbol: string

      Store symbol

    • Optional options: OptionalMethodArgs & { attachedDeposit?: string; icon?: string }

    Returns Promise<ResponseData<boolean>>

details

  • details(): Promise<ResponseData<{ accountId: string; allowance: string; balance: string; contractName: string }>>
  • Fetches connected account details.

    Returns Promise<ResponseData<{ accountId: string; allowance: string; balance: string; contractName: string }>>

    details of the current connection.

disconnect

  • Disconnects user. Removes the LocalStorage entry that represents an authorized wallet account but leaves private keys intact.

    Returns ResponseData<string>

executeMultipleTransactions

fetchTransactionResult

  • fetchTransactionResult(txHash: string): Promise<ResponseData<FinalExecutionOutcome>>
  • Fetch transaction result given a transaction hash.

    Parameters

    • txHash: string

      the transaction's hash

    Returns Promise<ResponseData<FinalExecutionOutcome>>

    the transaction result

Private getKeyStore

  • getKeyStore(): InMemoryKeyStore | BrowserLocalStorageKeyStore
  • Returns InMemoryKeyStore | BrowserLocalStorageKeyStore

getLocalAccounts

Private getNearConfig

  • Get NEAR configuration object. Defaults to testnet.

    Parameters

    • networkName: Network
    • Optional contractAddress: string

    Returns NEARConfig

getSessionKeyPair

grantMinter

init

isConnected

  • isConnected(): boolean

list

  • list(tokenId: string, storeId: string, price: string, options?: OptionalMethodArgs & { autotransfer?: boolean; marketAddress?: string }): Promise<ResponseData<boolean>>
  • List an item for sale in the market.

    Parameters

    • tokenId: string

      The token id.

    • storeId: string

      The token store id (contract name).

    • price: string

      The listing price.

    • Optional options: OptionalMethodArgs & { autotransfer?: boolean; marketAddress?: string }

    Returns Promise<ResponseData<boolean>>

makeGroupOffer

  • makeGroupOffer(groupId: string, price?: string, options?: OptionalMethodArgs & { marketAddress?: string; timeout?: number }): Promise<ResponseData<boolean>>
  • Make an offer to a token from a group.

    Parameters

    • groupId: string
    • Optional price: string
    • Optional options: OptionalMethodArgs & { marketAddress?: string; timeout?: number }

    Returns Promise<ResponseData<boolean>>

makeOffer

  • makeOffer(tokenId: string, price: string, options?: OptionalMethodArgs & { marketAddress?: string; timeout?: number }): Promise<ResponseData<boolean>>
  • Make an offer to a token.

    Parameters

    • tokenId: string
    • price: string
    • Optional options: OptionalMethodArgs & { marketAddress?: string; timeout?: number }

    Returns Promise<ResponseData<boolean>>

mint

  • mint(amount: number, contractName: string, royalties?: Royalties, splits?: Split, category?: string, options?: OptionalMethodArgs & { metadataId?: string; owner?: string; royaltyPercentage?: number }): Promise<ResponseData<boolean>>
  • Mint a token

    Parameters

    • amount: number

      The number of tokens to mint.

    • contractName: string

      The contract in which tokens will be minted.

    • Optional royalties: Royalties
    • Optional splits: Split
    • Optional category: string
    • Optional options: OptionalMethodArgs & { metadataId?: string; owner?: string; royaltyPercentage?: number }

    Returns Promise<ResponseData<boolean>>

mintMore

  • Mint more pieces of tokens of a thing.

    Parameters

    • amount: number

      The number of tokens to mint.

    • id: string

      The thing id

    • Optional splits: Split

      The contract in which tokens will be minted.

    • Optional options: OptionalMethodArgs

    Returns Promise<ResponseData<boolean>>

revokeAccount

revokeAllAccounts

revokeMinter

Private rpcCall

  • rpcCall(__namedParameters: { body?: any; headers?: any; method: string }): Promise<any>
  • Parameters

    • __namedParameters: { body?: any; headers?: any; method: string }
      • Optional body?: any
      • Optional headers?: any
      • method: string

    Returns Promise<any>

setSessionKeyPair

  • setSessionKeyPair(accountId: string, privateKey: string): Promise<ResponseData<KeyStore>>

signMessage

  • signMessage(message: string): Promise<ResponseData<{ accountId: string; publicKey: number[]; publicKey_str: string; signature: number[] }>>
  • Parameters

    • message: string

    Returns Promise<ResponseData<{ accountId: string; publicKey: number[]; publicKey_str: string; signature: number[] }>>

simpleTransfer

  • Transfer one token.

    Parameters

    • tokenId: string

      The token id to transfer.

    • receiverId: string

      The account id to transfer to.

    • contractName: string

      The contract name to transfer tokens from.

    • Optional options: OptionalMethodArgs

    Returns Promise<ResponseData<boolean>>

transactionStatus

  • transactionStatus(transactionHash: string, accountId: string): Promise<ResponseData<any>>
  • Fetch a transaction status.

    Parameters

    • transactionHash: string

      The transactions' hash.

    • accountId: string

      The account who initiated the transation. TODO: Might not be really necessary to pass this.

    Returns Promise<ResponseData<any>>

    The transaction result

transactionStatusWithReceipts

  • transactionStatusWithReceipts(transactionHash: string, accountId: string): Promise<ResponseData<any>>
  • Fetch transaction status with all receipts.

    Parameters

    • transactionHash: string

      The transactions' hash.

    • accountId: string

      The account who initiated the transation. TODO: Might not be really necessary to pass this.

    Returns Promise<ResponseData<any>>

    The transaction result with all receipts.

transfer

  • Transfer one or more tokens.

    Parameters

    • tokenIds: [string, string][]

      The mapping of transfers, defined by: [[accountName1, tokenId1], [accountName2, tokenId2]]

    • contractName: string

      The contract name to transfer tokens from.

    • Optional options: OptionalMethodArgs

    Returns Promise<ResponseData<boolean>>

transferStoreOwnership

  • transferStoreOwnership(newOwner: string, contractName: string, options?: OptionalMethodArgs & { keepOldMinters: boolean }): Promise<ResponseData<boolean>>

verifySignature

  • verifySignature(requestBody: { accountId: string; message: string; publicKey: number[]; signature: number[] }): Promise<boolean>
  • Parameters

    • requestBody: { accountId: string; message: string; publicKey: number[]; signature: number[] }
      • accountId: string
      • message: string
      • publicKey: number[]
      • signature: number[]

    Returns Promise<boolean>

viewAccessKey

  • viewAccessKey(accountId: string, publicKey: string): Promise<ResponseData<any>>
  • Fetch access key information

    Parameters

    • accountId: string

      account id

    • publicKey: string

      public key

    Returns Promise<ResponseData<any>>

    Access Key information

viewAccessKeyList

  • viewAccessKeyList(accountId: string): Promise<ResponseData<any>>
  • Fetch list of access keys for a given account

    Parameters

    • accountId: string

      account id

    Returns Promise<ResponseData<any>>

    List of access keys

withdrawOffer

  • Withdraw the escrow deposited for an offer.

    Parameters

    • tokenKey: string

      The token key. <tokenId>:<contractName>

    • Optional options: OptionalMethodArgs & { marketAddress?: string }

    Returns Promise<ResponseData<boolean>>

Generated using TypeDoc