@atomiqlabs/chain-solana 13.5.13 → 13.5.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -201
- package/README.md +73 -73
- package/dist/index.d.ts +81 -81
- package/dist/index.js +102 -102
- package/dist/node/index.d.ts +9 -9
- package/dist/node/index.js +13 -13
- package/dist/solana/SolanaChainType.d.ts +15 -15
- package/dist/solana/SolanaChainType.js +2 -2
- package/dist/solana/SolanaChains.d.ts +12 -12
- package/dist/solana/SolanaChains.js +45 -45
- package/dist/solana/SolanaInitializer.d.ts +94 -94
- package/dist/solana/SolanaInitializer.js +174 -174
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +222 -222
- package/dist/solana/btcrelay/SolanaBtcRelay.js +455 -455
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +84 -84
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +70 -70
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +92 -92
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +109 -109
- package/dist/solana/btcrelay/program/programIdl.json +671 -671
- package/dist/solana/chain/SolanaAction.d.ts +26 -26
- package/dist/solana/chain/SolanaAction.js +87 -87
- package/dist/solana/chain/SolanaChainInterface.d.ts +224 -224
- package/dist/solana/chain/SolanaChainInterface.js +275 -275
- package/dist/solana/chain/SolanaModule.d.ts +14 -14
- package/dist/solana/chain/SolanaModule.js +13 -13
- package/dist/solana/chain/modules/SolanaAddresses.d.ts +8 -8
- package/dist/solana/chain/modules/SolanaAddresses.js +22 -22
- package/dist/solana/chain/modules/SolanaBlocks.d.ts +32 -32
- package/dist/solana/chain/modules/SolanaBlocks.js +78 -78
- package/dist/solana/chain/modules/SolanaEvents.d.ts +68 -68
- package/dist/solana/chain/modules/SolanaEvents.js +238 -238
- package/dist/solana/chain/modules/SolanaFees.d.ts +189 -189
- package/dist/solana/chain/modules/SolanaFees.js +434 -434
- package/dist/solana/chain/modules/SolanaSignatures.d.ts +24 -24
- package/dist/solana/chain/modules/SolanaSignatures.js +39 -39
- package/dist/solana/chain/modules/SolanaSlots.d.ts +33 -33
- package/dist/solana/chain/modules/SolanaSlots.js +72 -72
- package/dist/solana/chain/modules/SolanaTokens.d.ts +123 -123
- package/dist/solana/chain/modules/SolanaTokens.js +242 -242
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +149 -149
- package/dist/solana/chain/modules/SolanaTransactions.js +445 -445
- package/dist/solana/connection/ConnectionWithRetries.d.ts +35 -35
- package/dist/solana/connection/ConnectionWithRetries.js +86 -71
- package/dist/solana/events/SolanaChainEvents.d.ts +45 -45
- package/dist/solana/events/SolanaChainEvents.js +108 -108
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +205 -205
- package/dist/solana/events/SolanaChainEventsBrowser.js +404 -404
- package/dist/solana/program/SolanaProgramBase.d.ts +73 -73
- package/dist/solana/program/SolanaProgramBase.js +54 -54
- package/dist/solana/program/SolanaProgramModule.d.ts +8 -8
- package/dist/solana/program/SolanaProgramModule.js +11 -11
- package/dist/solana/program/modules/SolanaProgramEvents.d.ts +53 -53
- package/dist/solana/program/modules/SolanaProgramEvents.js +117 -117
- package/dist/solana/swaps/SolanaSwapData.d.ts +333 -333
- package/dist/solana/swaps/SolanaSwapData.js +535 -535
- package/dist/solana/swaps/SolanaSwapModule.d.ts +11 -11
- package/dist/solana/swaps/SolanaSwapModule.js +12 -12
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +376 -376
- package/dist/solana/swaps/SolanaSwapProgram.js +769 -769
- package/dist/solana/swaps/SwapTypeEnum.d.ts +11 -11
- package/dist/solana/swaps/SwapTypeEnum.js +43 -43
- package/dist/solana/swaps/modules/SolanaDataAccount.d.ts +95 -95
- package/dist/solana/swaps/modules/SolanaDataAccount.js +232 -232
- package/dist/solana/swaps/modules/SolanaLpVault.d.ts +69 -69
- package/dist/solana/swaps/modules/SolanaLpVault.js +171 -171
- package/dist/solana/swaps/modules/SwapClaim.d.ts +126 -126
- package/dist/solana/swaps/modules/SwapClaim.js +294 -294
- package/dist/solana/swaps/modules/SwapInit.d.ts +213 -213
- package/dist/solana/swaps/modules/SwapInit.js +658 -658
- package/dist/solana/swaps/modules/SwapRefund.d.ts +87 -87
- package/dist/solana/swaps/modules/SwapRefund.js +293 -293
- package/dist/solana/swaps/programIdl.json +945 -945
- package/dist/solana/swaps/programTypes.d.ts +943 -943
- package/dist/solana/swaps/programTypes.js +945 -945
- package/dist/solana/swaps/v1/programIdl.json +945 -945
- package/dist/solana/swaps/v1/programTypes.d.ts +943 -943
- package/dist/solana/swaps/v1/programTypes.js +945 -945
- package/dist/solana/swaps/v2/programIdl.json +952 -952
- package/dist/solana/swaps/v2/programTypes.d.ts +950 -950
- package/dist/solana/swaps/v2/programTypes.js +952 -952
- package/dist/solana/wallet/SolanaKeypairWallet.d.ts +29 -29
- package/dist/solana/wallet/SolanaKeypairWallet.js +50 -50
- package/dist/solana/wallet/SolanaSigner.d.ts +30 -30
- package/dist/solana/wallet/SolanaSigner.js +30 -30
- package/dist/utils/Utils.d.ts +58 -58
- package/dist/utils/Utils.js +170 -170
- package/node/index.d.ts +1 -1
- package/node/index.js +3 -3
- package/package.json +46 -46
- package/src/index.ts +87 -87
- package/src/node/index.ts +9 -9
- package/src/solana/SolanaChainType.ts +32 -32
- package/src/solana/SolanaChains.ts +46 -46
- package/src/solana/SolanaInitializer.ts +278 -278
- package/src/solana/btcrelay/SolanaBtcRelay.ts +615 -615
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +116 -116
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +148 -148
- package/src/solana/btcrelay/program/programIdl.json +670 -670
- package/src/solana/chain/SolanaAction.ts +109 -109
- package/src/solana/chain/SolanaChainInterface.ts +404 -404
- package/src/solana/chain/SolanaModule.ts +20 -20
- package/src/solana/chain/modules/SolanaAddresses.ts +20 -20
- package/src/solana/chain/modules/SolanaBlocks.ts +89 -89
- package/src/solana/chain/modules/SolanaEvents.ts +271 -271
- package/src/solana/chain/modules/SolanaFees.ts +522 -522
- package/src/solana/chain/modules/SolanaSignatures.ts +39 -39
- package/src/solana/chain/modules/SolanaSlots.ts +85 -85
- package/src/solana/chain/modules/SolanaTokens.ts +300 -300
- package/src/solana/chain/modules/SolanaTransactions.ts +503 -503
- package/src/solana/connection/ConnectionWithRetries.ts +113 -96
- package/src/solana/events/SolanaChainEvents.ts +127 -127
- package/src/solana/events/SolanaChainEventsBrowser.ts +495 -495
- package/src/solana/program/SolanaProgramBase.ts +119 -119
- package/src/solana/program/SolanaProgramModule.ts +15 -15
- package/src/solana/program/modules/SolanaProgramEvents.ts +157 -157
- package/src/solana/swaps/SolanaSwapData.ts +735 -735
- package/src/solana/swaps/SolanaSwapModule.ts +19 -19
- package/src/solana/swaps/SolanaSwapProgram.ts +1074 -1074
- package/src/solana/swaps/SwapTypeEnum.ts +30 -30
- package/src/solana/swaps/modules/SolanaDataAccount.ts +302 -302
- package/src/solana/swaps/modules/SolanaLpVault.ts +208 -208
- package/src/solana/swaps/modules/SwapClaim.ts +387 -387
- package/src/solana/swaps/modules/SwapInit.ts +785 -785
- package/src/solana/swaps/modules/SwapRefund.ts +353 -353
- package/src/solana/swaps/v1/programIdl.json +944 -944
- package/src/solana/swaps/v1/programTypes.ts +1885 -1885
- package/src/solana/swaps/v2/programIdl.json +951 -951
- package/src/solana/swaps/v2/programTypes.ts +1899 -1899
- package/src/solana/wallet/SolanaKeypairWallet.ts +56 -56
- package/src/solana/wallet/SolanaSigner.ts +43 -43
- package/src/utils/Utils.ts +194 -194
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { BtcHeader } from "@atomiqlabs/base";
|
|
4
|
-
import { Buffer } from "buffer";
|
|
5
|
-
export type SolanaBtcHeaderType = {
|
|
6
|
-
version: number;
|
|
7
|
-
reversedPrevBlockhash: number[];
|
|
8
|
-
merkleRoot: number[];
|
|
9
|
-
timestamp: number;
|
|
10
|
-
nbits: number;
|
|
11
|
-
nonce: number;
|
|
12
|
-
hash: Buffer;
|
|
13
|
-
};
|
|
14
|
-
/**
|
|
15
|
-
* Represents bitcoin blockheader data to be submitted to the Solana BTC relay program.
|
|
16
|
-
*
|
|
17
|
-
* @category BTC Relay
|
|
18
|
-
*/
|
|
19
|
-
export declare class SolanaBtcHeader implements BtcHeader {
|
|
20
|
-
/**
|
|
21
|
-
* Version field of the blockheader.
|
|
22
|
-
*/
|
|
23
|
-
private readonly version;
|
|
24
|
-
/**
|
|
25
|
-
* Previous block hash in little-endian representation.
|
|
26
|
-
*/
|
|
27
|
-
private readonly reversedPrevBlockhash;
|
|
28
|
-
/**
|
|
29
|
-
* Merkle root in little-endian representation.
|
|
30
|
-
*/
|
|
31
|
-
private readonly merkleRoot;
|
|
32
|
-
/**
|
|
33
|
-
* Block timestamp in UNIX seconds.
|
|
34
|
-
*/
|
|
35
|
-
private readonly timestamp;
|
|
36
|
-
/**
|
|
37
|
-
* Compact target (`nBits`) field.
|
|
38
|
-
*/
|
|
39
|
-
private readonly nbits;
|
|
40
|
-
/**
|
|
41
|
-
* Nonce field.
|
|
42
|
-
*/
|
|
43
|
-
private readonly nonce;
|
|
44
|
-
/**
|
|
45
|
-
* Reversed block hash bytes.
|
|
46
|
-
*/
|
|
47
|
-
private readonly hash;
|
|
48
|
-
/**
|
|
49
|
-
* Constructs the bitcoin blockheader
|
|
50
|
-
*
|
|
51
|
-
* @param obj Blockheader fields
|
|
52
|
-
*
|
|
53
|
-
* @internal
|
|
54
|
-
*/
|
|
55
|
-
constructor(obj: SolanaBtcHeaderType);
|
|
56
|
-
/**
|
|
57
|
-
* @inheritDoc
|
|
58
|
-
*/
|
|
59
|
-
getMerkleRoot(): Buffer;
|
|
60
|
-
/**
|
|
61
|
-
* @inheritDoc
|
|
62
|
-
*/
|
|
63
|
-
getNbits(): number;
|
|
64
|
-
/**
|
|
65
|
-
* @inheritDoc
|
|
66
|
-
*/
|
|
67
|
-
getNonce(): number;
|
|
68
|
-
/**
|
|
69
|
-
* @inheritDoc
|
|
70
|
-
*/
|
|
71
|
-
getReversedPrevBlockhash(): Buffer;
|
|
72
|
-
/**
|
|
73
|
-
* @inheritDoc
|
|
74
|
-
*/
|
|
75
|
-
getTimestamp(): number;
|
|
76
|
-
/**
|
|
77
|
-
* @inheritDoc
|
|
78
|
-
*/
|
|
79
|
-
getVersion(): number;
|
|
80
|
-
/**
|
|
81
|
-
* Returns block hash bytes in little-endian representation.
|
|
82
|
-
*/
|
|
83
|
-
getHash(): Buffer;
|
|
84
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { BtcHeader } from "@atomiqlabs/base";
|
|
4
|
+
import { Buffer } from "buffer";
|
|
5
|
+
export type SolanaBtcHeaderType = {
|
|
6
|
+
version: number;
|
|
7
|
+
reversedPrevBlockhash: number[];
|
|
8
|
+
merkleRoot: number[];
|
|
9
|
+
timestamp: number;
|
|
10
|
+
nbits: number;
|
|
11
|
+
nonce: number;
|
|
12
|
+
hash: Buffer;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Represents bitcoin blockheader data to be submitted to the Solana BTC relay program.
|
|
16
|
+
*
|
|
17
|
+
* @category BTC Relay
|
|
18
|
+
*/
|
|
19
|
+
export declare class SolanaBtcHeader implements BtcHeader {
|
|
20
|
+
/**
|
|
21
|
+
* Version field of the blockheader.
|
|
22
|
+
*/
|
|
23
|
+
private readonly version;
|
|
24
|
+
/**
|
|
25
|
+
* Previous block hash in little-endian representation.
|
|
26
|
+
*/
|
|
27
|
+
private readonly reversedPrevBlockhash;
|
|
28
|
+
/**
|
|
29
|
+
* Merkle root in little-endian representation.
|
|
30
|
+
*/
|
|
31
|
+
private readonly merkleRoot;
|
|
32
|
+
/**
|
|
33
|
+
* Block timestamp in UNIX seconds.
|
|
34
|
+
*/
|
|
35
|
+
private readonly timestamp;
|
|
36
|
+
/**
|
|
37
|
+
* Compact target (`nBits`) field.
|
|
38
|
+
*/
|
|
39
|
+
private readonly nbits;
|
|
40
|
+
/**
|
|
41
|
+
* Nonce field.
|
|
42
|
+
*/
|
|
43
|
+
private readonly nonce;
|
|
44
|
+
/**
|
|
45
|
+
* Reversed block hash bytes.
|
|
46
|
+
*/
|
|
47
|
+
private readonly hash;
|
|
48
|
+
/**
|
|
49
|
+
* Constructs the bitcoin blockheader
|
|
50
|
+
*
|
|
51
|
+
* @param obj Blockheader fields
|
|
52
|
+
*
|
|
53
|
+
* @internal
|
|
54
|
+
*/
|
|
55
|
+
constructor(obj: SolanaBtcHeaderType);
|
|
56
|
+
/**
|
|
57
|
+
* @inheritDoc
|
|
58
|
+
*/
|
|
59
|
+
getMerkleRoot(): Buffer;
|
|
60
|
+
/**
|
|
61
|
+
* @inheritDoc
|
|
62
|
+
*/
|
|
63
|
+
getNbits(): number;
|
|
64
|
+
/**
|
|
65
|
+
* @inheritDoc
|
|
66
|
+
*/
|
|
67
|
+
getNonce(): number;
|
|
68
|
+
/**
|
|
69
|
+
* @inheritDoc
|
|
70
|
+
*/
|
|
71
|
+
getReversedPrevBlockhash(): Buffer;
|
|
72
|
+
/**
|
|
73
|
+
* @inheritDoc
|
|
74
|
+
*/
|
|
75
|
+
getTimestamp(): number;
|
|
76
|
+
/**
|
|
77
|
+
* @inheritDoc
|
|
78
|
+
*/
|
|
79
|
+
getVersion(): number;
|
|
80
|
+
/**
|
|
81
|
+
* Returns block hash bytes in little-endian representation.
|
|
82
|
+
*/
|
|
83
|
+
getHash(): Buffer;
|
|
84
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaBtcHeader = void 0;
|
|
4
|
-
const buffer_1 = require("buffer");
|
|
5
|
-
/**
|
|
6
|
-
* Represents bitcoin blockheader data to be submitted to the Solana BTC relay program.
|
|
7
|
-
*
|
|
8
|
-
* @category BTC Relay
|
|
9
|
-
*/
|
|
10
|
-
class SolanaBtcHeader {
|
|
11
|
-
/**
|
|
12
|
-
* Constructs the bitcoin blockheader
|
|
13
|
-
*
|
|
14
|
-
* @param obj Blockheader fields
|
|
15
|
-
*
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
constructor(obj) {
|
|
19
|
-
this.version = obj.version;
|
|
20
|
-
this.reversedPrevBlockhash = obj.reversedPrevBlockhash;
|
|
21
|
-
this.merkleRoot = obj.merkleRoot;
|
|
22
|
-
this.timestamp = obj.timestamp;
|
|
23
|
-
this.nbits = obj.nbits;
|
|
24
|
-
this.nonce = obj.nonce;
|
|
25
|
-
this.hash = obj.hash;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* @inheritDoc
|
|
29
|
-
*/
|
|
30
|
-
getMerkleRoot() {
|
|
31
|
-
return buffer_1.Buffer.from(this.merkleRoot);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* @inheritDoc
|
|
35
|
-
*/
|
|
36
|
-
getNbits() {
|
|
37
|
-
return this.nbits;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* @inheritDoc
|
|
41
|
-
*/
|
|
42
|
-
getNonce() {
|
|
43
|
-
return this.nonce;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* @inheritDoc
|
|
47
|
-
*/
|
|
48
|
-
getReversedPrevBlockhash() {
|
|
49
|
-
return buffer_1.Buffer.from(this.reversedPrevBlockhash);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* @inheritDoc
|
|
53
|
-
*/
|
|
54
|
-
getTimestamp() {
|
|
55
|
-
return this.timestamp;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @inheritDoc
|
|
59
|
-
*/
|
|
60
|
-
getVersion() {
|
|
61
|
-
return this.version;
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* Returns block hash bytes in little-endian representation.
|
|
65
|
-
*/
|
|
66
|
-
getHash() {
|
|
67
|
-
return this.hash;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
exports.SolanaBtcHeader = SolanaBtcHeader;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaBtcHeader = void 0;
|
|
4
|
+
const buffer_1 = require("buffer");
|
|
5
|
+
/**
|
|
6
|
+
* Represents bitcoin blockheader data to be submitted to the Solana BTC relay program.
|
|
7
|
+
*
|
|
8
|
+
* @category BTC Relay
|
|
9
|
+
*/
|
|
10
|
+
class SolanaBtcHeader {
|
|
11
|
+
/**
|
|
12
|
+
* Constructs the bitcoin blockheader
|
|
13
|
+
*
|
|
14
|
+
* @param obj Blockheader fields
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
constructor(obj) {
|
|
19
|
+
this.version = obj.version;
|
|
20
|
+
this.reversedPrevBlockhash = obj.reversedPrevBlockhash;
|
|
21
|
+
this.merkleRoot = obj.merkleRoot;
|
|
22
|
+
this.timestamp = obj.timestamp;
|
|
23
|
+
this.nbits = obj.nbits;
|
|
24
|
+
this.nonce = obj.nonce;
|
|
25
|
+
this.hash = obj.hash;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* @inheritDoc
|
|
29
|
+
*/
|
|
30
|
+
getMerkleRoot() {
|
|
31
|
+
return buffer_1.Buffer.from(this.merkleRoot);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* @inheritDoc
|
|
35
|
+
*/
|
|
36
|
+
getNbits() {
|
|
37
|
+
return this.nbits;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @inheritDoc
|
|
41
|
+
*/
|
|
42
|
+
getNonce() {
|
|
43
|
+
return this.nonce;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @inheritDoc
|
|
47
|
+
*/
|
|
48
|
+
getReversedPrevBlockhash() {
|
|
49
|
+
return buffer_1.Buffer.from(this.reversedPrevBlockhash);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
54
|
+
getTimestamp() {
|
|
55
|
+
return this.timestamp;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @inheritDoc
|
|
59
|
+
*/
|
|
60
|
+
getVersion() {
|
|
61
|
+
return this.version;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns block hash bytes in little-endian representation.
|
|
65
|
+
*/
|
|
66
|
+
getHash() {
|
|
67
|
+
return this.hash;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SolanaBtcHeader = SolanaBtcHeader;
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { BtcStoredHeader } from "@atomiqlabs/base";
|
|
4
|
-
import { SolanaBtcHeader, SolanaBtcHeaderType } from "./SolanaBtcHeader";
|
|
5
|
-
import { Buffer } from "buffer";
|
|
6
|
-
export type SolanaBtcStoredHeaderType = {
|
|
7
|
-
chainWork: number[];
|
|
8
|
-
header: SolanaBtcHeaderType | SolanaBtcHeader;
|
|
9
|
-
lastDiffAdjustment: number;
|
|
10
|
-
blockheight: number;
|
|
11
|
-
prevBlockTimestamps: number[];
|
|
12
|
-
};
|
|
13
|
-
/**
|
|
14
|
-
* Represents a bitcoin blockheader that has already been stored and committed in the Solana BTC relay program.
|
|
15
|
-
*
|
|
16
|
-
* @category BTC Relay
|
|
17
|
-
*/
|
|
18
|
-
export declare class SolanaBtcStoredHeader implements BtcStoredHeader<SolanaBtcHeader> {
|
|
19
|
-
/**
|
|
20
|
-
* Total accumulated chainwork for this header.
|
|
21
|
-
*/
|
|
22
|
-
private readonly chainWork;
|
|
23
|
-
/**
|
|
24
|
-
* Stored bitcoin blockheader.
|
|
25
|
-
*/
|
|
26
|
-
private readonly header;
|
|
27
|
-
/**
|
|
28
|
-
* Timestamp of the last difficulty adjustment.
|
|
29
|
-
*/
|
|
30
|
-
private readonly lastDiffAdjustment;
|
|
31
|
-
/**
|
|
32
|
-
* Blockheight of the stored header.
|
|
33
|
-
*/
|
|
34
|
-
private readonly blockheight;
|
|
35
|
-
/**
|
|
36
|
-
* Previous block timestamps tracked for median-time-past checks.
|
|
37
|
-
*/
|
|
38
|
-
private readonly prevBlockTimestamps;
|
|
39
|
-
/**
|
|
40
|
-
* Constructs the stored bitcoin blockheader from Solana event data.
|
|
41
|
-
*
|
|
42
|
-
* @param obj Decoded stored-header fields
|
|
43
|
-
*
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
|
-
constructor(obj: SolanaBtcStoredHeaderType);
|
|
47
|
-
/**
|
|
48
|
-
* @inheritDoc
|
|
49
|
-
*/
|
|
50
|
-
getBlockheight(): number;
|
|
51
|
-
/**
|
|
52
|
-
* @inheritDoc
|
|
53
|
-
*/
|
|
54
|
-
getChainWork(): Buffer;
|
|
55
|
-
/**
|
|
56
|
-
* @inheritDoc
|
|
57
|
-
*/
|
|
58
|
-
getHeader(): SolanaBtcHeader;
|
|
59
|
-
/**
|
|
60
|
-
* @inheritDoc
|
|
61
|
-
*/
|
|
62
|
-
getLastDiffAdjustment(): number;
|
|
63
|
-
/**
|
|
64
|
-
* @inheritDoc
|
|
65
|
-
*/
|
|
66
|
-
getPrevBlockTimestamps(): number[];
|
|
67
|
-
/**
|
|
68
|
-
* Computes prevBlockTimestamps for a next block, shifting the old block timestamps to the left & appending
|
|
69
|
-
* this block's timestamp to the end
|
|
70
|
-
*
|
|
71
|
-
* @private
|
|
72
|
-
*/
|
|
73
|
-
private computeNextBlockTimestamps;
|
|
74
|
-
/**
|
|
75
|
-
* Computes total chain work after a new header with "nbits" is added to the chain
|
|
76
|
-
*
|
|
77
|
-
* @param nbits
|
|
78
|
-
* @private
|
|
79
|
-
*/
|
|
80
|
-
private computeNextChainWork;
|
|
81
|
-
/**
|
|
82
|
-
* Computes lastDiffAdjustment, this changes only once every DIFF_ADJUSTMENT_PERIOD blocks
|
|
83
|
-
*
|
|
84
|
-
* @param headerTimestamp
|
|
85
|
-
* @private
|
|
86
|
-
*/
|
|
87
|
-
private computeNextLastDiffAdjustment;
|
|
88
|
-
/**
|
|
89
|
-
* @inheritDoc
|
|
90
|
-
*/
|
|
91
|
-
computeNext(header: SolanaBtcHeader): SolanaBtcStoredHeader;
|
|
92
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { BtcStoredHeader } from "@atomiqlabs/base";
|
|
4
|
+
import { SolanaBtcHeader, SolanaBtcHeaderType } from "./SolanaBtcHeader";
|
|
5
|
+
import { Buffer } from "buffer";
|
|
6
|
+
export type SolanaBtcStoredHeaderType = {
|
|
7
|
+
chainWork: number[];
|
|
8
|
+
header: SolanaBtcHeaderType | SolanaBtcHeader;
|
|
9
|
+
lastDiffAdjustment: number;
|
|
10
|
+
blockheight: number;
|
|
11
|
+
prevBlockTimestamps: number[];
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Represents a bitcoin blockheader that has already been stored and committed in the Solana BTC relay program.
|
|
15
|
+
*
|
|
16
|
+
* @category BTC Relay
|
|
17
|
+
*/
|
|
18
|
+
export declare class SolanaBtcStoredHeader implements BtcStoredHeader<SolanaBtcHeader> {
|
|
19
|
+
/**
|
|
20
|
+
* Total accumulated chainwork for this header.
|
|
21
|
+
*/
|
|
22
|
+
private readonly chainWork;
|
|
23
|
+
/**
|
|
24
|
+
* Stored bitcoin blockheader.
|
|
25
|
+
*/
|
|
26
|
+
private readonly header;
|
|
27
|
+
/**
|
|
28
|
+
* Timestamp of the last difficulty adjustment.
|
|
29
|
+
*/
|
|
30
|
+
private readonly lastDiffAdjustment;
|
|
31
|
+
/**
|
|
32
|
+
* Blockheight of the stored header.
|
|
33
|
+
*/
|
|
34
|
+
private readonly blockheight;
|
|
35
|
+
/**
|
|
36
|
+
* Previous block timestamps tracked for median-time-past checks.
|
|
37
|
+
*/
|
|
38
|
+
private readonly prevBlockTimestamps;
|
|
39
|
+
/**
|
|
40
|
+
* Constructs the stored bitcoin blockheader from Solana event data.
|
|
41
|
+
*
|
|
42
|
+
* @param obj Decoded stored-header fields
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
constructor(obj: SolanaBtcStoredHeaderType);
|
|
47
|
+
/**
|
|
48
|
+
* @inheritDoc
|
|
49
|
+
*/
|
|
50
|
+
getBlockheight(): number;
|
|
51
|
+
/**
|
|
52
|
+
* @inheritDoc
|
|
53
|
+
*/
|
|
54
|
+
getChainWork(): Buffer;
|
|
55
|
+
/**
|
|
56
|
+
* @inheritDoc
|
|
57
|
+
*/
|
|
58
|
+
getHeader(): SolanaBtcHeader;
|
|
59
|
+
/**
|
|
60
|
+
* @inheritDoc
|
|
61
|
+
*/
|
|
62
|
+
getLastDiffAdjustment(): number;
|
|
63
|
+
/**
|
|
64
|
+
* @inheritDoc
|
|
65
|
+
*/
|
|
66
|
+
getPrevBlockTimestamps(): number[];
|
|
67
|
+
/**
|
|
68
|
+
* Computes prevBlockTimestamps for a next block, shifting the old block timestamps to the left & appending
|
|
69
|
+
* this block's timestamp to the end
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
*/
|
|
73
|
+
private computeNextBlockTimestamps;
|
|
74
|
+
/**
|
|
75
|
+
* Computes total chain work after a new header with "nbits" is added to the chain
|
|
76
|
+
*
|
|
77
|
+
* @param nbits
|
|
78
|
+
* @private
|
|
79
|
+
*/
|
|
80
|
+
private computeNextChainWork;
|
|
81
|
+
/**
|
|
82
|
+
* Computes lastDiffAdjustment, this changes only once every DIFF_ADJUSTMENT_PERIOD blocks
|
|
83
|
+
*
|
|
84
|
+
* @param headerTimestamp
|
|
85
|
+
* @private
|
|
86
|
+
*/
|
|
87
|
+
private computeNextLastDiffAdjustment;
|
|
88
|
+
/**
|
|
89
|
+
* @inheritDoc
|
|
90
|
+
*/
|
|
91
|
+
computeNext(header: SolanaBtcHeader): SolanaBtcStoredHeader;
|
|
92
|
+
}
|