@atomiqlabs/base 10.0.0-dev.9 → 12.0.0
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/dist/chains/ChainInterface.d.ts +25 -2
- package/dist/chains/ChainInterface.js +5 -0
- package/dist/chains/ChainType.d.ts +2 -1
- package/dist/errors/TransactionRevertedError.d.ts +3 -0
- package/dist/errors/TransactionRevertedError.js +11 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/spv_swap/SpvVaultContract.d.ts +62 -3
- package/dist/swaps/SwapContract.d.ts +11 -0
- package/package.json +1 -1
- package/src/chains/ChainInterface.ts +30 -3
- package/src/chains/ChainType.ts +4 -2
- package/src/errors/TransactionRevertedError.ts +11 -0
- package/src/index.ts +1 -0
- package/src/spv_swap/SpvVaultContract.ts +42 -3
- package/src/swaps/SwapContract.ts +7 -0
- package/dist/messaging/EventMessaging.d.ts +0 -8
- package/dist/messaging/EventMessaging.js +0 -2
|
@@ -4,9 +4,13 @@ export type TransactionConfirmationOptions = {
|
|
|
4
4
|
feeRate?: string;
|
|
5
5
|
};
|
|
6
6
|
export type AbstractSigner = {
|
|
7
|
+
type: "AtomiqAbstractSigner";
|
|
7
8
|
getAddress: () => string;
|
|
9
|
+
init?: () => Promise<void>;
|
|
10
|
+
stop?: () => Promise<void>;
|
|
8
11
|
};
|
|
9
|
-
export
|
|
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> {
|
|
10
14
|
readonly chainId: ChainId;
|
|
11
15
|
/**
|
|
12
16
|
* Returns the token balance of a specific address
|
|
@@ -23,8 +27,15 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
|
|
|
23
27
|
* Checks if a given string is a valid wallet address
|
|
24
28
|
*
|
|
25
29
|
* @param address
|
|
30
|
+
* @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
|
|
26
31
|
*/
|
|
27
|
-
isValidAddress(address: string): boolean;
|
|
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;
|
|
28
39
|
/**
|
|
29
40
|
* Checks if a given string is a valid token identifier
|
|
30
41
|
*
|
|
@@ -75,6 +86,14 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
|
|
|
75
86
|
* @param txId Transaction ID
|
|
76
87
|
*/
|
|
77
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
|
+
}>;
|
|
78
97
|
/**
|
|
79
98
|
* Signs, sends a batch of transaction and optionally waits for their confirmation
|
|
80
99
|
*
|
|
@@ -107,4 +126,8 @@ export interface ChainInterface<TX = any, Signer extends AbstractSigner = Abstra
|
|
|
107
126
|
* Returns randomly generated signer
|
|
108
127
|
*/
|
|
109
128
|
randomSigner(): Signer;
|
|
129
|
+
/**
|
|
130
|
+
* Wraps a native chain signer object to an atomiq-understandable AbstractSigner
|
|
131
|
+
*/
|
|
132
|
+
wrapSigner(signer: NativeSigner): Promise<Signer>;
|
|
110
133
|
}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
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;
|
|
@@ -6,7 +6,7 @@ import { AbstractSigner, ChainInterface } from "./ChainInterface";
|
|
|
6
6
|
import { SpvVaultData } from "../spv_swap/SpvVaultData";
|
|
7
7
|
import { SpvVaultContract } from "../spv_swap/SpvVaultContract";
|
|
8
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>> = {
|
|
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
10
|
ChainId: ChainId;
|
|
11
11
|
PreFetchData: PreFetchData;
|
|
12
12
|
PreFetchVerification: PreFetchVerification;
|
|
@@ -20,4 +20,5 @@ export type ChainType<ChainId extends string = string, PreFetchData = any, PreFe
|
|
|
20
20
|
SpvVaultData: SpvData;
|
|
21
21
|
SpvVaultContract: SpvContract;
|
|
22
22
|
SpvVaultWithdrawalData: SpvWithdrawalData;
|
|
23
|
+
NativeSigner: NativeSigner;
|
|
23
24
|
};
|
|
@@ -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;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./swaps/SwapCommitState";
|
|
|
20
20
|
export * from "./errors/SignatureVerificationError";
|
|
21
21
|
export * from "./errors/CannotInitializeATAError";
|
|
22
22
|
export * from "./errors/SwapDataVerificationError";
|
|
23
|
+
export * from "./errors/TransactionRevertedError";
|
|
23
24
|
export * from "./chains/ChainType";
|
|
24
25
|
export * from "./chains/ChainData";
|
|
25
26
|
export * from "./utils/BigIntBufferUtils";
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __exportStar(require("./swaps/SwapCommitState"), exports);
|
|
|
36
36
|
__exportStar(require("./errors/SignatureVerificationError"), exports);
|
|
37
37
|
__exportStar(require("./errors/CannotInitializeATAError"), exports);
|
|
38
38
|
__exportStar(require("./errors/SwapDataVerificationError"), exports);
|
|
39
|
+
__exportStar(require("./errors/TransactionRevertedError"), exports);
|
|
39
40
|
__exportStar(require("./chains/ChainType"), exports);
|
|
40
41
|
__exportStar(require("./chains/ChainData"), exports);
|
|
41
42
|
__exportStar(require("./utils/BigIntBufferUtils"), exports);
|
|
@@ -111,6 +111,18 @@ export interface SpvVaultContract<TX = any, Signer extends AbstractSigner = Abst
|
|
|
111
111
|
* @param withdrawal Withdrawal transaction to check the fronting for
|
|
112
112
|
*/
|
|
113
113
|
getFronterAddress(owner: string, vaultId: bigint, withdrawal: WithdrawalTX): Promise<string | null>;
|
|
114
|
+
/**
|
|
115
|
+
* Returns the parties which currently fronted the withdrawal transactions
|
|
116
|
+
*
|
|
117
|
+
* @param withdrawals withdrawals to query
|
|
118
|
+
*/
|
|
119
|
+
getFronterAddresses(withdrawals: {
|
|
120
|
+
owner: string;
|
|
121
|
+
vaultId: bigint;
|
|
122
|
+
withdrawal: WithdrawalTX;
|
|
123
|
+
}[]): Promise<{
|
|
124
|
+
[btcTxId: string]: string | null;
|
|
125
|
+
}>;
|
|
114
126
|
/**
|
|
115
127
|
* Returns current vault data
|
|
116
128
|
*
|
|
@@ -118,17 +130,64 @@ export interface SpvVaultContract<TX = any, Signer extends AbstractSigner = Abst
|
|
|
118
130
|
* @param vaultId Vault ID
|
|
119
131
|
*/
|
|
120
132
|
getVaultData(owner: string, vaultId: bigint): Promise<Data>;
|
|
133
|
+
/**
|
|
134
|
+
* Returns current vault data for multiple vaults
|
|
135
|
+
*
|
|
136
|
+
* @param vaults Vault data to query
|
|
137
|
+
*/
|
|
138
|
+
getMultipleVaultData(vaults: {
|
|
139
|
+
owner: string;
|
|
140
|
+
vaultId: bigint;
|
|
141
|
+
}[]): Promise<{
|
|
142
|
+
[owner: string]: {
|
|
143
|
+
[vaultId: string]: Data;
|
|
144
|
+
};
|
|
145
|
+
}>;
|
|
146
|
+
/**
|
|
147
|
+
* Returns the latest utxo of a vault (or null if vault closed or not found)
|
|
148
|
+
*
|
|
149
|
+
* @param owner Owner of the vault
|
|
150
|
+
* @param vaultId Vault ID
|
|
151
|
+
*/
|
|
152
|
+
getVaultLatestUtxo(owner: string, vaultId: bigint): Promise<string | null>;
|
|
153
|
+
/**
|
|
154
|
+
* Returns the latest utxos of for multiple vaults (or null if vault closed or not found)
|
|
155
|
+
*
|
|
156
|
+
* @param vaults Vault data to query
|
|
157
|
+
*/
|
|
158
|
+
getVaultLatestUtxos(vaults: {
|
|
159
|
+
owner: string;
|
|
160
|
+
vaultId: bigint;
|
|
161
|
+
}[]): Promise<{
|
|
162
|
+
[owner: string]: {
|
|
163
|
+
[vaultId: string]: string | null;
|
|
164
|
+
};
|
|
165
|
+
}>;
|
|
121
166
|
/**
|
|
122
167
|
* Returns all currently opened vaults
|
|
123
168
|
* NOTE: This will take a long time, since the implementation will have to go through all the prior events
|
|
124
169
|
*/
|
|
125
170
|
getAllVaults(owner?: string): Promise<Data[]>;
|
|
126
171
|
/**
|
|
127
|
-
* Returns current state of the withdrawal
|
|
172
|
+
* Returns current state of the withdrawal, optionally
|
|
173
|
+
* only check withdrawals from the provided block height
|
|
174
|
+
*
|
|
175
|
+
* @param withdrawalTx
|
|
176
|
+
* @param scStartBlockheight
|
|
177
|
+
*/
|
|
178
|
+
getWithdrawalState(withdrawalTx: WithdrawalTX, scStartBlockheight?: number): Promise<SpvWithdrawalState>;
|
|
179
|
+
/**
|
|
180
|
+
* Returns current state of the withdrawals, optionally
|
|
181
|
+
* only check withdrawals from the provided block height
|
|
128
182
|
*
|
|
129
|
-
* @param
|
|
183
|
+
* @param withdrawalTxs Object with the withdrawal tx to check + an optional start blockheight
|
|
130
184
|
*/
|
|
131
|
-
|
|
185
|
+
getWithdrawalStates(withdrawalTxs: {
|
|
186
|
+
withdrawal: WithdrawalTX;
|
|
187
|
+
scStartBlockheight?: number;
|
|
188
|
+
}[]): Promise<{
|
|
189
|
+
[btcTxId: string]: SpvWithdrawalState;
|
|
190
|
+
}>;
|
|
132
191
|
/**
|
|
133
192
|
* Parses withdrawal data from the parsed bitcoin transaction
|
|
134
193
|
*
|
|
@@ -190,6 +190,17 @@ export interface SwapContract<T extends SwapData = SwapData, TX = any, PreFetchD
|
|
|
190
190
|
* @param swapData
|
|
191
191
|
*/
|
|
192
192
|
getCommitStatus(signer: string, swapData: T): Promise<SwapCommitState>;
|
|
193
|
+
/**
|
|
194
|
+
* Returns the full status of the passed swaps, expiry is handled by the isExpired function so also requires a signer/sender
|
|
195
|
+
*
|
|
196
|
+
* @param request
|
|
197
|
+
*/
|
|
198
|
+
getCommitStatuses(request: {
|
|
199
|
+
signer: string;
|
|
200
|
+
swapData: T;
|
|
201
|
+
}[]): Promise<{
|
|
202
|
+
[escrowHash: string]: SwapCommitState;
|
|
203
|
+
}>;
|
|
193
204
|
/**
|
|
194
205
|
* Checks whether a given swap is refundable by us, i.e. it is already expired, we are offerer & swap is committed on-chain
|
|
195
206
|
*
|
package/package.json
CHANGED
|
@@ -5,13 +5,21 @@ export type TransactionConfirmationOptions = {
|
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export type AbstractSigner = {
|
|
8
|
-
|
|
8
|
+
type: "AtomiqAbstractSigner",
|
|
9
|
+
getAddress: () => string,
|
|
10
|
+
init?: () => Promise<void>,
|
|
11
|
+
stop?: () => Promise<void>
|
|
9
12
|
};
|
|
10
13
|
|
|
14
|
+
export function isAbstractSigner(val: any): val is AbstractSigner {
|
|
15
|
+
return typeof(val)==="object" && val.type==="AtomiqAbstractSigner" && typeof(val.getAddress)==="function";
|
|
16
|
+
}
|
|
17
|
+
|
|
11
18
|
export interface ChainInterface<
|
|
12
19
|
TX = any,
|
|
13
20
|
Signer extends AbstractSigner = AbstractSigner,
|
|
14
|
-
ChainId extends string = string
|
|
21
|
+
ChainId extends string = string,
|
|
22
|
+
NativeSigner = any
|
|
15
23
|
> {
|
|
16
24
|
|
|
17
25
|
readonly chainId: ChainId;
|
|
@@ -33,8 +41,16 @@ export interface ChainInterface<
|
|
|
33
41
|
* Checks if a given string is a valid wallet address
|
|
34
42
|
*
|
|
35
43
|
* @param address
|
|
44
|
+
* @param lenient Whether a lenient parsing should be used (i.e. don't strictly enforce the Starknet address lengths)
|
|
45
|
+
*/
|
|
46
|
+
isValidAddress(address: string, lenient?: boolean): boolean;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Normalizes a given address i.e. pads it to the specific size
|
|
50
|
+
*
|
|
51
|
+
* @param address
|
|
36
52
|
*/
|
|
37
|
-
|
|
53
|
+
normalizeAddress(address: string): string;
|
|
38
54
|
|
|
39
55
|
/**
|
|
40
56
|
* Checks if a given string is a valid token identifier
|
|
@@ -93,6 +109,12 @@ export interface ChainInterface<
|
|
|
93
109
|
*/
|
|
94
110
|
getTxIdStatus(txId: string): Promise<"not_found" | "pending" | "success" | "reverted">;
|
|
95
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Returns the latest known finalized block data (this is a block with 100% certainty of not getting re-org, i.e.
|
|
114
|
+
* a block already committed on L1)
|
|
115
|
+
*/
|
|
116
|
+
getFinalizedBlock(): Promise<{height: number, blockHash: string}>;
|
|
117
|
+
|
|
96
118
|
/**
|
|
97
119
|
* Signs, sends a batch of transaction and optionally waits for their confirmation
|
|
98
120
|
*
|
|
@@ -130,4 +152,9 @@ export interface ChainInterface<
|
|
|
130
152
|
*/
|
|
131
153
|
randomSigner(): Signer;
|
|
132
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Wraps a native chain signer object to an atomiq-understandable AbstractSigner
|
|
157
|
+
*/
|
|
158
|
+
wrapSigner(signer: NativeSigner): Promise<Signer>;
|
|
159
|
+
|
|
133
160
|
}
|
package/src/chains/ChainType.ts
CHANGED
|
@@ -13,9 +13,10 @@ export type ChainType<
|
|
|
13
13
|
PreFetchVerification = any,
|
|
14
14
|
TXType = any,
|
|
15
15
|
Signer extends AbstractSigner = AbstractSigner,
|
|
16
|
+
NativeSigner = any,
|
|
16
17
|
T extends SwapData = SwapData,
|
|
17
18
|
C extends SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId> = SwapContract<T, TXType, PreFetchData, PreFetchVerification, Signer, ChainId>,
|
|
18
|
-
I extends ChainInterface<TXType, Signer, ChainId> = ChainInterface<TXType, Signer, ChainId>,
|
|
19
|
+
I extends ChainInterface<TXType, Signer, ChainId, NativeSigner> = ChainInterface<TXType, Signer, ChainId, NativeSigner>,
|
|
19
20
|
E extends ChainEvents<T> = ChainEvents<T>,
|
|
20
21
|
B extends BtcRelay<any, TXType, any, Signer> = BtcRelay<any, TXType, any, Signer>,
|
|
21
22
|
SpvData extends SpvVaultData = SpvVaultData,
|
|
@@ -34,5 +35,6 @@ export type ChainType<
|
|
|
34
35
|
BtcRelay: B,
|
|
35
36
|
SpvVaultData: SpvData,
|
|
36
37
|
SpvVaultContract: SpvContract,
|
|
37
|
-
SpvVaultWithdrawalData: SpvWithdrawalData
|
|
38
|
+
SpvVaultWithdrawalData: SpvWithdrawalData,
|
|
39
|
+
NativeSigner: NativeSigner
|
|
38
40
|
}
|
package/src/index.ts
CHANGED
|
@@ -21,6 +21,7 @@ export * from "./swaps/SwapCommitState";
|
|
|
21
21
|
export * from "./errors/SignatureVerificationError";
|
|
22
22
|
export * from "./errors/CannotInitializeATAError"
|
|
23
23
|
export * from "./errors/SwapDataVerificationError";
|
|
24
|
+
export * from "./errors/TransactionRevertedError";
|
|
24
25
|
|
|
25
26
|
export * from "./chains/ChainType";
|
|
26
27
|
export * from "./chains/ChainData";
|
|
@@ -136,6 +136,13 @@ export interface SpvVaultContract<
|
|
|
136
136
|
*/
|
|
137
137
|
getFronterAddress(owner: string, vaultId: bigint, withdrawal: WithdrawalTX): Promise<string | null>;
|
|
138
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Returns the parties which currently fronted the withdrawal transactions
|
|
141
|
+
*
|
|
142
|
+
* @param withdrawals withdrawals to query
|
|
143
|
+
*/
|
|
144
|
+
getFronterAddresses(withdrawals: {owner: string, vaultId: bigint, withdrawal: WithdrawalTX}[]): Promise<{[btcTxId: string]: string | null}>;
|
|
145
|
+
|
|
139
146
|
/**
|
|
140
147
|
* Returns current vault data
|
|
141
148
|
*
|
|
@@ -144,6 +151,28 @@ export interface SpvVaultContract<
|
|
|
144
151
|
*/
|
|
145
152
|
getVaultData(owner: string, vaultId: bigint): Promise<Data>;
|
|
146
153
|
|
|
154
|
+
/**
|
|
155
|
+
* Returns current vault data for multiple vaults
|
|
156
|
+
*
|
|
157
|
+
* @param vaults Vault data to query
|
|
158
|
+
*/
|
|
159
|
+
getMultipleVaultData(vaults: {owner: string, vaultId: bigint}[]): Promise<{[owner: string]: {[vaultId: string]: Data}}>;
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Returns the latest utxo of a vault (or null if vault closed or not found)
|
|
163
|
+
*
|
|
164
|
+
* @param owner Owner of the vault
|
|
165
|
+
* @param vaultId Vault ID
|
|
166
|
+
*/
|
|
167
|
+
getVaultLatestUtxo(owner: string, vaultId: bigint): Promise<string | null>;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Returns the latest utxos of for multiple vaults (or null if vault closed or not found)
|
|
171
|
+
*
|
|
172
|
+
* @param vaults Vault data to query
|
|
173
|
+
*/
|
|
174
|
+
getVaultLatestUtxos(vaults: {owner: string, vaultId: bigint}[]): Promise<{[owner: string]: {[vaultId: string]: string | null}}>;
|
|
175
|
+
|
|
147
176
|
/**
|
|
148
177
|
* Returns all currently opened vaults
|
|
149
178
|
* NOTE: This will take a long time, since the implementation will have to go through all the prior events
|
|
@@ -151,11 +180,21 @@ export interface SpvVaultContract<
|
|
|
151
180
|
getAllVaults(owner?: string): Promise<Data[]>;
|
|
152
181
|
|
|
153
182
|
/**
|
|
154
|
-
* Returns current state of the withdrawal
|
|
183
|
+
* Returns current state of the withdrawal, optionally
|
|
184
|
+
* only check withdrawals from the provided block height
|
|
185
|
+
*
|
|
186
|
+
* @param withdrawalTx
|
|
187
|
+
* @param scStartBlockheight
|
|
188
|
+
*/
|
|
189
|
+
getWithdrawalState(withdrawalTx: WithdrawalTX, scStartBlockheight?: number): Promise<SpvWithdrawalState>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Returns current state of the withdrawals, optionally
|
|
193
|
+
* only check withdrawals from the provided block height
|
|
155
194
|
*
|
|
156
|
-
* @param
|
|
195
|
+
* @param withdrawalTxs Object with the withdrawal tx to check + an optional start blockheight
|
|
157
196
|
*/
|
|
158
|
-
|
|
197
|
+
getWithdrawalStates(withdrawalTxs: {withdrawal: WithdrawalTX, scStartBlockheight?: number}[]): Promise<{[btcTxId: string]: SpvWithdrawalState}>;
|
|
159
198
|
|
|
160
199
|
/**
|
|
161
200
|
* Parses withdrawal data from the parsed bitcoin transaction
|
|
@@ -238,6 +238,13 @@ export interface SwapContract<
|
|
|
238
238
|
*/
|
|
239
239
|
getCommitStatus(signer: string, swapData: T): Promise<SwapCommitState>;
|
|
240
240
|
|
|
241
|
+
/**
|
|
242
|
+
* Returns the full status of the passed swaps, expiry is handled by the isExpired function so also requires a signer/sender
|
|
243
|
+
*
|
|
244
|
+
* @param request
|
|
245
|
+
*/
|
|
246
|
+
getCommitStatuses(request: {signer: string, swapData: T}[]): Promise<{[escrowHash: string]: SwapCommitState}>;
|
|
247
|
+
|
|
241
248
|
/**
|
|
242
249
|
* Checks whether a given swap is refundable by us, i.e. it is already expired, we are offerer & swap is committed on-chain
|
|
243
250
|
*
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { Message } from "./messages/Message";
|
|
2
|
-
export interface EventMessaging {
|
|
3
|
-
init(): Promise<void>;
|
|
4
|
-
broadcast(msg: Message): Promise<void>;
|
|
5
|
-
subscribe(callback: (msg: Message) => void): Promise<void>;
|
|
6
|
-
unsubscribe(callback: (msg: Message) => void): Promise<boolean>;
|
|
7
|
-
stop(): Promise<void>;
|
|
8
|
-
}
|