@recta/client 0.1.12 → 0.1.13
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 +5 -0
- package/dist/artifact.d.ts +3 -0
- package/dist/artifact.js +11 -3
- package/dist/constants.d.ts +2 -2
- package/dist/constants.js +1 -1
- package/dist/pinned-routes.d.ts +3 -0
- package/dist/pinned-routes.js +166 -0
- package/dist/preflight.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,6 +193,11 @@ anyone; LayerZero endpoint id, with no executor options, compose message or OFT
|
|
|
193
193
|
amount (Across `outputAmount`, CCTP amount minus `maxFee`, LayerZero `minAmountLD`); native value is allowed only as
|
|
194
194
|
the declared messaging fee, within `maxNativeValueWei`.
|
|
195
195
|
|
|
196
|
+
Native ETH (since 0.1.13: Ethereum to and from Base, Arbitrum and Optimism, `source_asset` and `destination_asset`
|
|
197
|
+
`"ETH"`, amount in ETH): the route is an Across `deposit` of the network's wrapped ETH with no approval, and its value
|
|
198
|
+
must be exactly the amount you asked to move (that value is the transfer itself, so `maxNativeValueWei` does not
|
|
199
|
+
bound it). Across delivers native ETH to a recipient without code.
|
|
200
|
+
|
|
196
201
|
`report` returns `stage`: `ACCRUED` (Recta verified and recorded the saving), `PENDING` (report again later) or
|
|
197
202
|
`REFUSED` (Recta will not accrue this execution; see `body.reason_code`).
|
|
198
203
|
|
package/dist/artifact.d.ts
CHANGED
|
@@ -46,6 +46,9 @@ export declare function pinnedRouteOf(request: Pick<EvaluationRequestView, "sour
|
|
|
46
46
|
* token and exact amount, the pinned destination (Across chain id and output token, CCTP domain with any caller, OFT
|
|
47
47
|
* endpoint id), and a guaranteed output of at least `minOutputBps` of the amount; its native value is the one the
|
|
48
48
|
* call declares, within the agent's limit.
|
|
49
|
+
* - a native ETH route (pinned `native`) has no approval and is an Across deposit of the pinned wrapped ETH whose value
|
|
50
|
+
* is exactly the amount: the SpokePool wraps it, and delivers ETH to the recipient. That value is the transfer the
|
|
51
|
+
* agent asked for, so `maxNativeValueWei` (fees) does not bound it.
|
|
49
52
|
* Anything else is refused.
|
|
50
53
|
*/
|
|
51
54
|
export declare function checkExecutionArtifact(artifact: unknown, args: {
|
package/dist/artifact.js
CHANGED
|
@@ -41,6 +41,9 @@ export function pinnedRouteOf(request) {
|
|
|
41
41
|
* token and exact amount, the pinned destination (Across chain id and output token, CCTP domain with any caller, OFT
|
|
42
42
|
* endpoint id), and a guaranteed output of at least `minOutputBps` of the amount; its native value is the one the
|
|
43
43
|
* call declares, within the agent's limit.
|
|
44
|
+
* - a native ETH route (pinned `native`) has no approval and is an Across deposit of the pinned wrapped ETH whose value
|
|
45
|
+
* is exactly the amount: the SpokePool wraps it, and delivers ETH to the recipient. That value is the transfer the
|
|
46
|
+
* agent asked for, so `maxNativeValueWei` (fees) does not bound it.
|
|
44
47
|
* Anything else is refused.
|
|
45
48
|
*/
|
|
46
49
|
export function checkExecutionArtifact(artifact, args) {
|
|
@@ -94,6 +97,8 @@ export function checkExecutionArtifact(artifact, args) {
|
|
|
94
97
|
if (maxPriority !== undefined && priority > BigInt(maxPriority))
|
|
95
98
|
fail("transaction_gas_price", `transaction ${i} tips more per gas than the request allows`);
|
|
96
99
|
if (role === "APPROVAL") {
|
|
100
|
+
if (route.native === true)
|
|
101
|
+
fail("approval", `transaction ${i} is an approval, and a native ETH route needs none`);
|
|
97
102
|
if (to !== route.source_token || value !== 0n)
|
|
98
103
|
fail("approval", `transaction ${i} is not an approval on the source token`);
|
|
99
104
|
const d = (() => { try {
|
|
@@ -113,7 +118,7 @@ export function checkExecutionArtifact(artifact, args) {
|
|
|
113
118
|
const candidates = route.contracts.filter((c) => c.address === to);
|
|
114
119
|
if (candidates.length === 0)
|
|
115
120
|
fail("execution_target", `the execution calls ${to}, which is not a pinned contract of this corridor`);
|
|
116
|
-
checkExecutionCall(data, value, candidates, { token: route.source_token, sender: signer, recipient: request.recipient, maxNativeValueWei: limits.maxNativeValueWei, minimum });
|
|
121
|
+
checkExecutionCall(data, value, candidates, { token: route.source_token, sender: signer, recipient: request.recipient, maxNativeValueWei: limits.maxNativeValueWei, minimum, native: route.native === true });
|
|
117
122
|
executionTo = to;
|
|
118
123
|
}
|
|
119
124
|
out.push({ role, chainId: route.source_chain_id, to: to, data, value, gas: n("gas_limit"), maxFeePerGas: fee, maxPriorityFeePerGas: priority });
|
|
@@ -157,10 +162,13 @@ function checkExecutionCall(data, value, candidates, e) {
|
|
|
157
162
|
fail("execution_destination", "the Across deposit carries a message (the recipient would run it as a handler)");
|
|
158
163
|
if (outputAmount < minimumOutput(e.minimum, true))
|
|
159
164
|
fail("execution_min_output", `the Across deposit guarantees ${outputAmount}, less than your minimum`);
|
|
160
|
-
if (value !== 0n)
|
|
161
|
-
fail("execution_value", "the Across deposit attaches native value");
|
|
165
|
+
if (e.native ? value !== amount : value !== 0n)
|
|
166
|
+
fail("execution_value", e.native ? `the native ETH deposit attaches ${value} wei, not exactly the amount ${amount}` : "the Across deposit attaches native value");
|
|
162
167
|
return;
|
|
163
168
|
}
|
|
169
|
+
// A native ETH route is an Across deposit only.
|
|
170
|
+
if (e.native)
|
|
171
|
+
fail("execution_call", "a native ETH route is an Across deposit, and this is not one");
|
|
164
172
|
const cctp = destinations("cctp_v2").length > 0 ? decode(CCTP_DEPOSIT_FOR_BURN_ABI) : undefined;
|
|
165
173
|
if (cctp !== undefined) {
|
|
166
174
|
const [burnAmount, domain, mintRecipient, burnToken, destinationCaller, maxFee] = cctp.args;
|
package/dist/constants.d.ts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export declare const RECTA_ORIGIN = "https://api.recta.build";
|
|
9
9
|
/** This package's version (equal to package.json, checked in CI). */
|
|
10
|
-
export declare const CLIENT_VERSION = "0.1.
|
|
10
|
+
export declare const CLIENT_VERSION = "0.1.13";
|
|
11
11
|
/** Sent on every request so Recta can count real use of this package apart from other clients (no address, no key). */
|
|
12
|
-
export declare const USER_AGENT = "recta-client/0.1.
|
|
12
|
+
export declare const USER_AGENT = "recta-client/0.1.13";
|
|
13
13
|
/** The fee: x402 `upto` on Base, a Permit2 `permitWitnessTransferFrom`. All lowercase. */
|
|
14
14
|
export declare const FEE_CHAIN_ID = 8453;
|
|
15
15
|
export declare const PERMIT2 = "0x000000000022d473030f116ddee9f6b43ac78ba3";
|
package/dist/constants.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export const RECTA_ORIGIN = "https://api.recta.build";
|
|
9
9
|
/** This package's version (equal to package.json, checked in CI). */
|
|
10
|
-
export const CLIENT_VERSION = "0.1.
|
|
10
|
+
export const CLIENT_VERSION = "0.1.13";
|
|
11
11
|
/** Sent on every request so Recta can count real use of this package apart from other clients (no address, no key). */
|
|
12
12
|
export const USER_AGENT = `recta-client/${CLIENT_VERSION}`;
|
|
13
13
|
/** The fee: x402 `upto` on Base, a Permit2 `permitWitnessTransferFrom`. All lowercase. */
|
package/dist/pinned-routes.d.ts
CHANGED
|
@@ -15,5 +15,8 @@ export interface PinnedRoute {
|
|
|
15
15
|
readonly address: string;
|
|
16
16
|
readonly destination_id: number;
|
|
17
17
|
}[];
|
|
18
|
+
/** Native ETH: the tokens are the wrapped ETH Across deposits and delivers; the deposit carries the amount as value
|
|
19
|
+
* and the route needs no approval. */
|
|
20
|
+
readonly native?: true;
|
|
18
21
|
}
|
|
19
22
|
export declare const PINNED_ROUTES: Readonly<Record<string, PinnedRoute>>;
|
package/dist/pinned-routes.js
CHANGED
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
export const PINNED_ROUTES = {
|
|
2
|
+
"arbitrum:ETH>ethereum:ETH": {
|
|
3
|
+
"source_chain_id": 42161,
|
|
4
|
+
"source_token": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
5
|
+
"source_decimals": 18,
|
|
6
|
+
"output_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
7
|
+
"output_decimals": 18,
|
|
8
|
+
"native": true,
|
|
9
|
+
"contracts": [
|
|
10
|
+
{
|
|
11
|
+
"protocol": "across",
|
|
12
|
+
"address": "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
|
|
13
|
+
"destination_id": 1
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
},
|
|
2
17
|
"arbitrum:USDC>arc:USDC": {
|
|
3
18
|
"source_chain_id": 42161,
|
|
4
19
|
"source_token": "0xaf88d065e77c8cc2239327c5edb3a432268e5831",
|
|
@@ -252,6 +267,25 @@ export const PINNED_ROUTES = {
|
|
|
252
267
|
}
|
|
253
268
|
]
|
|
254
269
|
},
|
|
270
|
+
"arbitrum:USDT>bnb_chain:USDT_BINANCE_PEG": {
|
|
271
|
+
"source_chain_id": 42161,
|
|
272
|
+
"source_token": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
273
|
+
"source_decimals": 6,
|
|
274
|
+
"output_token": "0x55d398326f99059ff775485246999027b3197955",
|
|
275
|
+
"output_decimals": 18,
|
|
276
|
+
"contracts": [
|
|
277
|
+
{
|
|
278
|
+
"protocol": "oft",
|
|
279
|
+
"address": "0xce8cca271ebc0533920c83d39f417ed6a0abb7d0",
|
|
280
|
+
"destination_id": 30102
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"protocol": "across",
|
|
284
|
+
"address": "0xe35e9842fceaca96570b734083f4a58e8f7c5f2a",
|
|
285
|
+
"destination_id": 56
|
|
286
|
+
}
|
|
287
|
+
]
|
|
288
|
+
},
|
|
255
289
|
"arbitrum:USDT>ethereum:USDT": {
|
|
256
290
|
"source_chain_id": 42161,
|
|
257
291
|
"source_token": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
@@ -800,6 +834,21 @@ export const PINNED_ROUTES = {
|
|
|
800
834
|
}
|
|
801
835
|
]
|
|
802
836
|
},
|
|
837
|
+
"base:ETH>ethereum:ETH": {
|
|
838
|
+
"source_chain_id": 8453,
|
|
839
|
+
"source_token": "0x4200000000000000000000000000000000000006",
|
|
840
|
+
"source_decimals": 18,
|
|
841
|
+
"output_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
842
|
+
"output_decimals": 18,
|
|
843
|
+
"native": true,
|
|
844
|
+
"contracts": [
|
|
845
|
+
{
|
|
846
|
+
"protocol": "across",
|
|
847
|
+
"address": "0x09aea4b2242abc8bb4bb78d537a67a245a7bec64",
|
|
848
|
+
"destination_id": 1
|
|
849
|
+
}
|
|
850
|
+
]
|
|
851
|
+
},
|
|
803
852
|
"base:USDC>arbitrum:USDC": {
|
|
804
853
|
"source_chain_id": 8453,
|
|
805
854
|
"source_token": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",
|
|
@@ -1148,6 +1197,25 @@ export const PINNED_ROUTES = {
|
|
|
1148
1197
|
}
|
|
1149
1198
|
]
|
|
1150
1199
|
},
|
|
1200
|
+
"bnb_chain:USDT_BINANCE_PEG>arbitrum:USDT": {
|
|
1201
|
+
"source_chain_id": 56,
|
|
1202
|
+
"source_token": "0x55d398326f99059ff775485246999027b3197955",
|
|
1203
|
+
"source_decimals": 18,
|
|
1204
|
+
"output_token": "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9",
|
|
1205
|
+
"output_decimals": 6,
|
|
1206
|
+
"contracts": [
|
|
1207
|
+
{
|
|
1208
|
+
"protocol": "oft",
|
|
1209
|
+
"address": "0x138eb30f73bc423c6455c53df6d89cb01d9ebc63",
|
|
1210
|
+
"destination_id": 30110
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
"protocol": "across",
|
|
1214
|
+
"address": "0x4e8e101924ede233c13e2d8622dc8aed2872d505",
|
|
1215
|
+
"destination_id": 42161
|
|
1216
|
+
}
|
|
1217
|
+
]
|
|
1218
|
+
},
|
|
1151
1219
|
"bnb_chain:USDT_BINANCE_PEG>ethereum:USDT": {
|
|
1152
1220
|
"source_chain_id": 56,
|
|
1153
1221
|
"source_token": "0x55d398326f99059ff775485246999027b3197955",
|
|
@@ -1167,6 +1235,70 @@ export const PINNED_ROUTES = {
|
|
|
1167
1235
|
}
|
|
1168
1236
|
]
|
|
1169
1237
|
},
|
|
1238
|
+
"bnb_chain:USDT_BINANCE_PEG>polygon:USDT": {
|
|
1239
|
+
"source_chain_id": 56,
|
|
1240
|
+
"source_token": "0x55d398326f99059ff775485246999027b3197955",
|
|
1241
|
+
"source_decimals": 18,
|
|
1242
|
+
"output_token": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
1243
|
+
"output_decimals": 6,
|
|
1244
|
+
"contracts": [
|
|
1245
|
+
{
|
|
1246
|
+
"protocol": "oft",
|
|
1247
|
+
"address": "0x138eb30f73bc423c6455c53df6d89cb01d9ebc63",
|
|
1248
|
+
"destination_id": 30109
|
|
1249
|
+
},
|
|
1250
|
+
{
|
|
1251
|
+
"protocol": "across",
|
|
1252
|
+
"address": "0x4e8e101924ede233c13e2d8622dc8aed2872d505",
|
|
1253
|
+
"destination_id": 137
|
|
1254
|
+
}
|
|
1255
|
+
]
|
|
1256
|
+
},
|
|
1257
|
+
"ethereum:ETH>arbitrum:ETH": {
|
|
1258
|
+
"source_chain_id": 1,
|
|
1259
|
+
"source_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
1260
|
+
"source_decimals": 18,
|
|
1261
|
+
"output_token": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1",
|
|
1262
|
+
"output_decimals": 18,
|
|
1263
|
+
"native": true,
|
|
1264
|
+
"contracts": [
|
|
1265
|
+
{
|
|
1266
|
+
"protocol": "across",
|
|
1267
|
+
"address": "0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5",
|
|
1268
|
+
"destination_id": 42161
|
|
1269
|
+
}
|
|
1270
|
+
]
|
|
1271
|
+
},
|
|
1272
|
+
"ethereum:ETH>base:ETH": {
|
|
1273
|
+
"source_chain_id": 1,
|
|
1274
|
+
"source_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
1275
|
+
"source_decimals": 18,
|
|
1276
|
+
"output_token": "0x4200000000000000000000000000000000000006",
|
|
1277
|
+
"output_decimals": 18,
|
|
1278
|
+
"native": true,
|
|
1279
|
+
"contracts": [
|
|
1280
|
+
{
|
|
1281
|
+
"protocol": "across",
|
|
1282
|
+
"address": "0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5",
|
|
1283
|
+
"destination_id": 8453
|
|
1284
|
+
}
|
|
1285
|
+
]
|
|
1286
|
+
},
|
|
1287
|
+
"ethereum:ETH>optimism:ETH": {
|
|
1288
|
+
"source_chain_id": 1,
|
|
1289
|
+
"source_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
1290
|
+
"source_decimals": 18,
|
|
1291
|
+
"output_token": "0x4200000000000000000000000000000000000006",
|
|
1292
|
+
"output_decimals": 18,
|
|
1293
|
+
"native": true,
|
|
1294
|
+
"contracts": [
|
|
1295
|
+
{
|
|
1296
|
+
"protocol": "across",
|
|
1297
|
+
"address": "0x5c7bcd6e7de5423a257d81b442095a1a6ced35c5",
|
|
1298
|
+
"destination_id": 10
|
|
1299
|
+
}
|
|
1300
|
+
]
|
|
1301
|
+
},
|
|
1170
1302
|
"ethereum:USDC>arbitrum:USDC": {
|
|
1171
1303
|
"source_chain_id": 1,
|
|
1172
1304
|
"source_token": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
@@ -2475,6 +2607,21 @@ export const PINNED_ROUTES = {
|
|
|
2475
2607
|
}
|
|
2476
2608
|
]
|
|
2477
2609
|
},
|
|
2610
|
+
"optimism:ETH>ethereum:ETH": {
|
|
2611
|
+
"source_chain_id": 10,
|
|
2612
|
+
"source_token": "0x4200000000000000000000000000000000000006",
|
|
2613
|
+
"source_decimals": 18,
|
|
2614
|
+
"output_token": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
|
|
2615
|
+
"output_decimals": 18,
|
|
2616
|
+
"native": true,
|
|
2617
|
+
"contracts": [
|
|
2618
|
+
{
|
|
2619
|
+
"protocol": "across",
|
|
2620
|
+
"address": "0x6f26bf09b1c792e3228e5467807a900a503c0281",
|
|
2621
|
+
"destination_id": 1
|
|
2622
|
+
}
|
|
2623
|
+
]
|
|
2624
|
+
},
|
|
2478
2625
|
"optimism:USDC>arbitrum:USDC": {
|
|
2479
2626
|
"source_chain_id": 10,
|
|
2480
2627
|
"source_token": "0x0b2c639c533813f4aa9d7837caf62653d097ff85",
|
|
@@ -3062,6 +3209,25 @@ export const PINNED_ROUTES = {
|
|
|
3062
3209
|
}
|
|
3063
3210
|
]
|
|
3064
3211
|
},
|
|
3212
|
+
"polygon:USDT>bnb_chain:USDT_BINANCE_PEG": {
|
|
3213
|
+
"source_chain_id": 137,
|
|
3214
|
+
"source_token": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
|
3215
|
+
"source_decimals": 6,
|
|
3216
|
+
"output_token": "0x55d398326f99059ff775485246999027b3197955",
|
|
3217
|
+
"output_decimals": 18,
|
|
3218
|
+
"contracts": [
|
|
3219
|
+
{
|
|
3220
|
+
"protocol": "across",
|
|
3221
|
+
"address": "0x9295ee1d8c5b022be115a2ad3c30c72e34e7f096",
|
|
3222
|
+
"destination_id": 56
|
|
3223
|
+
},
|
|
3224
|
+
{
|
|
3225
|
+
"protocol": "oft",
|
|
3226
|
+
"address": "0xd47b03ee6d86cf251ee7860fb2acf9f91b9fd4d7",
|
|
3227
|
+
"destination_id": 30102
|
|
3228
|
+
}
|
|
3229
|
+
]
|
|
3230
|
+
},
|
|
3065
3231
|
"polygon:USDT>ethereum:USDT": {
|
|
3066
3232
|
"source_chain_id": 137,
|
|
3067
3233
|
"source_token": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
|
package/dist/preflight.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export declare const PREFLIGHT_PATH = "/v1/preflight";
|
|
8
8
|
/** Sent on every preflight this package makes, so Recta can count use of the wrapper apart from other clients. */
|
|
9
|
-
export declare const PREFLIGHT_USER_AGENT = "recta-client/0.1.
|
|
9
|
+
export declare const PREFLIGHT_USER_AGENT = "recta-client/0.1.13 (preflight)";
|
|
10
10
|
export interface PreflightTransfer {
|
|
11
11
|
/** Network keys as Recta names them: base, arbitrum, ethereum, optimism, polygon… */
|
|
12
12
|
readonly source_network: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recta/client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.13",
|
|
4
4
|
"description": "Client for Recta (api.recta.build): evaluate a cross-chain stablecoin transfer, authorize Recta's 5 %-of-verified-saving fee, execute the committed route and report it, with local checks before every signature.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Recta (https://recta.build)",
|