@atomiqlabs/chain-solana 12.0.14 → 12.0.15
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/dist/index.d.ts +29 -29
- package/dist/index.js +45 -45
- package/dist/solana/SolanaChainType.d.ts +11 -11
- package/dist/solana/SolanaChainType.js +2 -2
- package/dist/solana/SolanaChains.d.ts +20 -20
- package/dist/solana/SolanaChains.js +25 -25
- package/dist/solana/SolanaInitializer.d.ts +18 -18
- package/dist/solana/SolanaInitializer.js +63 -63
- package/dist/solana/btcrelay/SolanaBtcRelay.d.ts +228 -228
- package/dist/solana/btcrelay/SolanaBtcRelay.js +441 -441
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.d.ts +29 -29
- package/dist/solana/btcrelay/headers/SolanaBtcHeader.js +34 -34
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.d.ts +46 -46
- package/dist/solana/btcrelay/headers/SolanaBtcStoredHeader.js +78 -78
- package/dist/solana/btcrelay/program/programIdl.json +671 -671
- package/dist/solana/chain/SolanaAction.d.ts +26 -26
- package/dist/solana/chain/SolanaAction.js +86 -86
- package/dist/solana/chain/SolanaChainInterface.d.ts +65 -65
- package/dist/solana/chain/SolanaChainInterface.js +125 -125
- 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 +28 -28
- package/dist/solana/chain/modules/SolanaBlocks.js +72 -72
- 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 +121 -121
- package/dist/solana/chain/modules/SolanaFees.js +379 -379
- package/dist/solana/chain/modules/SolanaSignatures.d.ts +23 -23
- package/dist/solana/chain/modules/SolanaSignatures.js +39 -39
- package/dist/solana/chain/modules/SolanaSlots.d.ts +31 -31
- package/dist/solana/chain/modules/SolanaSlots.js +68 -68
- package/dist/solana/chain/modules/SolanaTokens.d.ts +136 -136
- package/dist/solana/chain/modules/SolanaTokens.js +248 -248
- package/dist/solana/chain/modules/SolanaTransactions.d.ts +124 -124
- package/dist/solana/chain/modules/SolanaTransactions.js +323 -323
- package/dist/solana/events/SolanaChainEvents.d.ts +88 -88
- package/dist/solana/events/SolanaChainEvents.js +256 -256
- package/dist/solana/events/SolanaChainEventsBrowser.d.ts +75 -75
- package/dist/solana/events/SolanaChainEventsBrowser.js +172 -172
- package/dist/solana/program/SolanaProgramBase.d.ts +40 -40
- package/dist/solana/program/SolanaProgramBase.js +43 -43
- 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 +114 -114
- package/dist/solana/swaps/SolanaSwapData.d.ts +71 -71
- package/dist/solana/swaps/SolanaSwapData.js +292 -292
- package/dist/solana/swaps/SolanaSwapModule.d.ts +10 -10
- package/dist/solana/swaps/SolanaSwapModule.js +11 -11
- package/dist/solana/swaps/SolanaSwapProgram.d.ts +224 -224
- package/dist/solana/swaps/SolanaSwapProgram.js +570 -570
- package/dist/solana/swaps/SwapTypeEnum.d.ts +11 -11
- package/dist/solana/swaps/SwapTypeEnum.js +42 -42
- package/dist/solana/swaps/modules/SolanaDataAccount.d.ts +94 -94
- package/dist/solana/swaps/modules/SolanaDataAccount.js +231 -231
- package/dist/solana/swaps/modules/SolanaLpVault.d.ts +71 -71
- package/dist/solana/swaps/modules/SolanaLpVault.js +173 -173
- package/dist/solana/swaps/modules/SwapClaim.d.ts +129 -129
- package/dist/solana/swaps/modules/SwapClaim.js +291 -291
- package/dist/solana/swaps/modules/SwapInit.d.ts +217 -217
- package/dist/solana/swaps/modules/SwapInit.js +519 -519
- package/dist/solana/swaps/modules/SwapRefund.d.ts +82 -82
- package/dist/solana/swaps/modules/SwapRefund.js +262 -262
- 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/wallet/SolanaKeypairWallet.d.ts +9 -9
- package/dist/solana/wallet/SolanaKeypairWallet.js +33 -33
- package/dist/solana/wallet/SolanaSigner.d.ts +11 -11
- package/dist/solana/wallet/SolanaSigner.js +17 -17
- package/dist/utils/Utils.d.ts +53 -53
- package/dist/utils/Utils.js +170 -170
- package/package.json +41 -41
- package/src/index.ts +36 -36
- package/src/solana/SolanaChainType.ts +27 -27
- package/src/solana/SolanaChains.ts +23 -23
- package/src/solana/SolanaInitializer.ts +102 -102
- package/src/solana/btcrelay/SolanaBtcRelay.ts +589 -589
- package/src/solana/btcrelay/headers/SolanaBtcHeader.ts +57 -57
- package/src/solana/btcrelay/headers/SolanaBtcStoredHeader.ts +102 -102
- package/src/solana/btcrelay/program/programIdl.json +670 -670
- package/src/solana/chain/SolanaAction.ts +108 -108
- package/src/solana/chain/SolanaChainInterface.ts +192 -192
- package/src/solana/chain/SolanaModule.ts +20 -20
- package/src/solana/chain/modules/SolanaAddresses.ts +20 -20
- package/src/solana/chain/modules/SolanaBlocks.ts +78 -78
- package/src/solana/chain/modules/SolanaEvents.ts +270 -270
- package/src/solana/chain/modules/SolanaFees.ts +450 -450
- package/src/solana/chain/modules/SolanaSignatures.ts +39 -39
- package/src/solana/chain/modules/SolanaSlots.ts +82 -82
- package/src/solana/chain/modules/SolanaTokens.ts +307 -307
- package/src/solana/chain/modules/SolanaTransactions.ts +365 -365
- package/src/solana/events/SolanaChainEvents.ts +299 -299
- package/src/solana/events/SolanaChainEventsBrowser.ts +209 -209
- package/src/solana/program/SolanaProgramBase.ts +79 -79
- package/src/solana/program/SolanaProgramModule.ts +15 -15
- package/src/solana/program/modules/SolanaProgramEvents.ts +155 -155
- package/src/solana/swaps/SolanaSwapData.ts +430 -430
- package/src/solana/swaps/SolanaSwapModule.ts +16 -16
- package/src/solana/swaps/SolanaSwapProgram.ts +854 -854
- package/src/solana/swaps/SwapTypeEnum.ts +29 -29
- package/src/solana/swaps/modules/SolanaDataAccount.ts +307 -307
- package/src/solana/swaps/modules/SolanaLpVault.ts +215 -215
- package/src/solana/swaps/modules/SwapClaim.ts +389 -389
- package/src/solana/swaps/modules/SwapInit.ts +663 -663
- package/src/solana/swaps/modules/SwapRefund.ts +323 -323
- package/src/solana/swaps/programIdl.json +944 -944
- package/src/solana/swaps/programTypes.ts +1885 -1885
- package/src/solana/wallet/SolanaKeypairWallet.ts +36 -36
- package/src/solana/wallet/SolanaSigner.ts +24 -24
- package/src/utils/Utils.ts +180 -180
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Finality, SendOptions, Signer, Transaction } from "@solana/web3.js";
|
|
3
|
-
import { SolanaModule } from "../SolanaModule";
|
|
4
|
-
import { Buffer } from "buffer";
|
|
5
|
-
import { SolanaSigner } from "../../wallet/SolanaSigner";
|
|
6
|
-
export type SolanaTx = {
|
|
7
|
-
tx: Transaction;
|
|
8
|
-
signers: Signer[];
|
|
9
|
-
};
|
|
10
|
-
export declare class SolanaTransactions extends SolanaModule {
|
|
11
|
-
private cbkBeforeTxSigned;
|
|
12
|
-
/**
|
|
13
|
-
* Callback for sending transaction, returns not null if it was successfully able to send the transaction, and null
|
|
14
|
-
* if the transaction should be sent through other means)
|
|
15
|
-
* @private
|
|
16
|
-
*/
|
|
17
|
-
private cbkSendTransaction;
|
|
18
|
-
/**
|
|
19
|
-
* Sends raw solana transaction, first through the cbkSendTransaction callback (for e.g. sending the transaction
|
|
20
|
-
* to a different specific RPC), the through the Fees handler (for e.g. Jito transaction) and last through the
|
|
21
|
-
* underlying provider's Connection instance (the usual way). Only sends the transaction through one channel.
|
|
22
|
-
*
|
|
23
|
-
* @param data
|
|
24
|
-
* @param options
|
|
25
|
-
* @private
|
|
26
|
-
*/
|
|
27
|
-
private sendRawTransaction;
|
|
28
|
-
/**
|
|
29
|
-
* Waits for the transaction to confirm by periodically checking the transaction status over HTTP, also
|
|
30
|
-
* re-sends the transaction at regular intervals
|
|
31
|
-
*
|
|
32
|
-
* @param solanaTx solana tx to wait for confirmation for
|
|
33
|
-
* @param finality wait for this finality
|
|
34
|
-
* @param abortSignal signal to abort waiting for tx confirmation
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
private txConfirmationAndResendWatchdog;
|
|
38
|
-
/**
|
|
39
|
-
* Waits for the transaction to confirm from WS, sometimes the WS rejects even though the transaction was confirmed
|
|
40
|
-
* this therefore also runs an ultimate check on the transaction in case the WS handler rejects, checking if it
|
|
41
|
-
* really was expired
|
|
42
|
-
*
|
|
43
|
-
* @param solanaTx solana tx to wait for confirmation for
|
|
44
|
-
* @param finality wait for this finality
|
|
45
|
-
* @param abortSignal signal to abort waiting for tx confirmation
|
|
46
|
-
* @private
|
|
47
|
-
*/
|
|
48
|
-
private txConfirmFromWebsocket;
|
|
49
|
-
/**
|
|
50
|
-
* Waits for transaction confirmation using WS subscription and occasional HTTP polling, also re-sends
|
|
51
|
-
* the transaction at regular interval
|
|
52
|
-
*
|
|
53
|
-
* @param solanaTx solana transaction to wait for confirmation for & keep re-sending until it confirms
|
|
54
|
-
* @param abortSignal signal to abort waiting for tx confirmation
|
|
55
|
-
* @param finality wait for specific finality
|
|
56
|
-
* @private
|
|
57
|
-
*/
|
|
58
|
-
private confirmTransaction;
|
|
59
|
-
/**
|
|
60
|
-
* Prepares solana transactions, assigns recentBlockhash if needed, applies Phantom hotfix,
|
|
61
|
-
* sets feePayer to ourselves, calls beforeTxSigned callback & signs transaction with provided signers array
|
|
62
|
-
*
|
|
63
|
-
* @param signer
|
|
64
|
-
* @param txs
|
|
65
|
-
* @private
|
|
66
|
-
*/
|
|
67
|
-
private prepareTransactions;
|
|
68
|
-
/**
|
|
69
|
-
* Sends out a signed transaction to the RPC
|
|
70
|
-
*
|
|
71
|
-
* @param solTx solana tx to send
|
|
72
|
-
* @param options send options to be passed to the RPC
|
|
73
|
-
* @param onBeforePublish a callback called before every transaction is published
|
|
74
|
-
* @private
|
|
75
|
-
*/
|
|
76
|
-
private sendSignedTransaction;
|
|
77
|
-
/**
|
|
78
|
-
* Prepares (adds recent blockhash if required, applies Phantom hotfix),
|
|
79
|
-
* signs (all together using signAllTransactions() calls), sends (in parallel or sequentially) &
|
|
80
|
-
* optionally waits for confirmation of a batch of solana transactions
|
|
81
|
-
*
|
|
82
|
-
* @param signer
|
|
83
|
-
* @param _txs
|
|
84
|
-
* @param waitForConfirmation whether to wait for transaction confirmations (this also makes sure the transactions
|
|
85
|
-
* are re-sent at regular intervals)
|
|
86
|
-
* @param abortSignal abort signal to abort waiting for transaction confirmations
|
|
87
|
-
* @param parallel whether the send all the transaction at once in parallel or sequentially (such that transactions
|
|
88
|
-
* are executed in order)
|
|
89
|
-
* @param onBeforePublish a callback called before every transaction is published
|
|
90
|
-
*/
|
|
91
|
-
sendAndConfirm(signer: SolanaSigner, _txs: SolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
92
|
-
/**
|
|
93
|
-
* Serializes the solana transaction, saves the transaction, signers & last valid blockheight
|
|
94
|
-
*
|
|
95
|
-
* @param tx
|
|
96
|
-
*/
|
|
97
|
-
serializeTx(tx: SolanaTx): Promise<string>;
|
|
98
|
-
/**
|
|
99
|
-
* Deserializes saved solana transaction, extracting the transaction, signers & last valid blockheight
|
|
100
|
-
*
|
|
101
|
-
* @param txData
|
|
102
|
-
*/
|
|
103
|
-
deserializeTx(txData: string): Promise<SolanaTx>;
|
|
104
|
-
/**
|
|
105
|
-
* Gets the status of the raw solana transaction, this also checks transaction expiry & can therefore report tx
|
|
106
|
-
* in "pending" status, however pending status doesn't necessarily mean that the transaction was sent (again,
|
|
107
|
-
* no mempool on Solana, cannot check that), this function is preferred against getTxIdStatus
|
|
108
|
-
*
|
|
109
|
-
* @param tx
|
|
110
|
-
*/
|
|
111
|
-
getTxStatus(tx: string): Promise<"pending" | "success" | "not_found" | "reverted">;
|
|
112
|
-
/**
|
|
113
|
-
* Gets the status of the solana transaction with a specific txId, this cannot report whether the transaction is
|
|
114
|
-
* "pending" because Solana has no concept of mempool & only confirmed transactions are accessible
|
|
115
|
-
*
|
|
116
|
-
* @param txId
|
|
117
|
-
* @param finality
|
|
118
|
-
*/
|
|
119
|
-
getTxIdStatus(txId: string, finality?: Finality): Promise<"success" | "not_found" | "reverted">;
|
|
120
|
-
onBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): void;
|
|
121
|
-
offBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): boolean;
|
|
122
|
-
onSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): void;
|
|
123
|
-
offSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): boolean;
|
|
124
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Finality, SendOptions, Signer, Transaction } from "@solana/web3.js";
|
|
3
|
+
import { SolanaModule } from "../SolanaModule";
|
|
4
|
+
import { Buffer } from "buffer";
|
|
5
|
+
import { SolanaSigner } from "../../wallet/SolanaSigner";
|
|
6
|
+
export type SolanaTx = {
|
|
7
|
+
tx: Transaction;
|
|
8
|
+
signers: Signer[];
|
|
9
|
+
};
|
|
10
|
+
export declare class SolanaTransactions extends SolanaModule {
|
|
11
|
+
private cbkBeforeTxSigned;
|
|
12
|
+
/**
|
|
13
|
+
* Callback for sending transaction, returns not null if it was successfully able to send the transaction, and null
|
|
14
|
+
* if the transaction should be sent through other means)
|
|
15
|
+
* @private
|
|
16
|
+
*/
|
|
17
|
+
private cbkSendTransaction;
|
|
18
|
+
/**
|
|
19
|
+
* Sends raw solana transaction, first through the cbkSendTransaction callback (for e.g. sending the transaction
|
|
20
|
+
* to a different specific RPC), the through the Fees handler (for e.g. Jito transaction) and last through the
|
|
21
|
+
* underlying provider's Connection instance (the usual way). Only sends the transaction through one channel.
|
|
22
|
+
*
|
|
23
|
+
* @param data
|
|
24
|
+
* @param options
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private sendRawTransaction;
|
|
28
|
+
/**
|
|
29
|
+
* Waits for the transaction to confirm by periodically checking the transaction status over HTTP, also
|
|
30
|
+
* re-sends the transaction at regular intervals
|
|
31
|
+
*
|
|
32
|
+
* @param solanaTx solana tx to wait for confirmation for
|
|
33
|
+
* @param finality wait for this finality
|
|
34
|
+
* @param abortSignal signal to abort waiting for tx confirmation
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
private txConfirmationAndResendWatchdog;
|
|
38
|
+
/**
|
|
39
|
+
* Waits for the transaction to confirm from WS, sometimes the WS rejects even though the transaction was confirmed
|
|
40
|
+
* this therefore also runs an ultimate check on the transaction in case the WS handler rejects, checking if it
|
|
41
|
+
* really was expired
|
|
42
|
+
*
|
|
43
|
+
* @param solanaTx solana tx to wait for confirmation for
|
|
44
|
+
* @param finality wait for this finality
|
|
45
|
+
* @param abortSignal signal to abort waiting for tx confirmation
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private txConfirmFromWebsocket;
|
|
49
|
+
/**
|
|
50
|
+
* Waits for transaction confirmation using WS subscription and occasional HTTP polling, also re-sends
|
|
51
|
+
* the transaction at regular interval
|
|
52
|
+
*
|
|
53
|
+
* @param solanaTx solana transaction to wait for confirmation for & keep re-sending until it confirms
|
|
54
|
+
* @param abortSignal signal to abort waiting for tx confirmation
|
|
55
|
+
* @param finality wait for specific finality
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
private confirmTransaction;
|
|
59
|
+
/**
|
|
60
|
+
* Prepares solana transactions, assigns recentBlockhash if needed, applies Phantom hotfix,
|
|
61
|
+
* sets feePayer to ourselves, calls beforeTxSigned callback & signs transaction with provided signers array
|
|
62
|
+
*
|
|
63
|
+
* @param signer
|
|
64
|
+
* @param txs
|
|
65
|
+
* @private
|
|
66
|
+
*/
|
|
67
|
+
private prepareTransactions;
|
|
68
|
+
/**
|
|
69
|
+
* Sends out a signed transaction to the RPC
|
|
70
|
+
*
|
|
71
|
+
* @param solTx solana tx to send
|
|
72
|
+
* @param options send options to be passed to the RPC
|
|
73
|
+
* @param onBeforePublish a callback called before every transaction is published
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
private sendSignedTransaction;
|
|
77
|
+
/**
|
|
78
|
+
* Prepares (adds recent blockhash if required, applies Phantom hotfix),
|
|
79
|
+
* signs (all together using signAllTransactions() calls), sends (in parallel or sequentially) &
|
|
80
|
+
* optionally waits for confirmation of a batch of solana transactions
|
|
81
|
+
*
|
|
82
|
+
* @param signer
|
|
83
|
+
* @param _txs
|
|
84
|
+
* @param waitForConfirmation whether to wait for transaction confirmations (this also makes sure the transactions
|
|
85
|
+
* are re-sent at regular intervals)
|
|
86
|
+
* @param abortSignal abort signal to abort waiting for transaction confirmations
|
|
87
|
+
* @param parallel whether the send all the transaction at once in parallel or sequentially (such that transactions
|
|
88
|
+
* are executed in order)
|
|
89
|
+
* @param onBeforePublish a callback called before every transaction is published
|
|
90
|
+
*/
|
|
91
|
+
sendAndConfirm(signer: SolanaSigner, _txs: SolanaTx[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Serializes the solana transaction, saves the transaction, signers & last valid blockheight
|
|
94
|
+
*
|
|
95
|
+
* @param tx
|
|
96
|
+
*/
|
|
97
|
+
serializeTx(tx: SolanaTx): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Deserializes saved solana transaction, extracting the transaction, signers & last valid blockheight
|
|
100
|
+
*
|
|
101
|
+
* @param txData
|
|
102
|
+
*/
|
|
103
|
+
deserializeTx(txData: string): Promise<SolanaTx>;
|
|
104
|
+
/**
|
|
105
|
+
* Gets the status of the raw solana transaction, this also checks transaction expiry & can therefore report tx
|
|
106
|
+
* in "pending" status, however pending status doesn't necessarily mean that the transaction was sent (again,
|
|
107
|
+
* no mempool on Solana, cannot check that), this function is preferred against getTxIdStatus
|
|
108
|
+
*
|
|
109
|
+
* @param tx
|
|
110
|
+
*/
|
|
111
|
+
getTxStatus(tx: string): Promise<"pending" | "success" | "not_found" | "reverted">;
|
|
112
|
+
/**
|
|
113
|
+
* Gets the status of the solana transaction with a specific txId, this cannot report whether the transaction is
|
|
114
|
+
* "pending" because Solana has no concept of mempool & only confirmed transactions are accessible
|
|
115
|
+
*
|
|
116
|
+
* @param txId
|
|
117
|
+
* @param finality
|
|
118
|
+
*/
|
|
119
|
+
getTxIdStatus(txId: string, finality?: Finality): Promise<"success" | "not_found" | "reverted">;
|
|
120
|
+
onBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): void;
|
|
121
|
+
offBeforeTxSigned(callback: (tx: SolanaTx) => Promise<void>): boolean;
|
|
122
|
+
onSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): void;
|
|
123
|
+
offSendTransaction(callback: (tx: Buffer, options?: SendOptions) => Promise<string>): boolean;
|
|
124
|
+
}
|