@across-protocol/sdk 4.3.9 → 4.3.11
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/arch/evm/index.d.ts +1 -0
- package/dist/cjs/arch/evm/index.js +1 -0
- package/dist/cjs/arch/evm/index.js.map +1 -1
- package/dist/cjs/arch/evm/utils/index.d.ts +1 -0
- package/dist/cjs/arch/evm/utils/index.js +5 -0
- package/dist/cjs/arch/evm/utils/index.js.map +1 -0
- package/dist/cjs/arch/evm/utils/wait.d.ts +17 -0
- package/dist/cjs/arch/evm/utils/wait.js +81 -0
- package/dist/cjs/arch/evm/utils/wait.js.map +1 -0
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +2 -2
- package/dist/cjs/arch/svm/SpokeUtils.js +66 -52
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/provider.d.ts +2 -0
- package/dist/cjs/arch/svm/provider.js +7 -0
- package/dist/cjs/arch/svm/provider.js.map +1 -0
- package/dist/cjs/arch/svm/utils.d.ts +1 -0
- package/dist/cjs/arch/svm/utils.js +3 -1
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js +23 -3
- package/dist/cjs/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
- package/dist/cjs/interfaces/PubSubMechanism.d.ts +4 -0
- package/dist/cjs/interfaces/PubSubMechanism.js +3 -0
- package/dist/cjs/interfaces/PubSubMechanism.js.map +1 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/interfaces/index.js.map +1 -1
- package/dist/cjs/providers/types.d.ts +2 -2
- package/dist/cjs/typeguards/error.d.ts +2 -1
- package/dist/cjs/typeguards/error.js +3 -1
- package/dist/cjs/typeguards/error.js.map +1 -1
- package/dist/esm/arch/evm/index.d.ts +1 -0
- package/dist/esm/arch/evm/index.js +1 -0
- package/dist/esm/arch/evm/index.js.map +1 -1
- package/dist/esm/arch/evm/utils/index.d.ts +1 -0
- package/dist/esm/arch/evm/utils/index.js +2 -0
- package/dist/esm/arch/evm/utils/index.js.map +1 -0
- package/dist/esm/arch/evm/utils/wait.d.ts +17 -0
- package/dist/esm/arch/evm/utils/wait.js +77 -0
- package/dist/esm/arch/evm/utils/wait.js.map +1 -0
- package/dist/esm/arch/svm/SpokeUtils.d.ts +2 -2
- package/dist/esm/arch/svm/SpokeUtils.js +22 -8
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/provider.d.ts +6 -0
- package/dist/esm/arch/svm/provider.js +7 -0
- package/dist/esm/arch/svm/provider.js.map +1 -0
- package/dist/esm/arch/svm/utils.d.ts +1 -0
- package/dist/esm/arch/svm/utils.js +1 -0
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js +24 -4
- package/dist/esm/clients/SpokePoolClient/SVMSpokePoolClient.js.map +1 -1
- package/dist/esm/interfaces/PubSubMechanism.d.ts +14 -0
- package/dist/esm/interfaces/PubSubMechanism.js +2 -0
- package/dist/esm/interfaces/PubSubMechanism.js.map +1 -0
- package/dist/esm/interfaces/index.d.ts +1 -0
- package/dist/esm/interfaces/index.js +1 -0
- package/dist/esm/interfaces/index.js.map +1 -1
- package/dist/esm/providers/types.d.ts +2 -2
- package/dist/esm/typeguards/error.d.ts +2 -1
- package/dist/esm/typeguards/error.js +1 -0
- package/dist/esm/typeguards/error.js.map +1 -1
- package/dist/types/arch/evm/index.d.ts +1 -0
- package/dist/types/arch/evm/index.d.ts.map +1 -1
- package/dist/types/arch/evm/utils/index.d.ts +2 -0
- package/dist/types/arch/evm/utils/index.d.ts.map +1 -0
- package/dist/types/arch/evm/utils/wait.d.ts +18 -0
- package/dist/types/arch/evm/utils/wait.d.ts.map +1 -0
- package/dist/types/arch/svm/SpokeUtils.d.ts +2 -2
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/provider.d.ts +7 -0
- package/dist/types/arch/svm/provider.d.ts.map +1 -0
- package/dist/types/arch/svm/utils.d.ts +1 -0
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/SpokePoolClient/SVMSpokePoolClient.d.ts.map +1 -1
- package/dist/types/interfaces/PubSubMechanism.d.ts +15 -0
- package/dist/types/interfaces/PubSubMechanism.d.ts.map +1 -0
- package/dist/types/interfaces/index.d.ts +1 -0
- package/dist/types/interfaces/index.d.ts.map +1 -1
- package/dist/types/providers/types.d.ts +2 -2
- package/dist/types/typeguards/error.d.ts +2 -1
- package/dist/types/typeguards/error.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/evm/index.ts +1 -0
- package/src/arch/evm/utils/index.ts +1 -0
- package/src/arch/evm/utils/wait.ts +84 -0
- package/src/arch/svm/SpokeUtils.ts +24 -8
- package/src/arch/svm/provider.ts +7 -0
- package/src/arch/svm/utils.ts +2 -0
- package/src/clients/SpokePoolClient/SVMSpokePoolClient.ts +14 -4
- package/src/interfaces/PubSubMechanism.ts +15 -0
- package/src/interfaces/index.ts +1 -0
- package/src/typeguards/error.ts +3 -1
package/src/arch/svm/utils.ts
CHANGED
|
@@ -20,6 +20,8 @@ import { FillType, RelayData } from "../../interfaces";
|
|
|
20
20
|
import { BigNumber, getRelayDataHash, isDefined, isUint8Array, Address as SdkAddress } from "../../utils";
|
|
21
21
|
import { EventName, SVMEventNames, SVMProvider } from "./types";
|
|
22
22
|
|
|
23
|
+
export { isSolanaError } from "@solana/kit";
|
|
24
|
+
|
|
23
25
|
/**
|
|
24
26
|
* Basic void TransactionSigner type
|
|
25
27
|
*/
|
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
DepositSearchResult,
|
|
18
18
|
EventSearchConfig,
|
|
19
19
|
InvalidFill,
|
|
20
|
+
getNetworkName,
|
|
21
|
+
isDefined,
|
|
20
22
|
MakeOptional,
|
|
21
23
|
sortEventsAscendingInPlace,
|
|
22
24
|
SvmAddress,
|
|
@@ -140,7 +142,7 @@ export class SVMSpokePoolClient extends SpokePoolClient {
|
|
|
140
142
|
const timerStart = Date.now();
|
|
141
143
|
|
|
142
144
|
const [currentTime, ...eventsQueried] = await Promise.all([
|
|
143
|
-
this.
|
|
145
|
+
this.getTimeAt(searchConfig.to),
|
|
144
146
|
...eventsToQuery.map(async (eventName, idx) => {
|
|
145
147
|
const config = eventSearchConfigs[idx];
|
|
146
148
|
const events = await this.svmEventsClient.queryEvents(
|
|
@@ -190,8 +192,16 @@ export class SVMSpokePoolClient extends SpokePoolClient {
|
|
|
190
192
|
/**
|
|
191
193
|
* Retrieves the timestamp for a given SVM slot number.
|
|
192
194
|
*/
|
|
193
|
-
public override getTimestampForBlock(slot: number): Promise<number> {
|
|
194
|
-
|
|
195
|
+
public override async getTimestampForBlock(slot: number): Promise<number> {
|
|
196
|
+
let _slot = BigInt(slot);
|
|
197
|
+
do {
|
|
198
|
+
const timestamp = await getTimestampForSlot(this.svmEventsClient.getRpc(), _slot);
|
|
199
|
+
if (isDefined(timestamp)) {
|
|
200
|
+
return timestamp;
|
|
201
|
+
}
|
|
202
|
+
} while (--_slot > 0);
|
|
203
|
+
|
|
204
|
+
throw new Error(`Unable to resolve time at or before ${getNetworkName(this.chainId)} slot ${slot}`);
|
|
195
205
|
}
|
|
196
206
|
|
|
197
207
|
/**
|
|
@@ -200,7 +210,7 @@ export class SVMSpokePoolClient extends SpokePoolClient {
|
|
|
200
210
|
* It is kept for consistency with the EVM SpokePoolClient.
|
|
201
211
|
*/
|
|
202
212
|
public getTimeAt(slot: number): Promise<number> {
|
|
203
|
-
return
|
|
213
|
+
return this.getTimestampForBlock(slot);
|
|
204
214
|
}
|
|
205
215
|
|
|
206
216
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface PubSubMechanismInterface {
|
|
2
|
+
/**
|
|
3
|
+
* Subscribes to a topic.
|
|
4
|
+
* @param topic The topic to subscribe to.
|
|
5
|
+
* @param callback The callback to call when a message is received.
|
|
6
|
+
*/
|
|
7
|
+
sub<T>(topic: string, callback: (message: T) => unknown): Promise<void>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Publishes a message to the network.
|
|
11
|
+
* @param topic The topic to publish to.
|
|
12
|
+
* @param message The message to publish.
|
|
13
|
+
*/
|
|
14
|
+
pub<T>(topic: string, message: T): Promise<void>;
|
|
15
|
+
}
|
package/src/interfaces/index.ts
CHANGED
package/src/typeguards/error.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ethers } from "ethers";
|
|
2
|
-
import { EthersError } from "../interfaces";
|
|
3
2
|
import { BaseError } from "viem";
|
|
3
|
+
import { EthersError } from "../interfaces";
|
|
4
|
+
|
|
5
|
+
export { isSolanaError } from "../arch/svm";
|
|
4
6
|
|
|
5
7
|
export const isError = (error: unknown): error is Error => error instanceof Error;
|
|
6
8
|
|