Hierarchy

  • ProviderRpcClient

Properties

Contract: (new <Abi>(abi: Abi, address: Address) => Contract<Abi>)

Type declaration

Subscriber: (new () => Subscriber)

Type declaration

Constructors

Methods

  • Checks whether this page has injected Everscale provider or there is a fallback provider.

    Returns Promise<boolean>

  • Waits until provider api will be available. Calls fallback if no provider was found

    Throws

    ProviderNotFoundException when no provider found

    Returns Promise<void>

  • Creates typed contract wrapper.

    Deprecated

    new ever.Contract(abi, address) should be used instead

    Type Parameters

    • Abi

    Parameters

    • abi: Abi

      Readonly object (must be declared with as const)

    • address: Address

      Default contract address

    Returns Contract<Abi>

  • Updates accountInteraction permission value


    Requires permissions: accountInteraction

    Returns Promise<void>

  • Removes all permissions for current origin and stops all subscriptions

    Returns Promise<void>

  • Called every time contract state changes

    Parameters

    • eventName: "contractStateChanged"
    • params: {
          address: Address;
      }

    Returns Promise<Subscription<"contractStateChanged">>

  • Called on each new transactions batch, received on subscription

    Parameters

    • eventName: "transactionsFound"
    • params: {
          address: Address;
      }

    Returns Promise<Subscription<"transactionsFound">>

  • Called every time when provider connection is established

    Parameters

    • eventName: "connected"

    Returns Promise<Subscription<"connected">>

  • Called when inpage provider disconnects from extension

    Parameters

    • eventName: "disconnected"

    Returns Promise<Subscription<"disconnected">>

  • Called every time a delayed message was delivered or expired

    Parameters

    • eventName: "messageStatusUpdated"

    Returns Promise<Subscription<"messageStatusUpdated">>

  • Called each time the user changes network

    Parameters

    • eventName: "networkChanged"

    Returns Promise<Subscription<"networkChanged">>

  • Called when permissions are changed. Mostly when account has been removed from the current accountInteraction permission, or disconnect method was called

    Parameters

    • eventName: "permissionsChanged"

    Returns Promise<Subscription<"permissionsChanged">>

  • Called when the user logs out of the extension

    Parameters

    • eventName: "loggedOut"

    Returns Promise<Subscription<"loggedOut">>

  • Returns provider api state


    Required permissions: none

    Returns Promise<{
        version: string;
        numericVersion: number;
        selectedConnection: string;
        networkId: number;
        supportedPermissions: (keyof Permissions<Address>)[];
        permissions: Partial<Permissions<Address>>;
        subscriptions: {
            [address: string]: ContractUpdatesSubscription;
        };
    }>

  • Requests contract balance


    Required permissions: basic

    Parameters

    Returns Promise<string>

  • Compute storage fee


    Required permissions: basic

    Parameters

    • args: {
          state: FullContractState;
          masterchain?: boolean;
          timestamp?: number;
      }
      • state: FullContractState

        Existing contract state

      • Optional masterchain?: boolean

        Whether to assume that the contract is in the masterchain. Default: false

      • Optional timestamp?: number

        Optional UNIX timestamp (in seconds) of the moment up to which the storage fee is calculated. Default: current timestamp

        NOTE: for a time that was earlier than the last state update, the last_paid time will be used.

    Returns Promise<{
        storageFee: string;
        storageFeeDebt?: string;
        accountStatus: AccountStatus;
        freezeDueLimit: string;
        deleteDueLimit: string;
    }>

  • Requests accounts with specified code hash


    Required permissions: basic

    Parameters

    • args: {
          codeHash: string;
          continuation?: string;
          limit?: number;
      }
      • codeHash: string

        Hex encoded code hash

      • Optional continuation?: string

        Last address from previous batch

      • Optional limit?: number

        Optional limit. Values grater than 50 have no effect

    Returns Promise<{
        accounts: Address[];
        continuation: undefined | string;
    }>

  • Searches transaction by hash


    Required permissions: basic

    Parameters

    • args: {
          hash: string;
      }
      • hash: string

        Hex encoded transaction hash

    Returns Promise<{
        transaction: undefined | Transaction<Address>;
    }>

  • Computes contract address and state from code and init params


    Required permissions: basic

    Type Parameters

    • Abi

    Parameters

    Returns Promise<{
        address: Address;
        stateInit: string;
        hash: string;
    }>

  • Decodes initial contract data using the specified ABI


    Required permissions: basic

    Type Parameters

    • Abi

    Parameters

    • abi: Abi
    • data: string

    Returns Promise<{
        publicKey?: string;
        initParams: DecodedAbiInitData<Abi>;
    }>

  • Computes hash of base64 encoded BOC


    Required permissions: basic

    Parameters

    • boc: string

    Returns Promise<string>

  • Decodes base64 encoded BOC


    Required permissions: basic

    Type Parameters

    Parameters

    • args: {
          abiVersion?: AbiVersion;
          structure: P;
          boc: string;
          allowPartial: boolean;
      }
      • Optional abiVersion?: AbiVersion
      • structure: P
      • boc: string
      • allowPartial: boolean

    Returns Promise<{
        data: MergeOutputObjectsArray<P>;
    }>

  • Extracts public key from raw account state

    NOTE: can only be used on contracts which are deployed and has pubkey header


    Required permissions: basic

    Parameters

    • boc: string

    Returns Promise<string>

  • Converts base64 encoded contract code into tvc with default init data


    Required permissions: basic

    Parameters

    • code: string

    Returns Promise<string>

  • Merges code and data into state init


    Required permissions: basic

    Parameters

    • args: {
          code: string;
          data: string;
      }
      • code: string

        Base64 encoded contract code

      • data: string

        Base64 encoded contract data

    Returns Promise<{
        tvc: string;
        hash: string;
    }>

  • Splits base64 encoded state init into code and data


    Required permissions: basic

    Parameters

    • tvc: string

    Returns Promise<{
        data: undefined | string;
        code: undefined | string;
    }>

  • Merges code and data into state init


    Required permissions: basic

    Type Parameters

    Parameters

    Returns Promise<{
        code: string;
        hash: string;
    }>

  • Retrieves salt from code. Returns undefined if code doesn't contain salt


    Required permissions: basic

    Parameters

    Returns Promise<undefined | string>

  • Adds asset to the selected account


    Requires permissions: accountInteraction

    Type Parameters

    • T extends "tip3_token"

    Parameters

    Returns Promise<{
        newAsset: boolean;
    }>

  • Parameters

    • args: {
          publicKey: string;
          dataHash: string;
          signature: string;
          withSignatureId?: number | boolean;
      }
      • publicKey: string

        The public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided

      • dataHash: string

        Base64 or hex encoded arbitrary bytes hash (data must be 32 bytes long)

      • signature: string

        Base64 or hex encoded signature bytes (data must be 64 bytes long)

      • Optional withSignatureId?: number | boolean

        Whether to use the signature id during verification (true by default).

        • If true, uses the signature id of the selected network (if the capability is enabled).
        • If false, forces signature check to ignore any signature id.
        • If number, uses the specified number as a signature id.

    Returns Promise<{
        isValid: boolean;
    }>

  • Signs arbitrary data.

    NOTE: hashes data before signing. Use signDataRaw to sign without hash.


    Requires permissions: accountInteraction

    Parameters

    • args: {
          publicKey: string;
          data: string;
          withSignatureId?: number | boolean;
      }
      • publicKey: string

        The public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided

      • data: string

        Base64 encoded arbitrary bytes

      • Optional withSignatureId?: number | boolean

        Whether to use the signature id for signing (true by default).

        • If true, uses the signature id of the selected network (if the capability is enabled).
        • If false, forces signature check to ignore any signature id.
        • If number, uses the specified number as a signature id.

    Returns Promise<{
        dataHash: string;
        signature: string;
        signatureHex: string;
        signatureParts: {
            high: string;
            low: string;
        };
    }>

  • Signs arbitrary data without hashing it


    Requires permissions: accountInteraction

    Parameters

    • args: {
          publicKey: string;
          data: string;
          withSignatureId?: number | boolean;
      }
      • publicKey: string

        The public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided

      • data: string

        Base64 encoded arbitrary bytes

      • Optional withSignatureId?: number | boolean

        Whether to use the signature id for signing (true by default).

        • If true, uses the signature id of the selected network (if the capability is enabled).
        • If false, forces signature check to ignore any signature id.
        • If number, uses the specified number as a signature id.

    Returns Promise<{
        signature: string;
        signatureHex: string;
        signatureParts: {
            high: string;
            low: string;
        };
    }>

  • Encrypts arbitrary data with specified algorithm for each specified recipient


    Requires permissions: accountInteraction

    Parameters

    • args: {
          publicKey: string;
          recipientPublicKeys: string[];
          algorithm: "ChaCha20Poly1305";
          data: string;
      }
      • publicKey: string

        The public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided

      • recipientPublicKeys: string[]

        Public keys of recipients. Hex encoded

      • algorithm: "ChaCha20Poly1305"

        Encryption algorithm. Nonce will be generated for each recipient

      • data: string

        Base64 encoded data

    Returns Promise<EncryptedData[]>

  • Decrypts encrypted data. Returns base64 encoded data


    Requires permissions: accountInteraction

    Parameters

    Returns Promise<string>

  • Sends an internal message from the user account. Shows an approval window to the user.


    Required permissions: accountInteraction

    Parameters

    • args: {
          sender: Address;
          recipient: Address;
          amount: string;
          bounce: boolean;
          payload?: FunctionCall<Address>;
          stateInit?: string;
      }
      • sender: Address

        Preferred wallet address. It is the same address as the accountInteraction.address, but it must be explicitly provided

      • recipient: Address

        Message destination address

      • amount: string

        Amount of nano EVER to send

      • bounce: boolean

        Whether to bounce message back on error

      • Optional payload?: FunctionCall<Address>

        Optional function call

      • Optional stateInit?: string

        Optional base64 encoded TVC

        NOTE: If the selected contract do not support this, an error is returned

    Returns Promise<{
        transaction: Transaction<Address>;
    }>

  • Sends an internal message from the user account without waiting for the transaction. Shows an approval window to the user.

    See

    messageStatusUpdated


    Required permissions: accountInteraction

    Parameters

    • args: {
          sender: Address;
          recipient: Address;
          amount: string;
          bounce: boolean;
          payload?: FunctionCall<Address>;
          stateInit?: string;
      }
      • sender: Address

        Preferred wallet address. It is the same address as the accountInteraction.address, but it must be explicitly provided

      • recipient: Address

        Message destination address

      • amount: string

        Amount of nano EVER to send

      • bounce: boolean

        Whether to bounce message back on error

      • Optional payload?: FunctionCall<Address>

        Optional function call

      • Optional stateInit?: string

        Optional base64 encoded TVC

        NOTE: If the selected contract do not support this, an error is returned

    Returns Promise<DelayedMessageExecution>

Accessors

  • get isInitialized(): boolean
  • Whether provider api is ready

    Returns boolean