@across-protocol/sdk 4.3.12 → 4.3.14
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/svm/BlockUtils.d.ts +1 -0
- package/dist/cjs/arch/svm/BlockUtils.js +69 -52
- package/dist/cjs/arch/svm/BlockUtils.js.map +1 -1
- package/dist/cjs/arch/svm/SpokeUtils.d.ts +21 -10
- package/dist/cjs/arch/svm/SpokeUtils.js +303 -49
- package/dist/cjs/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/cjs/arch/svm/eventsClient.js +1 -1
- package/dist/cjs/arch/svm/eventsClient.js.map +1 -1
- package/dist/cjs/arch/svm/types.d.ts +7 -0
- package/dist/cjs/arch/svm/utils.d.ts +8 -3
- package/dist/cjs/arch/svm/utils.js +82 -5
- package/dist/cjs/arch/svm/utils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js +5 -2
- package/dist/cjs/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/cjs/clients/BundleDataClient/utils/SuperstructUtils.d.ts +18 -18
- package/dist/cjs/clients/HubPoolClient.d.ts +1 -0
- package/dist/cjs/clients/HubPoolClient.js +11 -0
- package/dist/cjs/clients/HubPoolClient.js.map +1 -1
- package/dist/esm/arch/svm/BlockUtils.d.ts +7 -0
- package/dist/esm/arch/svm/BlockUtils.js +76 -54
- package/dist/esm/arch/svm/BlockUtils.js.map +1 -1
- package/dist/esm/arch/svm/SpokeUtils.d.ts +51 -10
- package/dist/esm/arch/svm/SpokeUtils.js +296 -10
- package/dist/esm/arch/svm/SpokeUtils.js.map +1 -1
- package/dist/esm/arch/svm/eventsClient.js +1 -1
- package/dist/esm/arch/svm/eventsClient.js.map +1 -1
- package/dist/esm/arch/svm/types.d.ts +7 -0
- package/dist/esm/arch/svm/utils.d.ts +35 -3
- package/dist/esm/arch/svm/utils.js +104 -4
- package/dist/esm/arch/svm/utils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts +1 -1
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js +5 -2
- package/dist/esm/clients/BundleDataClient/utils/PoolRebalanceUtils.js.map +1 -1
- package/dist/esm/clients/BundleDataClient/utils/SuperstructUtils.d.ts +18 -18
- package/dist/esm/clients/HubPoolClient.d.ts +1 -0
- package/dist/esm/clients/HubPoolClient.js +19 -0
- package/dist/esm/clients/HubPoolClient.js.map +1 -1
- package/dist/types/arch/svm/BlockUtils.d.ts +7 -0
- package/dist/types/arch/svm/BlockUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/SpokeUtils.d.ts +51 -10
- package/dist/types/arch/svm/SpokeUtils.d.ts.map +1 -1
- package/dist/types/arch/svm/types.d.ts +7 -0
- package/dist/types/arch/svm/types.d.ts.map +1 -1
- package/dist/types/arch/svm/utils.d.ts +35 -3
- package/dist/types/arch/svm/utils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts +1 -1
- package/dist/types/clients/BundleDataClient/utils/PoolRebalanceUtils.d.ts.map +1 -1
- package/dist/types/clients/BundleDataClient/utils/SuperstructUtils.d.ts +18 -18
- package/dist/types/clients/HubPoolClient.d.ts +1 -0
- package/dist/types/clients/HubPoolClient.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/arch/svm/BlockUtils.ts +33 -16
- package/src/arch/svm/SpokeUtils.ts +277 -12
- package/src/arch/svm/eventsClient.ts +1 -1
- package/src/arch/svm/types.ts +8 -0
- package/src/arch/svm/utils.ts +100 -9
- package/src/clients/BundleDataClient/utils/PoolRebalanceUtils.ts +5 -2
- package/src/clients/HubPoolClient.ts +23 -0
|
@@ -8,6 +8,7 @@ export declare class SVMBlockFinder extends BlockFinder<SVMBlock> {
|
|
|
8
8
|
private readonly blocks;
|
|
9
9
|
constructor(provider: SVMProvider, blocks?: SVMBlock[]);
|
|
10
10
|
getBlockForTimestamp(timestamp: number | string, hints?: BlockFinderHints): Promise<SVMBlock>;
|
|
11
|
+
private getBlockTime;
|
|
11
12
|
private getLatestBlock;
|
|
12
13
|
private getBlock;
|
|
13
14
|
private findBlock;
|
|
@@ -9,6 +9,7 @@ var BlockFinder_1 = require("../../utils/BlockFinder");
|
|
|
9
9
|
var TypeGuards_1 = require("../../utils/TypeGuards");
|
|
10
10
|
var TimeUtils_1 = require("../../utils/TimeUtils");
|
|
11
11
|
var constants_1 = require("../../constants");
|
|
12
|
+
var SpokeUtils_1 = require("./SpokeUtils");
|
|
12
13
|
var now = (0, TimeUtils_1.getCurrentTime)();
|
|
13
14
|
var averageBlockTimes = (_a = {},
|
|
14
15
|
_a[constants_1.CHAIN_IDs.SOLANA] = { average: 0.4, timestamp: now, blockRange: 1 },
|
|
@@ -19,19 +20,9 @@ function averageBlockTime() {
|
|
|
19
20
|
exports.averageBlockTime = averageBlockTime;
|
|
20
21
|
function estimateBlocksElapsed(seconds, cushionPercentage, _provider) {
|
|
21
22
|
if (cushionPercentage === void 0) { cushionPercentage = 0.0; }
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
switch (_a.label) {
|
|
26
|
-
case 0:
|
|
27
|
-
cushionMultiplier = cushionPercentage + 1.0;
|
|
28
|
-
return [4, averageBlockTime()];
|
|
29
|
-
case 1:
|
|
30
|
-
average = (_a.sent()).average;
|
|
31
|
-
return [2, Math.floor((seconds * cushionMultiplier) / average)];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
23
|
+
var cushionMultiplier = cushionPercentage + 1.0;
|
|
24
|
+
var average = averageBlockTime().average;
|
|
25
|
+
return Math.floor((seconds * cushionMultiplier) / average);
|
|
35
26
|
}
|
|
36
27
|
var SVMBlockFinder = (function (_super) {
|
|
37
28
|
tslib_1.__extends(SVMBlockFinder, _super);
|
|
@@ -45,69 +36,94 @@ var SVMBlockFinder = (function (_super) {
|
|
|
45
36
|
SVMBlockFinder.prototype.getBlockForTimestamp = function (timestamp, hints) {
|
|
46
37
|
if (hints === void 0) { hints = {}; }
|
|
47
38
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
48
|
-
var block, initialBlock, cushion, incrementDistance,
|
|
39
|
+
var block, initialBlock, cushion, incrementDistance, multiplier, distance, blockNumber, block, index;
|
|
49
40
|
var _this = this;
|
|
50
|
-
return tslib_1.__generator(this, function (
|
|
51
|
-
switch (
|
|
41
|
+
return tslib_1.__generator(this, function (_a) {
|
|
42
|
+
switch (_a.label) {
|
|
52
43
|
case 0:
|
|
53
44
|
timestamp = Number(timestamp);
|
|
54
45
|
(0, assert_1.default)(timestamp !== undefined && timestamp !== null, "timestamp must be provided");
|
|
55
46
|
if (!(this.blocks.length === 0 || this.blocks[this.blocks.length - 1].timestamp < timestamp)) return [3, 2];
|
|
56
47
|
return [4, this.getLatestBlock()];
|
|
57
48
|
case 1:
|
|
58
|
-
block =
|
|
49
|
+
block = _a.sent();
|
|
59
50
|
if (timestamp >= block.timestamp)
|
|
60
51
|
return [2, block];
|
|
61
|
-
|
|
52
|
+
_a.label = 2;
|
|
62
53
|
case 2: return [4, Promise.all(Object.values(hints)
|
|
63
54
|
.filter(TypeGuards_1.isDefined)
|
|
64
55
|
.map(function (blockNumber) { return _this.getBlock(blockNumber); }))];
|
|
65
56
|
case 3:
|
|
66
|
-
|
|
67
|
-
if (!(this.blocks[0].timestamp > timestamp)) return [3,
|
|
57
|
+
_a.sent();
|
|
58
|
+
if (!(this.blocks[0].timestamp > timestamp)) return [3, 7];
|
|
68
59
|
initialBlock = this.blocks[0];
|
|
69
60
|
cushion = 1;
|
|
70
|
-
|
|
71
|
-
return [4, estimateBlocksElapsed(initialBlock.timestamp - timestamp, cushion, this.provider)];
|
|
72
|
-
case 4:
|
|
73
|
-
incrementDistance = _b.apply(_a, [_c.sent(), 1]);
|
|
61
|
+
incrementDistance = Math.max(estimateBlocksElapsed(initialBlock.timestamp - timestamp, cushion, this.provider), 1);
|
|
74
62
|
multiplier = 1;
|
|
75
|
-
|
|
76
|
-
case
|
|
63
|
+
_a.label = 4;
|
|
64
|
+
case 4:
|
|
77
65
|
distance = multiplier * incrementDistance;
|
|
78
66
|
blockNumber = Math.max(0, initialBlock.number - distance);
|
|
79
67
|
return [4, this.getBlock(blockNumber)];
|
|
80
|
-
case
|
|
81
|
-
block =
|
|
68
|
+
case 5:
|
|
69
|
+
block = _a.sent();
|
|
82
70
|
if (block.timestamp <= timestamp)
|
|
83
|
-
return [3,
|
|
71
|
+
return [3, 7];
|
|
84
72
|
(0, assert_1.default)(blockNumber > 0, "timestamp is before block 0");
|
|
85
|
-
|
|
86
|
-
case
|
|
73
|
+
_a.label = 6;
|
|
74
|
+
case 6:
|
|
87
75
|
multiplier++;
|
|
88
|
-
return [3,
|
|
89
|
-
case
|
|
76
|
+
return [3, 4];
|
|
77
|
+
case 7:
|
|
90
78
|
index = (0, lodash_1.sortedIndexBy)(this.blocks, { timestamp: timestamp }, "timestamp");
|
|
91
79
|
return [2, this.findBlock(this.blocks[index - 1], this.blocks[index], timestamp)];
|
|
92
80
|
}
|
|
93
81
|
});
|
|
94
82
|
});
|
|
95
83
|
};
|
|
96
|
-
SVMBlockFinder.prototype.
|
|
97
|
-
var _a;
|
|
84
|
+
SVMBlockFinder.prototype.getBlockTime = function (_slot) {
|
|
98
85
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
99
|
-
var
|
|
86
|
+
var timestamp, slot, _a;
|
|
100
87
|
return tslib_1.__generator(this, function (_b) {
|
|
101
88
|
switch (_b.label) {
|
|
102
|
-
case 0:
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
return [
|
|
89
|
+
case 0:
|
|
90
|
+
if (!(_slot !== null && _slot !== void 0)) return [3, 1];
|
|
91
|
+
_a = _slot;
|
|
92
|
+
return [3, 3];
|
|
93
|
+
case 1: return [4, this.provider.getSlot({ commitment: "finalized" }).send()];
|
|
106
94
|
case 2:
|
|
107
|
-
|
|
95
|
+
_a = (_b.sent());
|
|
96
|
+
_b.label = 3;
|
|
97
|
+
case 3:
|
|
98
|
+
slot = _a;
|
|
99
|
+
_b.label = 4;
|
|
100
|
+
case 4: return [4, (0, SpokeUtils_1.getTimestampForSlot)(this.provider, slot)];
|
|
101
|
+
case 5:
|
|
102
|
+
timestamp = _b.sent();
|
|
103
|
+
_b.label = 6;
|
|
104
|
+
case 6:
|
|
105
|
+
if (!(0, TypeGuards_1.isDefined)(timestamp) && --slot) return [3, 4];
|
|
106
|
+
_b.label = 7;
|
|
107
|
+
case 7:
|
|
108
|
+
(0, assert_1.default)((0, TypeGuards_1.isDefined)(timestamp), "Unable to resolve block time for SVM slot ".concat(_slot !== null && _slot !== void 0 ? _slot : "latest"));
|
|
109
|
+
(0, assert_1.default)(BigInt(Number(timestamp) === timestamp), "Unexpected SVM block timestamp: ".concat(timestamp));
|
|
110
|
+
return [2, { slot: slot, timestamp: Number(timestamp) }];
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
SVMBlockFinder.prototype.getLatestBlock = function () {
|
|
116
|
+
var _a;
|
|
117
|
+
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
118
|
+
var _b, slot, timestamp, block, index;
|
|
119
|
+
return tslib_1.__generator(this, function (_c) {
|
|
120
|
+
switch (_c.label) {
|
|
121
|
+
case 0: return [4, this.getBlockTime()];
|
|
122
|
+
case 1:
|
|
123
|
+
_b = _c.sent(), slot = _b.slot, timestamp = _b.timestamp;
|
|
108
124
|
block = {
|
|
109
|
-
timestamp:
|
|
110
|
-
number: Number(
|
|
125
|
+
timestamp: timestamp,
|
|
126
|
+
number: Number(slot),
|
|
111
127
|
};
|
|
112
128
|
index = (0, lodash_1.sortedIndexBy)(this.blocks, block, "number");
|
|
113
129
|
if (((_a = this.blocks[index]) === null || _a === void 0 ? void 0 : _a.number) !== block.number)
|
|
@@ -120,22 +136,23 @@ var SVMBlockFinder = (function (_super) {
|
|
|
120
136
|
SVMBlockFinder.prototype.getBlock = function (number) {
|
|
121
137
|
var _a, _b;
|
|
122
138
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
123
|
-
var index,
|
|
124
|
-
return tslib_1.__generator(this, function (
|
|
125
|
-
switch (
|
|
139
|
+
var index, _c, _slot, timestamp, slot, block;
|
|
140
|
+
return tslib_1.__generator(this, function (_d) {
|
|
141
|
+
switch (_d.label) {
|
|
126
142
|
case 0:
|
|
127
143
|
index = (0, lodash_1.sortedIndexBy)(this.blocks, { number: number }, "number");
|
|
128
144
|
if (((_a = this.blocks[index]) === null || _a === void 0 ? void 0 : _a.number) === number)
|
|
129
145
|
return [2, this.blocks[index]];
|
|
130
|
-
return [4, this.
|
|
146
|
+
return [4, this.getBlockTime(BigInt(number))];
|
|
131
147
|
case 1:
|
|
132
|
-
|
|
148
|
+
_c = _d.sent(), _slot = _c.slot, timestamp = _c.timestamp;
|
|
149
|
+
slot = Number(_slot);
|
|
133
150
|
block = {
|
|
134
|
-
timestamp:
|
|
135
|
-
number:
|
|
151
|
+
timestamp: timestamp,
|
|
152
|
+
number: slot,
|
|
136
153
|
};
|
|
137
|
-
index = (0, lodash_1.sortedIndexBy)(this.blocks, { number:
|
|
138
|
-
if (((_b = this.blocks[index]) === null || _b === void 0 ? void 0 : _b.number) ===
|
|
154
|
+
index = (0, lodash_1.sortedIndexBy)(this.blocks, { number: slot }, "number");
|
|
155
|
+
if (((_b = this.blocks[index]) === null || _b === void 0 ? void 0 : _b.number) === slot)
|
|
139
156
|
return [2, this.blocks[index]];
|
|
140
157
|
this.blocks.splice(index, 0, block);
|
|
141
158
|
return [2, block];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockUtils.js","sourceRoot":"","sources":["../../../../src/arch/svm/BlockUtils.ts"],"names":[],"mappings":";;;;;AAAA,0DAA4B;AAC5B,iCAA8C;AAC9C,uDAAgH;AAChH,q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,GAAG,CAAC,CAAC,CAAC,EAAA;;wBAAjG,QAAQ,GAAG,SAAsF;wBAGvG,IAAI,QAAQ,CAAC,SAAS,GAAG,SAAS,EAAE;4BAClC,WAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAC;yBACtD;6BAAM;4BACL,WAAO,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,CAAC,EAAC;yBACxD;;;;;KACF;IACH,qBAAC;AAAD,CAAC,AAtJD,CAAoC,yBAAW,GAsJ9C;AAtJY,wCAAc"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SvmSpokeClient } from "@across-protocol/contracts";
|
|
2
|
-
import { Address, ReadonlyUint8Array, type TransactionSigner } from "@solana/kit";
|
|
1
|
+
import { MessageTransmitterClient, SvmSpokeClient } from "@across-protocol/contracts";
|
|
2
|
+
import { Address, IAccountMeta, KeyPairSigner, ReadonlyUint8Array, type TransactionSigner } from "@solana/kit";
|
|
3
3
|
import { Logger } from "winston";
|
|
4
4
|
import { DepositWithBlock, FillStatus, FillWithBlock, RelayData } from "../../interfaces";
|
|
5
|
-
import { BigNumber, EvmAddress,
|
|
5
|
+
import { BigNumber, EvmAddress, Address as SdkAddress, SvmAddress } from "../../utils";
|
|
6
6
|
import { SvmCpiEventsClient } from "./eventsClient";
|
|
7
|
-
import { SVMProvider } from "./types";
|
|
7
|
+
import { AttestedCCTPMessage, SVMProvider } from "./types";
|
|
8
8
|
export declare const SLOT_DURATION_MS = 400;
|
|
9
9
|
type ProtoFill = Omit<RelayData, "recipient" | "outputToken"> & {
|
|
10
10
|
destinationChainId: number;
|
|
@@ -25,19 +25,19 @@ export declare function getFillRelayTx(spokePoolAddr: SvmAddress, solanaClient:
|
|
|
25
25
|
recipient: SvmAddress;
|
|
26
26
|
outputToken: SvmAddress;
|
|
27
27
|
}, signer: TransactionSigner, repaymentChainId: number, repaymentAddress: SdkAddress): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
28
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
28
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
29
29
|
version: 0;
|
|
30
30
|
}>, "feePayer">>;
|
|
31
31
|
export declare const createFillInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, fillInput: SvmSpokeClient.FillRelayInput, tokenDecimals: number, createRecipientAtaIfNeeded?: boolean) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
32
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
32
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
33
33
|
version: 0;
|
|
34
34
|
}>, "feePayer">>;
|
|
35
35
|
export declare const createDepositInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, depositInput: SvmSpokeClient.DepositInput, tokenDecimals: number, createVaultAtaIfNeeded?: boolean) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
36
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
36
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
37
37
|
version: 0;
|
|
38
38
|
}>, "feePayer">>;
|
|
39
39
|
export declare const createRequestSlowFillInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, requestSlowFillInput: SvmSpokeClient.RequestSlowFillInput) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
40
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
40
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
41
41
|
version: 0;
|
|
42
42
|
}>, "feePayer">>;
|
|
43
43
|
export declare function getSlowFillRequestTx(spokePoolAddr: SvmAddress, solanaClient: SVMProvider, relayData: Omit<RelayData, "recipient" | "outputToken"> & {
|
|
@@ -45,11 +45,15 @@ export declare function getSlowFillRequestTx(spokePoolAddr: SvmAddress, solanaCl
|
|
|
45
45
|
recipient: SvmAddress;
|
|
46
46
|
outputToken: SvmAddress;
|
|
47
47
|
}, signer: TransactionSigner): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
48
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
48
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
49
49
|
version: 0;
|
|
50
50
|
}>, "feePayer">>;
|
|
51
51
|
export declare const createCloseFillPdaInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, fillStatusPda: Address) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
52
|
-
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> |
|
|
52
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
53
|
+
version: 0;
|
|
54
|
+
}>, "feePayer">>;
|
|
55
|
+
export declare const createReceiveMessageInstruction: (signer: TransactionSigner, solanaClient: SVMProvider, input: MessageTransmitterClient.ReceiveMessageInput, remainingAccounts: IAccountMeta<string>[]) => Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
56
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
53
57
|
version: 0;
|
|
54
58
|
}>, "feePayer">>;
|
|
55
59
|
export declare function getAssociatedTokenAddress(owner: SvmAddress, mint: SvmAddress, tokenProgramId?: Address<string>): Promise<Address<string>>;
|
|
@@ -82,4 +86,11 @@ export declare function getDepositNowDelegatePda(depositData: {
|
|
|
82
86
|
message: Uint8Array;
|
|
83
87
|
}, programId: Address<string>): Promise<Address<string>>;
|
|
84
88
|
export declare function getFillRelayDelegatePda(relayHash: Uint8Array, repaymentChainId: bigint, repaymentAddress: Address<string>, programId: Address<string>): Promise<Address<string>>;
|
|
89
|
+
export declare const hasCCTPV1MessageBeenProcessed: (solanaClient: SVMProvider, signer: KeyPairSigner, nonce: number, sourceDomain: number) => Promise<boolean>;
|
|
90
|
+
export declare function getAccountMetasForTokenlessMessage(): Promise<IAccountMeta<string>[]>;
|
|
91
|
+
export declare function getCCTPV1ReceiveMessageTx(solanaClient: SVMProvider, signer: KeyPairSigner, message: AttestedCCTPMessage, hubChainId: number): Promise<import("@solana/kit").TransactionMessageWithBlockhashLifetime & import("@solana/kit").ITransactionMessageWithFeePayerSigner<string, TransactionSigner<string>> & Omit<Readonly<{
|
|
92
|
+
instructions: readonly import("@solana/kit").IInstruction<string, readonly (import("@solana/kit").IAccountLookupMeta<string, string> | IAccountMeta<string>)[]>[];
|
|
93
|
+
version: 0;
|
|
94
|
+
}>, "feePayer">>;
|
|
95
|
+
export declare function finalizeCCTPV1Messages(solanaClient: SVMProvider, attestedMessages: AttestedCCTPMessage[], signer: KeyPairSigner, simulate?: boolean, hubChainId?: number): Promise<string[]>;
|
|
85
96
|
export {};
|