@@ -16,6 +16,8 @@ import {
1616 EvmPlatform ,
1717 EvmPlatformType ,
1818 EvmAddress ,
19+ EvmUnsignedTransaction ,
20+ addChainId ,
1921} from "@wormhole-foundation/sdk-evm" ;
2022import {
2123 Ntt ,
@@ -39,6 +41,7 @@ export class EvmMultiTokenNttWithExecutor<
3941> implements MultiTokenNttWithExecutor < N , C >
4042{
4143 readonly chainId : bigint ;
44+ readonly managerAddress : string ;
4245 readonly multiTokenNttWithExecutorAddress : string ;
4346
4447 constructor (
@@ -52,6 +55,14 @@ export class EvmMultiTokenNttWithExecutor<
5255 chain
5356 ) as bigint ;
5457
58+ const managerAddress = contracts . multiTokenNtt ?. manager ;
59+ if ( ! managerAddress ) {
60+ throw new Error (
61+ `MultiTokenNtt manager address not found for chain ${ chain } on network ${ network } `
62+ ) ;
63+ }
64+ this . managerAddress = managerAddress ;
65+
5566 const multiTokenNttWithExecutorAddress =
5667 multiTokenNttWithExecutorAddresses [ this . network ] ?. [ this . chain ] ;
5768 if ( ! multiTokenNttWithExecutorAddress ) {
@@ -143,7 +154,7 @@ export class EvmMultiTokenNttWithExecutor<
143154
144155 if ( isNativeToken ) {
145156 data = iface . encodeFunctionData ( "transferETH" , [
146- multiTokenNtt . managerAddress ,
157+ this . managerAddress ,
147158 amount ,
148159 recipientChain ,
149160 recipient ,
@@ -172,14 +183,14 @@ export class EvmMultiTokenNttWithExecutor<
172183 amount
173184 ) ;
174185
175- yield multiTokenNtt . createUnsignedTx (
186+ yield this . createUnsignedTx (
176187 approveTx ,
177188 "MultiTokenNttWithExecutor.Approve"
178189 ) ;
179190 }
180191
181192 data = iface . encodeFunctionData ( "transfer" , [
182- multiTokenNtt . managerAddress ,
193+ this . managerAddress ,
183194 tokenAddress ,
184195 amount ,
185196 recipientChain ,
@@ -199,7 +210,7 @@ export class EvmMultiTokenNttWithExecutor<
199210 from : senderAddress ,
200211 } ;
201212
202- yield multiTokenNtt . createUnsignedTx (
213+ yield this . createUnsignedTx (
203214 txReq ,
204215 isNativeToken
205216 ? "MultiTokenNttWithExecutor.transferETH"
@@ -227,4 +238,18 @@ export class EvmMultiTokenNttWithExecutor<
227238 gasLimit,
228239 } ;
229240 }
241+
242+ createUnsignedTx (
243+ txReq : TransactionRequest ,
244+ description : string ,
245+ parallelizable : boolean = false
246+ ) : EvmUnsignedTransaction < N , C > {
247+ return new EvmUnsignedTransaction (
248+ addChainId ( txReq , this . chainId ) ,
249+ this . network ,
250+ this . chain ,
251+ description ,
252+ parallelizable
253+ ) ;
254+ }
230255}
0 commit comments