@atomiqlabs/base 10.0.0-dev.2 → 10.0.0-dev.21
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/btc/BitcoinNetwork.d.ts +6 -6
- package/dist/btc/BitcoinNetwork.js +10 -10
- package/dist/btc/rpc/BitcoinRpc.d.ts +68 -68
- package/dist/btc/rpc/BitcoinRpc.js +2 -2
- package/dist/btcrelay/BtcRelay.d.ts +61 -61
- package/dist/btcrelay/BtcRelay.js +2 -2
- package/dist/btcrelay/synchronizer/RelaySynchronizer.d.ts +18 -18
- package/dist/btcrelay/synchronizer/RelaySynchronizer.js +2 -2
- package/dist/btcrelay/types/BtcBlock.d.ts +13 -13
- package/dist/btcrelay/types/BtcBlock.js +2 -2
- package/dist/btcrelay/types/BtcHeader.d.ts +10 -10
- package/dist/btcrelay/types/BtcHeader.js +2 -2
- package/dist/btcrelay/types/BtcStoredHeader.d.ts +11 -11
- package/dist/btcrelay/types/BtcStoredHeader.js +2 -2
- package/dist/btcrelay/utils/StatePredictorUtils.d.ts +11 -11
- package/dist/btcrelay/utils/StatePredictorUtils.js +80 -80
- package/dist/chains/ChainData.d.ts +31 -31
- package/dist/chains/ChainData.js +2 -2
- package/dist/chains/ChainInterface.d.ts +133 -110
- package/dist/chains/ChainInterface.js +7 -2
- package/dist/chains/ChainType.d.ts +24 -23
- package/dist/chains/ChainType.js +2 -2
- package/dist/errors/CannotInitializeATAError.d.ts +3 -3
- package/dist/errors/CannotInitializeATAError.js +11 -11
- package/dist/errors/SignatureVerificationError.d.ts +3 -3
- package/dist/errors/SignatureVerificationError.js +11 -11
- package/dist/errors/SwapDataVerificationError.d.ts +3 -3
- package/dist/errors/SwapDataVerificationError.js +11 -11
- package/dist/errors/TransactionRevertedError.d.ts +3 -0
- package/dist/errors/TransactionRevertedError.js +11 -0
- package/dist/events/ChainEvents.d.ts +9 -9
- package/dist/events/ChainEvents.js +2 -2
- package/dist/events/types/ChainEvent.d.ts +7 -7
- package/dist/events/types/ChainEvent.js +6 -6
- package/dist/events/types/spv_vault/SpvVaultClaimEvent.d.ts +12 -12
- package/dist/events/types/spv_vault/SpvVaultClaimEvent.js +18 -18
- package/dist/events/types/spv_vault/SpvVaultCloseEvent.d.ts +7 -7
- package/dist/events/types/spv_vault/SpvVaultCloseEvent.js +13 -13
- package/dist/events/types/spv_vault/SpvVaultDepositEvent.d.ts +7 -7
- package/dist/events/types/spv_vault/SpvVaultDepositEvent.js +13 -13
- package/dist/events/types/spv_vault/SpvVaultEvent.d.ts +15 -15
- package/dist/events/types/spv_vault/SpvVaultEvent.js +20 -20
- package/dist/events/types/spv_vault/SpvVaultFrontEvent.d.ts +10 -10
- package/dist/events/types/spv_vault/SpvVaultFrontEvent.js +16 -16
- package/dist/events/types/spv_vault/SpvVaultOpenEvent.d.ts +7 -7
- package/dist/events/types/spv_vault/SpvVaultOpenEvent.js +13 -13
- package/dist/events/types/swap/ClaimEvent.d.ts +7 -7
- package/dist/events/types/swap/ClaimEvent.js +11 -11
- package/dist/events/types/swap/InitializeEvent.d.ts +9 -9
- package/dist/events/types/swap/InitializeEvent.js +12 -12
- package/dist/events/types/swap/RefundEvent.d.ts +5 -5
- package/dist/events/types/swap/RefundEvent.js +7 -7
- package/dist/events/types/swap/SwapEvent.d.ts +12 -12
- package/dist/events/types/swap/SwapEvent.js +17 -17
- package/dist/index.d.ts +42 -38
- package/dist/index.js +58 -54
- package/dist/lockable/Lockable.d.ts +6 -6
- package/dist/lockable/Lockable.js +28 -28
- package/dist/messaging/Messenger.d.ts +8 -0
- package/dist/messaging/Messenger.js +2 -0
- package/dist/messaging/messages/Message.d.ts +11 -0
- package/dist/messaging/messages/Message.js +22 -0
- package/dist/messaging/messages/SwapClaimWitnessMessage.d.ts +10 -0
- package/dist/messaging/messages/SwapClaimWitnessMessage.js +28 -0
- package/dist/spv_swap/SpvVaultContract.d.ts +258 -199
- package/dist/spv_swap/SpvVaultContract.js +2 -2
- package/dist/spv_swap/SpvVaultData.d.ts +35 -35
- package/dist/spv_swap/SpvVaultData.js +37 -37
- package/dist/spv_swap/SpvWithdrawalState.d.ts +31 -31
- package/dist/spv_swap/SpvWithdrawalState.js +10 -10
- package/dist/spv_swap/SpvWithdrawalTransactionData.d.ts +43 -43
- package/dist/spv_swap/SpvWithdrawalTransactionData.js +143 -143
- package/dist/storage/IStorageManager.d.ts +15 -15
- package/dist/storage/IStorageManager.js +2 -2
- package/dist/storage/StorageObject.d.ts +3 -3
- package/dist/storage/StorageObject.js +2 -2
- package/dist/swaps/ChainSwapType.d.ts +6 -6
- package/dist/swaps/ChainSwapType.js +10 -10
- package/dist/swaps/SwapCommitState.d.ts +39 -38
- package/dist/swaps/SwapCommitState.js +11 -11
- package/dist/swaps/SwapContract.d.ts +479 -467
- package/dist/swaps/SwapContract.js +2 -2
- package/dist/swaps/SwapData.d.ts +37 -36
- package/dist/swaps/SwapData.js +17 -14
- package/dist/utils/BigIntBufferUtils.d.ts +6 -6
- package/dist/utils/BigIntBufferUtils.js +31 -31
- package/package.json +31 -31
- package/src/btc/BitcoinNetwork.ts +6 -6
- package/src/btc/rpc/BitcoinRpc.ts +77 -77
- package/src/btcrelay/BtcRelay.ts +70 -70
- package/src/btcrelay/synchronizer/RelaySynchronizer.ts +17 -17
- package/src/btcrelay/types/BtcBlock.ts +15 -15
- package/src/btcrelay/types/BtcHeader.ts +11 -11
- package/src/btcrelay/types/BtcStoredHeader.ts +12 -12
- package/src/btcrelay/utils/StatePredictorUtils.ts +108 -108
- package/src/chains/ChainData.ts +40 -40
- package/src/chains/ChainInterface.ts +159 -132
- package/src/chains/ChainType.ts +40 -38
- package/src/errors/CannotInitializeATAError.ts +11 -11
- package/src/errors/SignatureVerificationError.ts +11 -11
- package/src/errors/SwapDataVerificationError.ts +11 -11
- package/src/errors/TransactionRevertedError.ts +11 -0
- package/src/events/ChainEvents.ts +13 -13
- package/src/events/types/ChainEvent.ts +10 -10
- package/src/events/types/spv_vault/SpvVaultClaimEvent.ts +31 -31
- package/src/events/types/spv_vault/SpvVaultCloseEvent.ts +17 -17
- package/src/events/types/spv_vault/SpvVaultDepositEvent.ts +17 -17
- package/src/events/types/spv_vault/SpvVaultEvent.ts +25 -25
- package/src/events/types/spv_vault/SpvVaultFrontEvent.ts +27 -27
- package/src/events/types/spv_vault/SpvVaultOpenEvent.ts +16 -16
- package/src/events/types/swap/ClaimEvent.ts +15 -15
- package/src/events/types/swap/InitializeEvent.ts +18 -18
- package/src/events/types/swap/RefundEvent.ts +6 -6
- package/src/events/types/swap/SwapEvent.ts +21 -21
- package/src/index.ts +51 -46
- package/src/lockable/Lockable.ts +30 -30
- package/src/messaging/Messenger.ts +11 -0
- package/src/messaging/messages/Message.ts +25 -0
- package/src/messaging/messages/SwapClaimWitnessMessage.ts +34 -0
- package/src/spv_swap/SpvVaultContract.ts +269 -230
- package/src/spv_swap/SpvVaultData.ts +70 -70
- package/src/spv_swap/SpvWithdrawalState.ts +40 -40
- package/src/spv_swap/SpvWithdrawalTransactionData.ts +169 -169
- package/src/storage/IStorageManager.ts +16 -16
- package/src/storage/StorageObject.ts +6 -6
- package/src/swaps/ChainSwapType.ts +6 -6
- package/src/swaps/SwapCommitState.ts +40 -39
- package/src/swaps/SwapContract.ts +564 -556
- package/src/swaps/SwapData.ts +69 -65
- package/src/utils/BigIntBufferUtils.ts +31 -31
|
@@ -1,110 +1,133 @@
|
|
|
1
|
-
export type TransactionConfirmationOptions = {
|
|
2
|
-
waitForConfirmation?: boolean;
|
|
3
|
-
abortSignal?: AbortSignal;
|
|
4
|
-
feeRate?: string;
|
|
5
|
-
};
|
|
6
|
-
export type AbstractSigner = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @param
|
|
49
|
-
* @param
|
|
50
|
-
* @param
|
|
51
|
-
* @param
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
* @param
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
*
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
*
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
1
|
+
export type TransactionConfirmationOptions = {
|
|
2
|
+
waitForConfirmation?: boolean;
|
|
3
|
+
abortSignal?: AbortSignal;
|
|
4
|
+
feeRate?: string;
|
|
5
|
+
};
|
|
6
|
+
export type AbstractSigner = {
|
|
7
|
+
type: "AtomiqAbstractSigner";
|
|
8
|
+
getAddress: () => string;
|
|
9
|
+
init?: () => Promise<void>;
|
|
10
|
+
stop?: () => Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
export declare function isAbstractSigner(val: any): val is AbstractSigner;
|
|
13
|
+
export interface ChainInterface<TX = any, Signer extends AbstractSigner = AbstractSigner, ChainId extends string = string, NativeSigner = any> {
|
|
14
|
+
readonly chainId: ChainId;
|
|
15
|
+
/**
|
|
16
|
+
* Returns the token balance of a specific address
|
|
17
|
+
*
|
|
18
|
+
* @param signer Address to check the balance of
|
|
19
|
+
* @param token Token
|
|
20
|
+
*/
|
|
21
|
+
getBalance(signer: string, token: string): Promise<bigint>;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the token address of the native currency of the chain
|
|
24
|
+
*/
|
|
25
|
+
getNativeCurrencyAddress(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if a given string is a valid wallet address
|
|
28
|
+
*
|
|
29
|
+
* @param address
|
|
30
|
+
* @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
|
|
31
|
+
*/
|
|
32
|
+
isValidAddress(address: string, lenient?: boolean): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Normalizes a given address i.e. pads it to the specific size
|
|
35
|
+
*
|
|
36
|
+
* @param address
|
|
37
|
+
*/
|
|
38
|
+
normalizeAddress(address: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Checks if a given string is a valid token identifier
|
|
41
|
+
*
|
|
42
|
+
* @param tokenIdentifier
|
|
43
|
+
*/
|
|
44
|
+
isValidToken(tokenIdentifier: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Transfers the specific token to a given recipient
|
|
47
|
+
*
|
|
48
|
+
* @param signer Signer/owner of the tokens
|
|
49
|
+
* @param token Token to transfer
|
|
50
|
+
* @param amount Amount of token to transfer
|
|
51
|
+
* @param dstAddress Destination address of the transfer
|
|
52
|
+
* @param txOptions Transaction options
|
|
53
|
+
*/
|
|
54
|
+
transfer(signer: Signer, token: string, amount: bigint, dstAddress: string, txOptions?: TransactionConfirmationOptions): Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Returns transactions for transferring a specific token to a given recipient
|
|
57
|
+
*
|
|
58
|
+
* @param signer Signer/owner of the tokens
|
|
59
|
+
* @param token Token to transfer
|
|
60
|
+
* @param amount Amount of token to transfer
|
|
61
|
+
* @param dstAddress Destination address of the transfer
|
|
62
|
+
* @param feeRate Optional fee rate to use for the transaction (fetched on-demand if not provided)
|
|
63
|
+
*/
|
|
64
|
+
txsTransfer(signer: string, token: string, amount: bigint, dstAddress: string, feeRate?: string): Promise<TX[]>;
|
|
65
|
+
/**
|
|
66
|
+
* Serializes a given transaction to a string
|
|
67
|
+
*
|
|
68
|
+
* @param tx Transaction to serialize
|
|
69
|
+
*/
|
|
70
|
+
serializeTx(tx: TX): Promise<string>;
|
|
71
|
+
/**
|
|
72
|
+
* Deserializes a transaction from string
|
|
73
|
+
*
|
|
74
|
+
* @param txData Serialized transaction data string
|
|
75
|
+
*/
|
|
76
|
+
deserializeTx(txData: string): Promise<TX>;
|
|
77
|
+
/**
|
|
78
|
+
* Returns the status of the given serialized transaction
|
|
79
|
+
*
|
|
80
|
+
* @param tx Serialized transaction
|
|
81
|
+
*/
|
|
82
|
+
getTxStatus(tx: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
83
|
+
/**
|
|
84
|
+
* Returns the status of the given transactionId (use getTxStatus whenever possible, it's more reliable)
|
|
85
|
+
*
|
|
86
|
+
* @param txId Transaction ID
|
|
87
|
+
*/
|
|
88
|
+
getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
89
|
+
/**
|
|
90
|
+
* Returns the latest known finalized block data (this is a block with 100% certainty of not getting re-org, i.e.
|
|
91
|
+
* a block already committed on L1)
|
|
92
|
+
*/
|
|
93
|
+
getFinalizedBlock(): Promise<{
|
|
94
|
+
height: number;
|
|
95
|
+
blockHash: string;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* Signs, sends a batch of transaction and optionally waits for their confirmation
|
|
99
|
+
*
|
|
100
|
+
* @param signer Signer to use for signing transactions
|
|
101
|
+
* @param txs Transactions to send
|
|
102
|
+
* @param waitForConfirmation Whether to wait for transaction confirmation (if parallel is not specified,
|
|
103
|
+
* every transaction's confirmation except the last one is awaited)
|
|
104
|
+
* @param abortSignal Abort signal
|
|
105
|
+
* @param parallel Whether to send all transactions in parallel or one by one (always waiting for the previous TX to confirm)
|
|
106
|
+
* @param onBeforePublish Callback called before a tx is broadcast
|
|
107
|
+
*/
|
|
108
|
+
sendAndConfirm(signer: Signer, txs: TX[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
|
|
109
|
+
/**
|
|
110
|
+
* Callback called when transaction is being replaced (used for EVM, when fee is bumped on an unconfirmed tx)
|
|
111
|
+
*
|
|
112
|
+
* @param callback
|
|
113
|
+
*/
|
|
114
|
+
onBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): void;
|
|
115
|
+
/**
|
|
116
|
+
* Remove tx replace callback
|
|
117
|
+
*
|
|
118
|
+
* @param callback
|
|
119
|
+
*/
|
|
120
|
+
offBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Returns a random valid wallet address
|
|
123
|
+
*/
|
|
124
|
+
randomAddress(): string;
|
|
125
|
+
/**
|
|
126
|
+
* Returns randomly generated signer
|
|
127
|
+
*/
|
|
128
|
+
randomSigner(): Signer;
|
|
129
|
+
/**
|
|
130
|
+
* Wraps a native chain signer object to an atomiq-understandable AbstractSigner
|
|
131
|
+
*/
|
|
132
|
+
wrapSigner(signer: NativeSigner): Promise<Signer>;
|
|
133
|
+
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAbstractSigner = void 0;
|
|
4
|
+
function isAbstractSigner(val) {
|
|
5
|
+
return typeof (val) === "object" && val.type === "AtomiqAbstractSigner" && typeof (val.getAddress) === "function";
|
|
6
|
+
}
|
|
7
|
+
exports.isAbstractSigner = isAbstractSigner;
|
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { SwapData } from "../swaps/SwapData";
|
|
2
|
-
import { ChainEvents } from "../events/ChainEvents";
|
|
3
|
-
import { SwapContract } from "../swaps/SwapContract";
|
|
4
|
-
import { BtcRelay } from "../btcrelay/BtcRelay";
|
|
5
|
-
import { AbstractSigner, ChainInterface } from "./ChainInterface";
|
|
6
|
-
import { SpvVaultData } from "../spv_swap/SpvVaultData";
|
|
7
|
-
import { SpvVaultContract } from "../spv_swap/SpvVaultContract";
|
|
8
|
-
import { SpvWithdrawalTransactionData } from "../spv_swap/SpvWithdrawalTransactionData";
|
|
9
|
-
export type ChainType<ChainId extends string = string, PreFetchData = any, PreFetchVerification = any, TXType = any, Signer extends AbstractSigner = AbstractSigner, T extends SwapData = SwapData, C extends SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId> = SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId>, I extends ChainInterface<TXType, Signer, ChainId> = ChainInterface<TXType, Signer, ChainId>, E extends ChainEvents<T> = ChainEvents<T>, B extends BtcRelay<any, TXType, any, Signer> = BtcRelay<any, TXType, any, Signer>, SpvData extends SpvVaultData = SpvVaultData, SpvWithdrawalData extends SpvWithdrawalTransactionData = SpvWithdrawalTransactionData, SpvContract extends SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData> = SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData>> = {
|
|
10
|
-
ChainId: ChainId;
|
|
11
|
-
PreFetchData: PreFetchData;
|
|
12
|
-
PreFetchVerification: PreFetchVerification;
|
|
13
|
-
TX: TXType;
|
|
14
|
-
Signer: Signer;
|
|
15
|
-
ChainInterface: I;
|
|
16
|
-
Data: T;
|
|
17
|
-
Contract: C;
|
|
18
|
-
Events: E;
|
|
19
|
-
BtcRelay: B;
|
|
20
|
-
SpvVaultData: SpvData;
|
|
21
|
-
SpvVaultContract: SpvContract;
|
|
22
|
-
SpvVaultWithdrawalData: SpvWithdrawalData;
|
|
23
|
-
|
|
1
|
+
import { SwapData } from "../swaps/SwapData";
|
|
2
|
+
import { ChainEvents } from "../events/ChainEvents";
|
|
3
|
+
import { SwapContract } from "../swaps/SwapContract";
|
|
4
|
+
import { BtcRelay } from "../btcrelay/BtcRelay";
|
|
5
|
+
import { AbstractSigner, ChainInterface } from "./ChainInterface";
|
|
6
|
+
import { SpvVaultData } from "../spv_swap/SpvVaultData";
|
|
7
|
+
import { SpvVaultContract } from "../spv_swap/SpvVaultContract";
|
|
8
|
+
import { SpvWithdrawalTransactionData } from "../spv_swap/SpvWithdrawalTransactionData";
|
|
9
|
+
export type ChainType<ChainId extends string = string, PreFetchData = any, PreFetchVerification = any, TXType = any, Signer extends AbstractSigner = AbstractSigner, NativeSigner = any, T extends SwapData = SwapData, C extends SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId> = SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId>, I extends ChainInterface<TXType, Signer, ChainId, NativeSigner> = ChainInterface<TXType, Signer, ChainId, NativeSigner>, E extends ChainEvents<T> = ChainEvents<T>, B extends BtcRelay<any, TXType, any, Signer> = BtcRelay<any, TXType, any, Signer>, SpvData extends SpvVaultData = SpvVaultData, SpvWithdrawalData extends SpvWithdrawalTransactionData = SpvWithdrawalTransactionData, SpvContract extends SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData> = SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData>> = {
|
|
10
|
+
ChainId: ChainId;
|
|
11
|
+
PreFetchData: PreFetchData;
|
|
12
|
+
PreFetchVerification: PreFetchVerification;
|
|
13
|
+
TX: TXType;
|
|
14
|
+
Signer: Signer;
|
|
15
|
+
ChainInterface: I;
|
|
16
|
+
Data: T;
|
|
17
|
+
Contract: C;
|
|
18
|
+
Events: E;
|
|
19
|
+
BtcRelay: B;
|
|
20
|
+
SpvVaultData: SpvData;
|
|
21
|
+
SpvVaultContract: SpvContract;
|
|
22
|
+
SpvVaultWithdrawalData: SpvWithdrawalData;
|
|
23
|
+
NativeSigner: NativeSigner;
|
|
24
|
+
};
|
package/dist/chains/ChainType.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class CannotInitializeATAError extends Error {
|
|
2
|
-
constructor(msg: string);
|
|
3
|
-
}
|
|
1
|
+
export declare class CannotInitializeATAError extends Error {
|
|
2
|
+
constructor(msg: string);
|
|
3
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CannotInitializeATAError = void 0;
|
|
4
|
-
class CannotInitializeATAError extends Error {
|
|
5
|
-
constructor(msg) {
|
|
6
|
-
super(msg);
|
|
7
|
-
// Set the prototype explicitly.
|
|
8
|
-
Object.setPrototypeOf(this, CannotInitializeATAError.prototype);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.CannotInitializeATAError = CannotInitializeATAError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CannotInitializeATAError = void 0;
|
|
4
|
+
class CannotInitializeATAError extends Error {
|
|
5
|
+
constructor(msg) {
|
|
6
|
+
super(msg);
|
|
7
|
+
// Set the prototype explicitly.
|
|
8
|
+
Object.setPrototypeOf(this, CannotInitializeATAError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.CannotInitializeATAError = CannotInitializeATAError;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class SignatureVerificationError extends Error {
|
|
2
|
-
constructor(msg: string);
|
|
3
|
-
}
|
|
1
|
+
export declare class SignatureVerificationError extends Error {
|
|
2
|
+
constructor(msg: string);
|
|
3
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SignatureVerificationError = void 0;
|
|
4
|
-
class SignatureVerificationError extends Error {
|
|
5
|
-
constructor(msg) {
|
|
6
|
-
super(msg);
|
|
7
|
-
// Set the prototype explicitly.
|
|
8
|
-
Object.setPrototypeOf(this, SignatureVerificationError.prototype);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SignatureVerificationError = SignatureVerificationError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SignatureVerificationError = void 0;
|
|
4
|
+
class SignatureVerificationError extends Error {
|
|
5
|
+
constructor(msg) {
|
|
6
|
+
super(msg);
|
|
7
|
+
// Set the prototype explicitly.
|
|
8
|
+
Object.setPrototypeOf(this, SignatureVerificationError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SignatureVerificationError = SignatureVerificationError;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare class SwapDataVerificationError extends Error {
|
|
2
|
-
constructor(msg: string);
|
|
3
|
-
}
|
|
1
|
+
export declare class SwapDataVerificationError extends Error {
|
|
2
|
+
constructor(msg: string);
|
|
3
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapDataVerificationError = void 0;
|
|
4
|
-
class SwapDataVerificationError extends Error {
|
|
5
|
-
constructor(msg) {
|
|
6
|
-
super(msg);
|
|
7
|
-
// Set the prototype explicitly.
|
|
8
|
-
Object.setPrototypeOf(this, SwapDataVerificationError.prototype);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.SwapDataVerificationError = SwapDataVerificationError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SwapDataVerificationError = void 0;
|
|
4
|
+
class SwapDataVerificationError extends Error {
|
|
5
|
+
constructor(msg) {
|
|
6
|
+
super(msg);
|
|
7
|
+
// Set the prototype explicitly.
|
|
8
|
+
Object.setPrototypeOf(this, SwapDataVerificationError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SwapDataVerificationError = SwapDataVerificationError;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TransactionRevertedError = void 0;
|
|
4
|
+
class TransactionRevertedError extends Error {
|
|
5
|
+
constructor(msg) {
|
|
6
|
+
super(msg);
|
|
7
|
+
// Set the prototype explicitly.
|
|
8
|
+
Object.setPrototypeOf(this, TransactionRevertedError.prototype);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.TransactionRevertedError = TransactionRevertedError;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { SwapData } from "../swaps/SwapData";
|
|
2
|
-
import { ChainEvent } from "./types/ChainEvent";
|
|
3
|
-
export type EventListener<T extends SwapData> = (obj: ChainEvent<T>[]) => Promise<boolean>;
|
|
4
|
-
export interface ChainEvents<T extends SwapData> {
|
|
5
|
-
init(): Promise<void>;
|
|
6
|
-
registerListener(cbk: EventListener<T>): void;
|
|
7
|
-
unregisterListener(cbk: EventListener<T>): boolean;
|
|
8
|
-
stop(): Promise<void>;
|
|
9
|
-
}
|
|
1
|
+
import { SwapData } from "../swaps/SwapData";
|
|
2
|
+
import { ChainEvent } from "./types/ChainEvent";
|
|
3
|
+
export type EventListener<T extends SwapData> = (obj: ChainEvent<T>[]) => Promise<boolean>;
|
|
4
|
+
export interface ChainEvents<T extends SwapData> {
|
|
5
|
+
init(): Promise<void>;
|
|
6
|
+
registerListener(cbk: EventListener<T>): void;
|
|
7
|
+
unregisterListener(cbk: EventListener<T>): boolean;
|
|
8
|
+
stop(): Promise<void>;
|
|
9
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SwapData } from "../../swaps/SwapData";
|
|
2
|
-
export declare class ChainEvent<T extends SwapData> {
|
|
3
|
-
meta?: {
|
|
4
|
-
blockTime: number;
|
|
5
|
-
txId: string;
|
|
6
|
-
};
|
|
7
|
-
}
|
|
1
|
+
import { SwapData } from "../../swaps/SwapData";
|
|
2
|
+
export declare class ChainEvent<T extends SwapData> {
|
|
3
|
+
meta?: {
|
|
4
|
+
blockTime: number;
|
|
5
|
+
txId: string;
|
|
6
|
+
};
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ChainEvent = void 0;
|
|
4
|
-
class ChainEvent {
|
|
5
|
-
}
|
|
6
|
-
exports.ChainEvent = ChainEvent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChainEvent = void 0;
|
|
4
|
+
class ChainEvent {
|
|
5
|
+
}
|
|
6
|
+
exports.ChainEvent = ChainEvent;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
-
export declare class SpvVaultClaimEvent extends SpvVaultEvent<SpvVaultEventType.CLAIM> {
|
|
3
|
-
readonly eventType = SpvVaultEventType.CLAIM;
|
|
4
|
-
btcTxId: string;
|
|
5
|
-
recipient: string;
|
|
6
|
-
executionHash: string;
|
|
7
|
-
amounts: bigint[];
|
|
8
|
-
caller: string;
|
|
9
|
-
frontingAddress: string;
|
|
10
|
-
withdrawCount: number;
|
|
11
|
-
constructor(owner: string, vaultId: bigint, btcTxId: string, recipient: string, executionHash: string, amounts: bigint[], caller: string, frontingAddress: string, withdrawCount: number);
|
|
12
|
-
}
|
|
1
|
+
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
+
export declare class SpvVaultClaimEvent extends SpvVaultEvent<SpvVaultEventType.CLAIM> {
|
|
3
|
+
readonly eventType = SpvVaultEventType.CLAIM;
|
|
4
|
+
btcTxId: string;
|
|
5
|
+
recipient: string;
|
|
6
|
+
executionHash: string;
|
|
7
|
+
amounts: bigint[];
|
|
8
|
+
caller: string;
|
|
9
|
+
frontingAddress: string;
|
|
10
|
+
withdrawCount: number;
|
|
11
|
+
constructor(owner: string, vaultId: bigint, btcTxId: string, recipient: string, executionHash: string, amounts: bigint[], caller: string, frontingAddress: string, withdrawCount: number);
|
|
12
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpvVaultClaimEvent = void 0;
|
|
4
|
-
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
-
class SpvVaultClaimEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
-
constructor(owner, vaultId, btcTxId, recipient, executionHash, amounts, caller, frontingAddress, withdrawCount) {
|
|
7
|
-
super(owner, vaultId);
|
|
8
|
-
this.eventType = SpvVaultEvent_1.SpvVaultEventType.CLAIM;
|
|
9
|
-
this.btcTxId = btcTxId;
|
|
10
|
-
this.recipient = recipient;
|
|
11
|
-
this.executionHash = executionHash;
|
|
12
|
-
this.amounts = amounts;
|
|
13
|
-
this.caller = caller;
|
|
14
|
-
this.frontingAddress = frontingAddress;
|
|
15
|
-
this.withdrawCount = withdrawCount;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.SpvVaultClaimEvent = SpvVaultClaimEvent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpvVaultClaimEvent = void 0;
|
|
4
|
+
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
+
class SpvVaultClaimEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
+
constructor(owner, vaultId, btcTxId, recipient, executionHash, amounts, caller, frontingAddress, withdrawCount) {
|
|
7
|
+
super(owner, vaultId);
|
|
8
|
+
this.eventType = SpvVaultEvent_1.SpvVaultEventType.CLAIM;
|
|
9
|
+
this.btcTxId = btcTxId;
|
|
10
|
+
this.recipient = recipient;
|
|
11
|
+
this.executionHash = executionHash;
|
|
12
|
+
this.amounts = amounts;
|
|
13
|
+
this.caller = caller;
|
|
14
|
+
this.frontingAddress = frontingAddress;
|
|
15
|
+
this.withdrawCount = withdrawCount;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.SpvVaultClaimEvent = SpvVaultClaimEvent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
-
export declare class SpvVaultCloseEvent extends SpvVaultEvent<SpvVaultEventType.CLOSE> {
|
|
3
|
-
readonly eventType = SpvVaultEventType.CLOSE;
|
|
4
|
-
btcTxId: string;
|
|
5
|
-
error: string;
|
|
6
|
-
constructor(owner: string, vaultId: bigint, btcTxId: string, error: string);
|
|
7
|
-
}
|
|
1
|
+
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
+
export declare class SpvVaultCloseEvent extends SpvVaultEvent<SpvVaultEventType.CLOSE> {
|
|
3
|
+
readonly eventType = SpvVaultEventType.CLOSE;
|
|
4
|
+
btcTxId: string;
|
|
5
|
+
error: string;
|
|
6
|
+
constructor(owner: string, vaultId: bigint, btcTxId: string, error: string);
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpvVaultCloseEvent = void 0;
|
|
4
|
-
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
-
class SpvVaultCloseEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
-
constructor(owner, vaultId, btcTxId, error) {
|
|
7
|
-
super(owner, vaultId);
|
|
8
|
-
this.eventType = SpvVaultEvent_1.SpvVaultEventType.CLOSE;
|
|
9
|
-
this.btcTxId = btcTxId;
|
|
10
|
-
this.error = error;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.SpvVaultCloseEvent = SpvVaultCloseEvent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpvVaultCloseEvent = void 0;
|
|
4
|
+
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
+
class SpvVaultCloseEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
+
constructor(owner, vaultId, btcTxId, error) {
|
|
7
|
+
super(owner, vaultId);
|
|
8
|
+
this.eventType = SpvVaultEvent_1.SpvVaultEventType.CLOSE;
|
|
9
|
+
this.btcTxId = btcTxId;
|
|
10
|
+
this.error = error;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SpvVaultCloseEvent = SpvVaultCloseEvent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
-
export declare class SpvVaultDepositEvent extends SpvVaultEvent<SpvVaultEventType.DEPOSIT> {
|
|
3
|
-
readonly eventType = SpvVaultEventType.DEPOSIT;
|
|
4
|
-
amounts: bigint[];
|
|
5
|
-
depositCount: number;
|
|
6
|
-
constructor(owner: string, vaultId: bigint, amounts: bigint[], depositCount: number);
|
|
7
|
-
}
|
|
1
|
+
import { SpvVaultEvent, SpvVaultEventType } from "./SpvVaultEvent";
|
|
2
|
+
export declare class SpvVaultDepositEvent extends SpvVaultEvent<SpvVaultEventType.DEPOSIT> {
|
|
3
|
+
readonly eventType = SpvVaultEventType.DEPOSIT;
|
|
4
|
+
amounts: bigint[];
|
|
5
|
+
depositCount: number;
|
|
6
|
+
constructor(owner: string, vaultId: bigint, amounts: bigint[], depositCount: number);
|
|
7
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SpvVaultDepositEvent = void 0;
|
|
4
|
-
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
-
class SpvVaultDepositEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
-
constructor(owner, vaultId, amounts, depositCount) {
|
|
7
|
-
super(owner, vaultId);
|
|
8
|
-
this.eventType = SpvVaultEvent_1.SpvVaultEventType.DEPOSIT;
|
|
9
|
-
this.amounts = amounts;
|
|
10
|
-
this.depositCount = depositCount;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.SpvVaultDepositEvent = SpvVaultDepositEvent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpvVaultDepositEvent = void 0;
|
|
4
|
+
const SpvVaultEvent_1 = require("./SpvVaultEvent");
|
|
5
|
+
class SpvVaultDepositEvent extends SpvVaultEvent_1.SpvVaultEvent {
|
|
6
|
+
constructor(owner, vaultId, amounts, depositCount) {
|
|
7
|
+
super(owner, vaultId);
|
|
8
|
+
this.eventType = SpvVaultEvent_1.SpvVaultEventType.DEPOSIT;
|
|
9
|
+
this.amounts = amounts;
|
|
10
|
+
this.depositCount = depositCount;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SpvVaultDepositEvent = SpvVaultDepositEvent;
|