@wormhole-labs/cctp-executor-route 0.4.0 → 0.5.0-beta.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/README.md +1 -1
- package/dist/cjs/aptos/executor.d.ts +1 -1
- package/dist/cjs/aptos/executor.d.ts.map +1 -1
- package/dist/cjs/aptos/executor.js +1 -1
- package/dist/cjs/aptos/executor.js.map +1 -1
- package/dist/cjs/consts.d.ts +22 -1
- package/dist/cjs/consts.d.ts.map +1 -1
- package/dist/cjs/consts.js +223 -5
- package/dist/cjs/consts.js.map +1 -1
- package/dist/cjs/evm/executor.d.ts +1 -1
- package/dist/cjs/evm/executor.d.ts.map +1 -1
- package/dist/cjs/evm/executor.js +1 -1
- package/dist/cjs/evm/executor.js.map +1 -1
- package/dist/cjs/evm/executorV2.d.ts +25 -0
- package/dist/cjs/evm/executorV2.d.ts.map +1 -0
- package/dist/cjs/evm/executorV2.js +100 -0
- package/dist/cjs/evm/executorV2.js.map +1 -0
- package/dist/cjs/evm/index.d.ts +1 -0
- package/dist/cjs/evm/index.d.ts.map +1 -1
- package/dist/cjs/evm/index.js +3 -0
- package/dist/cjs/evm/index.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -91
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +15 -334
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/layouts/circle.d.ts +161 -0
- package/dist/cjs/layouts/circle.d.ts.map +1 -0
- package/dist/cjs/layouts/circle.js +48 -0
- package/dist/cjs/layouts/circle.js.map +1 -0
- package/dist/cjs/layouts/index.d.ts +1 -1
- package/dist/cjs/layouts/index.d.ts.map +1 -1
- package/dist/cjs/layouts/index.js +1 -1
- package/dist/cjs/layouts/index.js.map +1 -1
- package/dist/cjs/routes/cctpV1.d.ts +92 -0
- package/dist/cjs/routes/cctpV1.d.ts.map +1 -0
- package/dist/cjs/routes/cctpV1.js +190 -0
- package/dist/cjs/routes/cctpV1.js.map +1 -0
- package/dist/cjs/routes/cctpV2Base.d.ts +57 -0
- package/dist/cjs/routes/cctpV2Base.d.ts.map +1 -0
- package/dist/cjs/routes/cctpV2Base.js +179 -0
- package/dist/cjs/routes/cctpV2Base.js.map +1 -0
- package/dist/cjs/routes/cctpV2Fast.d.ts +42 -0
- package/dist/cjs/routes/cctpV2Fast.d.ts.map +1 -0
- package/dist/cjs/routes/cctpV2Fast.js +138 -0
- package/dist/cjs/routes/cctpV2Fast.js.map +1 -0
- package/dist/cjs/routes/cctpV2Standard.d.ts +42 -0
- package/dist/cjs/routes/cctpV2Standard.d.ts.map +1 -0
- package/dist/cjs/routes/cctpV2Standard.js +126 -0
- package/dist/cjs/routes/cctpV2Standard.js.map +1 -0
- package/dist/cjs/routes/helpers.d.ts +12 -0
- package/dist/cjs/routes/helpers.d.ts.map +1 -0
- package/dist/cjs/routes/helpers.js +181 -0
- package/dist/cjs/routes/helpers.js.map +1 -0
- package/dist/cjs/routes/index.d.ts +5 -0
- package/dist/cjs/routes/index.d.ts.map +1 -0
- package/dist/cjs/routes/index.js +21 -0
- package/dist/cjs/routes/index.js.map +1 -0
- package/dist/cjs/sui/executor.d.ts +1 -1
- package/dist/cjs/sui/executor.d.ts.map +1 -1
- package/dist/cjs/svm/executor.d.ts +1 -1
- package/dist/cjs/svm/executor.d.ts.map +1 -1
- package/dist/cjs/svm/executor.js +1 -1
- package/dist/cjs/svm/executor.js.map +1 -1
- package/dist/cjs/types.d.ts +8 -1
- package/dist/cjs/types.d.ts.map +1 -1
- package/dist/cjs/utils.d.ts +20 -1
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +86 -2
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/aptos/executor.d.ts +1 -1
- package/dist/esm/aptos/executor.d.ts.map +1 -1
- package/dist/esm/aptos/executor.js +2 -2
- package/dist/esm/aptos/executor.js.map +1 -1
- package/dist/esm/consts.d.ts +22 -1
- package/dist/esm/consts.d.ts.map +1 -1
- package/dist/esm/consts.js +216 -4
- package/dist/esm/consts.js.map +1 -1
- package/dist/esm/evm/executor.d.ts +1 -1
- package/dist/esm/evm/executor.d.ts.map +1 -1
- package/dist/esm/evm/executor.js +2 -2
- package/dist/esm/evm/executor.js.map +1 -1
- package/dist/esm/evm/executorV2.d.ts +25 -0
- package/dist/esm/evm/executorV2.d.ts.map +1 -0
- package/dist/esm/evm/executorV2.js +96 -0
- package/dist/esm/evm/executorV2.js.map +1 -0
- package/dist/esm/evm/index.d.ts +1 -0
- package/dist/esm/evm/index.d.ts.map +1 -1
- package/dist/esm/evm/index.js +3 -0
- package/dist/esm/evm/index.js.map +1 -1
- package/dist/esm/index.d.ts +1 -91
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -331
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/layouts/circle.d.ts +161 -0
- package/dist/esm/layouts/circle.d.ts.map +1 -0
- package/dist/esm/layouts/circle.js +43 -0
- package/dist/esm/layouts/circle.js.map +1 -0
- package/dist/esm/layouts/index.d.ts +1 -1
- package/dist/esm/layouts/index.d.ts.map +1 -1
- package/dist/esm/layouts/index.js +1 -1
- package/dist/esm/layouts/index.js.map +1 -1
- package/dist/esm/routes/cctpV1.d.ts +92 -0
- package/dist/esm/routes/cctpV1.d.ts.map +1 -0
- package/dist/esm/routes/cctpV1.js +185 -0
- package/dist/esm/routes/cctpV1.js.map +1 -0
- package/dist/esm/routes/cctpV2Base.d.ts +57 -0
- package/dist/esm/routes/cctpV2Base.d.ts.map +1 -0
- package/dist/esm/routes/cctpV2Base.js +175 -0
- package/dist/esm/routes/cctpV2Base.js.map +1 -0
- package/dist/esm/routes/cctpV2Fast.d.ts +42 -0
- package/dist/esm/routes/cctpV2Fast.d.ts.map +1 -0
- package/dist/esm/routes/cctpV2Fast.js +133 -0
- package/dist/esm/routes/cctpV2Fast.js.map +1 -0
- package/dist/esm/routes/cctpV2Standard.d.ts +42 -0
- package/dist/esm/routes/cctpV2Standard.d.ts.map +1 -0
- package/dist/esm/routes/cctpV2Standard.js +121 -0
- package/dist/esm/routes/cctpV2Standard.js.map +1 -0
- package/dist/esm/routes/helpers.d.ts +12 -0
- package/dist/esm/routes/helpers.d.ts.map +1 -0
- package/dist/esm/routes/helpers.js +177 -0
- package/dist/esm/routes/helpers.js.map +1 -0
- package/dist/esm/routes/index.d.ts +5 -0
- package/dist/esm/routes/index.d.ts.map +1 -0
- package/dist/esm/routes/index.js +5 -0
- package/dist/esm/routes/index.js.map +1 -0
- package/dist/esm/sui/executor.d.ts +1 -1
- package/dist/esm/sui/executor.d.ts.map +1 -1
- package/dist/esm/svm/executor.d.ts +1 -1
- package/dist/esm/svm/executor.d.ts.map +1 -1
- package/dist/esm/svm/executor.js +2 -2
- package/dist/esm/svm/executor.js.map +1 -1
- package/dist/esm/types.d.ts +8 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils.d.ts +20 -1
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +83 -3
- package/dist/esm/utils.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/dist/cjs/layouts/requestForExecution.d.ts +0 -18
- package/dist/cjs/layouts/requestForExecution.d.ts.map +0 -1
- package/dist/cjs/layouts/requestForExecution.js +0 -15
- package/dist/cjs/layouts/requestForExecution.js.map +0 -1
- package/dist/esm/layouts/requestForExecution.d.ts +0 -18
- package/dist/esm/layouts/requestForExecution.d.ts.map +0 -1
- package/dist/esm/layouts/requestForExecution.js +0 -12
- package/dist/esm/layouts/requestForExecution.js.map +0 -1
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { LayoutToType } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
declare const circleBurnMessageV2Layout: readonly [{
|
|
3
|
+
readonly binary: "uint";
|
|
4
|
+
readonly size: 4;
|
|
5
|
+
readonly custom: 1;
|
|
6
|
+
readonly omit: false;
|
|
7
|
+
readonly name: "version";
|
|
8
|
+
}, {
|
|
9
|
+
readonly binary: "bytes";
|
|
10
|
+
readonly size: 32;
|
|
11
|
+
readonly custom: {
|
|
12
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
13
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
14
|
+
};
|
|
15
|
+
readonly name: "burnToken";
|
|
16
|
+
}, {
|
|
17
|
+
readonly binary: "bytes";
|
|
18
|
+
readonly size: 32;
|
|
19
|
+
readonly custom: {
|
|
20
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
21
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
22
|
+
};
|
|
23
|
+
readonly name: "mintRecipient";
|
|
24
|
+
}, {
|
|
25
|
+
readonly binary: "uint";
|
|
26
|
+
readonly size: 32;
|
|
27
|
+
readonly name: "amount";
|
|
28
|
+
}, {
|
|
29
|
+
readonly binary: "bytes";
|
|
30
|
+
readonly size: 32;
|
|
31
|
+
readonly custom: {
|
|
32
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
33
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
34
|
+
};
|
|
35
|
+
readonly name: "messageSender";
|
|
36
|
+
}, {
|
|
37
|
+
readonly binary: "uint";
|
|
38
|
+
readonly size: 32;
|
|
39
|
+
readonly name: "maxFee";
|
|
40
|
+
}, {
|
|
41
|
+
readonly binary: "uint";
|
|
42
|
+
readonly size: 32;
|
|
43
|
+
readonly name: "feeExecuted";
|
|
44
|
+
}, {
|
|
45
|
+
readonly binary: "uint";
|
|
46
|
+
readonly size: 32;
|
|
47
|
+
readonly name: "expirationBlock";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "hookData";
|
|
50
|
+
readonly binary: "bytes";
|
|
51
|
+
}];
|
|
52
|
+
export type CircleBurnMessageV2 = LayoutToType<typeof circleBurnMessageV2Layout>;
|
|
53
|
+
export declare const circleMessageV2Layout: readonly [{
|
|
54
|
+
readonly binary: "uint";
|
|
55
|
+
readonly size: 4;
|
|
56
|
+
readonly custom: 1;
|
|
57
|
+
readonly omit: false;
|
|
58
|
+
readonly name: "version";
|
|
59
|
+
}, {
|
|
60
|
+
readonly binary: "uint";
|
|
61
|
+
readonly size: 4;
|
|
62
|
+
readonly name: "sourceDomain";
|
|
63
|
+
}, {
|
|
64
|
+
readonly binary: "uint";
|
|
65
|
+
readonly size: 4;
|
|
66
|
+
readonly name: "destinationDomain";
|
|
67
|
+
}, {
|
|
68
|
+
readonly binary: "bytes";
|
|
69
|
+
readonly size: 32;
|
|
70
|
+
readonly name: "nonce";
|
|
71
|
+
}, {
|
|
72
|
+
readonly binary: "bytes";
|
|
73
|
+
readonly size: 32;
|
|
74
|
+
readonly custom: {
|
|
75
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
76
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
77
|
+
};
|
|
78
|
+
readonly name: "sender";
|
|
79
|
+
}, {
|
|
80
|
+
readonly binary: "bytes";
|
|
81
|
+
readonly size: 32;
|
|
82
|
+
readonly custom: {
|
|
83
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
84
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
85
|
+
};
|
|
86
|
+
readonly name: "recipient";
|
|
87
|
+
}, {
|
|
88
|
+
readonly binary: "bytes";
|
|
89
|
+
readonly size: 32;
|
|
90
|
+
readonly custom: {
|
|
91
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
92
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
93
|
+
};
|
|
94
|
+
readonly name: "destinationCaller";
|
|
95
|
+
}, {
|
|
96
|
+
readonly binary: "uint";
|
|
97
|
+
readonly size: 4;
|
|
98
|
+
readonly name: "minFinalityThreshold";
|
|
99
|
+
}, {
|
|
100
|
+
readonly binary: "uint";
|
|
101
|
+
readonly size: 4;
|
|
102
|
+
readonly name: "finalityThresholdExecuted";
|
|
103
|
+
}, {
|
|
104
|
+
readonly name: "messageBody";
|
|
105
|
+
readonly binary: "bytes";
|
|
106
|
+
readonly layout: readonly [{
|
|
107
|
+
readonly binary: "uint";
|
|
108
|
+
readonly size: 4;
|
|
109
|
+
readonly custom: 1;
|
|
110
|
+
readonly omit: false;
|
|
111
|
+
readonly name: "version";
|
|
112
|
+
}, {
|
|
113
|
+
readonly binary: "bytes";
|
|
114
|
+
readonly size: 32;
|
|
115
|
+
readonly custom: {
|
|
116
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
117
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
118
|
+
};
|
|
119
|
+
readonly name: "burnToken";
|
|
120
|
+
}, {
|
|
121
|
+
readonly binary: "bytes";
|
|
122
|
+
readonly size: 32;
|
|
123
|
+
readonly custom: {
|
|
124
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
125
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
126
|
+
};
|
|
127
|
+
readonly name: "mintRecipient";
|
|
128
|
+
}, {
|
|
129
|
+
readonly binary: "uint";
|
|
130
|
+
readonly size: 32;
|
|
131
|
+
readonly name: "amount";
|
|
132
|
+
}, {
|
|
133
|
+
readonly binary: "bytes";
|
|
134
|
+
readonly size: 32;
|
|
135
|
+
readonly custom: {
|
|
136
|
+
to: (val: Uint8Array) => import("@wormhole-foundation/sdk-definitions").UniversalAddress;
|
|
137
|
+
from: (val: import("@wormhole-foundation/sdk-definitions").UniversalAddress) => Uint8Array;
|
|
138
|
+
};
|
|
139
|
+
readonly name: "messageSender";
|
|
140
|
+
}, {
|
|
141
|
+
readonly binary: "uint";
|
|
142
|
+
readonly size: 32;
|
|
143
|
+
readonly name: "maxFee";
|
|
144
|
+
}, {
|
|
145
|
+
readonly binary: "uint";
|
|
146
|
+
readonly size: 32;
|
|
147
|
+
readonly name: "feeExecuted";
|
|
148
|
+
}, {
|
|
149
|
+
readonly binary: "uint";
|
|
150
|
+
readonly size: 32;
|
|
151
|
+
readonly name: "expirationBlock";
|
|
152
|
+
}, {
|
|
153
|
+
readonly name: "hookData";
|
|
154
|
+
readonly binary: "bytes";
|
|
155
|
+
}];
|
|
156
|
+
}];
|
|
157
|
+
export type CircleV2Message = LayoutToType<typeof circleMessageV2Layout>;
|
|
158
|
+
export declare const deserializeCircleV2Message: (msg: Uint8Array) => CircleV2Message;
|
|
159
|
+
export declare const serializeCircleV2Message: (msg: CircleV2Message) => Uint8Array;
|
|
160
|
+
export {};
|
|
161
|
+
//# sourceMappingURL=circle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../../../src/layouts/circle.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EAGb,MAAM,+BAA+B,CAAC;AAsBvC,QAAA,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUJ,CAAC;AAE5B,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAC5C,OAAO,yBAAyB,CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWP,CAAC;AAE5B,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEzE,eAAO,MAAM,0BAA0B,QAAS,UAAU,KAAG,eACd,CAAC;AAEhD,eAAO,MAAM,wBAAwB,QAAS,eAAe,KAAG,UACnB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.serializeCircleV2Message = exports.deserializeCircleV2Message = exports.circleMessageV2Layout = void 0;
|
|
4
|
+
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
|
|
5
|
+
const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
|
|
6
|
+
const { amountItem, circleDomainItem, universalAddressItem } = sdk_definitions_1.layoutItems;
|
|
7
|
+
const messageVersionItem = {
|
|
8
|
+
binary: "uint",
|
|
9
|
+
size: 4,
|
|
10
|
+
custom: 1,
|
|
11
|
+
omit: false,
|
|
12
|
+
};
|
|
13
|
+
const circleV2NonceItem = {
|
|
14
|
+
binary: "bytes",
|
|
15
|
+
size: 32,
|
|
16
|
+
};
|
|
17
|
+
const finalityThresholdItem = {
|
|
18
|
+
binary: "uint",
|
|
19
|
+
size: 4,
|
|
20
|
+
};
|
|
21
|
+
const circleBurnMessageV2Layout = [
|
|
22
|
+
{ name: "version", ...messageVersionItem },
|
|
23
|
+
{ name: "burnToken", ...universalAddressItem },
|
|
24
|
+
{ name: "mintRecipient", ...universalAddressItem },
|
|
25
|
+
{ name: "amount", ...amountItem },
|
|
26
|
+
{ name: "messageSender", ...universalAddressItem },
|
|
27
|
+
{ name: "maxFee", ...amountItem },
|
|
28
|
+
{ name: "feeExecuted", ...amountItem },
|
|
29
|
+
{ name: "expirationBlock", ...amountItem },
|
|
30
|
+
{ name: "hookData", binary: "bytes" },
|
|
31
|
+
];
|
|
32
|
+
exports.circleMessageV2Layout = [
|
|
33
|
+
{ name: "version", ...messageVersionItem },
|
|
34
|
+
{ name: "sourceDomain", ...circleDomainItem },
|
|
35
|
+
{ name: "destinationDomain", ...circleDomainItem },
|
|
36
|
+
{ name: "nonce", ...circleV2NonceItem },
|
|
37
|
+
{ name: "sender", ...universalAddressItem },
|
|
38
|
+
{ name: "recipient", ...universalAddressItem },
|
|
39
|
+
{ name: "destinationCaller", ...universalAddressItem },
|
|
40
|
+
{ name: "minFinalityThreshold", ...finalityThresholdItem },
|
|
41
|
+
{ name: "finalityThresholdExecuted", ...finalityThresholdItem },
|
|
42
|
+
{ name: "messageBody", binary: "bytes", layout: circleBurnMessageV2Layout },
|
|
43
|
+
];
|
|
44
|
+
const deserializeCircleV2Message = (msg) => (0, sdk_base_1.deserializeLayout)(exports.circleMessageV2Layout, msg);
|
|
45
|
+
exports.deserializeCircleV2Message = deserializeCircleV2Message;
|
|
46
|
+
const serializeCircleV2Message = (msg) => (0, sdk_base_1.serializeLayout)(exports.circleMessageV2Layout, msg);
|
|
47
|
+
exports.serializeCircleV2Message = serializeCircleV2Message;
|
|
48
|
+
//# sourceMappingURL=circle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../../../src/layouts/circle.ts"],"names":[],"mappings":";;;AAAA,4DAKuC;AACvC,0EAAmE;AAEnE,MAAM,EAAE,UAAU,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,GAAG,6BAAW,CAAC;AAE3E,MAAM,kBAAkB,GAAG;IACzB,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,KAAK;CACH,CAAC;AAEX,MAAM,iBAAiB,GAAG;IACxB,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,EAAE;CACiB,CAAC;AAE5B,MAAM,qBAAqB,GAAG;IAC5B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,CAAC;CACkB,CAAC;AAE5B,MAAM,yBAAyB,GAAG;IAChC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,kBAAkB,EAAE;IAC1C,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,oB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B,GAAG,CAAC,GAAoB,EAAc,EAAE,CAC3E,IAAA,0BAAe,EAAC,6BAAqB,EAAE,GAAG,CAAC,CAAC;AADjC,QAAA,wBAAwB,4BACS"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC"}
|
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./circle.js"), exports);
|
|
17
18
|
__exportStar(require("./relayInstruction.js"), exports);
|
|
18
|
-
__exportStar(require("./requestForExecution.js"), exports);
|
|
19
19
|
__exportStar(require("./signedQuote.js"), exports);
|
|
20
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layouts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/layouts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,wDAAsC;AACtC,mDAAiC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Chain, Network } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import { amount } from "@wormhole-foundation/sdk-base";
|
|
3
|
+
import { EmptyPlatformMap, type ChainAddress, type ChainContext, type Signer, type TokenId } from "@wormhole-foundation/sdk-definitions";
|
|
4
|
+
import { routes, Wormhole } from "@wormhole-foundation/sdk-connect";
|
|
5
|
+
import { CCTPExecutor } from "../types";
|
|
6
|
+
export declare namespace CCTPExecutorRoute {
|
|
7
|
+
type Options = {
|
|
8
|
+
nativeGas?: number;
|
|
9
|
+
};
|
|
10
|
+
type NormalizedParams = {
|
|
11
|
+
amount: amount.Amount;
|
|
12
|
+
};
|
|
13
|
+
interface ValidatedParams extends routes.ValidatedTransferParams<Options> {
|
|
14
|
+
normalizedParams: NormalizedParams;
|
|
15
|
+
}
|
|
16
|
+
type Config = {
|
|
17
|
+
referrerFeeDbps: bigint;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
type Op = CCTPExecutorRoute.Options;
|
|
21
|
+
type Vp = CCTPExecutorRoute.ValidatedParams;
|
|
22
|
+
type Tp = routes.TransferParams<Op>;
|
|
23
|
+
type Vr = routes.ValidationResult<Op>;
|
|
24
|
+
export type QuoteDetails = {
|
|
25
|
+
signedQuote: Uint8Array;
|
|
26
|
+
relayInstructions: Uint8Array;
|
|
27
|
+
estimatedCost: bigint;
|
|
28
|
+
referrer: ChainAddress;
|
|
29
|
+
referrerFee: bigint;
|
|
30
|
+
remainingAmount: bigint;
|
|
31
|
+
referrerFeeDbps: bigint;
|
|
32
|
+
expiryTime: Date;
|
|
33
|
+
gasDropOff: bigint;
|
|
34
|
+
};
|
|
35
|
+
type Q = routes.Quote<Op, Vp, QuoteDetails>;
|
|
36
|
+
type QR = routes.QuoteResult<Op, Vp>;
|
|
37
|
+
type AT = {
|
|
38
|
+
id: string;
|
|
39
|
+
attestation: {};
|
|
40
|
+
};
|
|
41
|
+
type R = routes.Receipt<AT>;
|
|
42
|
+
export declare function cctpExecutorRoute(config?: CCTPExecutorRoute.Config): {
|
|
43
|
+
new <N extends Network>(wh: Wormhole<N>): {
|
|
44
|
+
readonly staticConfig: any;
|
|
45
|
+
getDefaultOptions(): Op;
|
|
46
|
+
validate(request: routes.RouteTransferRequest<N>, params: Tp): Promise<Vr>;
|
|
47
|
+
quote(request: routes.RouteTransferRequest<N>, params: Vp): Promise<QR>;
|
|
48
|
+
initiate(request: routes.RouteTransferRequest<N>, signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
|
|
49
|
+
track(receipt: R, timeout?: number): AsyncGenerator<import("@wormhole-foundation/sdk-connect").SourceInitiatedTransferReceipt<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").FailedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").SourceFinalizedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").AttestedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").CompletedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">, R, unknown>;
|
|
50
|
+
wh: Wormhole<N>;
|
|
51
|
+
transferUrl(txid: string): string;
|
|
52
|
+
};
|
|
53
|
+
config: CCTPExecutorRoute.Config;
|
|
54
|
+
NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
|
|
55
|
+
meta: {
|
|
56
|
+
name: string;
|
|
57
|
+
provider: string;
|
|
58
|
+
};
|
|
59
|
+
supportedNetworks(): Network[];
|
|
60
|
+
supportedChains(network: Network): Chain[];
|
|
61
|
+
supportedDestinationTokens<N extends Network>(sourceToken: TokenId, fromChain: ChainContext<N>, toChain: ChainContext<N>): Promise<TokenId[]>;
|
|
62
|
+
IS_AUTOMATIC: boolean;
|
|
63
|
+
};
|
|
64
|
+
export declare class CCTPExecutorRoute<N extends Network> extends routes.AutomaticRoute<N, Op, Vp, R> implements routes.StaticRouteMethods<typeof CCTPExecutorRoute> {
|
|
65
|
+
static NATIVE_GAS_DROPOFF_SUPPORTED: boolean;
|
|
66
|
+
readonly staticConfig: any;
|
|
67
|
+
static config: CCTPExecutorRoute.Config;
|
|
68
|
+
static meta: {
|
|
69
|
+
name: string;
|
|
70
|
+
provider: string;
|
|
71
|
+
};
|
|
72
|
+
static supportedNetworks(): Network[];
|
|
73
|
+
static supportedChains(network: Network): Chain[];
|
|
74
|
+
static supportedDestinationTokens<N extends Network>(sourceToken: TokenId, fromChain: ChainContext<N>, toChain: ChainContext<N>): Promise<TokenId[]>;
|
|
75
|
+
getDefaultOptions(): Op;
|
|
76
|
+
validate(request: routes.RouteTransferRequest<N>, params: Tp): Promise<Vr>;
|
|
77
|
+
quote(request: routes.RouteTransferRequest<N>, params: Vp): Promise<QR>;
|
|
78
|
+
initiate(request: routes.RouteTransferRequest<N>, signer: Signer, quote: Q, to: ChainAddress): Promise<R>;
|
|
79
|
+
track(receipt: R, timeout?: number): AsyncGenerator<import("@wormhole-foundation/sdk-connect").SourceInitiatedTransferReceipt<"Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").FailedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").SourceFinalizedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").AttestedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia"> | import("@wormhole-foundation/sdk-connect").CompletedTransferReceipt<AT, "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia", "Solana" | "Ethereum" | "Terra" | "Bsc" | "Polygon" | "Avalanche" | "Oasis" | "Algorand" | "Aurora" | "Fantom" | "Karura" | "Acala" | "Klaytn" | "Celo" | "Near" | "Moonbeam" | "Neon" | "Terra2" | "Injective" | "Osmosis" | "Sui" | "Aptos" | "Arbitrum" | "Optimism" | "Gnosis" | "Pythnet" | "Xpla" | "Btc" | "Base" | "Sei" | "Scroll" | "Mantle" | "Blast" | "Xlayer" | "Linea" | "Berachain" | "Seievm" | "Snaxchain" | "Unichain" | "Worldchain" | "Ink" | "HyperEVM" | "Monad" | "Mezo" | "Sonic" | "Wormchain" | "Cosmoshub" | "Evmos" | "Kujira" | "Neutron" | "Celestia" | "Stargaze" | "Seda" | "Dymension" | "Provenance" | "Noble" | "Sepolia" | "ArbitrumSepolia" | "BaseSepolia" | "OptimismSepolia" | "Holesky" | "PolygonSepolia">, R, unknown>;
|
|
80
|
+
}
|
|
81
|
+
declare module "@wormhole-foundation/sdk-definitions" {
|
|
82
|
+
namespace WormholeRegistry {
|
|
83
|
+
interface ProtocolToInterfaceMapping<N, C> {
|
|
84
|
+
CCTPExecutor: CCTPExecutor<N, C>;
|
|
85
|
+
}
|
|
86
|
+
interface ProtocolToPlatformMapping {
|
|
87
|
+
CCTPExecutor: EmptyPlatformMap<"CCTPExecutor">;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
export {};
|
|
92
|
+
//# sourceMappingURL=cctpV1.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cctpV1.d.ts","sourceRoot":"","sources":["../../../src/routes/cctpV1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,MAAM,EAAY,MAAM,+BAA+B,CAAC;AACjE,OAAO,EACL,gBAAgB,EAGhB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,MAAM,EACX,KAAK,OAAO,EACb,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAML,MAAM,EAEN,QAAQ,EACT,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAIxC,yBAAiB,iBAAiB,CAAC;IACjC,KAAY,OAAO,GAAG;QAE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CAAC,EAAE,CAAC;IAmCR,KAAK,CACT,OAAO,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,EACvC,MAAM,EAAE,EAAE,GACT,OAAO,CAAC,EAAE,CAAC;IA2DR,QAAQ,CACZ,OAAO,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,CAAC,EACvC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,EACR,EAAE,EAAE,YAAY,GACf,OAAO,CAAC,CAAC,CAAC;IAWU,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;CAqE1D;AAED,OAAO,QAAQ,sCAAsC,CAAC;IACpD,UAAiB,gBAAgB,CAAC;QAChC,UAAU,0BAA0B,CAAC,CAAC,EAAE,CAAC;YACvC,YAAY,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SAClC;QACD,UAAU,yBAAyB;YACjC,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;SAChD;KACF;CACF"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CCTPExecutorRoute = void 0;
|
|
4
|
+
exports.cctpExecutorRoute = cctpExecutorRoute;
|
|
5
|
+
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
|
|
6
|
+
const sdk_definitions_1 = require("@wormhole-foundation/sdk-definitions");
|
|
7
|
+
const sdk_connect_1 = require("@wormhole-foundation/sdk-connect");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const consts_1 = require("../consts");
|
|
10
|
+
const helpers_1 = require("./helpers");
|
|
11
|
+
// Use this function to create a new CCTPExecutorRoute with custom config
|
|
12
|
+
function cctpExecutorRoute(config = { referrerFeeDbps: 0n }) {
|
|
13
|
+
if (config.referrerFeeDbps < 0 || config.referrerFeeDbps > 65535n) {
|
|
14
|
+
throw new Error("Referrer fee must be between 0 and 65535");
|
|
15
|
+
}
|
|
16
|
+
class CCTPExecutorRouteImpl extends CCTPExecutorRoute {
|
|
17
|
+
static config = config;
|
|
18
|
+
}
|
|
19
|
+
return CCTPExecutorRouteImpl;
|
|
20
|
+
}
|
|
21
|
+
// CCTPv1
|
|
22
|
+
class CCTPExecutorRoute extends sdk_connect_1.routes.AutomaticRoute {
|
|
23
|
+
static NATIVE_GAS_DROPOFF_SUPPORTED = true;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
// Since we set the config on the static class, access it with this param
|
|
26
|
+
// the CCTPExecutorRoute.config will always be empty
|
|
27
|
+
staticConfig = this.constructor.config;
|
|
28
|
+
static config = { referrerFeeDbps: 0n };
|
|
29
|
+
static meta = {
|
|
30
|
+
name: "CCTPExecutorRoute",
|
|
31
|
+
provider: "Circle",
|
|
32
|
+
};
|
|
33
|
+
static supportedNetworks() {
|
|
34
|
+
return ["Mainnet", "Testnet"];
|
|
35
|
+
}
|
|
36
|
+
static supportedChains(network) {
|
|
37
|
+
return [...Object.keys(consts_1.circleV1Domains[network] ?? {})];
|
|
38
|
+
}
|
|
39
|
+
static async supportedDestinationTokens(sourceToken, fromChain, toChain) {
|
|
40
|
+
if (!(0, consts_1.isCircleV1Chain)(fromChain.network, fromChain.chain) ||
|
|
41
|
+
!(0, consts_1.isCircleV1Chain)(toChain.network, toChain.chain)) {
|
|
42
|
+
return [];
|
|
43
|
+
}
|
|
44
|
+
// Ensure the source token is USDC
|
|
45
|
+
const sourceChainUsdcContract = consts_1.usdcContracts[fromChain.network]?.[fromChain.chain];
|
|
46
|
+
if (!(sourceChainUsdcContract &&
|
|
47
|
+
(0, sdk_definitions_1.isSameToken)(sourceToken, sdk_connect_1.Wormhole.tokenId(fromChain.chain, sourceChainUsdcContract)))) {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
const { network, chain } = toChain;
|
|
51
|
+
const destChainUsdcContract = consts_1.usdcContracts[network]?.[chain];
|
|
52
|
+
if (!destChainUsdcContract)
|
|
53
|
+
return [];
|
|
54
|
+
return [sdk_connect_1.Wormhole.chainAddress(chain, destChainUsdcContract)];
|
|
55
|
+
}
|
|
56
|
+
getDefaultOptions() {
|
|
57
|
+
return {
|
|
58
|
+
nativeGas: 0,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
async validate(request, params) {
|
|
62
|
+
const { fromChain, toChain } = request;
|
|
63
|
+
if (!(0, consts_1.isCircleV1Chain)(fromChain.network, fromChain.chain) ||
|
|
64
|
+
!(0, consts_1.isCircleV1Chain)(toChain.network, toChain.chain)) {
|
|
65
|
+
return {
|
|
66
|
+
valid: false,
|
|
67
|
+
error: new Error("Unsupported source or destination chain"),
|
|
68
|
+
params,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (params.options?.nativeGas &&
|
|
72
|
+
(params.options.nativeGas < 0 || params.options.nativeGas > 1)) {
|
|
73
|
+
return {
|
|
74
|
+
valid: false,
|
|
75
|
+
error: new Error("Invalid native gas percentage"),
|
|
76
|
+
params,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const validatedParams = {
|
|
80
|
+
normalizedParams: {
|
|
81
|
+
amount: request.parseAmount(params.amount),
|
|
82
|
+
},
|
|
83
|
+
options: params.options ?? this.getDefaultOptions(),
|
|
84
|
+
...params,
|
|
85
|
+
};
|
|
86
|
+
return { valid: true, params: validatedParams };
|
|
87
|
+
}
|
|
88
|
+
async quote(request, params) {
|
|
89
|
+
const { fromChain, toChain } = request;
|
|
90
|
+
try {
|
|
91
|
+
const quoteDetails = await (0, helpers_1.fetchExecutorQuote)(request, params, this.staticConfig.referrerFeeDbps, "ERC1");
|
|
92
|
+
const { remainingAmount, estimatedCost, gasDropOff, expiryTime } = quoteDetails;
|
|
93
|
+
// https://developers.circle.com/stablecoins/docs/required-block-confirmations
|
|
94
|
+
const eta = fromChain.chain === "Polygon"
|
|
95
|
+
? 2_000 * 200
|
|
96
|
+
: sdk_base_1.finality.estimateFinalityTime(fromChain.chain) + 1_000; // buffer for the relayer
|
|
97
|
+
const [srcNativeDecimals, dstNativeDecimals] = await Promise.all([
|
|
98
|
+
fromChain.getDecimals("native"),
|
|
99
|
+
toChain.getDecimals("native"),
|
|
100
|
+
]);
|
|
101
|
+
return {
|
|
102
|
+
success: true,
|
|
103
|
+
params,
|
|
104
|
+
sourceToken: {
|
|
105
|
+
token: request.source.id,
|
|
106
|
+
amount: params.normalizedParams.amount,
|
|
107
|
+
},
|
|
108
|
+
destinationToken: {
|
|
109
|
+
token: request.destination.id,
|
|
110
|
+
amount: sdk_base_1.amount.fromBaseUnits(remainingAmount, request.destination.decimals),
|
|
111
|
+
},
|
|
112
|
+
relayFee: {
|
|
113
|
+
token: (0, sdk_definitions_1.nativeTokenId)(fromChain.chain),
|
|
114
|
+
amount: sdk_base_1.amount.fromBaseUnits(estimatedCost, srcNativeDecimals),
|
|
115
|
+
},
|
|
116
|
+
destinationNativeGas: sdk_base_1.amount.fromBaseUnits(gasDropOff, dstNativeDecimals),
|
|
117
|
+
eta,
|
|
118
|
+
expires: expiryTime,
|
|
119
|
+
details: quoteDetails,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
return {
|
|
124
|
+
success: false,
|
|
125
|
+
error: new Error(e instanceof Error ? e.message : `${e}`),
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
async initiate(request, signer, quote, to) {
|
|
130
|
+
if (!quote.details) {
|
|
131
|
+
throw new Error("Missing quote details");
|
|
132
|
+
}
|
|
133
|
+
return await (0, helpers_1.initiateTransfer)(request, signer, to, {
|
|
134
|
+
protocol: "CCTPExecutor",
|
|
135
|
+
details: quote.details,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
async *track(receipt, timeout) {
|
|
139
|
+
if ((0, sdk_connect_1.isCompleted)(receipt) || (0, sdk_connect_1.isFailed)(receipt))
|
|
140
|
+
return receipt;
|
|
141
|
+
let leftover = timeout ? timeout : 60 * 60 * 1000;
|
|
142
|
+
while (leftover > 0) {
|
|
143
|
+
const start = Date.now();
|
|
144
|
+
if ((0, sdk_connect_1.isSourceInitiated)(receipt) ||
|
|
145
|
+
(0, sdk_connect_1.isSourceFinalized)(receipt) ||
|
|
146
|
+
(0, sdk_connect_1.isAttested)(receipt)) {
|
|
147
|
+
try {
|
|
148
|
+
const [txStatus] = await (0, utils_1.fetchStatus)(this.wh.network, receipt.originTxs.at(-1).txid, receipt.from);
|
|
149
|
+
if (!txStatus) {
|
|
150
|
+
throw new Error("No transaction status found");
|
|
151
|
+
}
|
|
152
|
+
const relayStatus = txStatus?.status;
|
|
153
|
+
if (relayStatus === utils_1.RelayStatus.Failed || // this could happen if simulation fails
|
|
154
|
+
relayStatus === utils_1.RelayStatus.Underpaid || // only happens if you don't pay at least the costEstimate
|
|
155
|
+
relayStatus === utils_1.RelayStatus.Unsupported || // capabilities check didn't pass
|
|
156
|
+
relayStatus === utils_1.RelayStatus.Aborted // An unrecoverable error indicating the attempt should stop (bad data, pre-flight checks failed, or chain-specific conditions)
|
|
157
|
+
) {
|
|
158
|
+
receipt = {
|
|
159
|
+
...receipt,
|
|
160
|
+
state: sdk_connect_1.TransferState.Failed,
|
|
161
|
+
error: new sdk_connect_1.routes.RelayFailedError(`Relay failed with status: ${relayStatus}`),
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (relayStatus === utils_1.RelayStatus.Submitted) {
|
|
165
|
+
receipt = {
|
|
166
|
+
...receipt,
|
|
167
|
+
state: sdk_connect_1.TransferState.DestinationFinalized,
|
|
168
|
+
attestation: { id: txStatus.id, attestation: {} },
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
// Important to yield before checking for completion
|
|
172
|
+
// so the caller can update the receipt state
|
|
173
|
+
yield receipt;
|
|
174
|
+
if ((0, sdk_connect_1.isCompleted)(receipt) || (0, sdk_connect_1.isFailed)(receipt)) {
|
|
175
|
+
return receipt;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
console.error(`Error fetching transaction status: ${error.message || error}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
// Sleep so we don't spam the endpoint
|
|
183
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
184
|
+
leftover -= Date.now() - start;
|
|
185
|
+
}
|
|
186
|
+
return receipt;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.CCTPExecutorRoute = CCTPExecutorRoute;
|
|
190
|
+
//# sourceMappingURL=cctpV1.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cctpV1.js","sourceRoot":"","sources":["../../../src/routes/cctpV1.ts"],"names":[],"mappings":";;;AA4EA,8CAWC;AAtFD,4DAAiE;AACjE,0EAQ8C;AAC9C,kEAS0C;AAC1C,oCAAqE;AAErE,sCAA4E;AAC5E,uCAAiE;AAmDjE,yEAAyE;AACzE,SAAgB,iBAAiB,CAC/B,SAAmC,EAAE,eAAe,EAAE,EAAE,EAAE;IAE1D,IAAI,MAAM,CAAC,eAAe,GAAG,CAAC,IAAI,MAAM,CAAC,eAAe,GAAG,MAAM,EAAE,CAAC;QAClE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,MAAM,qBAAyC,SAAQ,iBAAoB;QACzE,MAAM,CAAU,MAAM,GAAG,MAAM,CAAC;;IAGlC,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,SAAS;AACT,MAAa,iBACX,SAAQ,oBAAM,CAAC,cAA4B;IAG3C,MAAM,CAAC,4BAA4B,GAAG,IAAI,CAAC;IAE3C,aAAa;IACb,yEAAyE;IACzE,oDAAoD;IAC3C,YAAY,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;IAChD,MAAM,CAAC,MAAM,GAA6B,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC;IAElE,MAAM,CAAC,IAAI,GAAG;QACZ,IAAI,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