@atomiqlabs/base 10.0.0-dev.2 → 10.0.0-dev.3

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.
Files changed (130) hide show
  1. package/LICENSE +201 -201
  2. package/dist/btc/BitcoinNetwork.d.ts +6 -6
  3. package/dist/btc/BitcoinNetwork.js +10 -10
  4. package/dist/btc/rpc/BitcoinRpc.d.ts +68 -68
  5. package/dist/btc/rpc/BitcoinRpc.js +2 -2
  6. package/dist/btcrelay/BtcRelay.d.ts +61 -61
  7. package/dist/btcrelay/BtcRelay.js +2 -2
  8. package/dist/btcrelay/synchronizer/RelaySynchronizer.d.ts +18 -18
  9. package/dist/btcrelay/synchronizer/RelaySynchronizer.js +2 -2
  10. package/dist/btcrelay/types/BtcBlock.d.ts +13 -13
  11. package/dist/btcrelay/types/BtcBlock.js +2 -2
  12. package/dist/btcrelay/types/BtcHeader.d.ts +10 -10
  13. package/dist/btcrelay/types/BtcHeader.js +2 -2
  14. package/dist/btcrelay/types/BtcStoredHeader.d.ts +11 -11
  15. package/dist/btcrelay/types/BtcStoredHeader.js +2 -2
  16. package/dist/btcrelay/utils/StatePredictorUtils.d.ts +11 -11
  17. package/dist/btcrelay/utils/StatePredictorUtils.js +80 -80
  18. package/dist/chains/ChainData.d.ts +31 -31
  19. package/dist/chains/ChainData.js +2 -2
  20. package/dist/chains/ChainInterface.d.ts +110 -110
  21. package/dist/chains/ChainInterface.js +2 -2
  22. package/dist/chains/ChainType.d.ts +23 -23
  23. package/dist/chains/ChainType.js +2 -2
  24. package/dist/errors/CannotInitializeATAError.d.ts +3 -3
  25. package/dist/errors/CannotInitializeATAError.js +11 -11
  26. package/dist/errors/SignatureVerificationError.d.ts +3 -3
  27. package/dist/errors/SignatureVerificationError.js +11 -11
  28. package/dist/errors/SwapDataVerificationError.d.ts +3 -3
  29. package/dist/errors/SwapDataVerificationError.js +11 -11
  30. package/dist/events/ChainEvents.d.ts +9 -9
  31. package/dist/events/ChainEvents.js +2 -2
  32. package/dist/events/types/ChainEvent.d.ts +7 -7
  33. package/dist/events/types/ChainEvent.js +6 -6
  34. package/dist/events/types/spv_vault/SpvVaultClaimEvent.d.ts +12 -12
  35. package/dist/events/types/spv_vault/SpvVaultClaimEvent.js +18 -18
  36. package/dist/events/types/spv_vault/SpvVaultCloseEvent.d.ts +7 -7
  37. package/dist/events/types/spv_vault/SpvVaultCloseEvent.js +13 -13
  38. package/dist/events/types/spv_vault/SpvVaultDepositEvent.d.ts +7 -7
  39. package/dist/events/types/spv_vault/SpvVaultDepositEvent.js +13 -13
  40. package/dist/events/types/spv_vault/SpvVaultEvent.d.ts +15 -15
  41. package/dist/events/types/spv_vault/SpvVaultEvent.js +20 -20
  42. package/dist/events/types/spv_vault/SpvVaultFrontEvent.d.ts +10 -10
  43. package/dist/events/types/spv_vault/SpvVaultFrontEvent.js +16 -16
  44. package/dist/events/types/spv_vault/SpvVaultOpenEvent.d.ts +7 -7
  45. package/dist/events/types/spv_vault/SpvVaultOpenEvent.js +13 -13
  46. package/dist/events/types/swap/ClaimEvent.d.ts +7 -7
  47. package/dist/events/types/swap/ClaimEvent.js +11 -11
  48. package/dist/events/types/swap/InitializeEvent.d.ts +9 -9
  49. package/dist/events/types/swap/InitializeEvent.js +12 -12
  50. package/dist/events/types/swap/RefundEvent.d.ts +5 -5
  51. package/dist/events/types/swap/RefundEvent.js +7 -7
  52. package/dist/events/types/swap/SwapEvent.d.ts +12 -12
  53. package/dist/events/types/swap/SwapEvent.js +17 -17
  54. package/dist/index.d.ts +41 -38
  55. package/dist/index.js +57 -54
  56. package/dist/lockable/Lockable.d.ts +6 -6
  57. package/dist/lockable/Lockable.js +28 -28
  58. package/dist/messaging/EventMessaging.d.ts +8 -0
  59. package/dist/messaging/EventMessaging.js +2 -0
  60. package/dist/messaging/Messenger.d.ts +8 -0
  61. package/dist/messaging/Messenger.js +2 -0
  62. package/dist/messaging/messages/Message.d.ts +8 -0
  63. package/dist/messaging/messages/Message.js +24 -0
  64. package/dist/messaging/messages/SwapClaimWitnessMessage.d.ts +13 -0
  65. package/dist/messaging/messages/SwapClaimWitnessMessage.js +26 -0
  66. package/dist/spv_swap/SpvVaultContract.d.ts +199 -199
  67. package/dist/spv_swap/SpvVaultContract.js +2 -2
  68. package/dist/spv_swap/SpvVaultData.d.ts +35 -35
  69. package/dist/spv_swap/SpvVaultData.js +37 -37
  70. package/dist/spv_swap/SpvWithdrawalState.d.ts +31 -31
  71. package/dist/spv_swap/SpvWithdrawalState.js +10 -10
  72. package/dist/spv_swap/SpvWithdrawalTransactionData.d.ts +43 -43
  73. package/dist/spv_swap/SpvWithdrawalTransactionData.js +143 -143
  74. package/dist/storage/IStorageManager.d.ts +15 -15
  75. package/dist/storage/IStorageManager.js +2 -2
  76. package/dist/storage/StorageObject.d.ts +3 -3
  77. package/dist/storage/StorageObject.js +2 -2
  78. package/dist/swaps/ChainSwapType.d.ts +6 -6
  79. package/dist/swaps/ChainSwapType.js +10 -10
  80. package/dist/swaps/SwapCommitState.d.ts +38 -38
  81. package/dist/swaps/SwapCommitState.js +11 -11
  82. package/dist/swaps/SwapContract.d.ts +467 -467
  83. package/dist/swaps/SwapContract.js +2 -2
  84. package/dist/swaps/SwapData.d.ts +36 -36
  85. package/dist/swaps/SwapData.js +14 -14
  86. package/dist/utils/BigIntBufferUtils.d.ts +6 -6
  87. package/dist/utils/BigIntBufferUtils.js +31 -31
  88. package/package.json +31 -31
  89. package/src/btc/BitcoinNetwork.ts +6 -6
  90. package/src/btc/rpc/BitcoinRpc.ts +77 -77
  91. package/src/btcrelay/BtcRelay.ts +70 -70
  92. package/src/btcrelay/synchronizer/RelaySynchronizer.ts +17 -17
  93. package/src/btcrelay/types/BtcBlock.ts +15 -15
  94. package/src/btcrelay/types/BtcHeader.ts +11 -11
  95. package/src/btcrelay/types/BtcStoredHeader.ts +12 -12
  96. package/src/btcrelay/utils/StatePredictorUtils.ts +108 -108
  97. package/src/chains/ChainData.ts +40 -40
  98. package/src/chains/ChainInterface.ts +132 -132
  99. package/src/chains/ChainType.ts +38 -38
  100. package/src/errors/CannotInitializeATAError.ts +11 -11
  101. package/src/errors/SignatureVerificationError.ts +11 -11
  102. package/src/errors/SwapDataVerificationError.ts +11 -11
  103. package/src/events/ChainEvents.ts +13 -13
  104. package/src/events/types/ChainEvent.ts +10 -10
  105. package/src/events/types/spv_vault/SpvVaultClaimEvent.ts +31 -31
  106. package/src/events/types/spv_vault/SpvVaultCloseEvent.ts +17 -17
  107. package/src/events/types/spv_vault/SpvVaultDepositEvent.ts +17 -17
  108. package/src/events/types/spv_vault/SpvVaultEvent.ts +25 -25
  109. package/src/events/types/spv_vault/SpvVaultFrontEvent.ts +27 -27
  110. package/src/events/types/spv_vault/SpvVaultOpenEvent.ts +16 -16
  111. package/src/events/types/swap/ClaimEvent.ts +15 -15
  112. package/src/events/types/swap/InitializeEvent.ts +18 -18
  113. package/src/events/types/swap/RefundEvent.ts +6 -6
  114. package/src/events/types/swap/SwapEvent.ts +21 -21
  115. package/src/index.ts +50 -46
  116. package/src/lockable/Lockable.ts +30 -30
  117. package/src/messaging/Messenger.ts +11 -0
  118. package/src/messaging/messages/Message.ts +27 -0
  119. package/src/messaging/messages/SwapClaimWitnessMessage.ts +31 -0
  120. package/src/spv_swap/SpvVaultContract.ts +230 -230
  121. package/src/spv_swap/SpvVaultData.ts +70 -70
  122. package/src/spv_swap/SpvWithdrawalState.ts +40 -40
  123. package/src/spv_swap/SpvWithdrawalTransactionData.ts +169 -169
  124. package/src/storage/IStorageManager.ts +16 -16
  125. package/src/storage/StorageObject.ts +6 -6
  126. package/src/swaps/ChainSwapType.ts +6 -6
  127. package/src/swaps/SwapCommitState.ts +39 -39
  128. package/src/swaps/SwapContract.ts +556 -556
  129. package/src/swaps/SwapData.ts +65 -65
  130. package/src/utils/BigIntBufferUtils.ts +31 -31
@@ -1,110 +1,110 @@
1
- export type TransactionConfirmationOptions = {
2
- waitForConfirmation?: boolean;
3
- abortSignal?: AbortSignal;
4
- feeRate?: string;
5
- };
6
- export type AbstractSigner = {
7
- getAddress: () => string;
8
- };
9
- export interface ChainInterface<TX = any, Signer extends AbstractSigner = AbstractSigner, ChainId extends string = string> {
10
- readonly chainId: ChainId;
11
- /**
12
- * Returns the token balance of a specific address
13
- *
14
- * @param signer Address to check the balance of
15
- * @param token Token
16
- */
17
- getBalance(signer: string, token: string): Promise<bigint>;
18
- /**
19
- * Returns the token address of the native currency of the chain
20
- */
21
- getNativeCurrencyAddress(): string;
22
- /**
23
- * Checks if a given string is a valid wallet address
24
- *
25
- * @param address
26
- */
27
- isValidAddress(address: string): boolean;
28
- /**
29
- * Checks if a given string is a valid token identifier
30
- *
31
- * @param tokenIdentifier
32
- */
33
- isValidToken(tokenIdentifier: string): boolean;
34
- /**
35
- * Transfers the specific token to a given recipient
36
- *
37
- * @param signer Signer/owner of the tokens
38
- * @param token Token to transfer
39
- * @param amount Amount of token to transfer
40
- * @param dstAddress Destination address of the transfer
41
- * @param txOptions Transaction options
42
- */
43
- transfer(signer: Signer, token: string, amount: bigint, dstAddress: string, txOptions?: TransactionConfirmationOptions): Promise<string>;
44
- /**
45
- * Returns transactions for transferring a specific token to a given recipient
46
- *
47
- * @param signer Signer/owner of the tokens
48
- * @param token Token to transfer
49
- * @param amount Amount of token to transfer
50
- * @param dstAddress Destination address of the transfer
51
- * @param feeRate Optional fee rate to use for the transaction (fetched on-demand if not provided)
52
- */
53
- txsTransfer(signer: string, token: string, amount: bigint, dstAddress: string, feeRate?: string): Promise<TX[]>;
54
- /**
55
- * Serializes a given transaction to a string
56
- *
57
- * @param tx Transaction to serialize
58
- */
59
- serializeTx(tx: TX): Promise<string>;
60
- /**
61
- * Deserializes a transaction from string
62
- *
63
- * @param txData Serialized transaction data string
64
- */
65
- deserializeTx(txData: string): Promise<TX>;
66
- /**
67
- * Returns the status of the given serialized transaction
68
- *
69
- * @param tx Serialized transaction
70
- */
71
- getTxStatus(tx: string): Promise<"not_found" | "pending" | "success" | "reverted">;
72
- /**
73
- * Returns the status of the given transactionId (use getTxStatus whenever possible, it's more reliable)
74
- *
75
- * @param txId Transaction ID
76
- */
77
- getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
78
- /**
79
- * Signs, sends a batch of transaction and optionally waits for their confirmation
80
- *
81
- * @param signer Signer to use for signing transactions
82
- * @param txs Transactions to send
83
- * @param waitForConfirmation Whether to wait for transaction confirmation (if parallel is not specified,
84
- * every transaction's confirmation except the last one is awaited)
85
- * @param abortSignal Abort signal
86
- * @param parallel Whether to send all transactions in parallel or one by one (always waiting for the previous TX to confirm)
87
- * @param onBeforePublish Callback called before a tx is broadcast
88
- */
89
- sendAndConfirm(signer: Signer, txs: TX[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
90
- /**
91
- * Callback called when transaction is being replaced (used for EVM, when fee is bumped on an unconfirmed tx)
92
- *
93
- * @param callback
94
- */
95
- onBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): void;
96
- /**
97
- * Remove tx replace callback
98
- *
99
- * @param callback
100
- */
101
- offBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): boolean;
102
- /**
103
- * Returns a random valid wallet address
104
- */
105
- randomAddress(): string;
106
- /**
107
- * Returns randomly generated signer
108
- */
109
- randomSigner(): Signer;
110
- }
1
+ export type TransactionConfirmationOptions = {
2
+ waitForConfirmation?: boolean;
3
+ abortSignal?: AbortSignal;
4
+ feeRate?: string;
5
+ };
6
+ export type AbstractSigner = {
7
+ getAddress: () => string;
8
+ };
9
+ export interface ChainInterface<TX = any, Signer extends AbstractSigner = AbstractSigner, ChainId extends string = string> {
10
+ readonly chainId: ChainId;
11
+ /**
12
+ * Returns the token balance of a specific address
13
+ *
14
+ * @param signer Address to check the balance of
15
+ * @param token Token
16
+ */
17
+ getBalance(signer: string, token: string): Promise<bigint>;
18
+ /**
19
+ * Returns the token address of the native currency of the chain
20
+ */
21
+ getNativeCurrencyAddress(): string;
22
+ /**
23
+ * Checks if a given string is a valid wallet address
24
+ *
25
+ * @param address
26
+ */
27
+ isValidAddress(address: string): boolean;
28
+ /**
29
+ * Checks if a given string is a valid token identifier
30
+ *
31
+ * @param tokenIdentifier
32
+ */
33
+ isValidToken(tokenIdentifier: string): boolean;
34
+ /**
35
+ * Transfers the specific token to a given recipient
36
+ *
37
+ * @param signer Signer/owner of the tokens
38
+ * @param token Token to transfer
39
+ * @param amount Amount of token to transfer
40
+ * @param dstAddress Destination address of the transfer
41
+ * @param txOptions Transaction options
42
+ */
43
+ transfer(signer: Signer, token: string, amount: bigint, dstAddress: string, txOptions?: TransactionConfirmationOptions): Promise<string>;
44
+ /**
45
+ * Returns transactions for transferring a specific token to a given recipient
46
+ *
47
+ * @param signer Signer/owner of the tokens
48
+ * @param token Token to transfer
49
+ * @param amount Amount of token to transfer
50
+ * @param dstAddress Destination address of the transfer
51
+ * @param feeRate Optional fee rate to use for the transaction (fetched on-demand if not provided)
52
+ */
53
+ txsTransfer(signer: string, token: string, amount: bigint, dstAddress: string, feeRate?: string): Promise<TX[]>;
54
+ /**
55
+ * Serializes a given transaction to a string
56
+ *
57
+ * @param tx Transaction to serialize
58
+ */
59
+ serializeTx(tx: TX): Promise<string>;
60
+ /**
61
+ * Deserializes a transaction from string
62
+ *
63
+ * @param txData Serialized transaction data string
64
+ */
65
+ deserializeTx(txData: string): Promise<TX>;
66
+ /**
67
+ * Returns the status of the given serialized transaction
68
+ *
69
+ * @param tx Serialized transaction
70
+ */
71
+ getTxStatus(tx: string): Promise<"not_found" | "pending" | "success" | "reverted">;
72
+ /**
73
+ * Returns the status of the given transactionId (use getTxStatus whenever possible, it's more reliable)
74
+ *
75
+ * @param txId Transaction ID
76
+ */
77
+ getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
78
+ /**
79
+ * Signs, sends a batch of transaction and optionally waits for their confirmation
80
+ *
81
+ * @param signer Signer to use for signing transactions
82
+ * @param txs Transactions to send
83
+ * @param waitForConfirmation Whether to wait for transaction confirmation (if parallel is not specified,
84
+ * every transaction's confirmation except the last one is awaited)
85
+ * @param abortSignal Abort signal
86
+ * @param parallel Whether to send all transactions in parallel or one by one (always waiting for the previous TX to confirm)
87
+ * @param onBeforePublish Callback called before a tx is broadcast
88
+ */
89
+ sendAndConfirm(signer: Signer, txs: TX[], waitForConfirmation?: boolean, abortSignal?: AbortSignal, parallel?: boolean, onBeforePublish?: (txId: string, rawTx: string) => Promise<void>): Promise<string[]>;
90
+ /**
91
+ * Callback called when transaction is being replaced (used for EVM, when fee is bumped on an unconfirmed tx)
92
+ *
93
+ * @param callback
94
+ */
95
+ onBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): void;
96
+ /**
97
+ * Remove tx replace callback
98
+ *
99
+ * @param callback
100
+ */
101
+ offBeforeTxReplace(callback: (oldTx: string, oldTxId: string, newTx: string, newTxId: string) => Promise<void>): boolean;
102
+ /**
103
+ * Returns a random valid wallet address
104
+ */
105
+ randomAddress(): string;
106
+ /**
107
+ * Returns randomly generated signer
108
+ */
109
+ randomSigner(): Signer;
110
+ }
@@ -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,23 +1,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, 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, 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,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;
@@ -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;
@@ -1,15 +1,15 @@
1
- import { ChainEvent } from "../ChainEvent";
2
- import { SwapData } from "../../../swaps/SwapData";
3
- export declare enum SpvVaultEventType {
4
- OPEN = 0,
5
- DEPOSIT = 1,
6
- CLAIM = 2,
7
- CLOSE = 3,
8
- FRONT = 4
9
- }
10
- export declare class SpvVaultEvent<C extends SpvVaultEventType = SpvVaultEventType> extends ChainEvent<SwapData> {
11
- readonly eventType: C;
12
- owner: string;
13
- vaultId: bigint;
14
- constructor(owner: string, vaultId: bigint);
15
- }
1
+ import { ChainEvent } from "../ChainEvent";
2
+ import { SwapData } from "../../../swaps/SwapData";
3
+ export declare enum SpvVaultEventType {
4
+ OPEN = 0,
5
+ DEPOSIT = 1,
6
+ CLAIM = 2,
7
+ CLOSE = 3,
8
+ FRONT = 4
9
+ }
10
+ export declare class SpvVaultEvent<C extends SpvVaultEventType = SpvVaultEventType> extends ChainEvent<SwapData> {
11
+ readonly eventType: C;
12
+ owner: string;
13
+ vaultId: bigint;
14
+ constructor(owner: string, vaultId: bigint);
15
+ }