@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,29 +1,29 @@
|
|
|
1
|
-
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
2
|
-
import { Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
-
/**
|
|
4
|
-
* Keypair-based wallet implementation for Solana
|
|
5
|
-
* @category Wallets
|
|
6
|
-
*/
|
|
7
|
-
export declare class SolanaKeypairWallet implements Wallet {
|
|
8
|
-
/**
|
|
9
|
-
* Underlying signer keypair.
|
|
10
|
-
*/
|
|
11
|
-
readonly payer: Keypair;
|
|
12
|
-
constructor(payer: Keypair);
|
|
13
|
-
/**
|
|
14
|
-
* Public key of the wrapped payer keypair.
|
|
15
|
-
*/
|
|
16
|
-
get publicKey(): PublicKey;
|
|
17
|
-
/**
|
|
18
|
-
* Signs all provided transactions with the wrapped keypair.
|
|
19
|
-
*
|
|
20
|
-
* @param txs Transactions to sign
|
|
21
|
-
*/
|
|
22
|
-
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
|
|
23
|
-
/**
|
|
24
|
-
* Signs a single transaction with the wrapped keypair.
|
|
25
|
-
*
|
|
26
|
-
* @param tx Transaction to sign
|
|
27
|
-
*/
|
|
28
|
-
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
|
|
29
|
-
}
|
|
1
|
+
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
2
|
+
import { Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
3
|
+
/**
|
|
4
|
+
* Keypair-based wallet implementation for Solana
|
|
5
|
+
* @category Wallets
|
|
6
|
+
*/
|
|
7
|
+
export declare class SolanaKeypairWallet implements Wallet {
|
|
8
|
+
/**
|
|
9
|
+
* Underlying signer keypair.
|
|
10
|
+
*/
|
|
11
|
+
readonly payer: Keypair;
|
|
12
|
+
constructor(payer: Keypair);
|
|
13
|
+
/**
|
|
14
|
+
* Public key of the wrapped payer keypair.
|
|
15
|
+
*/
|
|
16
|
+
get publicKey(): PublicKey;
|
|
17
|
+
/**
|
|
18
|
+
* Signs all provided transactions with the wrapped keypair.
|
|
19
|
+
*
|
|
20
|
+
* @param txs Transactions to sign
|
|
21
|
+
*/
|
|
22
|
+
signAllTransactions<T extends Transaction | VersionedTransaction>(txs: T[]): Promise<T[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Signs a single transaction with the wrapped keypair.
|
|
25
|
+
*
|
|
26
|
+
* @param tx Transaction to sign
|
|
27
|
+
*/
|
|
28
|
+
signTransaction<T extends Transaction | VersionedTransaction>(tx: T): Promise<T>;
|
|
29
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaKeypairWallet = void 0;
|
|
4
|
-
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
-
/**
|
|
6
|
-
* Keypair-based wallet implementation for Solana
|
|
7
|
-
* @category Wallets
|
|
8
|
-
*/
|
|
9
|
-
class SolanaKeypairWallet {
|
|
10
|
-
constructor(payer) {
|
|
11
|
-
this.payer = payer;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Public key of the wrapped payer keypair.
|
|
15
|
-
*/
|
|
16
|
-
get publicKey() {
|
|
17
|
-
return this.payer.publicKey;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Signs all provided transactions with the wrapped keypair.
|
|
21
|
-
*
|
|
22
|
-
* @param txs Transactions to sign
|
|
23
|
-
*/
|
|
24
|
-
signAllTransactions(txs) {
|
|
25
|
-
txs.forEach((tx) => {
|
|
26
|
-
if (tx instanceof web3_js_1.Transaction) {
|
|
27
|
-
tx.partialSign(this.payer);
|
|
28
|
-
}
|
|
29
|
-
else if (tx instanceof web3_js_1.VersionedTransaction) {
|
|
30
|
-
tx.sign([this.payer]);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
return Promise.resolve(txs);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Signs a single transaction with the wrapped keypair.
|
|
37
|
-
*
|
|
38
|
-
* @param tx Transaction to sign
|
|
39
|
-
*/
|
|
40
|
-
signTransaction(tx) {
|
|
41
|
-
if (tx instanceof web3_js_1.Transaction) {
|
|
42
|
-
tx.partialSign(this.payer);
|
|
43
|
-
}
|
|
44
|
-
else if (tx instanceof web3_js_1.VersionedTransaction) {
|
|
45
|
-
tx.sign([this.payer]);
|
|
46
|
-
}
|
|
47
|
-
return Promise.resolve(tx);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.SolanaKeypairWallet = SolanaKeypairWallet;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaKeypairWallet = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
/**
|
|
6
|
+
* Keypair-based wallet implementation for Solana
|
|
7
|
+
* @category Wallets
|
|
8
|
+
*/
|
|
9
|
+
class SolanaKeypairWallet {
|
|
10
|
+
constructor(payer) {
|
|
11
|
+
this.payer = payer;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Public key of the wrapped payer keypair.
|
|
15
|
+
*/
|
|
16
|
+
get publicKey() {
|
|
17
|
+
return this.payer.publicKey;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Signs all provided transactions with the wrapped keypair.
|
|
21
|
+
*
|
|
22
|
+
* @param txs Transactions to sign
|
|
23
|
+
*/
|
|
24
|
+
signAllTransactions(txs) {
|
|
25
|
+
txs.forEach((tx) => {
|
|
26
|
+
if (tx instanceof web3_js_1.Transaction) {
|
|
27
|
+
tx.partialSign(this.payer);
|
|
28
|
+
}
|
|
29
|
+
else if (tx instanceof web3_js_1.VersionedTransaction) {
|
|
30
|
+
tx.sign([this.payer]);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return Promise.resolve(txs);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Signs a single transaction with the wrapped keypair.
|
|
37
|
+
*
|
|
38
|
+
* @param tx Transaction to sign
|
|
39
|
+
*/
|
|
40
|
+
signTransaction(tx) {
|
|
41
|
+
if (tx instanceof web3_js_1.Transaction) {
|
|
42
|
+
tx.partialSign(this.payer);
|
|
43
|
+
}
|
|
44
|
+
else if (tx instanceof web3_js_1.VersionedTransaction) {
|
|
45
|
+
tx.sign([this.payer]);
|
|
46
|
+
}
|
|
47
|
+
return Promise.resolve(tx);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.SolanaKeypairWallet = SolanaKeypairWallet;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
2
|
-
import { AbstractSigner } from "@atomiqlabs/base";
|
|
3
|
-
import { PublicKey, Signer } from "@solana/web3.js";
|
|
4
|
-
/**
|
|
5
|
-
* Solana signer implementation wrapping an Anchor Wallet
|
|
6
|
-
* @category Wallets
|
|
7
|
-
*/
|
|
8
|
-
export declare class SolanaSigner implements AbstractSigner {
|
|
9
|
-
/**
|
|
10
|
-
* @inheritDoc
|
|
11
|
-
*/
|
|
12
|
-
type: "AtomiqAbstractSigner";
|
|
13
|
-
/**
|
|
14
|
-
* Wrapped wallet implementation used for signing.
|
|
15
|
-
*/
|
|
16
|
-
wallet: Wallet;
|
|
17
|
-
/**
|
|
18
|
-
* Optional raw keypair signer when available.
|
|
19
|
-
*/
|
|
20
|
-
keypair?: Signer;
|
|
21
|
-
constructor(wallet: Wallet, keypair?: Signer);
|
|
22
|
-
/**
|
|
23
|
-
* Returns public key of the wrapped wallet.
|
|
24
|
-
*/
|
|
25
|
-
getPublicKey(): PublicKey;
|
|
26
|
-
/**
|
|
27
|
-
* @inheritDoc
|
|
28
|
-
*/
|
|
29
|
-
getAddress(): string;
|
|
30
|
-
}
|
|
1
|
+
import { Wallet } from "@coral-xyz/anchor/dist/cjs/provider";
|
|
2
|
+
import { AbstractSigner } from "@atomiqlabs/base";
|
|
3
|
+
import { PublicKey, Signer } from "@solana/web3.js";
|
|
4
|
+
/**
|
|
5
|
+
* Solana signer implementation wrapping an Anchor Wallet
|
|
6
|
+
* @category Wallets
|
|
7
|
+
*/
|
|
8
|
+
export declare class SolanaSigner implements AbstractSigner {
|
|
9
|
+
/**
|
|
10
|
+
* @inheritDoc
|
|
11
|
+
*/
|
|
12
|
+
type: "AtomiqAbstractSigner";
|
|
13
|
+
/**
|
|
14
|
+
* Wrapped wallet implementation used for signing.
|
|
15
|
+
*/
|
|
16
|
+
wallet: Wallet;
|
|
17
|
+
/**
|
|
18
|
+
* Optional raw keypair signer when available.
|
|
19
|
+
*/
|
|
20
|
+
keypair?: Signer;
|
|
21
|
+
constructor(wallet: Wallet, keypair?: Signer);
|
|
22
|
+
/**
|
|
23
|
+
* Returns public key of the wrapped wallet.
|
|
24
|
+
*/
|
|
25
|
+
getPublicKey(): PublicKey;
|
|
26
|
+
/**
|
|
27
|
+
* @inheritDoc
|
|
28
|
+
*/
|
|
29
|
+
getAddress(): string;
|
|
30
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaSigner = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Solana signer implementation wrapping an Anchor Wallet
|
|
6
|
-
* @category Wallets
|
|
7
|
-
*/
|
|
8
|
-
class SolanaSigner {
|
|
9
|
-
constructor(wallet, keypair) {
|
|
10
|
-
/**
|
|
11
|
-
* @inheritDoc
|
|
12
|
-
*/
|
|
13
|
-
this.type = "AtomiqAbstractSigner";
|
|
14
|
-
this.wallet = wallet;
|
|
15
|
-
this.keypair = keypair;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Returns public key of the wrapped wallet.
|
|
19
|
-
*/
|
|
20
|
-
getPublicKey() {
|
|
21
|
-
return this.wallet.publicKey;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* @inheritDoc
|
|
25
|
-
*/
|
|
26
|
-
getAddress() {
|
|
27
|
-
return this.wallet.publicKey.toString();
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.SolanaSigner = SolanaSigner;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolanaSigner = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Solana signer implementation wrapping an Anchor Wallet
|
|
6
|
+
* @category Wallets
|
|
7
|
+
*/
|
|
8
|
+
class SolanaSigner {
|
|
9
|
+
constructor(wallet, keypair) {
|
|
10
|
+
/**
|
|
11
|
+
* @inheritDoc
|
|
12
|
+
*/
|
|
13
|
+
this.type = "AtomiqAbstractSigner";
|
|
14
|
+
this.wallet = wallet;
|
|
15
|
+
this.keypair = keypair;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Returns public key of the wrapped wallet.
|
|
19
|
+
*/
|
|
20
|
+
getPublicKey() {
|
|
21
|
+
return this.wallet.publicKey;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @inheritDoc
|
|
25
|
+
*/
|
|
26
|
+
getAddress() {
|
|
27
|
+
return this.wallet.publicKey.toString();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.SolanaSigner = SolanaSigner;
|
package/dist/utils/Utils.d.ts
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
2
|
-
import * as BN from "bn.js";
|
|
3
|
-
export type Serialized<T> = {
|
|
4
|
-
[K in keyof T as T[K] extends Function ? never : K]: T[K] extends infer U ? U extends PublicKey | BN ? string : U extends object ? Serialized<U> : U : never;
|
|
5
|
-
};
|
|
6
|
-
export declare function timeoutPromise(timeoutMillis: number, abortSignal?: AbortSignal): Promise<void>;
|
|
7
|
-
export declare function onceAsync<T>(executor: () => Promise<T>): () => Promise<T>;
|
|
8
|
-
export declare function getLogger(prefix: string): {
|
|
9
|
-
debug: (msg: string, ...args: any[]) => false | void;
|
|
10
|
-
info: (msg: string, ...args: any[]) => false | void;
|
|
11
|
-
warn: (msg: string, ...args: any[]) => false | void;
|
|
12
|
-
error: (msg: string, ...args: any[]) => false | void;
|
|
13
|
-
};
|
|
14
|
-
export declare function tryWithRetries<T>(func: () => Promise<T>, retryPolicy?: {
|
|
15
|
-
maxRetries?: number;
|
|
16
|
-
delay?: number;
|
|
17
|
-
exponential?: boolean;
|
|
18
|
-
}, errorAllowed?: (e: any) => boolean, abortSignal?: AbortSignal): Promise<T>;
|
|
19
|
-
export declare class SolanaTxUtils {
|
|
20
|
-
private static LOW_VALUE;
|
|
21
|
-
private static HIGH_VALUE;
|
|
22
|
-
/**
|
|
23
|
-
* Compact u16 array header size
|
|
24
|
-
* @param n elements in the compact array
|
|
25
|
-
* @returns size in bytes of array header
|
|
26
|
-
*/
|
|
27
|
-
private static compactHeader;
|
|
28
|
-
/**
|
|
29
|
-
* Compact u16 array size
|
|
30
|
-
* @param n elements in the compact array
|
|
31
|
-
* @param size bytes per each element
|
|
32
|
-
* @returns size in bytes of array
|
|
33
|
-
*/
|
|
34
|
-
private static compactArraySize;
|
|
35
|
-
/**
|
|
36
|
-
* Returns # number of non-compute budget related instructions
|
|
37
|
-
*
|
|
38
|
-
* @param tx
|
|
39
|
-
*/
|
|
40
|
-
static getNonComputeBudgetIxs(tx: Transaction): number;
|
|
41
|
-
/**
|
|
42
|
-
* @param tx a solana transaction
|
|
43
|
-
* @param feePayer the publicKey of the signer
|
|
44
|
-
* @returns size in bytes of the transaction
|
|
45
|
-
*/
|
|
46
|
-
static getTxSize(tx: Transaction, feePayer: PublicKey): number;
|
|
47
|
-
}
|
|
48
|
-
export declare function toClaimHash(paymentHash: string, nonce: bigint, confirmations: number): string;
|
|
49
|
-
export declare function fromClaimHash(claimHash: string): {
|
|
50
|
-
paymentHash: string;
|
|
51
|
-
nonce: BN;
|
|
52
|
-
confirmations: number;
|
|
53
|
-
};
|
|
54
|
-
export declare function toEscrowHash(paymentHash: string, sequence: BN): string;
|
|
55
|
-
export declare function toBN(value: bigint): BN;
|
|
56
|
-
export declare function toBN(value: null): null;
|
|
57
|
-
export declare function toBigInt(value: BN): bigint;
|
|
58
|
-
export declare function toBigInt(value: null): null;
|
|
1
|
+
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
2
|
+
import * as BN from "bn.js";
|
|
3
|
+
export type Serialized<T> = {
|
|
4
|
+
[K in keyof T as T[K] extends Function ? never : K]: T[K] extends infer U ? U extends PublicKey | BN ? string : U extends object ? Serialized<U> : U : never;
|
|
5
|
+
};
|
|
6
|
+
export declare function timeoutPromise(timeoutMillis: number, abortSignal?: AbortSignal): Promise<void>;
|
|
7
|
+
export declare function onceAsync<T>(executor: () => Promise<T>): () => Promise<T>;
|
|
8
|
+
export declare function getLogger(prefix: string): {
|
|
9
|
+
debug: (msg: string, ...args: any[]) => false | void;
|
|
10
|
+
info: (msg: string, ...args: any[]) => false | void;
|
|
11
|
+
warn: (msg: string, ...args: any[]) => false | void;
|
|
12
|
+
error: (msg: string, ...args: any[]) => false | void;
|
|
13
|
+
};
|
|
14
|
+
export declare function tryWithRetries<T>(func: () => Promise<T>, retryPolicy?: {
|
|
15
|
+
maxRetries?: number;
|
|
16
|
+
delay?: number;
|
|
17
|
+
exponential?: boolean;
|
|
18
|
+
}, errorAllowed?: (e: any) => boolean, abortSignal?: AbortSignal): Promise<T>;
|
|
19
|
+
export declare class SolanaTxUtils {
|
|
20
|
+
private static LOW_VALUE;
|
|
21
|
+
private static HIGH_VALUE;
|
|
22
|
+
/**
|
|
23
|
+
* Compact u16 array header size
|
|
24
|
+
* @param n elements in the compact array
|
|
25
|
+
* @returns size in bytes of array header
|
|
26
|
+
*/
|
|
27
|
+
private static compactHeader;
|
|
28
|
+
/**
|
|
29
|
+
* Compact u16 array size
|
|
30
|
+
* @param n elements in the compact array
|
|
31
|
+
* @param size bytes per each element
|
|
32
|
+
* @returns size in bytes of array
|
|
33
|
+
*/
|
|
34
|
+
private static compactArraySize;
|
|
35
|
+
/**
|
|
36
|
+
* Returns # number of non-compute budget related instructions
|
|
37
|
+
*
|
|
38
|
+
* @param tx
|
|
39
|
+
*/
|
|
40
|
+
static getNonComputeBudgetIxs(tx: Transaction): number;
|
|
41
|
+
/**
|
|
42
|
+
* @param tx a solana transaction
|
|
43
|
+
* @param feePayer the publicKey of the signer
|
|
44
|
+
* @returns size in bytes of the transaction
|
|
45
|
+
*/
|
|
46
|
+
static getTxSize(tx: Transaction, feePayer: PublicKey): number;
|
|
47
|
+
}
|
|
48
|
+
export declare function toClaimHash(paymentHash: string, nonce: bigint, confirmations: number): string;
|
|
49
|
+
export declare function fromClaimHash(claimHash: string): {
|
|
50
|
+
paymentHash: string;
|
|
51
|
+
nonce: BN;
|
|
52
|
+
confirmations: number;
|
|
53
|
+
};
|
|
54
|
+
export declare function toEscrowHash(paymentHash: string, sequence: BN): string;
|
|
55
|
+
export declare function toBN(value: bigint): BN;
|
|
56
|
+
export declare function toBN(value: null): null;
|
|
57
|
+
export declare function toBigInt(value: BN): bigint;
|
|
58
|
+
export declare function toBigInt(value: null): null;
|