Skip to content
On this page

Class: ProviderRpcClient ​

Table of contents ​

Constructors ​

Properties ​

Accessors ​

Methods ​

Constructors ​

constructor ​

• new ProviderRpcClient(properties?)

Parameters ​

NameType
propertiesProviderProperties

Defined in ​

src/index.ts:168

Properties ​

Contract ​

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

Type declaration ​

• new Contract<Abi>(abi, address)

Type parameters ​
Name
Abi
Parameters ​
NameType
abiAbi
addressAddress

Defined in ​

src/index.ts:165


Subscriber ​

• Subscriber: () => Subscriber

Type declaration ​

• new Subscriber()

Defined in ​

src/index.ts:166

Accessors ​

isInitialized ​

• get isInitialized(): boolean

Whether provider api is ready

Returns ​

boolean

Defined in ​

src/index.ts:311


raw ​

• get raw(): Provider

Raw provider

Returns ​

Provider

Defined in ​

src/index.ts:318


rawApi ​

• get rawApi(): RawProviderApiMethods

Raw provider api

Returns ​

RawProviderApiMethods

Defined in ​

src/index.ts:329

Methods ​

createContract ​

▸ createContract<Abi>(abi, address): Contract<Abi>

Creates typed contract wrapper.

Deprecated

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

Sub Category

Factory methods

Type parameters ​

Name
Abi

Parameters ​

NameTypeDescription
abiAbiReadonly object (must be declared with as const)
addressAddressDefault contract address

Returns ​

Contract<Abi>

Defined in ​

src/index.ts:270


createSubscriber ​

▸ createSubscriber(): Subscriber

Creates subscriptions group

Deprecated

new ever.Subscriber() should be used instead

Returns ​

Subscriber

Defined in ​

src/index.ts:279


hasProvider ​

▸ hasProvider(): Promise<boolean>

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

Sub Category

Initialization and provider related methods

Returns ​

Promise<boolean>

Defined in ​

src/index.ts:289


ensureInitialized ​

▸ ensureInitialized(): Promise<void>

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

Throws

ProviderNotFoundException when no provider found

Returns ​

Promise<void>

Defined in ​

src/index.ts:301


requestPermissions ​

▸ requestPermissions(args): Promise<Partial<Permissions<Address>>>

Requests new permissions for current origin. Shows an approval window to the user. Will overwrite already existing permissions


Required permissions: none

Sub Category

Account and Permissions management

Parameters ​

NameType
argsObject
args.permissionskeyof Permissions<Address>[]

Returns ​

Promise<Partial<Permissions<Address>>>

Defined in ​

src/index.ts:343


changeAccount ​

▸ changeAccount(): Promise<void>

Updates accountInteraction permission value


Requires permissions: accountInteraction

Returns ​

Promise<void>

Defined in ​

src/index.ts:359


disconnect ​

▸ disconnect(): Promise<void>

Removes all permissions for current origin and stops all subscriptions

Returns ​

Promise<void>

Defined in ​

src/index.ts:367


subscribe ​

▸ subscribe(eventName, params): Promise<Subscription<"contractStateChanged">>

Called every time contract state changes

Sub Category

Subscription management

Parameters ​

NameType
eventName"contractStateChanged"
paramsObject
params.addressAddress

Returns ​

Promise<Subscription<"contractStateChanged">>

Defined in ​

src/index.ts:377

▸ subscribe(eventName, params): Promise<Subscription<"transactionsFound">>

Called on each new transactions batch, received on subscription

Parameters ​

NameType
eventName"transactionsFound"
paramsObject
params.addressAddress

Returns ​

Promise<Subscription<"transactionsFound">>

Defined in ​

src/index.ts:385

▸ subscribe(eventName): Promise<Subscription<"connected">>

Called every time when provider connection is established

Parameters ​

NameType
eventName"connected"

Returns ​

Promise<Subscription<"connected">>

Defined in ​

src/index.ts:393

▸ subscribe(eventName): Promise<Subscription<"disconnected">>

Called when inpage provider disconnects from extension

Parameters ​

NameType
eventName"disconnected"

Returns ​

Promise<Subscription<"disconnected">>

Defined in ​

src/index.ts:398

▸ subscribe(eventName): Promise<Subscription<"messageStatusUpdated">>

Called every time a delayed message was delivered or expired

Parameters ​

NameType
eventName"messageStatusUpdated"

Returns ​

Promise<Subscription<"messageStatusUpdated">>

Defined in ​

src/index.ts:403

▸ subscribe(eventName): Promise<Subscription<"networkChanged">>

Called each time the user changes network

Parameters ​

NameType
eventName"networkChanged"

Returns ​

Promise<Subscription<"networkChanged">>

Defined in ​

src/index.ts:408

▸ subscribe(eventName): Promise<Subscription<"permissionsChanged">>

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

Parameters ​

NameType
eventName"permissionsChanged"

Returns ​

Promise<Subscription<"permissionsChanged">>

Defined in ​

src/index.ts:415

▸ subscribe(eventName): Promise<Subscription<"loggedOut">>

Called when the user logs out of the extension

Parameters ​

NameType
eventName"loggedOut"

Returns ​

Promise<Subscription<"loggedOut">>

Defined in ​

src/index.ts:420


getProviderState ​

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

Returns provider api state


Required permissions: none

Sub Category

Contract & Data Handling

Returns ​

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

Defined in ​

src/index.ts:591


getBalance ​

▸ getBalance(address): Promise<string>

Requests contract balance


Required permissions: basic

Parameters ​

NameType
addressAddress

Returns ​

Promise<string>

Defined in ​

src/index.ts:606


getFullContractState ​

▸ getFullContractState(args): Promise<{ state: undefined | FullContractState }>

Requests contract data


Required permissions: basic

Parameters ​

NameTypeDescription
argsObject-
args.addressAddressContract address

Returns ​

Promise<{ state: undefined | FullContractState }>

Defined in ​

src/index.ts:619


getAccountsByCodeHash ​

▸ getAccountsByCodeHash(args): Promise<{ accounts: Address[] ; continuation: undefined | string }>

Requests accounts with specified code hash


Required permissions: basic

Parameters ​

NameTypeDescription
argsObject-
args.codeHashstringHex encoded code hash
args.continuation?stringLast address from previous batch
args.limit?numberOptional limit. Values grater than 50 have no effect

Returns ​

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

Defined in ​

src/index.ts:634


getExpectedAddress ​

▸ getExpectedAddress<Abi>(abi, args): Promise<Address>

Computes contract address from code and init params


Required permissions: basic

Type parameters ​

Name
Abi

Parameters ​

NameType
abiAbi
argsGetExpectedAddressParams<Abi>

Returns ​

Promise<Address>

Defined in ​

src/index.ts:653


getStateInit ​

▸ getStateInit<Abi>(abi, args): Promise<{ address: Address ; stateInit: string ; hash: string }>

Computes contract address and state from code and init params


Required permissions: basic

Type parameters ​

Name
Abi

Parameters ​

NameType
abiAbi
argsGetExpectedAddressParams<Abi>

Returns ​

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

Defined in ​

src/index.ts:664


unpackInitData ​

▸ unpackInitData<Abi>(abi, data): Promise<{ publicKey?: string ; initParams: DecodedAbiInitData<Abi> }>

Decodes initial contract data using the specified ABI


Required permissions: basic

Type parameters ​

Name
Abi

Parameters ​

NameType
abiAbi
datastring

Returns ​

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

Defined in ​

src/index.ts:687


packIntoCell ​

▸ packIntoCell<P>(args): Promise<{ boc: string ; hash: string }>

Creates base64 encoded BOC


Required permissions: basic

Type parameters ​

NameType
Pextends readonly ReadonlyAbiParam[]

Parameters ​

NameType
argsObject
args.abiVersion?AbiVersion
args.structureP
args.dataMergeInputObjectsArray<P>

Returns ​

Promise<{ boc: string ; hash: string }>

Defined in ​

src/index.ts:708


unpackFromCell ​

▸ unpackFromCell<P>(args): Promise<{ data: MergeOutputObjectsArray<P> }>

Decodes base64 encoded BOC


Required permissions: basic

Type parameters ​

NameType
Pextends readonly ReadonlyAbiParam[]

Parameters ​

NameType
argsObject
args.abiVersion?AbiVersion
args.structureP
args.bocstring
args.allowPartialboolean

Returns ​

Promise<{ data: MergeOutputObjectsArray<P> }>

Defined in ​

src/index.ts:727


extractPublicKey ​

▸ extractPublicKey(boc): 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 ​

NameType
bocstring

Returns ​

Promise<string>

Defined in ​

src/index.ts:751


codeToTvc ​

▸ codeToTvc(code): Promise<string>

Converts base64 encoded contract code into tvc with default init data


Required permissions: basic

Parameters ​

NameType
codestring

Returns ​

Promise<string>

Defined in ​

src/index.ts:765


mergeTvc ​

▸ mergeTvc(args): Promise<{ tvc: string ; hash: string }>

Merges code and data into state init


Required permissions: basic

Parameters ​

NameTypeDescription
argsObject-
args.codestringBase64 encoded contract code
args.datastringBase64 encoded contract data

Returns ​

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

Defined in ​

src/index.ts:779


splitTvc ​

▸ splitTvc(tvc): Promise<{ data: undefined | string ; code: undefined | string }>

Splits base64 encoded state init into code and data


Required permissions: basic

Parameters ​

NameType
tvcstring

Returns ​

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

Defined in ​

src/index.ts:790


setCodeSalt ​

▸ setCodeSalt<P>(args): Promise<{ code: string ; hash: string }>

Merges code and data into state init


Required permissions: basic

Type parameters ​

NameType
Pextends readonly ReadonlyAbiParam[]

Parameters ​

NameType
argsSetCodeSaltParams<P>

Returns ​

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

Defined in ​

src/index.ts:803


getCodeSalt ​

▸ getCodeSalt(args): Promise<undefined | string>

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


Required permissions: basic

Parameters ​

NameType
argsGetCodeSaltParams

Returns ​

Promise<undefined | string>

Defined in ​

src/index.ts:823


addAsset ​

▸ addAsset<T>(args): Promise<{ newAsset: boolean }>

Adds asset to the selected account


Requires permissions: accountInteraction

Type parameters ​

NameType
Textends "tip3_token"

Parameters ​

NameType
argsAddAssetParams<T>

Returns ​

Promise<{ newAsset: boolean }>

Defined in ​

src/index.ts:837


getTransactions ​

▸ getTransactions(args): Promise<{ transactions: Transaction<Address>[] ; continuation: undefined | TransactionId ; info?: TransactionsBatchInfo }>

Requests contract transactions


Required permissions: basic

Sub Category

Transactions

Parameters ​

NameTypeDescription
argsObject-
args.addressAddressContract address
args.continuation?TransactionIdId of the transaction from which to request the next batch
args.limit?numberOptional limit. Values greater than 50 have no effect

Returns ​

Promise<{ transactions: Transaction<Address>[] ; continuation: undefined | TransactionId ; info?: TransactionsBatchInfo }>

Defined in ​

src/index.ts:866


getTransaction ​

▸ getTransaction(args): Promise<{ transaction: undefined | Transaction<Address> }>

Searches transaction by hash


Required permissions: basic

Parameters ​

NameTypeDescription
argsObject-
args.hashstringHex encoded transaction hash

Returns ​

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

Defined in ​

src/index.ts:887


sendMessage ​

▸ sendMessage(args): Promise<{ transaction: Transaction<Address> }>

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


Required permissions: accountInteraction

Parameters ​

NameTypeDescription
argsObject-
args.senderAddressPreferred wallet address. It is the same address as the accountInteraction.address, but it must be explicitly provided
args.recipientAddressMessage destination address
args.amountstringAmount of nano EVER to send
args.bouncebooleanWhether to bounce message back on error
args.payload?FunctionCall<Address>Optional function call
args.stateInit?stringOptional base64 encoded TVC NOTE: If the selected contract do not support this, an error is returned

Returns ​

Promise<{ transaction: Transaction<Address> }>

Defined in ​

src/index.ts:906


sendMessageDelayed ​

▸ sendMessageDelayed(args): Promise<DelayedMessageExecution>

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 ​

NameTypeDescription
argsObject-
args.senderAddressPreferred wallet address. It is the same address as the accountInteraction.address, but it must be explicitly provided
args.recipientAddressMessage destination address
args.amountstringAmount of nano EVER to send
args.bouncebooleanWhether to bounce message back on error
args.payload?FunctionCall<Address>Optional function call
args.stateInit?stringOptional base64 encoded TVC NOTE: If the selected contract do not support this, an error is returned

Returns ​

Promise<DelayedMessageExecution>

Defined in ​

src/index.ts:936


getBocHash ​

▸ getBocHash(boc): Promise<string>

Computes hash of base64 encoded BOC


Required permissions: basic

Sub Category

Cryptography & Security

Parameters ​

NameType
bocstring

Returns ​

Promise<string>

Defined in ​

src/index.ts:1026


verifySignature ​

▸ verifySignature(args): Promise<{ isValid: boolean }>

Parameters ​

NameTypeDescription
argsObject-
args.publicKeystringThe public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided
args.dataHashstringBase64 or hex encoded arbitrary bytes hash (data must be 32 bytes long)
args.signaturestringBase64 or hex encoded signature bytes (data must be 64 bytes long)
args.withSignatureId?number | booleanWhether 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 }>

Defined in ​

src/index.ts:1035


signData ​

▸ signData(args): Promise<{ dataHash: string ; signature: string ; signatureHex: string ; signatureParts: { high: string ; low: string } }>

Signs arbitrary data.

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


Requires permissions: accountInteraction

Parameters ​

NameTypeDescription
argsObject-
args.publicKeystringThe public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided
args.datastringBase64 encoded arbitrary bytes
args.withSignatureId?number | booleanWhether 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 } }>

Defined in ​

src/index.ts:1050


signDataRaw ​

▸ signDataRaw(args): Promise<{ signature: string ; signatureHex: string ; signatureParts: { high: string ; low: string } }>

Signs arbitrary data without hashing it


Requires permissions: accountInteraction

Parameters ​

NameTypeDescription
argsObject-
args.publicKeystringThe public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided
args.datastringBase64 encoded arbitrary bytes
args.withSignatureId?number | booleanWhether 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 } }>

Defined in ​

src/index.ts:1061


encryptData ​

▸ encryptData(args): Promise<EncryptedData[]>

Encrypts arbitrary data with specified algorithm for each specified recipient


Requires permissions: accountInteraction

Parameters ​

NameTypeDescription
argsObject-
args.publicKeystringThe public key of the preferred account. It is the same publicKey as the accountInteraction.publicKey, but it must be explicitly provided
args.recipientPublicKeysstring[]Public keys of recipients. Hex encoded
args.algorithm"ChaCha20Poly1305"Encryption algorithm. Nonce will be generated for each recipient
args.datastringBase64 encoded data

Returns ​

Promise<EncryptedData[]>

Defined in ​

src/index.ts:1072


decryptData ​

▸ decryptData(encryptedData): Promise<string>

Decrypts encrypted data. Returns base64 encoded data


Requires permissions: accountInteraction

Parameters ​

NameType
encryptedDataEncryptedData

Returns ​

Promise<string>

Defined in ​

src/index.ts:1084