diff --git a/package.json b/package.json index 732c115..8315b5e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@layerzerolabs/ua-utils", - "version": "0.0.21", + "version": "0.0.23", "repository": "https://github.com/LayerZero-Labs/ua-utils.git", "license": "MIT", "main": "dist/index.js", diff --git a/src/utils/crossChainHelper.ts b/src/utils/crossChainHelper.ts index 2a40843..4374ec3 100644 --- a/src/utils/crossChainHelper.ts +++ b/src/utils/crossChainHelper.ts @@ -255,19 +255,23 @@ export const executeGnosisTransactions = async (hre: any, network: string, gnosi signerOrProvider: signer, }); - const safeSdk: Safe = await Safe.create({ ethAdapter, safeAddress, ...(!!contractNetworks && contractNetworks)}); + const safeSdk: Safe = await Safe.create({ ethAdapter, safeAddress, ...(!!contractNetworks && { contractNetworks })}); const gnosisTransactions = transactions.map((tx) => ({ to: tx.contractAddress, data: tx.calldata!, value: "0" })); - const nonce = await safeService.getNextNonce(safeAddress); - const safeTransaction = await safeSdk.createTransaction(gnosisTransactions, { nonce }); - - await safeSdk.signTransaction(safeTransaction); - const safeTxHash = await safeSdk.getTransactionHash(safeTransaction); - await safeService.proposeTransaction({ - safeAddress, - safeTransaction, - safeTxHash, - senderAddress: signer.address, - }); + if (gnosisTransactions.length > 0) { + const nonce = await safeService.getNextNonce(safeAddress); + const safeTransaction = await safeSdk.createTransaction(gnosisTransactions, { nonce }); + + await safeSdk.signTransaction(safeTransaction); + const safeTxHash = await safeSdk.getTransactionHash(safeTransaction); + await safeService.proposeTransaction({ + safeAddress, + safeTransaction, + safeTxHash, + senderAddress: signer.address, + }); + } else { + console.log(`No transactions to submit for ${network}`); + } } export const getDeploymentAddresses = (network: string, throwIfMissing: boolean = true): any => { diff --git a/src/utils/gnosis.ts b/src/utils/gnosis.ts index e561139..3d3a0ff 100644 --- a/src/utils/gnosis.ts +++ b/src/utils/gnosis.ts @@ -15,7 +15,7 @@ type SafeConfig = { * Contract addresses for each network. */ type ContractNetworks = { - [chainListId: number]: { + [chainListId: string]: { multiSendAddress: string safeMasterCopyAddress: string safeProxyFactoryAddress: string