SolanaBtcRelay<B>
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:40
Solana BTC relay (bitcoin light client) program representation.
Extends
SolanaProgramBase<any>
Type Parameters
| Type Parameter |
|---|
B extends BtcBlock |
Implements
BtcRelay<SolanaBtcStoredHeader, {signers:Signer[];tx:Transaction; },B,SolanaSigner>
Constructors
Constructor
new SolanaBtcRelay<B>(
chainInterface,
bitcoinRpc,
programAddress?): SolanaBtcRelay<B>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:176
Parameters
| Parameter | Type | Description |
|---|---|---|
chainInterface | SolanaChainInterface | Underlying chain interface to use for the Solana chain operations |
bitcoinRpc | BitcoinRpc<B> | Bitcoin RPC instance to use for read access to the bitcoin blockchain |
programAddress? | string | Optional Solana on-chain program address, defaults to the cannonical deployment |
Returns
SolanaBtcRelay<B>
Overrides
SolanaProgramBase<any>.constructor
Properties
maxForkHeadersPerTx
readonly maxForkHeadersPerTx: number = 4;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:165
Maximum amount of fork headers that fit in a single transactions
Implementation of
maxHeadersPerTx
readonly maxHeadersPerTx: number = 5;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:161
Maximum blockheaders that fit in a single transaction
Implementation of
maxShortForkHeadersPerTx
readonly maxShortForkHeadersPerTx: number = 4;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:169
Maximum amount of fork headers that can be submitted at once using the short fork method
Implementation of
BtcRelay.maxShortForkHeadersPerTx
program
program: Program<T>;
Defined in: atomiq-chain-solana/src/solana/program/SolanaProgramBase.ts:21
Inherited from
Methods
estimateSynchronizeFee()
estimateSynchronizeFee(requiredBlockheight, feeRate?): Promise<bigint>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:559
Estimate required synchronization fee (worst case) to synchronize btc relay to the required blockheight
Parameters
| Parameter | Type | Description |
|---|---|---|
requiredBlockheight | number | Blockheight to which to synchronize |
feeRate? | string | Optional fee rate to use for the estimation |
Returns
Promise<bigint>
Implementation of
BtcRelay.estimateSynchronizeFee
getFeePerBlock()
getFeePerBlock(feeRate?): Promise<bigint>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:578
Returns required fee in native token to synchronize a single block to btc relay
Parameters
| Parameter | Type | Description |
|---|---|---|
feeRate? | string | Optional fee rate to use for the estimation |
Returns
Promise<bigint>
Implementation of
getForkFeeRate()
getForkFeeRate(signer, forkId): Promise<string>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:598
Gets fee rate required for submitting blockheaders to the specific fork
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the estimation |
forkId | number | A fork ID to use for estimation |
Returns
Promise<string>
Implementation of
getMainFeeRate()
getMainFeeRate(signer): Promise<string>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:587
Gets fee rate required for submitting blockheaders to the main chain
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the estimation |
Returns
Promise<string>
Implementation of
getTipData()
getTipData(): Promise<{
blockhash: string;
blockheight: number;
chainWork: Buffer;
commitHash: string;
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:267
Returns data about current main chain tip stored in the btc relay
Returns
Promise<{
blockhash: string;
blockheight: number;
chainWork: Buffer;
commitHash: string;
}>
Implementation of
retrieveLatestKnownBlockLog()
retrieveLatestKnownBlockLog(): Promise<{
resultBitcoinHeader: B;
resultStoredHeader: SolanaBtcStoredHeader;
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:338
Retrieves latest known bitcoin blockheader stored in the BTC Relay and also known to the bitcoin RPC
Returns
Promise<{
resultBitcoinHeader: B;
resultStoredHeader: SolanaBtcStoredHeader;
}>
Implementation of
BtcRelay.retrieveLatestKnownBlockLog
retrieveLogAndBlockheight()
retrieveLogAndBlockheight(blockData, requiredBlockheight?): Promise<{
header: SolanaBtcStoredHeader;
height: number;
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:282
Retrieves blockheader with a specific blockhash, returns null if requiredBlockheight is provided and
btc relay contract is not synced up to the desired blockheight
Parameters
| Parameter | Type | Description |
|---|---|---|
blockData | { blockhash: string; } | |
blockData.blockhash | string | - |
requiredBlockheight? | number |
Returns
Promise<{
header: SolanaBtcStoredHeader;
height: number;
}>
Implementation of
BtcRelay.retrieveLogAndBlockheight
retrieveLogByCommitHash()
retrieveLogByCommitHash(commitmentHashStr, blockData): Promise<SolanaBtcStoredHeader>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:317
Retrieves stored bitcoin blockheader data by blockheader's commit hash and provided
blockhash from blockData
Parameters
| Parameter | Type | Description |
|---|---|---|
commitmentHashStr | string | |
blockData | { blockhash: string; } | |
blockData.blockhash | string | - |
Returns
Promise<SolanaBtcStoredHeader>
Implementation of
BtcRelay.retrieveLogByCommitHash
saveForkHeaders()
saveForkHeaders(
signer,
forkHeaders,
storedHeader,
forkId,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:451
Returns a transaction that continues submitting blockheaders to an existing long fork
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | SolanaBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
forkId | number | Fork ID to submit the blockheaders to |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>
Implementation of
saveInitialHeader()
saveInitialHeader(
signer,
header,
epochStart,
pastBlocksTimestamps,
feeRate?): Promise<{
signers: Signer[];
tx: Transaction;
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:374
Initializes the underlying BTC Relay contract
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address to use for the transaction |
header | B | Main chain blockheader to use as a genesis |
epochStart | number | Timestamp of the first block in this difficulty epoch |
pastBlocksTimestamps | number[] | Timestamps of the last 11 blockheaders, for median block time rule |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
signers: Signer[];
tx: Transaction;
}>
Implementation of
saveMainHeaders()
saveMainHeaders(
signer,
mainHeaders,
storedHeader,
feeRate?): Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:394
Returns a transaction that submits bitcoin blockheaders as a bitcoin main chain to the btc relay
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
mainHeaders | BtcBlock[] | New bitcoin blockheaders to submit |
storedHeader | SolanaBtcStoredHeader | Latest committed and stored bitcoin blockheader in the BTC relay |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>
Implementation of
saveNewForkHeaders()
saveNewForkHeaders(
signer,
forkHeaders,
storedHeader,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:415
Returns a transaction that submits a new long fork and submits the first headers to it
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | SolanaBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>
Implementation of
saveShortForkHeaders()
saveShortForkHeaders(
signer,
forkHeaders,
storedHeader,
tipWork,
feeRate?): Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:486
Returns a transaction that submits a short fork with the provided blockheaders
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | string | A signer's address for the transaction |
forkHeaders | BtcBlock[] | New fork bitcoin blockheaders to submit |
storedHeader | SolanaBtcStoredHeader | Committed and stored bitcoin blockheader in the BTC relay from which to fork |
tipWork | Buffer | Chainwork of the current BTC Relay main chain tip |
feeRate? | string | Optional fee rate for the transaction |
Returns
Promise<{
computedCommitedHeaders: SolanaBtcStoredHeader[];
forkId: number;
lastStoredHeader: SolanaBtcStoredHeader;
tx: {
signers: any[];
tx: any;
};
}>
Implementation of
sweepForkData()
sweepForkData(signer, lastSweepId?): Promise<number>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:517
Checks and sweeps data accounts which contain yet unused fork data (use for Solana's PDAs)
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | SolanaSigner | A signer's address to check account for |
lastSweepId? | number | Timestamp of the last sweep |
Returns
Promise<number>
A number of data accounts swept
Implementation of
Verify()
Verify(
signer,
reversedTxId,
confirmations,
position,
reversedMerkleProof,
committedHeader): Promise<SolanaAction>;
Defined in: atomiq-chain-solana/src/solana/btcrelay/SolanaBtcRelay.ts:85
Creates verify action to be used with the swap program, specifies the action to be firstIxBeforeComputeBudget, such that the verify instruction will always be the 0th in the transaction, this is required because swap program expects the verify instruction to be at the 0th position
Parameters
| Parameter | Type | Description |
|---|---|---|
signer | PublicKey | |
reversedTxId | Buffer | |
confirmations | number | |
position | number | |
reversedMerkleProof | Buffer<ArrayBufferLike>[] | |
committedHeader | SolanaBtcStoredHeader |
Returns
Promise<SolanaAction>