@@ -17,7 +17,7 @@ import { queryPubkey } from "./functions/query/queryPubkey.js";
1717import { arrayify , hexlify , SigningKey , keccak256 , recoverPublicKey , computeAddress } from "ethers/lib/utils.js" ;
1818import { assert } from "console" ;
1919
20- const { secretNunya : { nunyaContractCodeId, nunyaContractAddress, nunyaContractCodeHash } } =
20+ const { chainId : secretChainId , secretNunya : { nunyaContractCodeId, nunyaContractAddress, nunyaContractCodeHash } } =
2121 config . secret . network == "testnet"
2222 ? config . secret . testnet
2323 : config . secret . localhost ;
@@ -30,7 +30,7 @@ if (config.evm.network == "sepolia") {
3030} else {
3131 throw new Error ( `Unsupported network.` )
3232}
33- const { chainId, endpoint, nunyaBusinessContractAddress, gatewayContractAddress, privateKey } = vars ;
33+ const { chainId : evmChainId , endpoint, nunyaBusinessContractAddress, gatewayContractAddress, privateKey } = vars ;
3434
3535const SECRET_ADDRESS = nunyaContractAddress ;
3636const CONTRACT_CODE_HASH = nunyaContractCodeHash ;
@@ -109,10 +109,10 @@ async function unsafeRequestValue() {
109109 // // Data are the calldata/parameters that are passed into the contract
110110 // const data = JSON.stringify({ myArg: "123" });
111111
112- // assert!(chainId .toString() == (await provider.getNetwork()).chainId.toString());
112+ // assert!(evmChainId .toString() == (await provider.getNetwork()).chainId.toString());
113113
114114 // // EVM gateway contract address
115- // // const publicClientAddress = await getPublicClientAddress(chainId );
115+ // // const publicClientAddress = await getPublicClientAddress(evmChainId );
116116 // const publicClientAddress = gatewayContractAddress;
117117
118118 // const callbackAddress = publicClientAddress.toLowerCase();
@@ -130,6 +130,8 @@ async function unsafeRequestValue() {
130130 // callbackGasLimit
131131 // );
132132
133+ // const taskDestinationNetwork = secretChainId;
134+
133135 // // TODO: temporarily skip the below that encrypts the payload until resolve
134136 // // https://github.com/blake-regalia/belt/issues/1
135137 // const {
@@ -147,7 +149,9 @@ async function unsafeRequestValue() {
147149 // handle,
148150 // callbackGasLimit,
149151 // ifaceGateway,
150- // callbackSelector
152+ // callbackSelector,
153+ // taskDestinationNetwork,
154+ // lastNonce,
151155 // );
152156
153157// // TODO - temporary only but remove after resolve
@@ -190,7 +194,7 @@ async function unsafeRequestValue() {
190194// user_key: hexlify(userPublicKeyBytes),
191195// user_pubkey: userPublicKey, // user_pubkey;
192196// routing_code_hash: routing_code_hash,
193- // task_destination_network: chainId ,
197+ // task_destination_network: secretChainId ,
194198// handle: handle,
195199// nonce: hexlify(nextNonce),
196200// payload: hexlify(ciphertext),
@@ -219,31 +223,31 @@ async function unsafeRequestValue() {
219223// let amountOfGas;
220224// let my_gas = 150000;
221225
222- // if (chainId .toString() === "4202") {
226+ // if (evmChainId .toString() === "4202") {
223227// amountOfGas = gasFee.mul(callbackGasLimit).mul(100000).div(2);
224- // } else if (chainId .toString() === "128123") {
228+ // } else if (evmChainId .toString() === "128123") {
225229// amountOfGas = gasFee.mul(callbackGasLimit).mul(1000).div(2);
226230// my_gas = 15000000;
227- // } else if (chainId .toString() === "1287") {
231+ // } else if (evmChainId .toString() === "1287") {
228232// amountOfGas = gasFee.mul(callbackGasLimit).mul(1000).div(2);
229233// my_gas = 15000000;
230- // } else if (chainId .toString() === "300") {
234+ // } else if (evmChainId .toString() === "300") {
231235// amountOfGas = gasFee.mul(callbackGasLimit).mul(100000).div(2);
232236// my_gas = 15000000;
233- // } else if (chainId .toString() === "5003") {
237+ // } else if (evmChainId .toString() === "5003") {
234238// amountOfGas = gasFee.mul(callbackGasLimit).mul(1000000).div(2);
235239// my_gas = 1500000000;
236- // } else if (chainId .toString() === "80002") {
240+ // } else if (evmChainId .toString() === "80002") {
237241// amountOfGas = gasFee.mul(callbackGasLimit).mul(100).div(2);
238242// my_gas = 200000;
239- // } else if (chainId .toString() === "1995") {
243+ // } else if (evmChainId .toString() === "1995") {
240244// amountOfGas = gasFee.mul(callbackGasLimit).mul(100).div(2);
241245// my_gas = 200000;
242- // } else if (chainId .toString() === "713715") {
246+ // } else if (evmChainId .toString() === "713715") {
243247// amountOfGas = gasFee.mul(callbackGasLimit).mul(100).div(2);
244248// my_gas = 200000;
245249// } else {
246- // // Note: Sepolia Ethereum has chainId 11155111
250+ // // Note: Sepolia Ethereum has evmChainId 11155111
247251// amountOfGas = gasFee.mul(callbackGasLimit).mul(3).div(2);
248252// }
249253// // Note: Only if get error `replacement fee too low` then just increase gasPrice by 10%
@@ -259,7 +263,7 @@ async function unsafeRequestValue() {
259263// // from: myAddress,
260264// // value: hexlify(amountOfGas),
261265// // data: functionData,
262- // // chainId: chainId ,
266+ // // chainId: evmChainId ,
263267// // };
264268
265269// // TODO: should the `gasLimit` instead be `hexlify(amountOfGas)`?
@@ -271,7 +275,7 @@ async function unsafeRequestValue() {
271275// gasPrice: hexlify(my_gas),
272276// nonce: nextNonce,
273277// data: functionData,
274- // chainId: chainId ,
278+ // chainId: evmChainId ,
275279// }
276280
277281// const tx = await managedSigner.sendTransaction(tx_params);
0 commit comments