sendPinkQuery
Send a query to off-chain node and getting the result immediately.
Usage
example.ts
import * as fs from 'node:fs'
import { AccountId } from '@polkadot/types'
import { getContract, sendPinkQuery } from '@phala/sdk'
import { client, provider } from './setup'
const abi = fs.readFileSync('path/to/abi.json', 'utf-8')
const callerAddress = await sendPinkQuery<AccountId>({
address: '0x...',
provider,
abi,
functionName: 'getCaller',
args: ['Hi Remark'],
})
Parameters
client
OnChainRegistry
The OnChainRegistry
instance.
options
SendPinkQueryParameters
address
string | AccountId
provider
AnyProvider
abi
Record<string, any> | Abi
functionName
string
args
(optional)
any[]
Returns
Promise<T | null>
The result of the query.