@wormhole-foundation/sdk-evm-ntt 6.0.0 → 6.1.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/dist/cjs/executorGasLimits.d.ts +5 -0
- package/dist/cjs/executorGasLimits.d.ts.map +1 -0
- package/dist/cjs/executorGasLimits.js +22 -0
- package/dist/cjs/executorGasLimits.js.map +1 -0
- package/dist/cjs/nttWithExecutor.d.ts +6 -1
- package/dist/cjs/nttWithExecutor.d.ts.map +1 -1
- package/dist/cjs/nttWithExecutor.js +85 -40
- package/dist/cjs/nttWithExecutor.js.map +1 -1
- package/dist/esm/executorGasLimits.d.ts +5 -0
- package/dist/esm/executorGasLimits.d.ts.map +1 -0
- package/dist/esm/executorGasLimits.js +19 -0
- package/dist/esm/executorGasLimits.js.map +1 -0
- package/dist/esm/nttWithExecutor.d.ts +6 -1
- package/dist/esm/nttWithExecutor.d.ts.map +1 -1
- package/dist/esm/nttWithExecutor.js +83 -39
- package/dist/esm/nttWithExecutor.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Network } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import type { EvmChains } from "@wormhole-foundation/sdk-evm";
|
|
3
|
+
export declare const executorGasLimitOverrides: Partial<Record<Network, Partial<Record<EvmChains, bigint>>>>;
|
|
4
|
+
export declare const DEFAULT_EXECUTOR_GAS_LIMIT = 500000n;
|
|
5
|
+
//# sourceMappingURL=executorGasLimits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorGasLimits.d.ts","sourceRoot":"","sources":["../../src/executorGasLimits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAC7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAcpD,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAAW,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_EXECUTOR_GAS_LIMIT = exports.executorGasLimitOverrides = void 0;
|
|
4
|
+
// Must be high enough to cover the destination chain's worst case (otherwise
|
|
5
|
+
// the executor's relay simulation reverts), but not so high that it inflates
|
|
6
|
+
// the `estimatedCost` returned by /v0/quote.
|
|
7
|
+
exports.executorGasLimitOverrides = {
|
|
8
|
+
Mainnet: {
|
|
9
|
+
Arbitrum: 800000n,
|
|
10
|
+
CreditCoin: 1500000n,
|
|
11
|
+
Monad: 1000000n,
|
|
12
|
+
MegaETH: 1000000n,
|
|
13
|
+
Seievm: 1000000n,
|
|
14
|
+
},
|
|
15
|
+
Testnet: {
|
|
16
|
+
ArbitrumSepolia: 800000n,
|
|
17
|
+
Seievm: 1000000n,
|
|
18
|
+
Tempo: 1500000n,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
exports.DEFAULT_EXECUTOR_GAS_LIMIT = 500000n;
|
|
22
|
+
//# sourceMappingURL=executorGasLimits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorGasLimits.js","sourceRoot":"","sources":["../../src/executorGasLimits.ts"],"names":[],"mappings":";;;AAGA,6EAA6E;AAC7E,6EAA6E;AAC7E,6CAA6C;AAChC,QAAA,yBAAyB,GAElC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,OAAQ;QAClB,UAAU,EAAE,QAAU;QACtB,KAAK,EAAE,QAAU;QACjB,OAAO,EAAE,QAAU;QACnB,MAAM,EAAE,QAAU;KACnB;IACD,OAAO,EAAE;QACP,eAAe,EAAE,OAAQ;QACzB,MAAM,EAAE,QAAU;QAClB,KAAK,EAAE,QAAU;KAClB;CACF,CAAC;AAEW,QAAA,0BAA0B,GAAG,OAAQ,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { type EvmPlatformType, type EvmChains } from "@wormhole-foundation/sdk-e
|
|
|
5
5
|
import { Provider } from "ethers";
|
|
6
6
|
import { EvmNtt } from "./ntt.js";
|
|
7
7
|
export declare const nttWithExecutorAbi: string[];
|
|
8
|
+
export declare const nttWithExecutorWithTokenAbi: string[];
|
|
8
9
|
export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains> implements NttWithExecutor<N, C> {
|
|
9
10
|
readonly network: N;
|
|
10
11
|
readonly chain: C;
|
|
@@ -13,12 +14,15 @@ export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains>
|
|
|
13
14
|
ntt?: Ntt.Contracts;
|
|
14
15
|
};
|
|
15
16
|
readonly chainId: bigint;
|
|
16
|
-
readonly executorAddress: string;
|
|
17
|
+
readonly executorAddress: string | undefined;
|
|
18
|
+
readonly executorWithTokenAddress: string | undefined;
|
|
17
19
|
constructor(network: N, chain: C, provider: Provider, contracts: Contracts & {
|
|
18
20
|
ntt?: Ntt.Contracts;
|
|
19
21
|
});
|
|
20
22
|
static fromRpc<N extends Network>(provider: Provider, config: ChainsConfig<N, EvmPlatformType>): Promise<EvmNttWithExecutor<N, EvmChains>>;
|
|
23
|
+
private requireShimAddress;
|
|
21
24
|
transfer(sender: AccountAddress<C>, destination: ChainAddress, amount: bigint, quote: NttWithExecutor.Quote, ntt: EvmNtt<N, C>, wrapNative?: boolean): AsyncGenerator<UnsignedTransaction<N, C>>;
|
|
25
|
+
private txDescription;
|
|
22
26
|
private approveIfNeeded;
|
|
23
27
|
estimateMsgValueAndGasLimit(recipient: ChainAddress | undefined): Promise<{
|
|
24
28
|
msgValue: bigint;
|
|
@@ -29,4 +33,5 @@ export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains>
|
|
|
29
33
|
* Check if an executor (NttWithExecutor) is deployed for a given network and chain combination.
|
|
30
34
|
*/
|
|
31
35
|
export declare function hasExecutorDeployed(network: Network, chain: EvmChains): boolean;
|
|
36
|
+
export declare function hasExecutorWithTokenDeployed(network: Network, chain: EvmChains): boolean;
|
|
32
37
|
//# sourceMappingURL=nttWithExecutor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nttWithExecutor.d.ts","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,SAAS,EACT,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAa,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"nttWithExecutor.d.ts","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,SAAS,EACT,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAa,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAkElC,eAAO,MAAM,kBAAkB,UAG9B,C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A2B,CAC/B,SAAS,EAAE,YAAY,GAAG,SAAS,GAClC,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAMnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAET;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAIT"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EvmNttWithExecutor = exports.nttWithExecutorAbi = void 0;
|
|
3
|
+
exports.EvmNttWithExecutor = exports.nttWithExecutorWithTokenAbi = exports.nttWithExecutorAbi = void 0;
|
|
4
4
|
exports.hasExecutorDeployed = hasExecutorDeployed;
|
|
5
|
+
exports.hasExecutorWithTokenDeployed = hasExecutorWithTokenDeployed;
|
|
5
6
|
const sdk_base_1 = require("@wormhole-foundation/sdk-base");
|
|
6
7
|
const sdk_definitions_ntt_1 = require("@wormhole-foundation/sdk-definitions-ntt");
|
|
7
8
|
const sdk_evm_1 = require("@wormhole-foundation/sdk-evm");
|
|
8
9
|
const ethers_1 = require("ethers");
|
|
10
|
+
const executorGasLimits_js_1 = require("./executorGasLimits.js");
|
|
9
11
|
const nttManagerWithExecutorAddresses = {
|
|
10
12
|
Mainnet: {
|
|
11
13
|
Arbitrum: "0x5029a23E0EE11f6c9120EAb7eB48a94a49907EC4",
|
|
@@ -52,26 +54,22 @@ const nttManagerWithExecutorAddresses = {
|
|
|
52
54
|
ZeroGravity: "0x69BeC29e71711B30F58585C0bb1622e7b47e3707",
|
|
53
55
|
},
|
|
54
56
|
};
|
|
55
|
-
|
|
56
|
-
// to avoid relay failures. However, they should not be too high to reduce the
|
|
57
|
-
// `estimatedCost` returned by the quote endpoint.
|
|
58
|
-
const gasLimitOverrides = {
|
|
57
|
+
const nttManagerWithExecutorWithTokenAddresses = {
|
|
59
58
|
Mainnet: {
|
|
60
|
-
|
|
61
|
-
CreditCoin: 1500000n,
|
|
62
|
-
Monad: 1000000n,
|
|
63
|
-
MegaETH: 1000000n,
|
|
64
|
-
Seievm: 1000000n,
|
|
59
|
+
Tempo: "0x46d59af07A35751Deb45EC778150C7f0dFbb3d3a",
|
|
65
60
|
},
|
|
66
61
|
Testnet: {
|
|
67
|
-
|
|
68
|
-
Seievm: 1000000n,
|
|
62
|
+
Tempo: "0x3A91179E506A15ff91467e42f5B4bD4239c6eC68",
|
|
69
63
|
},
|
|
70
64
|
};
|
|
71
65
|
exports.nttWithExecutorAbi = [
|
|
72
66
|
"function transfer(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
73
67
|
"function transferETH(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
74
68
|
];
|
|
69
|
+
exports.nttWithExecutorWithTokenAbi = [
|
|
70
|
+
"function transfer(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, uint256 amount, address srcToken, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
71
|
+
"function transferETH(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, uint256 amount, address srcToken, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
72
|
+
];
|
|
75
73
|
class EvmNttWithExecutor {
|
|
76
74
|
network;
|
|
77
75
|
chain;
|
|
@@ -79,16 +77,17 @@ class EvmNttWithExecutor {
|
|
|
79
77
|
contracts;
|
|
80
78
|
chainId;
|
|
81
79
|
executorAddress;
|
|
80
|
+
executorWithTokenAddress;
|
|
82
81
|
constructor(network, chain, provider, contracts) {
|
|
83
82
|
this.network = network;
|
|
84
83
|
this.chain = chain;
|
|
85
84
|
this.provider = provider;
|
|
86
85
|
this.contracts = contracts;
|
|
87
86
|
this.chainId = sdk_base_1.nativeChainIds.networkChainToNativeChainId.get(network, chain);
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
87
|
+
this.executorAddress =
|
|
88
|
+
nttManagerWithExecutorAddresses[this.network]?.[this.chain];
|
|
89
|
+
this.executorWithTokenAddress =
|
|
90
|
+
nttManagerWithExecutorWithTokenAddresses[this.network]?.[this.chain];
|
|
92
91
|
}
|
|
93
92
|
static async fromRpc(provider, config) {
|
|
94
93
|
const [network, chain] = await sdk_evm_1.EvmPlatform.chainFromRpc(provider);
|
|
@@ -97,16 +96,44 @@ class EvmNttWithExecutor {
|
|
|
97
96
|
throw new Error(`Network mismatch: ${conf.network} != ${network}`);
|
|
98
97
|
return new EvmNttWithExecutor(network, chain, provider, conf.contracts);
|
|
99
98
|
}
|
|
99
|
+
requireShimAddress(quote) {
|
|
100
|
+
if (quote.feeToken) {
|
|
101
|
+
if (!this.executorWithTokenAddress) {
|
|
102
|
+
throw new Error(`NttManagerWithExecutorWithToken address not found for chain ${this.chain}`);
|
|
103
|
+
}
|
|
104
|
+
return this.executorWithTokenAddress;
|
|
105
|
+
}
|
|
106
|
+
if (!this.executorAddress) {
|
|
107
|
+
throw new Error(`Executor address not found for chain ${this.chain}`);
|
|
108
|
+
}
|
|
109
|
+
return this.executorAddress;
|
|
110
|
+
}
|
|
100
111
|
async *transfer(sender, destination, amount, quote, ntt, wrapNative = false) {
|
|
112
|
+
const shimAddress = this.requireShimAddress(quote);
|
|
101
113
|
const senderAddress = new sdk_evm_1.EvmAddress(sender).toString();
|
|
102
114
|
const deliveryPrice = await ntt.quoteDeliveryPrice(destination.chain, {
|
|
103
115
|
queue: false,
|
|
104
116
|
automatic: false,
|
|
105
117
|
});
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
118
|
+
const isTokenFee = quote.feeToken !== undefined;
|
|
119
|
+
const iface = new ethers_1.Interface(isTokenFee ? exports.nttWithExecutorWithTokenAbi : exports.nttWithExecutorAbi);
|
|
120
|
+
// executorArgs.value = native forwarded to the Executor: estimatedCost on
|
|
121
|
+
// the native-fee path, 0 on the token-fee path (the fee is pulled as ERC20).
|
|
122
|
+
const executorArgs = isTokenFee
|
|
123
|
+
? {
|
|
124
|
+
value: 0n,
|
|
125
|
+
amount: quote.estimatedCost,
|
|
126
|
+
srcToken: quote.feeToken,
|
|
127
|
+
refundAddress: senderAddress,
|
|
128
|
+
signedQuote: quote.signedQuote,
|
|
129
|
+
instructions: quote.relayInstructions,
|
|
130
|
+
}
|
|
131
|
+
: {
|
|
132
|
+
value: quote.estimatedCost,
|
|
133
|
+
refundAddress: senderAddress,
|
|
134
|
+
signedQuote: quote.signedQuote,
|
|
135
|
+
instructions: quote.relayInstructions,
|
|
136
|
+
};
|
|
110
137
|
const commonArgs = [
|
|
111
138
|
ntt.managerAddress,
|
|
112
139
|
quote.remainingAmount,
|
|
@@ -114,20 +141,21 @@ class EvmNttWithExecutor {
|
|
|
114
141
|
destination.address.toUniversalAddress().toUint8Array(),
|
|
115
142
|
sender.toUniversalAddress().toUint8Array(),
|
|
116
143
|
sdk_definitions_ntt_1.Ntt.encodeTransceiverInstructions(ntt.encodeOptions({ queue: false, automatic: false })),
|
|
117
|
-
|
|
118
|
-
value: quote.estimatedCost,
|
|
119
|
-
refundAddress: senderAddress,
|
|
120
|
-
signedQuote: quote.signedQuote,
|
|
121
|
-
instructions: quote.relayInstructions,
|
|
122
|
-
},
|
|
144
|
+
executorArgs,
|
|
123
145
|
];
|
|
146
|
+
// Merge into one approval when feeToken == bridged token (non-wrap only).
|
|
147
|
+
const sameTokenAsFee = isTokenFee &&
|
|
148
|
+
quote.feeToken.toLowerCase() === ntt.tokenAddress.toLowerCase();
|
|
149
|
+
const mergeFeeIntoBridgedApproval = sameTokenAsFee && !wrapNative;
|
|
150
|
+
if (isTokenFee && !mergeFeeIntoBridgedApproval) {
|
|
151
|
+
yield* this.approveIfNeeded(senderAddress, shimAddress, quote.feeToken, quote.estimatedCost, ntt);
|
|
152
|
+
}
|
|
124
153
|
let data;
|
|
125
154
|
let msgValue;
|
|
126
155
|
if (wrapNative) {
|
|
127
|
-
// The source token is native gas,
|
|
128
|
-
// transferTokenFee as ERC20
|
|
129
|
-
//
|
|
130
|
-
// referrer is paid out of msg.value directly.
|
|
156
|
+
// The source token is native gas, deposited into WETH by the shim, so
|
|
157
|
+
// transferTokenFee can't be pulled as ERC20. Fold it into nativeTokenFee
|
|
158
|
+
// (same units) — the referrer is paid out of msg.value directly.
|
|
131
159
|
const combinedNativeFee = quote.nativeTokenFee + quote.transferTokenFee;
|
|
132
160
|
const feeArgs = {
|
|
133
161
|
transferTokenFee: 0n,
|
|
@@ -136,8 +164,8 @@ class EvmNttWithExecutor {
|
|
|
136
164
|
};
|
|
137
165
|
data = iface.encodeFunctionData("transferETH", [...commonArgs, feeArgs]);
|
|
138
166
|
msgValue =
|
|
139
|
-
|
|
140
|
-
|
|
167
|
+
deliveryPrice +
|
|
168
|
+
executorArgs.value +
|
|
141
169
|
combinedNativeFee +
|
|
142
170
|
quote.remainingAmount;
|
|
143
171
|
}
|
|
@@ -147,22 +175,36 @@ class EvmNttWithExecutor {
|
|
|
147
175
|
nativeTokenFee: quote.nativeTokenFee,
|
|
148
176
|
payee: quote.referrer.address.toString(),
|
|
149
177
|
};
|
|
150
|
-
|
|
178
|
+
const bridgedApprovalAmount = quote.remainingAmount +
|
|
179
|
+
quote.transferTokenFee +
|
|
180
|
+
(mergeFeeIntoBridgedApproval ? quote.estimatedCost : 0n);
|
|
181
|
+
yield* this.approveIfNeeded(senderAddress, shimAddress, ntt.tokenAddress, bridgedApprovalAmount, ntt);
|
|
151
182
|
data = iface.encodeFunctionData("transfer", [...commonArgs, feeArgs]);
|
|
152
|
-
msgValue =
|
|
183
|
+
msgValue = deliveryPrice + executorArgs.value + quote.nativeTokenFee;
|
|
153
184
|
}
|
|
154
|
-
yield ntt.createUnsignedTx({ to:
|
|
185
|
+
yield ntt.createUnsignedTx({ to: shimAddress, data, value: msgValue }, this.txDescription(isTokenFee, wrapNative));
|
|
155
186
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
187
|
+
txDescription(isTokenFee, wrapNative) {
|
|
188
|
+
if (isTokenFee) {
|
|
189
|
+
return wrapNative
|
|
190
|
+
? "NttWithExecutorWithToken.transferETH"
|
|
191
|
+
: "NttWithExecutorWithToken.transfer";
|
|
192
|
+
}
|
|
193
|
+
return wrapNative
|
|
194
|
+
? "NttWithExecutor.transferETH"
|
|
195
|
+
: "NttWithExecutor.transfer";
|
|
196
|
+
}
|
|
197
|
+
async *approveIfNeeded(senderAddress, spender, tokenAddress, requiredAmount, ntt) {
|
|
198
|
+
const tokenContract = sdk_evm_1.EvmPlatform.getTokenImplementation(this.provider, tokenAddress);
|
|
199
|
+
const allowance = await tokenContract.allowance(senderAddress, spender);
|
|
159
200
|
if (allowance < requiredAmount) {
|
|
160
|
-
const txReq = await tokenContract.approve.populateTransaction(
|
|
201
|
+
const txReq = await tokenContract.approve.populateTransaction(spender, requiredAmount);
|
|
161
202
|
yield ntt.createUnsignedTx(txReq, "Ntt.Approve");
|
|
162
203
|
}
|
|
163
204
|
}
|
|
164
205
|
async estimateMsgValueAndGasLimit(recipient) {
|
|
165
|
-
const gasLimit =
|
|
206
|
+
const gasLimit = executorGasLimits_js_1.executorGasLimitOverrides[this.network]?.[this.chain] ??
|
|
207
|
+
executorGasLimits_js_1.DEFAULT_EXECUTOR_GAS_LIMIT;
|
|
166
208
|
return { msgValue: 0n, gasLimit };
|
|
167
209
|
}
|
|
168
210
|
}
|
|
@@ -173,4 +215,7 @@ exports.EvmNttWithExecutor = EvmNttWithExecutor;
|
|
|
173
215
|
function hasExecutorDeployed(network, chain) {
|
|
174
216
|
return nttManagerWithExecutorAddresses[network]?.[chain] !== undefined;
|
|
175
217
|
}
|
|
218
|
+
function hasExecutorWithTokenDeployed(network, chain) {
|
|
219
|
+
return (nttManagerWithExecutorWithTokenAddresses[network]?.[chain] !== undefined);
|
|
220
|
+
}
|
|
176
221
|
//# sourceMappingURL=nttWithExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nttWithExecutor.js","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"nttWithExecutor.js","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":";;;AAuTA,kDAKC;AAED,oEAOC;AArUD,4DAIuC;AAQvC,kFAAgF;AAChF,0DAKsC;AACtC,mCAA6C;AAE7C,iEAGgC;AAEhC,MAAM,+BAA+B,GAEjC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,4CAA4C;QACtD,SAAS,EAAE,4CAA4C;QACvD,IAAI,EAAE,4CAA4C;QAClD,SAAS,EAAE,4CAA4C;QACvD,GAAG,EAAE,4CAA4C;QACjD,IAAI,EAAE,4CAA4C;QAClD,UAAU,EAAE,4CAA4C;QACxD,QAAQ,EAAE,4CAA4C;QACtD,QAAQ,EAAE,4CAA4C;QACtD,GAAG,EAAE,4CAA4C;QACjD,KAAK,EAAE,4CAA4C;QACnD,OAAO,EAAE,4CAA4C;QACrD,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QAClD,KAAK,EAAE,4C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ACtD,IAAI,CAAC,QAAQ,EACb,YAAY,CACb,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QAExE,IAAI,SAAS,GAAG,cAAc,EAAE,CAAC;YAC/B,MAAM,KAAK,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,mBAAmB,CAC3D,OAAO,EACP,cAAc,CACf,CAAC;YACF,MAAM,GAAG,CAAC,gBAAgB,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;QACnD,CAAC;IACH,CAAC;IAED,KAAK,CAAC,2BAA2B,CAC/B,SAAmC;QAEnC,MAAM,QAAQ,GACZ,gDAAyB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YACrD,iDAA0B,CAAC;QAC7B,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;IACpC,CAAC;CACF;AAlND,gDAkNC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CACjC,OAAgB,EAChB,KAAgB;IAEhB,OAAO,+BAA+B,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,SAAS,CAAC;AACzE,CAAC;AAED,SAAgB,4BAA4B,CAC1C,OAAgB,EAChB,KAAgB;IAEhB,OAAO,CACL,wCAAwC,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,SAAS,CACzE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Network } from "@wormhole-foundation/sdk-base";
|
|
2
|
+
import type { EvmChains } from "@wormhole-foundation/sdk-evm";
|
|
3
|
+
export declare const executorGasLimitOverrides: Partial<Record<Network, Partial<Record<EvmChains, bigint>>>>;
|
|
4
|
+
export declare const DEFAULT_EXECUTOR_GAS_LIMIT = 500000n;
|
|
5
|
+
//# sourceMappingURL=executorGasLimits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorGasLimits.d.ts","sourceRoot":"","sources":["../../src/executorGasLimits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAK9D,eAAO,MAAM,yBAAyB,EAAE,OAAO,CAC7C,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAcpD,CAAC;AAEF,eAAO,MAAM,0BAA0B,UAAW,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Must be high enough to cover the destination chain's worst case (otherwise
|
|
2
|
+
// the executor's relay simulation reverts), but not so high that it inflates
|
|
3
|
+
// the `estimatedCost` returned by /v0/quote.
|
|
4
|
+
export const executorGasLimitOverrides = {
|
|
5
|
+
Mainnet: {
|
|
6
|
+
Arbitrum: 800000n,
|
|
7
|
+
CreditCoin: 1500000n,
|
|
8
|
+
Monad: 1000000n,
|
|
9
|
+
MegaETH: 1000000n,
|
|
10
|
+
Seievm: 1000000n,
|
|
11
|
+
},
|
|
12
|
+
Testnet: {
|
|
13
|
+
ArbitrumSepolia: 800000n,
|
|
14
|
+
Seievm: 1000000n,
|
|
15
|
+
Tempo: 1500000n,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
export const DEFAULT_EXECUTOR_GAS_LIMIT = 500000n;
|
|
19
|
+
//# sourceMappingURL=executorGasLimits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"executorGasLimits.js","sourceRoot":"","sources":["../../src/executorGasLimits.ts"],"names":[],"mappings":"AAGA,6EAA6E;AAC7E,6EAA6E;AAC7E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,yBAAyB,GAElC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,OAAQ;QAClB,UAAU,EAAE,QAAU;QACtB,KAAK,EAAE,QAAU;QACjB,OAAO,EAAE,QAAU;QACnB,MAAM,EAAE,QAAU;KACnB;IACD,OAAO,EAAE;QACP,eAAe,EAAE,OAAQ;QACzB,MAAM,EAAE,QAAU;QAClB,KAAK,EAAE,QAAU;KAClB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAQ,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { type EvmPlatformType, type EvmChains } from "@wormhole-foundation/sdk-e
|
|
|
5
5
|
import { Provider } from "ethers";
|
|
6
6
|
import { EvmNtt } from "./ntt.js";
|
|
7
7
|
export declare const nttWithExecutorAbi: string[];
|
|
8
|
+
export declare const nttWithExecutorWithTokenAbi: string[];
|
|
8
9
|
export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains> implements NttWithExecutor<N, C> {
|
|
9
10
|
readonly network: N;
|
|
10
11
|
readonly chain: C;
|
|
@@ -13,12 +14,15 @@ export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains>
|
|
|
13
14
|
ntt?: Ntt.Contracts;
|
|
14
15
|
};
|
|
15
16
|
readonly chainId: bigint;
|
|
16
|
-
readonly executorAddress: string;
|
|
17
|
+
readonly executorAddress: string | undefined;
|
|
18
|
+
readonly executorWithTokenAddress: string | undefined;
|
|
17
19
|
constructor(network: N, chain: C, provider: Provider, contracts: Contracts & {
|
|
18
20
|
ntt?: Ntt.Contracts;
|
|
19
21
|
});
|
|
20
22
|
static fromRpc<N extends Network>(provider: Provider, config: ChainsConfig<N, EvmPlatformType>): Promise<EvmNttWithExecutor<N, EvmChains>>;
|
|
23
|
+
private requireShimAddress;
|
|
21
24
|
transfer(sender: AccountAddress<C>, destination: ChainAddress, amount: bigint, quote: NttWithExecutor.Quote, ntt: EvmNtt<N, C>, wrapNative?: boolean): AsyncGenerator<UnsignedTransaction<N, C>>;
|
|
25
|
+
private txDescription;
|
|
22
26
|
private approveIfNeeded;
|
|
23
27
|
estimateMsgValueAndGasLimit(recipient: ChainAddress | undefined): Promise<{
|
|
24
28
|
msgValue: bigint;
|
|
@@ -29,4 +33,5 @@ export declare class EvmNttWithExecutor<N extends Network, C extends EvmChains>
|
|
|
29
33
|
* Check if an executor (NttWithExecutor) is deployed for a given network and chain combination.
|
|
30
34
|
*/
|
|
31
35
|
export declare function hasExecutorDeployed(network: Network, chain: EvmChains): boolean;
|
|
36
|
+
export declare function hasExecutorWithTokenDeployed(network: Network, chain: EvmChains): boolean;
|
|
32
37
|
//# sourceMappingURL=nttWithExecutor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nttWithExecutor.d.ts","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,SAAS,EACT,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEf,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAa,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"nttWithExecutor.d.ts","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,SAAS,EACT,mBAAmB,EACpB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,SAAS,EAEf,MAAM,8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AAC,CAAC,EACjB,UAAU,GAAE,OAAe,GAC1B,cAAc,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAyG5C,OAAO,CAAC,aAAa;YAWN,eAAe;IAuBxB,2BAA2B,CAC/B,SAAS,EAAE,YAAY,GAAG,SAAS,GAClC,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAMnD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAET;AAED,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS,GACf,OAAO,CAIT"}
|
|
@@ -2,6 +2,7 @@ import { nativeChainIds, toChainId, } from "@wormhole-foundation/sdk-base";
|
|
|
2
2
|
import { Ntt } from "@wormhole-foundation/sdk-definitions-ntt";
|
|
3
3
|
import { EvmPlatform, EvmAddress, } from "@wormhole-foundation/sdk-evm";
|
|
4
4
|
import { Interface } from "ethers";
|
|
5
|
+
import { DEFAULT_EXECUTOR_GAS_LIMIT, executorGasLimitOverrides, } from "./executorGasLimits.js";
|
|
5
6
|
const nttManagerWithExecutorAddresses = {
|
|
6
7
|
Mainnet: {
|
|
7
8
|
Arbitrum: "0x5029a23E0EE11f6c9120EAb7eB48a94a49907EC4",
|
|
@@ -48,26 +49,22 @@ const nttManagerWithExecutorAddresses = {
|
|
|
48
49
|
ZeroGravity: "0x69BeC29e71711B30F58585C0bb1622e7b47e3707",
|
|
49
50
|
},
|
|
50
51
|
};
|
|
51
|
-
|
|
52
|
-
// to avoid relay failures. However, they should not be too high to reduce the
|
|
53
|
-
// `estimatedCost` returned by the quote endpoint.
|
|
54
|
-
const gasLimitOverrides = {
|
|
52
|
+
const nttManagerWithExecutorWithTokenAddresses = {
|
|
55
53
|
Mainnet: {
|
|
56
|
-
|
|
57
|
-
CreditCoin: 1500000n,
|
|
58
|
-
Monad: 1000000n,
|
|
59
|
-
MegaETH: 1000000n,
|
|
60
|
-
Seievm: 1000000n,
|
|
54
|
+
Tempo: "0x46d59af07A35751Deb45EC778150C7f0dFbb3d3a",
|
|
61
55
|
},
|
|
62
56
|
Testnet: {
|
|
63
|
-
|
|
64
|
-
Seievm: 1000000n,
|
|
57
|
+
Tempo: "0x3A91179E506A15ff91467e42f5B4bD4239c6eC68",
|
|
65
58
|
},
|
|
66
59
|
};
|
|
67
60
|
export const nttWithExecutorAbi = [
|
|
68
61
|
"function transfer(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
69
62
|
"function transferETH(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
70
63
|
];
|
|
64
|
+
export const nttWithExecutorWithTokenAbi = [
|
|
65
|
+
"function transfer(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, uint256 amount, address srcToken, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
66
|
+
"function transferETH(address nttManager, uint256 amount, uint16 recipientChain, bytes32 recipientAddress, bytes32 refundAddress, bytes encodedInstructions, (uint256 value, uint256 amount, address srcToken, address refundAddress, bytes signedQuote, bytes instructions) executorArgs, (uint256 transferTokenFee, uint256 nativeTokenFee, address payee) feeArgs) external payable returns (uint64 msgId)",
|
|
67
|
+
];
|
|
71
68
|
export class EvmNttWithExecutor {
|
|
72
69
|
network;
|
|
73
70
|
chain;
|
|
@@ -75,16 +72,17 @@ export class EvmNttWithExecutor {
|
|
|
75
72
|
contracts;
|
|
76
73
|
chainId;
|
|
77
74
|
executorAddress;
|
|
75
|
+
executorWithTokenAddress;
|
|
78
76
|
constructor(network, chain, provider, contracts) {
|
|
79
77
|
this.network = network;
|
|
80
78
|
this.chain = chain;
|
|
81
79
|
this.provider = provider;
|
|
82
80
|
this.contracts = contracts;
|
|
83
81
|
this.chainId = nativeChainIds.networkChainToNativeChainId.get(network, chain);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
82
|
+
this.executorAddress =
|
|
83
|
+
nttManagerWithExecutorAddresses[this.network]?.[this.chain];
|
|
84
|
+
this.executorWithTokenAddress =
|
|
85
|
+
nttManagerWithExecutorWithTokenAddresses[this.network]?.[this.chain];
|
|
88
86
|
}
|
|
89
87
|
static async fromRpc(provider, config) {
|
|
90
88
|
const [network, chain] = await EvmPlatform.chainFromRpc(provider);
|
|
@@ -93,16 +91,44 @@ export class EvmNttWithExecutor {
|
|
|
93
91
|
throw new Error(`Network mismatch: ${conf.network} != ${network}`);
|
|
94
92
|
return new EvmNttWithExecutor(network, chain, provider, conf.contracts);
|
|
95
93
|
}
|
|
94
|
+
requireShimAddress(quote) {
|
|
95
|
+
if (quote.feeToken) {
|
|
96
|
+
if (!this.executorWithTokenAddress) {
|
|
97
|
+
throw new Error(`NttManagerWithExecutorWithToken address not found for chain ${this.chain}`);
|
|
98
|
+
}
|
|
99
|
+
return this.executorWithTokenAddress;
|
|
100
|
+
}
|
|
101
|
+
if (!this.executorAddress) {
|
|
102
|
+
throw new Error(`Executor address not found for chain ${this.chain}`);
|
|
103
|
+
}
|
|
104
|
+
return this.executorAddress;
|
|
105
|
+
}
|
|
96
106
|
async *transfer(sender, destination, amount, quote, ntt, wrapNative = false) {
|
|
107
|
+
const shimAddress = this.requireShimAddress(quote);
|
|
97
108
|
const senderAddress = new EvmAddress(sender).toString();
|
|
98
109
|
const deliveryPrice = await ntt.quoteDeliveryPrice(destination.chain, {
|
|
99
110
|
queue: false,
|
|
100
111
|
automatic: false,
|
|
101
112
|
});
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
113
|
+
const isTokenFee = quote.feeToken !== undefined;
|
|
114
|
+
const iface = new Interface(isTokenFee ? nttWithExecutorWithTokenAbi : nttWithExecutorAbi);
|
|
115
|
+
// executorArgs.value = native forwarded to the Executor: estimatedCost on
|
|
116
|
+
// the native-fee path, 0 on the token-fee path (the fee is pulled as ERC20).
|
|
117
|
+
const executorArgs = isTokenFee
|
|
118
|
+
? {
|
|
119
|
+
value: 0n,
|
|
120
|
+
amount: quote.estimatedCost,
|
|
121
|
+
srcToken: quote.feeToken,
|
|
122
|
+
refundAddress: senderAddress,
|
|
123
|
+
signedQuote: quote.signedQuote,
|
|
124
|
+
instructions: quote.relayInstructions,
|
|
125
|
+
}
|
|
126
|
+
: {
|
|
127
|
+
value: quote.estimatedCost,
|
|
128
|
+
refundAddress: senderAddress,
|
|
129
|
+
signedQuote: quote.signedQuote,
|
|
130
|
+
instructions: quote.relayInstructions,
|
|
131
|
+
};
|
|
106
132
|
const commonArgs = [
|
|
107
133
|
ntt.managerAddress,
|
|
108
134
|
quote.remainingAmount,
|
|
@@ -110,20 +136,21 @@ export class EvmNttWithExecutor {
|
|
|
110
136
|
destination.address.toUniversalAddress().toUint8Array(),
|
|
111
137
|
sender.toUniversalAddress().toUint8Array(),
|
|
112
138
|
Ntt.encodeTransceiverInstructions(ntt.encodeOptions({ queue: false, automatic: false })),
|
|
113
|
-
|
|
114
|
-
value: quote.estimatedCost,
|
|
115
|
-
refundAddress: senderAddress,
|
|
116
|
-
signedQuote: quote.signedQuote,
|
|
117
|
-
instructions: quote.relayInstructions,
|
|
118
|
-
},
|
|
139
|
+
executorArgs,
|
|
119
140
|
];
|
|
141
|
+
// Merge into one approval when feeToken == bridged token (non-wrap only).
|
|
142
|
+
const sameTokenAsFee = isTokenFee &&
|
|
143
|
+
quote.feeToken.toLowerCase() === ntt.tokenAddress.toLowerCase();
|
|
144
|
+
const mergeFeeIntoBridgedApproval = sameTokenAsFee && !wrapNative;
|
|
145
|
+
if (isTokenFee && !mergeFeeIntoBridgedApproval) {
|
|
146
|
+
yield* this.approveIfNeeded(senderAddress, shimAddress, quote.feeToken, quote.estimatedCost, ntt);
|
|
147
|
+
}
|
|
120
148
|
let data;
|
|
121
149
|
let msgValue;
|
|
122
150
|
if (wrapNative) {
|
|
123
|
-
// The source token is native gas,
|
|
124
|
-
// transferTokenFee as ERC20
|
|
125
|
-
//
|
|
126
|
-
// referrer is paid out of msg.value directly.
|
|
151
|
+
// The source token is native gas, deposited into WETH by the shim, so
|
|
152
|
+
// transferTokenFee can't be pulled as ERC20. Fold it into nativeTokenFee
|
|
153
|
+
// (same units) — the referrer is paid out of msg.value directly.
|
|
127
154
|
const combinedNativeFee = quote.nativeTokenFee + quote.transferTokenFee;
|
|
128
155
|
const feeArgs = {
|
|
129
156
|
transferTokenFee: 0n,
|
|
@@ -132,8 +159,8 @@ export class EvmNttWithExecutor {
|
|
|
132
159
|
};
|
|
133
160
|
data = iface.encodeFunctionData("transferETH", [...commonArgs, feeArgs]);
|
|
134
161
|
msgValue =
|
|
135
|
-
|
|
136
|
-
|
|
162
|
+
deliveryPrice +
|
|
163
|
+
executorArgs.value +
|
|
137
164
|
combinedNativeFee +
|
|
138
165
|
quote.remainingAmount;
|
|
139
166
|
}
|
|
@@ -143,22 +170,36 @@ export class EvmNttWithExecutor {
|
|
|
143
170
|
nativeTokenFee: quote.nativeTokenFee,
|
|
144
171
|
payee: quote.referrer.address.toString(),
|
|
145
172
|
};
|
|
146
|
-
|
|
173
|
+
const bridgedApprovalAmount = quote.remainingAmount +
|
|
174
|
+
quote.transferTokenFee +
|
|
175
|
+
(mergeFeeIntoBridgedApproval ? quote.estimatedCost : 0n);
|
|
176
|
+
yield* this.approveIfNeeded(senderAddress, shimAddress, ntt.tokenAddress, bridgedApprovalAmount, ntt);
|
|
147
177
|
data = iface.encodeFunctionData("transfer", [...commonArgs, feeArgs]);
|
|
148
|
-
msgValue =
|
|
178
|
+
msgValue = deliveryPrice + executorArgs.value + quote.nativeTokenFee;
|
|
149
179
|
}
|
|
150
|
-
yield ntt.createUnsignedTx({ to:
|
|
180
|
+
yield ntt.createUnsignedTx({ to: shimAddress, data, value: msgValue }, this.txDescription(isTokenFee, wrapNative));
|
|
151
181
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
182
|
+
txDescription(isTokenFee, wrapNative) {
|
|
183
|
+
if (isTokenFee) {
|
|
184
|
+
return wrapNative
|
|
185
|
+
? "NttWithExecutorWithToken.transferETH"
|
|
186
|
+
: "NttWithExecutorWithToken.transfer";
|
|
187
|
+
}
|
|
188
|
+
return wrapNative
|
|
189
|
+
? "NttWithExecutor.transferETH"
|
|
190
|
+
: "NttWithExecutor.transfer";
|
|
191
|
+
}
|
|
192
|
+
async *approveIfNeeded(senderAddress, spender, tokenAddress, requiredAmount, ntt) {
|
|
193
|
+
const tokenContract = EvmPlatform.getTokenImplementation(this.provider, tokenAddress);
|
|
194
|
+
const allowance = await tokenContract.allowance(senderAddress, spender);
|
|
155
195
|
if (allowance < requiredAmount) {
|
|
156
|
-
const txReq = await tokenContract.approve.populateTransaction(
|
|
196
|
+
const txReq = await tokenContract.approve.populateTransaction(spender, requiredAmount);
|
|
157
197
|
yield ntt.createUnsignedTx(txReq, "Ntt.Approve");
|
|
158
198
|
}
|
|
159
199
|
}
|
|
160
200
|
async estimateMsgValueAndGasLimit(recipient) {
|
|
161
|
-
const gasLimit =
|
|
201
|
+
const gasLimit = executorGasLimitOverrides[this.network]?.[this.chain] ??
|
|
202
|
+
DEFAULT_EXECUTOR_GAS_LIMIT;
|
|
162
203
|
return { msgValue: 0n, gasLimit };
|
|
163
204
|
}
|
|
164
205
|
}
|
|
@@ -168,4 +209,7 @@ export class EvmNttWithExecutor {
|
|
|
168
209
|
export function hasExecutorDeployed(network, chain) {
|
|
169
210
|
return nttManagerWithExecutorAddresses[network]?.[chain] !== undefined;
|
|
170
211
|
}
|
|
212
|
+
export function hasExecutorWithTokenDeployed(network, chain) {
|
|
213
|
+
return (nttManagerWithExecutorWithTokenAddresses[network]?.[chain] !== undefined);
|
|
214
|
+
}
|
|
171
215
|
//# sourceMappingURL=nttWithExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nttWithExecutor.js","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,GAEV,MAAM,+BAA+B,CAAC;AAQvC,OAAO,EAAE,GAAG,EAAmB,MAAM,0CAA0C,CAAC;AAChF,OAAO,EACL,WAAW,EAGX,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAY,SAAS,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"nttWithExecutor.js","sourceRoot":"","sources":["../../src/nttWithExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,GAEV,MAAM,+BAA+B,CAAC;AAQvC,OAAO,EAAE,GAAG,EAAmB,MAAM,0CAA0C,CAAC;AAChF,OAAO,EACL,WAAW,EAGX,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAY,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE7C,OAAO,EACL,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,wBAAwB,CAAC;AAEhC,MAAM,+BAA+B,GAEjC;IACF,OAAO,EAAE;QACP,QAAQ,EAAE,4CAA4C;QACtD,SAAS,EAAE,4CAA4C;QACvD,IAAI,EAAE,4CAA4C;QAClD,SAAS,EAAE,4CAA4C;QACvD,GAAG,EAAE,4CAA4C;QACjD,IAAI,EAAE,4CAA4C;QAClD,UAAU,EAAE,4CAA4C;QACxD,QAAQ,EAAE,4CAA4C;QAC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
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/wormhole-foundation/native-token-transfers.git"
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prettier": "prettier --write ./src ./__tests__"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@wormhole-foundation/sdk-definitions-ntt": "6.
|
|
49
|
+
"@wormhole-foundation/sdk-definitions-ntt": "6.1.0",
|
|
50
50
|
"ethers": "^6.5.1"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|