@across-protocol/sdk 4.2.7 → 4.2.8
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/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/cjs/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js +5 -13
- package/dist/cjs/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/cjs/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js +18 -35
- package/dist/cjs/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/SpokePool.d.ts +1 -3
- package/dist/cjs/interfaces/SpokePool.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js +1 -1
- package/dist/esm/clients/SpokePoolClient/EVMSpokePoolClient.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js +5 -13
- package/dist/esm/clients/SpokePoolClient/SpokePoolClient.js.map +1 -1
- package/dist/esm/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/esm/clients/mocks/MockSpokePoolClient.js +21 -38
- package/dist/esm/clients/mocks/MockSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/SpokePool.d.ts +1 -3
- package/dist/esm/interfaces/SpokePool.js.map +1 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts +3 -1
- package/dist/types/clients/SpokePoolClient/SpokePoolClient.d.ts.map +1 -1
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts +5 -11
- package/dist/types/clients/mocks/MockSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/SpokePool.d.ts +1 -3
- package/dist/types/interfaces/SpokePool.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/clients/SpokePoolClient/EVMSpokePoolClient.ts +1 -1
- package/src/clients/SpokePoolClient/SpokePoolClient.ts +8 -16
- package/src/clients/mocks/MockSpokePoolClient.ts +36 -66
- package/src/interfaces/SpokePool.ts +1 -4
|
@@ -25,7 +25,6 @@ import {
|
|
|
25
25
|
BigNumber,
|
|
26
26
|
bnZero,
|
|
27
27
|
bnOne,
|
|
28
|
-
toAddress,
|
|
29
28
|
toBytes32,
|
|
30
29
|
spreadEventWithBlockNumber,
|
|
31
30
|
} from "../../utils";
|
|
@@ -85,6 +84,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
85
84
|
lastDepositId = _depositIds[i];
|
|
86
85
|
}
|
|
87
86
|
}
|
|
87
|
+
|
|
88
88
|
_getDepositIdAtBlock(blockTag: number): Promise<BigNumber> {
|
|
89
89
|
return Promise.resolve(this.depositIdAtBlock[blockTag]);
|
|
90
90
|
}
|
|
@@ -129,10 +129,6 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
129
129
|
return this._deposit("FundsDeposited", deposit);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
depositV3(deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
133
|
-
return this._deposit("V3FundsDeposited", deposit);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
132
|
protected _deposit(event: string, deposit: Omit<Deposit, "messageHash"> & Partial<SortableEvent>): Log {
|
|
137
133
|
const { blockNumber, txnIndex } = deposit;
|
|
138
134
|
let { depositId, destinationChainId, inputAmount, outputAmount } = deposit;
|
|
@@ -140,12 +136,11 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
140
136
|
this.numberOfDeposits = depositId.add(bnOne);
|
|
141
137
|
|
|
142
138
|
destinationChainId ??= random(1, 42161, false);
|
|
143
|
-
const
|
|
144
|
-
const
|
|
145
|
-
const
|
|
146
|
-
const
|
|
147
|
-
const
|
|
148
|
-
const exclusiveRelayer = addressModifier(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
139
|
+
const depositor = toBytes32(deposit.depositor ?? randomAddress());
|
|
140
|
+
const recipient = toBytes32(deposit.recipient ?? depositor);
|
|
141
|
+
const inputToken = toBytes32(deposit.inputToken ?? randomAddress());
|
|
142
|
+
const outputToken = toBytes32(deposit.outputToken ?? inputToken);
|
|
143
|
+
const exclusiveRelayer = toBytes32(deposit.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
149
144
|
|
|
150
145
|
inputAmount ??= toBNWei(random(1, 1000, false));
|
|
151
146
|
outputAmount ??= inputAmount.mul(toBN("0.95"));
|
|
@@ -180,17 +175,13 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
180
175
|
});
|
|
181
176
|
}
|
|
182
177
|
|
|
183
|
-
|
|
184
|
-
return this._fillRelay("FilledV3Relay", fill);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
fillRelay(fill: Omit<Fill, "messageHash"> & { message: string } & Partial<SortableEvent>): Log {
|
|
178
|
+
fillRelay(fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>): Log {
|
|
188
179
|
return this._fillRelay("FilledRelay", fill);
|
|
189
180
|
}
|
|
190
181
|
|
|
191
182
|
protected _fillRelay(
|
|
192
183
|
event: string,
|
|
193
|
-
fill: Omit<Fill, "messageHash"> & { message
|
|
184
|
+
fill: Omit<Fill, "messageHash"> & { message?: string } & Partial<SortableEvent>
|
|
194
185
|
): Log {
|
|
195
186
|
const { blockNumber, txnIndex } = fill;
|
|
196
187
|
let { originChainId, depositId, inputAmount, outputAmount, fillDeadline } = fill;
|
|
@@ -200,15 +191,14 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
200
191
|
outputAmount ??= inputAmount;
|
|
201
192
|
fillDeadline ??= getCurrentTime() + 60;
|
|
202
193
|
|
|
203
|
-
const
|
|
204
|
-
const
|
|
205
|
-
const
|
|
206
|
-
const
|
|
207
|
-
const
|
|
208
|
-
const
|
|
209
|
-
const relayer = addressModifier(fill.relayer ?? randomAddress());
|
|
194
|
+
const depositor = toBytes32(fill.depositor ?? randomAddress());
|
|
195
|
+
const recipient = toBytes32(fill.recipient ?? depositor);
|
|
196
|
+
const inputToken = toBytes32(fill.inputToken ?? randomAddress());
|
|
197
|
+
const outputToken = toBytes32(fill.outputToken ?? ZERO_ADDRESS);
|
|
198
|
+
const exclusiveRelayer = toBytes32(fill.exclusiveRelayer ?? ZERO_ADDRESS);
|
|
199
|
+
const relayer = toBytes32(fill.relayer ?? randomAddress());
|
|
210
200
|
|
|
211
|
-
const topics = [originChainId, depositId, relayer];
|
|
201
|
+
const topics = [originChainId, depositId, relayer];
|
|
212
202
|
const message = fill.message ?? EMPTY_MESSAGE;
|
|
213
203
|
const updatedMessage = fill.relayExecutionInfo?.updatedMessage ?? message;
|
|
214
204
|
|
|
@@ -239,25 +229,14 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
239
229
|
},
|
|
240
230
|
};
|
|
241
231
|
|
|
242
|
-
const args =
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
},
|
|
251
|
-
}
|
|
252
|
-
: {
|
|
253
|
-
// FilledV3Relay
|
|
254
|
-
..._args,
|
|
255
|
-
message,
|
|
256
|
-
relayExecutionInfo: {
|
|
257
|
-
...relayExecutionInfo,
|
|
258
|
-
updatedMessage,
|
|
259
|
-
},
|
|
260
|
-
};
|
|
232
|
+
const args = {
|
|
233
|
+
..._args,
|
|
234
|
+
messageHash: getMessageHash(message),
|
|
235
|
+
relayExecutionInfo: {
|
|
236
|
+
...relayExecutionInfo,
|
|
237
|
+
updatedMessageHash: getMessageHash(updatedMessage),
|
|
238
|
+
},
|
|
239
|
+
};
|
|
261
240
|
|
|
262
241
|
return this.eventManager.generateEvent({
|
|
263
242
|
event,
|
|
@@ -269,17 +248,12 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
269
248
|
});
|
|
270
249
|
}
|
|
271
250
|
|
|
272
|
-
speedUpV3Deposit(speedUp: SpeedUp): Log {
|
|
273
|
-
return this._speedUpDeposit("RequestedSpeedUpV3Deposit", speedUp);
|
|
274
|
-
}
|
|
275
|
-
|
|
276
251
|
speedUpDeposit(speedUp: SpeedUp): Log {
|
|
277
252
|
return this._speedUpDeposit("RequestedSpeedUpDeposit", speedUp);
|
|
278
253
|
}
|
|
279
254
|
|
|
280
255
|
protected _speedUpDeposit(event: string, speedUp: SpeedUp): Log {
|
|
281
|
-
const
|
|
282
|
-
const depositor = addressModifier(speedUp.depositor);
|
|
256
|
+
const depositor = toBytes32(speedUp.depositor);
|
|
283
257
|
const topics = [speedUp.depositId, depositor];
|
|
284
258
|
const args = { ...speedUp };
|
|
285
259
|
|
|
@@ -290,7 +264,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
290
264
|
args: {
|
|
291
265
|
...args,
|
|
292
266
|
depositor,
|
|
293
|
-
updatedRecipient:
|
|
267
|
+
updatedRecipient: toBytes32(speedUp.updatedRecipient),
|
|
294
268
|
},
|
|
295
269
|
});
|
|
296
270
|
}
|
|
@@ -308,24 +282,19 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
308
282
|
});
|
|
309
283
|
}
|
|
310
284
|
|
|
311
|
-
|
|
312
|
-
return this._requestSlowFill("RequestedV3SlowFill", request);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
requestSlowFill(request: Omit<SlowFillRequest, "messageHash"> & Partial<SortableEvent>): Log {
|
|
285
|
+
requestSlowFill(request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>): Log {
|
|
316
286
|
return this._requestSlowFill("RequestedSlowFill", request);
|
|
317
287
|
}
|
|
318
288
|
|
|
319
289
|
protected _requestSlowFill(
|
|
320
290
|
event: string,
|
|
321
|
-
request: Omit<SlowFillRequest, "
|
|
291
|
+
request: Omit<SlowFillRequest, "destinationChainId"> & Partial<SortableEvent>
|
|
322
292
|
): Log {
|
|
323
293
|
const { originChainId, depositId } = request;
|
|
324
294
|
const topics = [originChainId, depositId];
|
|
325
295
|
const args = { ...request };
|
|
326
296
|
|
|
327
|
-
const
|
|
328
|
-
const depositor = addressModifier(args.depositor ?? randomAddress());
|
|
297
|
+
const depositor = toBytes32(args.depositor ?? randomAddress());
|
|
329
298
|
|
|
330
299
|
return this.eventManager.generateEvent({
|
|
331
300
|
event,
|
|
@@ -333,20 +302,21 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
333
302
|
topics: topics.map((topic) => topic.toString()),
|
|
334
303
|
args: {
|
|
335
304
|
...args,
|
|
305
|
+
destinationChainId: this.chainId,
|
|
336
306
|
depositor,
|
|
337
|
-
recipient:
|
|
338
|
-
inputToken:
|
|
339
|
-
outputToken:
|
|
340
|
-
exclusiveRelayer:
|
|
307
|
+
recipient: toBytes32(args.recipient ?? depositor),
|
|
308
|
+
inputToken: toBytes32(args.inputToken ?? randomAddress()),
|
|
309
|
+
outputToken: toBytes32(args.outputToken ?? ZERO_ADDRESS),
|
|
310
|
+
exclusiveRelayer: toBytes32(args.exclusiveRelayer ?? ZERO_ADDRESS),
|
|
341
311
|
},
|
|
342
312
|
blockNumber: request.blockNumber,
|
|
343
313
|
transactionIndex: request.txnIndex,
|
|
344
314
|
});
|
|
345
315
|
}
|
|
346
316
|
|
|
347
|
-
// This is a simple wrapper around
|
|
317
|
+
// This is a simple wrapper around fillRelay().
|
|
348
318
|
// rootBundleId and proof are discarded here - we have no interest in verifying that.
|
|
349
|
-
|
|
319
|
+
executeSlowRelayLeaf(leaf: Omit<SlowFillLeaf, "messageHash">): Log {
|
|
350
320
|
const fill = {
|
|
351
321
|
...leaf.relayData,
|
|
352
322
|
destinationChainId: this.chainId,
|
|
@@ -361,7 +331,7 @@ export class MockSpokePoolClient extends EVMSpokePoolClient {
|
|
|
361
331
|
},
|
|
362
332
|
};
|
|
363
333
|
|
|
364
|
-
return this.
|
|
334
|
+
return this.fillRelay(fill);
|
|
365
335
|
}
|
|
366
336
|
|
|
367
337
|
executeRelayerRefundLeaf(refund: RelayerRefundExecution & Partial<SortableEvent>): Log {
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { SortableEvent } from "./Common";
|
|
2
|
-
import { FilledV3RelayEvent, V3FundsDepositedEvent } from "../typechain";
|
|
3
2
|
import { SpokePoolClient } from "../clients";
|
|
4
3
|
import { BigNumber } from "../utils";
|
|
5
4
|
import { RelayerRefundLeaf } from "./HubPool";
|
|
6
5
|
|
|
7
|
-
export type { FilledV3RelayEvent, V3FundsDepositedEvent };
|
|
8
|
-
|
|
9
6
|
export interface RelayData {
|
|
10
7
|
originChainId: number;
|
|
11
8
|
depositor: string;
|
|
@@ -93,7 +90,7 @@ export interface SpeedUp {
|
|
|
93
90
|
|
|
94
91
|
export interface SpeedUpWithBlock extends SpeedUp, SortableEvent {}
|
|
95
92
|
|
|
96
|
-
export interface SlowFillRequest extends RelayData {
|
|
93
|
+
export interface SlowFillRequest extends Omit<RelayData, "message"> {
|
|
97
94
|
messageHash: string;
|
|
98
95
|
destinationChainId: number;
|
|
99
96
|
}
|