Contract Instances
You can use getContract
to get a PinkContractPromise
instance, and then use the instance to interact with the contract.
Usage
import * as fs from 'node:fs'
import { getContract } from '@phala/sdk'
const contractId = '0x...'
const abi = fs.readFileSync('path/to/your/abi.json', 'utf-8')
const contract = await getContract({
client,
contractId,
abi,
provider,
})
Parameters
client
Client
The client instance from getClient
.
contractId
string
The contract ID.
abi
Record<string, any> | Abi
The contract ABI, can be a object parse from the ABI JSON file or a instance of Abi
class.
provider
(optional)
AnyProvider
One of provider implementation instance, you can read more about provider in the providers section.
Returns
Promise<PinkContractPromise>