@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
package/src/chains/ChainType.ts
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
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
|
-
|
|
10
|
-
export type ChainType<
|
|
11
|
-
ChainId extends string = string,
|
|
12
|
-
PreFetchData = any,
|
|
13
|
-
PreFetchVerification = any,
|
|
14
|
-
TXType = any,
|
|
15
|
-
Signer extends AbstractSigner = AbstractSigner,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
> =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
+
|
|
10
|
+
export type ChainType<
|
|
11
|
+
ChainId extends string = string,
|
|
12
|
+
PreFetchData = any,
|
|
13
|
+
PreFetchVerification = any,
|
|
14
|
+
TXType = any,
|
|
15
|
+
Signer extends AbstractSigner = AbstractSigner,
|
|
16
|
+
NativeSigner = any,
|
|
17
|
+
T extends SwapData = SwapData,
|
|
18
|
+
C extends SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId> = SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId>,
|
|
19
|
+
I extends ChainInterface<TXType, Signer, ChainId, NativeSigner> = ChainInterface<TXType, Signer, ChainId, NativeSigner>,
|
|
20
|
+
E extends ChainEvents<T> = ChainEvents<T>,
|
|
21
|
+
B extends BtcRelay<any, TXType, any, Signer> = BtcRelay<any, TXType, any, Signer>,
|
|
22
|
+
SpvData extends SpvVaultData = SpvVaultData,
|
|
23
|
+
SpvWithdrawalData extends SpvWithdrawalTransactionData = SpvWithdrawalTransactionData,
|
|
24
|
+
SpvContract extends SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData> = SpvVaultContract<TXType, Signer, ChainId, SpvData, SpvWithdrawalData>
|
|
25
|
+
> = {
|
|
26
|
+
ChainId: ChainId,
|
|
27
|
+
PreFetchData: PreFetchData,
|
|
28
|
+
PreFetchVerification: PreFetchVerification,
|
|
29
|
+
TX: TXType,
|
|
30
|
+
Signer: Signer,
|
|
31
|
+
ChainInterface: I,
|
|
32
|
+
Data: T,
|
|
33
|
+
Contract: C,
|
|
34
|
+
Events: E,
|
|
35
|
+
BtcRelay: B,
|
|
36
|
+
SpvVaultData: SpvData,
|
|
37
|
+
SpvVaultContract: SpvContract,
|
|
38
|
+
SpvVaultWithdrawalData: SpvWithdrawalData,
|
|
39
|
+
NativeSigner: NativeSigner
|
|
40
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export class CannotInitializeATAError extends Error {
|
|
3
|
-
|
|
4
|
-
constructor(msg: string) {
|
|
5
|
-
super(msg);
|
|
6
|
-
// Set the prototype explicitly.
|
|
7
|
-
Object.setPrototypeOf(this, CannotInitializeATAError.prototype);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
|
|
2
|
+
export class CannotInitializeATAError extends Error {
|
|
3
|
+
|
|
4
|
+
constructor(msg: string) {
|
|
5
|
+
super(msg);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, CannotInitializeATAError.prototype);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export class SignatureVerificationError extends Error {
|
|
3
|
-
|
|
4
|
-
constructor(msg: string) {
|
|
5
|
-
super(msg);
|
|
6
|
-
// Set the prototype explicitly.
|
|
7
|
-
Object.setPrototypeOf(this, SignatureVerificationError.prototype);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
|
|
2
|
+
export class SignatureVerificationError extends Error {
|
|
3
|
+
|
|
4
|
+
constructor(msg: string) {
|
|
5
|
+
super(msg);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, SignatureVerificationError.prototype);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
export class SwapDataVerificationError extends Error {
|
|
3
|
-
|
|
4
|
-
constructor(msg: string) {
|
|
5
|
-
super(msg);
|
|
6
|
-
// Set the prototype explicitly.
|
|
7
|
-
Object.setPrototypeOf(this, SwapDataVerificationError.prototype);
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
|
|
2
|
+
export class SwapDataVerificationError extends Error {
|
|
3
|
+
|
|
4
|
+
constructor(msg: string) {
|
|
5
|
+
super(msg);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, SwapDataVerificationError.prototype);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
}
|
|
11
|
+
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {SwapData} from "../swaps/SwapData";
|
|
2
|
-
import {ChainEvent} from "./types/ChainEvent";
|
|
3
|
-
|
|
4
|
-
export type EventListener<T extends SwapData> = (obj: ChainEvent<T>[]) => Promise<boolean>;
|
|
5
|
-
|
|
6
|
-
export interface ChainEvents<T extends SwapData> {
|
|
7
|
-
|
|
8
|
-
init(): Promise<void>;
|
|
9
|
-
registerListener(cbk: EventListener<T>): void;
|
|
10
|
-
unregisterListener(cbk: EventListener<T>): boolean;
|
|
11
|
-
stop(): Promise<void>;
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import {SwapData} from "../swaps/SwapData";
|
|
2
|
+
import {ChainEvent} from "./types/ChainEvent";
|
|
3
|
+
|
|
4
|
+
export type EventListener<T extends SwapData> = (obj: ChainEvent<T>[]) => Promise<boolean>;
|
|
5
|
+
|
|
6
|
+
export interface ChainEvents<T extends SwapData> {
|
|
7
|
+
|
|
8
|
+
init(): Promise<void>;
|
|
9
|
+
registerListener(cbk: EventListener<T>): void;
|
|
10
|
+
unregisterListener(cbk: EventListener<T>): boolean;
|
|
11
|
+
stop(): Promise<void>;
|
|
12
|
+
|
|
13
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {SwapData} from "../../swaps/SwapData";
|
|
2
|
-
|
|
3
|
-
export class ChainEvent<T extends SwapData> {
|
|
4
|
-
|
|
5
|
-
meta?: {
|
|
6
|
-
blockTime: number,
|
|
7
|
-
txId: string
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import {SwapData} from "../../swaps/SwapData";
|
|
2
|
+
|
|
3
|
+
export class ChainEvent<T extends SwapData> {
|
|
4
|
+
|
|
5
|
+
meta?: {
|
|
6
|
+
blockTime: number,
|
|
7
|
+
txId: string
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class SpvVaultClaimEvent extends SpvVaultEvent<SpvVaultEventType.CLAIM> {
|
|
5
|
-
|
|
6
|
-
readonly eventType = SpvVaultEventType.CLAIM;
|
|
7
|
-
|
|
8
|
-
btcTxId: string;
|
|
9
|
-
recipient: string;
|
|
10
|
-
executionHash: string;
|
|
11
|
-
amounts: bigint[];
|
|
12
|
-
caller: string;
|
|
13
|
-
frontingAddress: string;
|
|
14
|
-
withdrawCount: number;
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
owner: string, vaultId: bigint,
|
|
18
|
-
btcTxId: string, recipient: string, executionHash: string, amounts: bigint[],
|
|
19
|
-
caller: string, frontingAddress: string, withdrawCount: number
|
|
20
|
-
) {
|
|
21
|
-
super(owner, vaultId);
|
|
22
|
-
this.btcTxId = btcTxId;
|
|
23
|
-
this.recipient = recipient;
|
|
24
|
-
this.executionHash = executionHash;
|
|
25
|
-
this.amounts = amounts;
|
|
26
|
-
this.caller = caller;
|
|
27
|
-
this.frontingAddress = frontingAddress;
|
|
28
|
-
this.withdrawCount = withdrawCount;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|
|
1
|
+
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class SpvVaultClaimEvent extends SpvVaultEvent<SpvVaultEventType.CLAIM> {
|
|
5
|
+
|
|
6
|
+
readonly eventType = SpvVaultEventType.CLAIM;
|
|
7
|
+
|
|
8
|
+
btcTxId: string;
|
|
9
|
+
recipient: string;
|
|
10
|
+
executionHash: string;
|
|
11
|
+
amounts: bigint[];
|
|
12
|
+
caller: string;
|
|
13
|
+
frontingAddress: string;
|
|
14
|
+
withdrawCount: number;
|
|
15
|
+
|
|
16
|
+
constructor(
|
|
17
|
+
owner: string, vaultId: bigint,
|
|
18
|
+
btcTxId: string, recipient: string, executionHash: string, amounts: bigint[],
|
|
19
|
+
caller: string, frontingAddress: string, withdrawCount: number
|
|
20
|
+
) {
|
|
21
|
+
super(owner, vaultId);
|
|
22
|
+
this.btcTxId = btcTxId;
|
|
23
|
+
this.recipient = recipient;
|
|
24
|
+
this.executionHash = executionHash;
|
|
25
|
+
this.amounts = amounts;
|
|
26
|
+
this.caller = caller;
|
|
27
|
+
this.frontingAddress = frontingAddress;
|
|
28
|
+
this.withdrawCount = withdrawCount;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class SpvVaultCloseEvent extends SpvVaultEvent<SpvVaultEventType.CLOSE> {
|
|
5
|
-
|
|
6
|
-
readonly eventType = SpvVaultEventType.CLOSE;
|
|
7
|
-
|
|
8
|
-
btcTxId: string;
|
|
9
|
-
error: string;
|
|
10
|
-
|
|
11
|
-
constructor(owner: string, vaultId: bigint, btcTxId: string, error: string) {
|
|
12
|
-
super(owner, vaultId);
|
|
13
|
-
this.btcTxId = btcTxId;
|
|
14
|
-
this.error = error;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class SpvVaultCloseEvent extends SpvVaultEvent<SpvVaultEventType.CLOSE> {
|
|
5
|
+
|
|
6
|
+
readonly eventType = SpvVaultEventType.CLOSE;
|
|
7
|
+
|
|
8
|
+
btcTxId: string;
|
|
9
|
+
error: string;
|
|
10
|
+
|
|
11
|
+
constructor(owner: string, vaultId: bigint, btcTxId: string, error: string) {
|
|
12
|
+
super(owner, vaultId);
|
|
13
|
+
this.btcTxId = btcTxId;
|
|
14
|
+
this.error = error;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class SpvVaultDepositEvent extends SpvVaultEvent<SpvVaultEventType.DEPOSIT> {
|
|
5
|
-
|
|
6
|
-
readonly eventType = SpvVaultEventType.DEPOSIT;
|
|
7
|
-
|
|
8
|
-
amounts: bigint[];
|
|
9
|
-
depositCount: number;
|
|
10
|
-
|
|
11
|
-
constructor(owner: string, vaultId: bigint, amounts: bigint[], depositCount: number) {
|
|
12
|
-
super(owner, vaultId);
|
|
13
|
-
this.amounts = amounts;
|
|
14
|
-
this.depositCount = depositCount;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
}
|
|
1
|
+
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class SpvVaultDepositEvent extends SpvVaultEvent<SpvVaultEventType.DEPOSIT> {
|
|
5
|
+
|
|
6
|
+
readonly eventType = SpvVaultEventType.DEPOSIT;
|
|
7
|
+
|
|
8
|
+
amounts: bigint[];
|
|
9
|
+
depositCount: number;
|
|
10
|
+
|
|
11
|
+
constructor(owner: string, vaultId: bigint, amounts: bigint[], depositCount: number) {
|
|
12
|
+
super(owner, vaultId);
|
|
13
|
+
this.amounts = amounts;
|
|
14
|
+
this.depositCount = depositCount;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {ChainEvent} from "../ChainEvent";
|
|
2
|
-
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
-
|
|
4
|
-
export enum SpvVaultEventType {
|
|
5
|
-
OPEN = 0,
|
|
6
|
-
DEPOSIT = 1,
|
|
7
|
-
CLAIM = 2,
|
|
8
|
-
CLOSE = 3,
|
|
9
|
-
FRONT = 4
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class SpvVaultEvent<C extends SpvVaultEventType = SpvVaultEventType> extends ChainEvent<SwapData> {
|
|
13
|
-
|
|
14
|
-
readonly eventType: C;
|
|
15
|
-
|
|
16
|
-
owner: string;
|
|
17
|
-
vaultId: bigint;
|
|
18
|
-
|
|
19
|
-
constructor(owner: string, vaultId: bigint) {
|
|
20
|
-
super();
|
|
21
|
-
this.owner = owner;
|
|
22
|
-
this.vaultId = vaultId;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
}
|
|
1
|
+
import {ChainEvent} from "../ChainEvent";
|
|
2
|
+
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
+
|
|
4
|
+
export enum SpvVaultEventType {
|
|
5
|
+
OPEN = 0,
|
|
6
|
+
DEPOSIT = 1,
|
|
7
|
+
CLAIM = 2,
|
|
8
|
+
CLOSE = 3,
|
|
9
|
+
FRONT = 4
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class SpvVaultEvent<C extends SpvVaultEventType = SpvVaultEventType> extends ChainEvent<SwapData> {
|
|
13
|
+
|
|
14
|
+
readonly eventType: C;
|
|
15
|
+
|
|
16
|
+
owner: string;
|
|
17
|
+
vaultId: bigint;
|
|
18
|
+
|
|
19
|
+
constructor(owner: string, vaultId: bigint) {
|
|
20
|
+
super();
|
|
21
|
+
this.owner = owner;
|
|
22
|
+
this.vaultId = vaultId;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class SpvVaultFrontEvent extends SpvVaultEvent<SpvVaultEventType.FRONT> {
|
|
5
|
-
|
|
6
|
-
readonly eventType = SpvVaultEventType.FRONT;
|
|
7
|
-
|
|
8
|
-
btcTxId: string;
|
|
9
|
-
recipient: string;
|
|
10
|
-
executionHash: string;
|
|
11
|
-
amounts: bigint[];
|
|
12
|
-
frontingAddress: string
|
|
13
|
-
|
|
14
|
-
constructor(
|
|
15
|
-
owner: string, vaultId: bigint,
|
|
16
|
-
btcTxId: string, recipient: string, executionHash: string, amounts: bigint[],
|
|
17
|
-
frontingAddress: string
|
|
18
|
-
) {
|
|
19
|
-
super(owner, vaultId);
|
|
20
|
-
this.btcTxId = btcTxId;
|
|
21
|
-
this.recipient = recipient;
|
|
22
|
-
this.executionHash = executionHash;
|
|
23
|
-
this.amounts = amounts;
|
|
24
|
-
this.frontingAddress = frontingAddress;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
}
|
|
1
|
+
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class SpvVaultFrontEvent extends SpvVaultEvent<SpvVaultEventType.FRONT> {
|
|
5
|
+
|
|
6
|
+
readonly eventType = SpvVaultEventType.FRONT;
|
|
7
|
+
|
|
8
|
+
btcTxId: string;
|
|
9
|
+
recipient: string;
|
|
10
|
+
executionHash: string;
|
|
11
|
+
amounts: bigint[];
|
|
12
|
+
frontingAddress: string
|
|
13
|
+
|
|
14
|
+
constructor(
|
|
15
|
+
owner: string, vaultId: bigint,
|
|
16
|
+
btcTxId: string, recipient: string, executionHash: string, amounts: bigint[],
|
|
17
|
+
frontingAddress: string
|
|
18
|
+
) {
|
|
19
|
+
super(owner, vaultId);
|
|
20
|
+
this.btcTxId = btcTxId;
|
|
21
|
+
this.recipient = recipient;
|
|
22
|
+
this.executionHash = executionHash;
|
|
23
|
+
this.amounts = amounts;
|
|
24
|
+
this.frontingAddress = frontingAddress;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export class SpvVaultOpenEvent extends SpvVaultEvent<SpvVaultEventType.OPEN> {
|
|
5
|
-
|
|
6
|
-
readonly eventType = SpvVaultEventType.OPEN;
|
|
7
|
-
|
|
8
|
-
btcTxId: string;
|
|
9
|
-
vout: number;
|
|
10
|
-
|
|
11
|
-
constructor(owner: string, vaultId: bigint, btcTxId: string, vout: number) {
|
|
12
|
-
super(owner, vaultId);
|
|
13
|
-
this.btcTxId = btcTxId;
|
|
14
|
-
this.vout = vout;
|
|
15
|
-
}
|
|
16
|
-
|
|
1
|
+
import {SpvVaultEvent, SpvVaultEventType} from "./SpvVaultEvent";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
export class SpvVaultOpenEvent extends SpvVaultEvent<SpvVaultEventType.OPEN> {
|
|
5
|
+
|
|
6
|
+
readonly eventType = SpvVaultEventType.OPEN;
|
|
7
|
+
|
|
8
|
+
btcTxId: string;
|
|
9
|
+
vout: number;
|
|
10
|
+
|
|
11
|
+
constructor(owner: string, vaultId: bigint, btcTxId: string, vout: number) {
|
|
12
|
+
super(owner, vaultId);
|
|
13
|
+
this.btcTxId = btcTxId;
|
|
14
|
+
this.vout = vout;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
17
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
-
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
-
|
|
4
|
-
export class ClaimEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.CLAIM> {
|
|
5
|
-
|
|
6
|
-
readonly eventType: SwapEventType.CLAIM;
|
|
7
|
-
|
|
8
|
-
result: string;
|
|
9
|
-
|
|
10
|
-
constructor(escrowHash: string, result: string) {
|
|
11
|
-
super(escrowHash);
|
|
12
|
-
this.result = result;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
}
|
|
1
|
+
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
+
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
+
|
|
4
|
+
export class ClaimEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.CLAIM> {
|
|
5
|
+
|
|
6
|
+
readonly eventType: SwapEventType.CLAIM;
|
|
7
|
+
|
|
8
|
+
result: string;
|
|
9
|
+
|
|
10
|
+
constructor(escrowHash: string, result: string) {
|
|
11
|
+
super(escrowHash);
|
|
12
|
+
this.result = result;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
-
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
-
import {ChainSwapType} from "../../../swaps/ChainSwapType";
|
|
4
|
-
|
|
5
|
-
export class InitializeEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.INITIALIZE> {
|
|
6
|
-
|
|
7
|
-
readonly eventType: SwapEventType.INITIALIZE;
|
|
8
|
-
|
|
9
|
-
swapType: ChainSwapType;
|
|
10
|
-
swapData: () => Promise<T>;
|
|
11
|
-
|
|
12
|
-
constructor(escrowHash: string, swapType: ChainSwapType, swapData: () => Promise<T>) {
|
|
13
|
-
super(escrowHash);
|
|
14
|
-
this.swapType = swapType;
|
|
15
|
-
this.swapData = swapData;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
}
|
|
1
|
+
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
+
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
+
import {ChainSwapType} from "../../../swaps/ChainSwapType";
|
|
4
|
+
|
|
5
|
+
export class InitializeEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.INITIALIZE> {
|
|
6
|
+
|
|
7
|
+
readonly eventType: SwapEventType.INITIALIZE;
|
|
8
|
+
|
|
9
|
+
swapType: ChainSwapType;
|
|
10
|
+
swapData: () => Promise<T>;
|
|
11
|
+
|
|
12
|
+
constructor(escrowHash: string, swapType: ChainSwapType, swapData: () => Promise<T>) {
|
|
13
|
+
super(escrowHash);
|
|
14
|
+
this.swapType = swapType;
|
|
15
|
+
this.swapData = swapData;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
-
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
-
|
|
4
|
-
export class RefundEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.REFUND> {
|
|
5
|
-
readonly eventType: SwapEventType.REFUND;
|
|
6
|
-
}
|
|
1
|
+
import {SwapEvent, SwapEventType} from "./SwapEvent";
|
|
2
|
+
import {SwapData} from "../../../swaps/SwapData";
|
|
3
|
+
|
|
4
|
+
export class RefundEvent<T extends SwapData> extends SwapEvent<T, SwapEventType.REFUND> {
|
|
5
|
+
readonly eventType: SwapEventType.REFUND;
|
|
6
|
+
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import {SwapData} from "../../../swaps/SwapData";
|
|
2
|
-
import {ChainEvent} from "../ChainEvent";
|
|
3
|
-
|
|
4
|
-
export enum SwapEventType {
|
|
5
|
-
INITIALIZE = 0,
|
|
6
|
-
REFUND = 1,
|
|
7
|
-
CLAIM = 2
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export class SwapEvent<T extends SwapData, C extends SwapEventType = SwapEventType> extends ChainEvent<T> {
|
|
11
|
-
|
|
12
|
-
readonly eventType: C;
|
|
13
|
-
|
|
14
|
-
escrowHash: string;
|
|
15
|
-
|
|
16
|
-
constructor(escrowHash: string) {
|
|
17
|
-
super();
|
|
18
|
-
this.escrowHash = escrowHash;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
}
|
|
1
|
+
import {SwapData} from "../../../swaps/SwapData";
|
|
2
|
+
import {ChainEvent} from "../ChainEvent";
|
|
3
|
+
|
|
4
|
+
export enum SwapEventType {
|
|
5
|
+
INITIALIZE = 0,
|
|
6
|
+
REFUND = 1,
|
|
7
|
+
CLAIM = 2
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class SwapEvent<T extends SwapData, C extends SwapEventType = SwapEventType> extends ChainEvent<T> {
|
|
11
|
+
|
|
12
|
+
readonly eventType: C;
|
|
13
|
+
|
|
14
|
+
escrowHash: string;
|
|
15
|
+
|
|
16
|
+
constructor(escrowHash: string) {
|
|
17
|
+
super();
|
|
18
|
+
this.escrowHash = escrowHash;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
}
|