everscale-inpage-provider - v0.6.6
    Preparing search index...

    Class ProviderRpcClient

    Index

    Constructors

    Properties

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

    Accessors

    • get isInitialized(): boolean

      Whether provider api is ready

      Returns boolean

    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

      Returns Promise<void>

      ProviderNotFoundException when no provider found

    • Creates typed contract wrapper.

      Type Parameters

      • Abi

      Parameters

      • abi: Abi

        Readonly object (must be declared with as const)

      • address: Address

        Default contract address

      Returns Contract<Abi>

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

    • 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<Addr>>;
              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

        • Optionalmasterchain?: boolean

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

        • Optionaltimestamp?: 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

        • Optionalcontinuation?: string

          Last address from previous batch

        • Optionallimit?: number

          Optional limit. Values grater than 50 have no effect

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

    • Searches transaction by hash


      Required permissions: basic

      Parameters

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

          Hex encoded transaction hash

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

    • 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>

    • 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: string | undefined; code: string | undefined }>

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


      Required permissions: basic

      Parameters

      Returns Promise<string | undefined>

    • 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;
            withSignatureContext?: SignatureContext;
        }
        • 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)

        • OptionalwithSignatureId?: 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.

          Use withSignatureContext instead.

        • OptionalwithSignatureContext?: SignatureContext

          Optional advanced signature configuration.

          In most cases you do not need to set this manually. The wallet or network configuration will choose the correct mode.

          This field controls how the data is prepared before signing:

          • empty — signs the data as-is. Use for simple or legacy signing.

          • signatureId — signs the data together with a network-specific id. Prevents signatures from being reused on another network.

          • signatureDomainL2 — same as signature id but with a different prefix. This should be used where the SignatureDomain capability is enabled.

          If provided, this field overrides withSignatureId.

      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;
            withSignatureContext?: SignatureContext;
        }
        • 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

        • OptionalwithSignatureId?: 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.

          Use withSignatureContext instead.

        • OptionalwithSignatureContext?: SignatureContext

          Optional advanced signature configuration.

          In most cases you do not need to set this manually. The wallet or network configuration will choose the correct mode.

          This field controls how the data is prepared before signing:

          • empty — signs the data as-is. Use for simple or legacy signing.

          • signatureId — signs the data together with a network-specific id. Prevents signatures from being reused on another network.

          • signatureDomainL2 — same as signature id but with a different prefix. This should be used where the SignatureDomain capability is enabled.

          If provided, this field overrides withSignatureId.

      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;
            withSignatureContext?: SignatureContext;
        }
        • 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

        • OptionalwithSignatureId?: 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.

          Use withSignatureContext instead.

        • OptionalwithSignatureContext?: SignatureContext

          Optional advanced signature configuration.

          In most cases you do not need to set this manually. The wallet or network configuration will choose the correct mode.

          This field controls how the data is prepared before signing:

          • empty — signs the data as-is. Use for simple or legacy signing.

          • signatureId — signs the data together with a network-specific id. Prevents signatures from being reused on another network.

          • signatureDomainL2 — same as signature id but with a different prefix. This should be used where the SignatureDomain capability is enabled.

          If provided, this field overrides withSignatureId.

      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>

    • Request user to add a new network. Shows an approval window to the user.


      Required permissions: basic

      Parameters

      • args: { network: AddNetwork; switchNetwork?: boolean }
        • network: AddNetwork

          Network info

        • OptionalswitchNetwork?: boolean

          Whether to switch to the added network (false by default)

      Returns Promise<{ network: Network | null }>

    • Request user to change selected network. Shows an approval window to the user.


      Required permissions: basic

      Parameters

      • args: { networkId: number }

      Returns Promise<{ network: Network | null }>