From 68bd06e337b8aee80af2ae90051e118fe76290d9 Mon Sep 17 00:00:00 2001 From: Muhammad Usman Date: Wed, 18 Dec 2024 16:44:12 +0500 Subject: [PATCH 1/3] fix(config): replace llama rpcs --- src/factory/config.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/factory/config.ts b/src/factory/config.ts index 48ad3419f..747035f0d 100644 --- a/src/factory/config.ts +++ b/src/factory/config.ts @@ -190,7 +190,7 @@ export namespace ChainFactoryConfigs { return { bscParams: { identifier: Chain.BSC, - provider: new JsonRpcProvider("https://binance.llamarpc.com"), + provider: new JsonRpcProvider("https://rpc.ankr.com/bsc"), bridge: ethers.getAddress("0x289FDdDce5119C41B82C969135212061D5E7Dce5"), royaltySalePrice: 10000, storage, @@ -204,7 +204,7 @@ export namespace ChainFactoryConfigs { }, baseParams: { identifier: Chain.BASE, - provider: new JsonRpcProvider("https://base.llamarpc.com"), + provider: new JsonRpcProvider("https://base.meowrpc.com/"), bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), royaltySalePrice: 10000, storage, @@ -293,7 +293,9 @@ export namespace ChainFactoryConfigs { ethParams: { bridge: ethers.getAddress("0x4B2A837613bA45C734439155CC7030c79095a2ed"), identifier: "ETHEREUM", - provider: new JsonRpcProvider("https://eth.llamarpc.com"), + provider: new JsonRpcProvider( + "https://gateway.tenderly.co/public/mainnet", + ), royaltySalePrice: 10000, storage, }, From 95a144384922f49a084925185ae96a40d3ae2aca Mon Sep 17 00:00:00 2001 From: Muhammad Usman Date: Thu, 19 Dec 2024 12:00:20 +0500 Subject: [PATCH 2/3] fix(storage): get nft signatures from old contract if not found in new storage --- src/factory/config.ts | 558 ++++++++++++++++++++----------------- src/factory/factory.ts | 14 +- src/factory/types/utils.ts | 6 + 3 files changed, 321 insertions(+), 257 deletions(-) diff --git a/src/factory/config.ts b/src/factory/config.ts index 13325d5fb..7829ae540 100644 --- a/src/factory/config.ts +++ b/src/factory/config.ts @@ -9,7 +9,10 @@ import { Framework } from "@vechain/connex-framework"; import * as thor from "@vechain/web3-providers-connex"; import { BrowserProvider, JsonRpcProvider, ethers } from "ethers"; import { SecretNetworkClient } from "secretjs"; -import { BridgeStorage__factory } from "../contractsTypes/evm"; +import { + type BridgeStorage, + BridgeStorage__factory, +} from "../contractsTypes/evm"; import type { TAptosParams } from "../handlers/aptos/types"; import type { TCasperParams } from "../handlers/casper/types"; import type { TCosmWasmParams } from "../handlers/cosmwasm/types"; @@ -45,6 +48,11 @@ export interface TChainParams { vechainParams: TEvmParams; } +export interface IBridgeConfig { + bridgeChains: Partial; + oldStorage: BridgeStorage; +} + export namespace ChainFactoryConfigs { export async function TestNet() { const skale = new JsonRpcProvider( @@ -54,129 +62,146 @@ export namespace ChainFactoryConfigs { "0x8184bCDC0a4C24D1cB8e054E389660B5b7160186", skale, ); + const oldStorage = BridgeStorage__factory.connect( + "0x8184bCDC0a4C24D1cB8e054E389660B5b7160186", + skale, + ); const net = new SimpleNet("https://sync-testnet.veblocks.net"); const driver = await Driver.connect(net); const connexObj = new Framework(driver); return { - bscParams: { - identifier: Chain.BSC, - provider: new JsonRpcProvider("https://bsc-testnet.publicnode.com"), - bridge: ethers.getAddress("0xA86704500C991a5C1976756Ee3f458d59240A6cE"), - royaltySalePrice: 10000, - storage, - }, - hederaParams: { - identifier: Chain.HEDERA, - bridge: ethers.getAddress("0x0C687Dc235f8e461441d69Dc6aD123EAe7401744"), - bridgeContractId: "0.0.5273403", - provider: new JsonRpcProvider("https://testnet.hashio.io/api"), - royaltySalePrice: 10000, - storage, - royaltyProxy: "0xFdDEEbDf5F2e959A1637Cb130cE753d42083a2EA", - mirrorNodeApi: "https://testnet.mirrornode.hedera.com/api", - }, - tonParams: { - identifier: Chain.TON, - bridgeAddress: "kQCHrjSTU6W7XYUfJgwr_trmG3QL_llPJfPyXPmINYznrkh6", - client: new TonClient({ - endpoint: - "https://testnet.toncenter.com/api/v2/jsonRPC?api_key=f3f6ef64352ac53cdfca18a3ba5372983e4037182c2b510fc52de5a259ecf292", - }), - storage, - }, - moonbeamParams: { - bridge: ethers.getAddress("0x4144b9255B45691E1Cc9BEdE04726b26ebd6C90A"), - identifier: "MOONBEAM", - provider: new JsonRpcProvider( - "https://rpc.api.moonbase.moonbeam.network", - ), - royaltySalePrice: 10000, - storage, - }, - secretParams: { - bridge: "secret13kgatwt6cachvy2v9n7lkkwewq9qhvphynuns3", - bridgeCodeHash: "", - chainId: "secret-4", - identifier: "SECRET", - nftCodeId: 2075, - provider: new SecretNetworkClient({ + bridgeChains: { + bscParams: { + identifier: Chain.BSC, + provider: new JsonRpcProvider("https://bsc-testnet.publicnode.com"), + bridge: ethers.getAddress( + "0xA86704500C991a5C1976756Ee3f458d59240A6cE", + ), + royaltySalePrice: 10000, + storage, + }, + hederaParams: { + identifier: Chain.HEDERA, + bridge: ethers.getAddress( + "0x0C687Dc235f8e461441d69Dc6aD123EAe7401744", + ), + bridgeContractId: "0.0.5273403", + provider: new JsonRpcProvider("https://testnet.hashio.io/api"), + royaltySalePrice: 10000, + storage, + royaltyProxy: "0xFdDEEbDf5F2e959A1637Cb130cE753d42083a2EA", + mirrorNodeApi: "https://testnet.mirrornode.hedera.com/api", + }, + tonParams: { + identifier: Chain.TON, + bridgeAddress: "kQCHrjSTU6W7XYUfJgwr_trmG3QL_llPJfPyXPmINYznrkh6", + client: new TonClient({ + endpoint: + "https://testnet.toncenter.com/api/v2/jsonRPC?api_key=f3f6ef64352ac53cdfca18a3ba5372983e4037182c2b510fc52de5a259ecf292", + }), + storage, + }, + moonbeamParams: { + bridge: ethers.getAddress( + "0x4144b9255B45691E1Cc9BEdE04726b26ebd6C90A", + ), + identifier: "MOONBEAM", + provider: new JsonRpcProvider( + "https://rpc.api.moonbase.moonbeam.network", + ), + royaltySalePrice: 10000, + storage, + }, + secretParams: { + bridge: "secret13kgatwt6cachvy2v9n7lkkwewq9qhvphynuns3", + bridgeCodeHash: "", chainId: "secret-4", - url: "https://rpc.ankr.com/http/scrt_cosmos", - }), - storage, - }, - tezosParams: { - bridge: "KT1CFXpeB7RPAvzgGAVBkKZ5fXsAB61h72rs", - identifier: "TEZOS", - storage, - Tezos: new TezosToolkit("https://ghostnet.ecadinfra.com"), - tzktApi: "https://api.ghostnet.tzkt.io/", - }, - multiversxParams: { - bridge: - "erd1qqqqqqqqqqqqqpgq4tfugv4aks67l6ggh2zs0xuxk7d00x4ttxsqud4vpp", - chainId: "D", - identifier: "MULTIVERSX", - gatewayURL: "https://devnet-gateway.multiversx.com", - provider: new ProxyNetworkProvider( - "https://devnet-gateway.multiversx.com", - ), - storage, - }, - icpParams: { - agent: new HttpAgent({ - host: "https://tools.xp.network", - }), - bridge: Principal.fromText("bw4dl-smaaa-aaaaa-qaacq-cai"), - identifier: "ICP", - storage, - }, - nearParams: { - bridge: "xp-bridge-test.testnet", - networkId: "testnet", - nodeUrl: "https://archival-rpc.testnet.near.org", - identifier: "NEAR", - storage, - }, - blastParams: { - identifier: Chain.BLAST, - provider: new JsonRpcProvider( - "https://blast-sepolia.blockpi.network/v1/rpc/public", - ), - bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), - royaltySalePrice: 10000, - storage, - }, - aptosParams: { - bridge: - "68c508b1b20701c8ddecbbc8e603e788be96c1dcb6ccdcf43ac8594f6f49077a", - identifier: "APTOS", - network: Network.TESTNET, - storage, - }, - casperParams: { - bridge: - "hash-047ddacdb2d4c44b3d0d6c02341ff96e951409d30d4627d7b580db46743a6111", - identifier: Chain.CASPER, - network: "casper-test", - rpc: "https://rpc.testnet.casperlabs.io/rpc", - storage, - proxy_url: "https://sheltered-crag-76748.herokuapp.com/", - }, - vechainParams: { - identifier: Chain.VECHAIN, - provider: new BrowserProvider( - new thor.Provider({ - connex: connexObj, - net, + identifier: "SECRET", + nftCodeId: 2075, + provider: new SecretNetworkClient({ + chainId: "secret-4", + url: "https://rpc.ankr.com/http/scrt_cosmos", }), - ), - bridge: ethers.getAddress("0x7111eb5f8d9dA472e9608f2ab3De275C040D60B2"), - royaltySalePrice: 10000, - storage, + storage, + }, + tezosParams: { + bridge: "KT1CFXpeB7RPAvzgGAVBkKZ5fXsAB61h72rs", + identifier: "TEZOS", + storage, + Tezos: new TezosToolkit("https://ghostnet.ecadinfra.com"), + tzktApi: "https://api.ghostnet.tzkt.io/", + }, + multiversxParams: { + bridge: + "erd1qqqqqqqqqqqqqpgq4tfugv4aks67l6ggh2zs0xuxk7d00x4ttxsqud4vpp", + chainId: "D", + identifier: "MULTIVERSX", + gatewayURL: "https://devnet-gateway.multiversx.com", + provider: new ProxyNetworkProvider( + "https://devnet-gateway.multiversx.com", + ), + storage, + }, + icpParams: { + agent: new HttpAgent({ + host: "https://tools.xp.network", + }), + bridge: Principal.fromText("bw4dl-smaaa-aaaaa-qaacq-cai"), + identifier: "ICP", + storage, + }, + nearParams: { + bridge: "xp-bridge-test.testnet", + networkId: "testnet", + nodeUrl: "https://archival-rpc.testnet.near.org", + identifier: "NEAR", + storage, + }, + blastParams: { + identifier: Chain.BLAST, + provider: new JsonRpcProvider( + "https://blast-sepolia.blockpi.network/v1/rpc/public", + ), + bridge: ethers.getAddress( + "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83", + ), + royaltySalePrice: 10000, + storage, + }, + aptosParams: { + bridge: + "68c508b1b20701c8ddecbbc8e603e788be96c1dcb6ccdcf43ac8594f6f49077a", + identifier: "APTOS", + network: Network.TESTNET, + storage, + }, + casperParams: { + bridge: + "hash-047ddacdb2d4c44b3d0d6c02341ff96e951409d30d4627d7b580db46743a6111", + identifier: Chain.CASPER, + network: "casper-test", + rpc: "https://rpc.testnet.casperlabs.io/rpc", + storage, + proxy_url: "https://sheltered-crag-76748.herokuapp.com/", + }, + vechainParams: { + identifier: Chain.VECHAIN, + provider: new BrowserProvider( + new thor.Provider({ + connex: connexObj, + net, + }), + ), + bridge: ethers.getAddress( + "0x7111eb5f8d9dA472e9608f2ab3De275C040D60B2", + ), + royaltySalePrice: 10000, + storage, + }, }, - } satisfies Partial; + oldStorage, + } satisfies IBridgeConfig; } export function MainNet() { @@ -184,149 +209,174 @@ export namespace ChainFactoryConfigs { "https://optimism-mainnet.public.blastapi.io", ); const storage = BridgeStorage__factory.connect( + "0x6fF8599f69B50Fbb906bD8b86Db512F431C34461", + optimism, + ); + const oldStorage = BridgeStorage__factory.connect( "0xc6e84955ba7C354fb7ca60011883e5673Be3F629", optimism, ); return { - bscParams: { - identifier: Chain.BSC, - provider: new JsonRpcProvider("https://rpc.ankr.com/bsc"), - bridge: ethers.getAddress("0x289FDdDce5119C41B82C969135212061D5E7Dce5"), - royaltySalePrice: 10000, - storage, - }, - maticParams: { - identifier: Chain.MATIC, - provider: new JsonRpcProvider("https://polygon-pokt.nodies.app"), - bridge: ethers.getAddress("0x2011DAD5caE280243d075D12a38CcCc0Fb4412dE"), - royaltySalePrice: 10000, - storage, - }, - baseParams: { - identifier: Chain.BASE, - provider: new JsonRpcProvider("https://base.meowrpc.com/"), - bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), - royaltySalePrice: 10000, - storage, - }, - hederaParams: { - identifier: Chain.HEDERA, - bridge: ethers.getAddress("0x0000000000000000000000000000000000786484"), - bridgeContractId: "0.0.7890052", - provider: new JsonRpcProvider("https://mainnet.hashio.io/api"), - royaltySalePrice: 10000, - storage, - royaltyProxy: "0x97fec8ed7203ea3ce58e2a4f44056fd954a35be4", - mirrorNodeApi: "https://mainnet.mirrornode.hedera.com/api", - }, - tonParams: { - identifier: Chain.TON, - bridgeAddress: "EQDn9dWuVp18AMnFc7yrEx6TxDwrbFI8FZYElkY7Exe1QcQO", - client: new TonClient({ - endpoint: - "https://toncenter.com/api/v2/jsonRPC?api_key=78b6f2e7cbe2900dd39ab51a3f8fe3090154973343929991ed9b4f63fbeb45a5", - }), - storage, - }, - tezosParams: { - bridge: "KT1NDDHcQeSTEEU7euxpjLbQuKuZkMArp7W4", - identifier: Chain.TEZOS, - storage, - Tezos: new TezosToolkit("https://mainnet.ecadinfra.com"), - tzktApi: "https://api.tzkt.io/", - }, - icpParams: { - agent: new HttpAgent({ - host: "https://ic0.app", - }), - bridge: Principal.fromText("6gfde-pqaaa-aaaal-al76q-cai"), - identifier: "ICP", - storage, - }, - terraParams: { - bridge: - "terra1sryye399v0wrq5aap0s9jlqn9s6wm34gmd27pnlmceghd9qsgyqsugalra", - chainId: "pisco-1", - denom: "uluna", - identifier: "TERRA", - nftCodeId: 14213, - rpc: "https://rpc.testcosmos.directory/terra2testnet", - storage, - }, - multiversxParams: { - bridge: - "erd1qqqqqqqqqqqqqpgqmads3ruz3ywdq47a2whdgwsxdvtgut84txsqnuwr6c", - chainId: "1", - identifier: "MULTIVERSX", - gatewayURL: "https://gateway.multiversx.com", - provider: new ProxyNetworkProvider("https://gateway.multiversx.com"), - storage, - }, - blastParams: { - identifier: Chain.BLAST, - provider: new JsonRpcProvider("https://blast.gateway.tenderly.co"), - bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), - royaltySalePrice: 10000, - storage, - }, - fantomParams: { - identifier: Chain.FANTOM, - provider: new JsonRpcProvider("https://rpc.fantom.network"), - bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), - royaltySalePrice: 10000, - storage, - }, - avaxParams: { - identifier: Chain.AVALANCHE, - provider: new JsonRpcProvider("https://avalanche.public-rpc.com"), - bridge: ethers.getAddress("0x92764FF21a1a8cC4e8eEec43ED04Bea3B76D8fD3"), - royaltySalePrice: 10000, - storage, - }, - moonbeamParams: { - bridge: ethers.getAddress("0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83"), - identifier: "MOONBEAM", - provider: new JsonRpcProvider("https://1rpc.io/glmr"), - royaltySalePrice: 10000, - storage, - }, - ethParams: { - bridge: ethers.getAddress("0x4B2A837613bA45C734439155CC7030c79095a2ed"), - identifier: "ETHEREUM", - provider: new JsonRpcProvider( - "https://gateway.tenderly.co/public/mainnet", - ), - royaltySalePrice: 10000, - storage, - }, - casperParams: { - bridge: - "hash-284d7eeee5d0ece8b0d56cc7162a3cf72e6fabc62946e3a9abae219c646d56c3", - identifier: Chain.CASPER, - network: "casper", - rpc: "http://37.27.69.30:7777/rpc", - storage, - proxy_url: "https://sheltered-crag-76748.herokuapp.com/", - }, - nearParams: { - bridge: "xp-bridge-main.near", - networkId: "mainnet", - nodeUrl: "https://rpc.mainnet.near.org", - identifier: Chain.NEAR, - storage, - }, - secretParams: { - bridge: "secret160da5pcn05xz2nhwudjvcg7rjzs9sc50pdlp0d", - bridgeCodeHash: "", - chainId: "secret-4", - identifier: "SECRET", - nftCodeId: 2075, - provider: new SecretNetworkClient({ + bridgeChains: { + bscParams: { + identifier: Chain.BSC, + provider: new JsonRpcProvider("https://rpc.ankr.com/bsc"), + bridge: ethers.getAddress( + "0x289FDdDce5119C41B82C969135212061D5E7Dce5", + ), + royaltySalePrice: 10000, + storage, + }, + maticParams: { + identifier: Chain.MATIC, + provider: new JsonRpcProvider("https://polygon-pokt.nodies.app"), + bridge: ethers.getAddress( + "0x2011DAD5caE280243d075D12a38CcCc0Fb4412dE", + ), + royaltySalePrice: 10000, + storage, + }, + baseParams: { + identifier: Chain.BASE, + provider: new JsonRpcProvider("https://base.meowrpc.com/"), + bridge: ethers.getAddress( + "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83", + ), + royaltySalePrice: 10000, + storage, + }, + hederaParams: { + identifier: Chain.HEDERA, + bridge: ethers.getAddress( + "0x0000000000000000000000000000000000786484", + ), + bridgeContractId: "0.0.7890052", + provider: new JsonRpcProvider("https://mainnet.hashio.io/api"), + royaltySalePrice: 10000, + storage, + royaltyProxy: "0x97fec8ed7203ea3ce58e2a4f44056fd954a35be4", + mirrorNodeApi: "https://mainnet.mirrornode.hedera.com/api", + }, + tonParams: { + identifier: Chain.TON, + bridgeAddress: "EQDn9dWuVp18AMnFc7yrEx6TxDwrbFI8FZYElkY7Exe1QcQO", + client: new TonClient({ + endpoint: + "https://toncenter.com/api/v2/jsonRPC?api_key=78b6f2e7cbe2900dd39ab51a3f8fe3090154973343929991ed9b4f63fbeb45a5", + }), + storage, + }, + tezosParams: { + bridge: "KT1NDDHcQeSTEEU7euxpjLbQuKuZkMArp7W4", + identifier: Chain.TEZOS, + storage, + Tezos: new TezosToolkit("https://mainnet.ecadinfra.com"), + tzktApi: "https://api.tzkt.io/", + }, + icpParams: { + agent: new HttpAgent({ + host: "https://ic0.app", + }), + bridge: Principal.fromText("6gfde-pqaaa-aaaal-al76q-cai"), + identifier: "ICP", + storage, + }, + terraParams: { + bridge: + "terra1sryye399v0wrq5aap0s9jlqn9s6wm34gmd27pnlmceghd9qsgyqsugalra", + chainId: "pisco-1", + denom: "uluna", + identifier: "TERRA", + nftCodeId: 14213, + rpc: "https://rpc.testcosmos.directory/terra2testnet", + storage, + }, + multiversxParams: { + bridge: + "erd1qqqqqqqqqqqqqpgqmads3ruz3ywdq47a2whdgwsxdvtgut84txsqnuwr6c", + chainId: "1", + identifier: "MULTIVERSX", + gatewayURL: "https://gateway.multiversx.com", + provider: new ProxyNetworkProvider("https://gateway.multiversx.com"), + storage, + }, + blastParams: { + identifier: Chain.BLAST, + provider: new JsonRpcProvider("https://blast.gateway.tenderly.co"), + bridge: ethers.getAddress( + "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83", + ), + royaltySalePrice: 10000, + storage, + }, + fantomParams: { + identifier: Chain.FANTOM, + provider: new JsonRpcProvider("https://rpc.fantom.network"), + bridge: ethers.getAddress( + "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83", + ), + royaltySalePrice: 10000, + storage, + }, + avaxParams: { + identifier: Chain.AVALANCHE, + provider: new JsonRpcProvider("https://avalanche.public-rpc.com"), + bridge: ethers.getAddress( + "0x92764FF21a1a8cC4e8eEec43ED04Bea3B76D8fD3", + ), + royaltySalePrice: 10000, + storage, + }, + moonbeamParams: { + bridge: ethers.getAddress( + "0x2Aa8Dbb7543754d70B5A40D52cB81c2a0bB08B83", + ), + identifier: "MOONBEAM", + provider: new JsonRpcProvider("https://1rpc.io/glmr"), + royaltySalePrice: 10000, + storage, + }, + ethParams: { + bridge: ethers.getAddress( + "0x4B2A837613bA45C734439155CC7030c79095a2ed", + ), + identifier: "ETHEREUM", + provider: new JsonRpcProvider( + "https://gateway.tenderly.co/public/mainnet", + ), + royaltySalePrice: 10000, + storage, + }, + casperParams: { + bridge: + "hash-284d7eeee5d0ece8b0d56cc7162a3cf72e6fabc62946e3a9abae219c646d56c3", + identifier: Chain.CASPER, + network: "casper", + rpc: "http://37.27.69.30:7777/rpc", + storage, + proxy_url: "https://sheltered-crag-76748.herokuapp.com/", + }, + nearParams: { + bridge: "xp-bridge-main.near", + networkId: "mainnet", + nodeUrl: "https://rpc.mainnet.near.org", + identifier: Chain.NEAR, + storage, + }, + secretParams: { + bridge: "secret160da5pcn05xz2nhwudjvcg7rjzs9sc50pdlp0d", + bridgeCodeHash: "", chainId: "secret-4", - url: "https://rpc.ankr.com/http/scrt_cosmos", - }), - storage, + identifier: "SECRET", + nftCodeId: 2075, + provider: new SecretNetworkClient({ + chainId: "secret-4", + url: "https://rpc.ankr.com/http/scrt_cosmos", + }), + storage, + }, }, - } satisfies Partial; + oldStorage, + } satisfies IBridgeConfig; } } diff --git a/src/factory/factory.ts b/src/factory/factory.ts index c00c97f20..4c6b5ed7c 100644 --- a/src/factory/factory.ts +++ b/src/factory/factory.ts @@ -21,7 +21,7 @@ import { convertStringToHexToNumb, fetchHttpOrIpfs, } from "../handlers/utils"; -import type { TChainParams } from "./config"; +import type { IBridgeConfig, TChainParams } from "./config"; export namespace Chain { export const MULTIVERSX = "MULTIVERSX"; @@ -69,8 +69,8 @@ function mapNonceToParams(chainParams: Partial): TParamMap { return cToP; } -export function ChainFactory(cp: Partial): TChainFactory { - const map = mapNonceToParams(cp); +export function ChainFactory(bc: IBridgeConfig): TChainFactory { + const map = mapNonceToParams(bc.bridgeChains); const helpers = new Map>(); return { async lockNft( @@ -198,6 +198,14 @@ export function ChainFactory(cp: Partial): TChainFactory { lockTxChain: chain.identifier, }; }, + async getLockNftSignatures(chain, txHash, from) { + const storageContract = chain.getStorageContract(); + let signatures = await storageContract.getLockNftSignatures(txHash, from); + if (signatures.length === 0) { + signatures = await bc.oldStorage.getLockNftSignatures(txHash, from); + } + return signatures; + }, }; } diff --git a/src/factory/types/utils.ts b/src/factory/types/utils.ts index fdc124722..768bd9628 100644 --- a/src/factory/types/utils.ts +++ b/src/factory/types/utils.ts @@ -1,4 +1,5 @@ import type { MetaMap } from "."; +import type { SignerAndSignatureStruct } from "../../contractsTypes/evm/contracts/BridgeStorage"; import type { TClaimSFT, TGetChainIdentifier, @@ -47,6 +48,11 @@ export type TChainFactory = { metadataUri: string, extraArgs?: ExtraArgs, ) => Promise<{ ret: Ret; hash: () => string }>; + getLockNftSignatures: ( + chain: TGetStorage, + txHash: string, + from: string, + ) => Promise; }; export type TParamMap = { From 00b54ae0920afc38efd9a916ac46e4044241231e Mon Sep 17 00:00:00 2001 From: Muhammad Usman Date: Thu, 19 Dec 2024 15:04:52 +0500 Subject: [PATCH 3/3] fix(storage): update getLockNftSignatures type --- src/factory/types/utils.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/factory/types/utils.ts b/src/factory/types/utils.ts index 768bd9628..d2fde1f31 100644 --- a/src/factory/types/utils.ts +++ b/src/factory/types/utils.ts @@ -1,5 +1,4 @@ import type { MetaMap } from "."; -import type { SignerAndSignatureStruct } from "../../contractsTypes/evm/contracts/BridgeStorage"; import type { TClaimSFT, TGetChainIdentifier, @@ -8,6 +7,7 @@ import type { TLockNFT, TLockSFT, TNftTransferDetailsObject, + TSignerAndSignature, } from "../../handlers/index"; export type TSupportedChain = keyof MetaMap; @@ -52,7 +52,7 @@ export type TChainFactory = { chain: TGetStorage, txHash: string, from: string, - ) => Promise; + ) => Promise; }; export type TParamMap = {