Solana Chain Signatures Contract
The Solana Chain Signatures Contract provides an implementation of the abstract ChainSignatureContract for Solana-based blockchains using Anchor and Solana's Web3.js. It enables interaction with Chain Signatures programs deployed on Solana.
Usage
import { contracts, constants } from 'signet.js'
import { AnchorProvider, Wallet } from '@coral-xyz/anchor'
import { Connection, PublicKey, Keypair } from '@solana/web3.js'
const connection = new Connection('https://api.devnet.solana.com')
const wallet = new Wallet(/* Use your actual keypair here */ Keypair.generate())
const provider = new AnchorProvider(
connection,
wallet,
AnchorProvider.defaultOptions()
)
const contract = new contracts.solana.ChainSignatureContract({
provider,
programId: new PublicKey(constants.CONTRACT_ADDRESSES.SOLANA.TESTNET_DEV),
})With Custom Configuration
import { contracts, constants } from 'signet.js'
import type { ChainSignaturesProject } from 'signet.js/contracts/solana'
import { AnchorProvider, Wallet, type Idl } from '@coral-xyz/anchor'
import { Connection, PublicKey, Keypair } from '@solana/web3.js'
import customIdl from './custom-idl.json'
const connection = new Connection('https://api.devnet.solana.com')
const wallet = new Wallet(Keypair.generate())
const provider = new AnchorProvider(
connection,
wallet,
AnchorProvider.defaultOptions()
)
const contract = new contracts.solana.ChainSignatureContract({
provider,
programId: new PublicKey(constants.CONTRACT_ADDRESSES.SOLANA.TESTNET_DEV),
config: {
rootPublicKey: 'secp256k1:...',
requesterAddress: 'Dewq9xyD1MZi1rE588XZFvK7uUqkcHLgCnDsn9Ns4H9M',
idl: customIdl as ChainSignaturesProject & Idl,
},
})Parameters
| Parameter | Type | Description |
|---|---|---|
args | object | Configuration options for the contract |
args.provider | AnchorProvider | Anchor provider instance for interacting with Solana |
args.programId | string | PublicKey | The program ID of the deployed ChainSignatures program |
args.config? | object | Optional configuration object |
args.config.rootPublicKey? | NajPublicKey | Optional root public key; derived from program ID if not provided |
args.config.requesterAddress? | string | Optional requester wallet address. If not provided, defaults to the wallet address. Fee payer is always the wallet address. |
args.config.idl? | ChainSignaturesProject & Idl | Optional custom IDL. If not provided, the default ChainSignatures IDL will be used |
