diff --git a/package.json b/package.json index 542e9a97..c953c483 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,7 @@ "@typescript-eslint/eslint-plugin": "^5.59.9", "@typescript-eslint/parser": "^5.59.9", "@uniswap/v2-core": "^1.0.1", + "@zetachain/protocol-contracts-solana": "2.0.0-rc1", "chai": "^4.2.0", "cpx": "^1.5.0", "eslint": "^8.42.0", @@ -101,7 +102,7 @@ "@uniswap/v2-periphery": "^1.1.0-beta.0", "@zetachain/faucet-cli": "^4.1.1", "@zetachain/networks": "10.0.0-rc3", - "@zetachain/protocol-contracts": "11.0.0-rc3", + "@zetachain/protocol-contracts": "11.0.0-rc4", "axios": "^1.4.0", "bech32": "^2.0.0", "bip39": "^3.1.0", @@ -125,4 +126,4 @@ "ws": "^8.17.1" }, "packageManager": "yarn@1.22.21+sha1.1959a18351b811cdeedbd484a8f86c3cc3bbaf72" -} +} \ No newline at end of file diff --git a/packages/client/src/client.ts b/packages/client/src/client.ts index 2e9102f1..fadace0e 100644 --- a/packages/client/src/client.ts +++ b/packages/client/src/client.ts @@ -2,6 +2,8 @@ import type { Wallet as SolanaWallet } from "@coral-xyz/anchor"; import type { WalletContextState } from "@solana/wallet-adapter-react"; import { PublicKey } from "@solana/web3.js"; import { networks } from "@zetachain/networks"; +import mainnetAddresses from "@zetachain/protocol-contracts/dist/data/addresses.mainnet.json"; +import testnetAddresses from "@zetachain/protocol-contracts/dist/data/addresses.testnet.json"; import type { Signer, Wallet } from "ethers"; import merge from "lodash/merge"; @@ -23,6 +25,7 @@ import { getZRC20GasToken, sendZeta, solanaDeposit, + solanaDepositAndCall, trackCCTX, zetachainCall, zetachainWithdraw, @@ -31,6 +34,7 @@ import { export interface ZetaChainClientParamsBase { chains?: { [key: string]: any }; + contracts?: LocalnetAddress[] | MainnetTestnetAddress[]; network?: string; } @@ -68,6 +72,20 @@ export type ZetaChainClientParams = ZetaChainClientParamsBase & } ); +interface MainnetTestnetAddress { + address: string; + category: string; + chain_id: number; + chain_name: string; + type: string; +} + +interface LocalnetAddress { + address: string; + chain: string; + type: string; +} + export class ZetaChainClient { public chains: { [key: string]: any }; public network: string; @@ -75,6 +93,7 @@ export class ZetaChainClient { public signer: any | undefined; public solanaWallet: SolanaWallet | undefined; public solanaAdapter: WalletContextState | undefined; + private contracts: LocalnetAddress[] | MainnetTestnetAddress[]; /** * Initializes ZetaChainClient instance. @@ -136,6 +155,16 @@ export class ZetaChainClient { this.chains = { ...networks }; this.network = params.network || ""; + if (params.contracts) { + this.contracts = params.contracts; + } else if (this.network === "localnet" || this.network === "localhost") { + throw new Error("Localnet contracts are required"); + } else { + this.contracts = this.network.includes("test") + ? testnetAddresses + : mainnetAddresses; + } + this.mergeChains(params.chains); } @@ -147,6 +176,47 @@ export class ZetaChainClient { }); } + public async getGatewayAddress(): Promise { + if (this.network === "localnet" || this.network === "localhost") { + const gateway = (this.contracts as LocalnetAddress[]).find( + (item) => item.type === "gatewayZEVM" + ); + + if (!gateway) { + throw new Error("Gateway address not found in localnet configuration"); + } + + return gateway.address; + } else { + let gateway; + if (this.wallet) { + try { + const chainId = await this.wallet!.getChainId(); + gateway = (this.contracts as MainnetTestnetAddress[]).find( + (item) => chainId === item.chain_id && item.type === "gateway" + ); + } catch (error) { + throw new Error("Failed to get gateway address: " + error); + } + } else { + try { + const chainId = await this.signer!.getChainId(); + gateway = (this.contracts as MainnetTestnetAddress[]).find( + (item) => chainId === item.chain_id && item.type === "gateway" + ); + } catch (error) { + throw new Error("Failed to get gateway address: " + error); + } + } + + if (!gateway) { + throw new Error(`Gateway address not found in signer or wallet`); + } + + return gateway.address; + } + } + public getChains(): { [key: string]: any } { return this.chains; } @@ -176,6 +246,7 @@ export class ZetaChainClient { getZRC20FromERC20 = getZRC20FromERC20; getZRC20GasToken = getZRC20GasToken; solanaDeposit = solanaDeposit; + solanaDepositAndCall = solanaDepositAndCall; zetachainWithdrawAndCall = zetachainWithdrawAndCall; zetachainWithdraw = zetachainWithdraw; zetachainCall = zetachainCall; diff --git a/packages/client/src/evmCall.ts b/packages/client/src/evmCall.ts index b2b5f4f4..53894f6f 100644 --- a/packages/client/src/evmCall.ts +++ b/packages/client/src/evmCall.ts @@ -24,7 +24,7 @@ import type { revertOptions, txOptions } from "./types"; export const evmCall = async function ( this: ZetaChainClient, args: { - gatewayEvm: string; + gatewayEvm?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -34,7 +34,12 @@ export const evmCall = async function ( ) { const signer = this.signer; const { utils } = ethers; - const gateway = new ethers.Contract(args.gatewayEvm, GatewayABI.abi, signer); + const gatewayEvmAddress = args.gatewayEvm || (await this.getGatewayAddress()); + const gateway = new ethers.Contract( + gatewayEvmAddress, + GatewayABI.abi, + signer + ); const valuesArray = args.values.map((value, index) => { const type = args.types[index]; diff --git a/packages/client/src/evmDeposit.ts b/packages/client/src/evmDeposit.ts index 75111d67..ff2ae1ad 100644 --- a/packages/client/src/evmDeposit.ts +++ b/packages/client/src/evmDeposit.ts @@ -27,7 +27,7 @@ export const evmDeposit = async function ( args: { amount: string; erc20: string; - gatewayEvm: string; + gatewayEvm?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -35,7 +35,12 @@ export const evmDeposit = async function ( ) { const signer = this.signer; const { utils } = ethers; - const gateway = new ethers.Contract(args.gatewayEvm, GatewayABI.abi, signer); + const gatewayEvmAddress = args.gatewayEvm || (await this.getGatewayAddress()); + const gateway = new ethers.Contract( + gatewayEvmAddress, + GatewayABI.abi, + signer + ); const revertOptions = { abortAddress: "0x0000000000000000000000000000000000000000", // not used @@ -61,7 +66,7 @@ export const evmDeposit = async function ( ); const decimals = await erc20Contract.decimals(); const value = utils.parseUnits(args.amount, decimals); - await erc20Contract.connect(signer).approve(args.gatewayEvm, value); + await erc20Contract.connect(signer).approve(gatewayEvmAddress, value); const method = "deposit(address,uint256,address,(address,bool,address,bytes,uint256))"; tx = await gateway[method]( diff --git a/packages/client/src/evmDepositAndCall.ts b/packages/client/src/evmDepositAndCall.ts index 301361d1..40050065 100644 --- a/packages/client/src/evmDepositAndCall.ts +++ b/packages/client/src/evmDepositAndCall.ts @@ -29,7 +29,7 @@ export const evmDepositAndCall = async function ( args: { amount: string; erc20: string; - gatewayEvm: string; + gatewayEvm?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -39,7 +39,12 @@ export const evmDepositAndCall = async function ( ) { const signer = this.signer; const { utils } = ethers; - const gateway = new ethers.Contract(args.gatewayEvm, GatewayABI.abi, signer); + const gatewayEvmAddress = args.gatewayEvm || (await this.getGatewayAddress()); + const gateway = new ethers.Contract( + gatewayEvmAddress, + GatewayABI.abi, + signer + ); const revertOptions = { abortAddress: "0x0000000000000000000000000000000000000000", // not used @@ -87,7 +92,7 @@ export const evmDepositAndCall = async function ( ); const decimals = await erc20Contract.decimals(); const value = utils.parseUnits(args.amount, decimals); - await erc20Contract.connect(signer).approve(args.gatewayEvm, value); + await erc20Contract.connect(signer).approve(gatewayEvmAddress, value); const method = "depositAndCall(address,uint256,address,bytes,(address,bool,address,bytes,uint256))"; tx = await gateway[method]( diff --git a/packages/client/src/idl/gateway.json b/packages/client/src/idl/gateway.json deleted file mode 100644 index d5f677ae..00000000 --- a/packages/client/src/idl/gateway.json +++ /dev/null @@ -1,497 +0,0 @@ -{ - "address": "ZETAjseVjuFsxdRxo6MmTCvqFwb3ZHUx56Co3vCmGis", - "metadata": { - "name": "gateway", - "version": "0.1.0", - "spec": "0.1.0", - "description": "Created with Anchor" - }, - "instructions": [ - { - "name": "deposit", - "discriminator": [ - 242, - 35, - 198, - 137, - 82, - 225, - 242, - 182 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "memo", - "type": "bytes" - } - ] - }, - { - "name": "deposit_spl_token", - "discriminator": [ - 86, - 172, - 212, - 121, - 63, - 233, - 96, - 144 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "name": "from", - "writable": true - }, - { - "name": "to", - "writable": true - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "memo", - "type": "bytes" - } - ] - }, - { - "name": "initialize", - "discriminator": [ - 175, - 175, - 109, - 31, - 13, - 152, - 155, - 237 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "system_program", - "address": "11111111111111111111111111111111" - } - ], - "args": [ - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - }, - { - "name": "chain_id", - "type": "u64" - } - ] - }, - { - "name": "set_deposit_paused", - "discriminator": [ - 98, - 179, - 141, - 24, - 246, - 120, - 164, - 143 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "deposit_paused", - "type": "bool" - } - ] - }, - { - "name": "update_authority", - "discriminator": [ - 32, - 46, - 64, - 28, - 149, - 75, - 243, - 88 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "new_authority_address", - "type": "pubkey" - } - ] - }, - { - "name": "update_tss", - "discriminator": [ - 227, - 136, - 3, - 242, - 177, - 168, - 10, - 160 - ], - "accounts": [ - { - "name": "pda", - "writable": true - }, - { - "name": "signer", - "writable": true, - "signer": true - } - ], - "args": [ - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - } - ] - }, - { - "name": "withdraw", - "discriminator": [ - 183, - 18, - 70, - 156, - 148, - 109, - 161, - 34 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true - }, - { - "name": "to", - "writable": true - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "signature", - "type": { - "array": [ - "u8", - 64 - ] - } - }, - { - "name": "recovery_id", - "type": "u8" - }, - { - "name": "message_hash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "nonce", - "type": "u64" - } - ] - }, - { - "name": "withdraw_spl_token", - "discriminator": [ - 219, - 156, - 234, - 11, - 89, - 235, - 246, - 32 - ], - "accounts": [ - { - "name": "signer", - "writable": true, - "signer": true - }, - { - "name": "pda", - "writable": true, - "pda": { - "seeds": [ - { - "kind": "const", - "value": [ - 109, - 101, - 116, - 97 - ] - } - ] - } - }, - { - "name": "from", - "writable": true - }, - { - "name": "to", - "writable": true - }, - { - "name": "token_program", - "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - } - ], - "args": [ - { - "name": "amount", - "type": "u64" - }, - { - "name": "signature", - "type": { - "array": [ - "u8", - 64 - ] - } - }, - { - "name": "recovery_id", - "type": "u8" - }, - { - "name": "message_hash", - "type": { - "array": [ - "u8", - 32 - ] - } - }, - { - "name": "nonce", - "type": "u64" - } - ] - } - ], - "accounts": [ - { - "name": "Pda", - "discriminator": [ - 169, - 245, - 0, - 205, - 225, - 36, - 43, - 94 - ] - } - ], - "errors": [ - { - "code": 6000, - "name": "SignerIsNotAuthority", - "msg": "SignerIsNotAuthority" - }, - { - "code": 6001, - "name": "InsufficientPoints", - "msg": "InsufficientPoints" - }, - { - "code": 6002, - "name": "NonceMismatch", - "msg": "NonceMismatch" - }, - { - "code": 6003, - "name": "TSSAuthenticationFailed", - "msg": "TSSAuthenticationFailed" - }, - { - "code": 6004, - "name": "DepositToAddressMismatch", - "msg": "DepositToAddressMismatch" - }, - { - "code": 6005, - "name": "MessageHashMismatch", - "msg": "MessageHashMismatch" - }, - { - "code": 6006, - "name": "MemoLengthExceeded", - "msg": "MemoLengthExceeded" - }, - { - "code": 6007, - "name": "MemoLengthTooShort", - "msg": "MemoLengthTooShort" - }, - { - "code": 6008, - "name": "DepositPaused", - "msg": "DepositPaused" - } - ], - "types": [ - { - "name": "Pda", - "type": { - "kind": "struct", - "fields": [ - { - "name": "nonce", - "type": "u64" - }, - { - "name": "tss_address", - "type": { - "array": [ - "u8", - 20 - ] - } - }, - { - "name": "authority", - "type": "pubkey" - }, - { - "name": "chain_id", - "type": "u64" - }, - { - "name": "deposit_paused", - "type": "bool" - } - ] - } - } - ] -} \ No newline at end of file diff --git a/packages/client/src/index.ts b/packages/client/src/index.ts index 6f1e0ce5..5f30930b 100644 --- a/packages/client/src/index.ts +++ b/packages/client/src/index.ts @@ -15,6 +15,7 @@ export * from "./getSupportedChains"; export * from "./prepareData"; export * from "./sendZeta"; export * from "./solanaDeposit"; +export * from "./solanaDepositAndCall"; export * from "./trackCCTX"; export * from "./zetachainCall"; export * from "./zetachainWithdraw"; diff --git a/packages/client/src/solanaDeposit.ts b/packages/client/src/solanaDeposit.ts index 0ceab20f..3cfc9e83 100644 --- a/packages/client/src/solanaDeposit.ts +++ b/packages/client/src/solanaDeposit.ts @@ -2,10 +2,10 @@ import * as anchor from "@coral-xyz/anchor"; import { TransactionMessage, VersionedTransaction } from "@solana/web3.js"; import { Transaction } from "@solana/web3.js"; import { getEndpoints } from "@zetachain/networks"; +import Gateway_IDL from "@zetachain/protocol-contracts-solana/idl/gateway.json"; import { ethers } from "ethers"; import { ZetaChainClient } from "./client"; -import Gateway_IDL from "./idl/gateway.json"; const SEED = "meta"; @@ -13,7 +13,6 @@ export const solanaDeposit = async function ( this: ZetaChainClient, args: { amount: number; - params: any[]; recipient: string; } ) { @@ -80,16 +79,9 @@ export const solanaDeposit = async function ( try { const tx = new anchor.web3.Transaction(); - const m = Buffer.from( - ethers.utils.arrayify( - args.recipient + - ethers.utils.defaultAbiCoder - .encode(args.params[0], args.params[1]) - .slice(2) - ) - ); + const recipient = Buffer.from(ethers.utils.arrayify(args.recipient)); const depositInstruction = await gatewayProgram.methods - .deposit(depositAmount, m) + .deposit(depositAmount, recipient) .accounts({ pda: pdaAccount, signer: this.solanaAdapter diff --git a/packages/client/src/solanaDepositAndCall.ts b/packages/client/src/solanaDepositAndCall.ts new file mode 100644 index 00000000..61624d01 --- /dev/null +++ b/packages/client/src/solanaDepositAndCall.ts @@ -0,0 +1,141 @@ +import * as anchor from "@coral-xyz/anchor"; +import { TransactionMessage, VersionedTransaction } from "@solana/web3.js"; +import { Transaction } from "@solana/web3.js"; +import { getEndpoints } from "@zetachain/networks"; +import Gateway_IDL from "@zetachain/protocol-contracts-solana/idl/gateway.json"; +import { ethers } from "ethers"; + +import { ZetaChainClient } from "./client"; + +const SEED = "meta"; + +export const solanaDepositAndCall = async function ( + this: ZetaChainClient, + args: { + amount: number; + params: any[]; + recipient: string; + } +) { + if (!this.isSolanaWalletConnected()) { + throw new Error("Solana wallet not connected"); + } + + const network = "solana_" + this.network; + const api = getEndpoints("solana" as any, network); + + const connection = new anchor.web3.Connection(api[0].url); + + let provider; + if (this.solanaAdapter) { + const walletAdapter = { + publicKey: this.solanaAdapter.publicKey!, + signAllTransactions: async (txs: Transaction[]) => { + if (!this.solanaAdapter?.signAllTransactions) { + throw new Error( + "Wallet does not support signing multiple transactions" + ); + } + return await this.solanaAdapter.signAllTransactions(txs); + }, + signTransaction: async (tx: Transaction) => { + if (!this.solanaAdapter?.signTransaction) { + throw new Error("Wallet does not support transaction signing"); + } + return await this.solanaAdapter.signTransaction(tx); + }, + }; + + provider = new anchor.AnchorProvider( + connection, + walletAdapter as any, + anchor.AnchorProvider.defaultOptions() + ); + } else if (this.solanaWallet) { + provider = new anchor.AnchorProvider( + connection, + this.solanaWallet, + anchor.AnchorProvider.defaultOptions() + ); + } else { + throw new Error("No valid Solana wallet found"); + } + anchor.setProvider(provider); + + const programId = new anchor.web3.PublicKey(Gateway_IDL.address); + const gatewayProgram = new anchor.Program( + Gateway_IDL as anchor.Idl, + provider + ); + + const seeds = [Buffer.from(SEED, "utf-8")]; + const [pdaAccount] = anchor.web3.PublicKey.findProgramAddressSync( + seeds, + programId + ); + + const depositAmount = new anchor.BN( + anchor.web3.LAMPORTS_PER_SOL * args.amount + ); + + try { + const tx = new anchor.web3.Transaction(); + const recipient = Buffer.from(ethers.utils.arrayify(args.recipient)); + + if (!Array.isArray(args.params[0]) || !Array.isArray(args.params[1])) { + throw new Error( + "Invalid 'params' format. Expected arrays of types and values." + ); + } + + const message = Buffer.from( + ethers.utils.arrayify( + ethers.utils.defaultAbiCoder.encode(args.params[0], args.params[1]) + ) + ); + + const depositInstruction = await gatewayProgram.methods + .depositAndCall(depositAmount, recipient, message) + .accounts({ + pda: pdaAccount, + signer: this.solanaAdapter + ? this.solanaAdapter.publicKey! + : this.solanaWallet!.publicKey, + systemProgram: anchor.web3.SystemProgram.programId, + }) + .instruction(); + + tx.add(depositInstruction); + + // Send the transaction + let txSignature; + if (this.solanaAdapter) { + const { blockhash, lastValidBlockHeight } = + await connection.getLatestBlockhash(); + const messageLegacy = new TransactionMessage({ + instructions: tx.instructions, + payerKey: this.solanaAdapter.publicKey!, + recentBlockhash: blockhash, + }).compileToV0Message(); + + const versionedTransaction = new VersionedTransaction(messageLegacy); + + txSignature = await this.solanaAdapter.sendTransaction( + versionedTransaction, + connection + ); + } else { + txSignature = await anchor.web3.sendAndConfirmTransaction( + connection, + tx, + [this.solanaWallet!.payer] + ); + } + + console.log("Transaction signature:", txSignature); + + return txSignature; + } catch (error) { + console.error("Transaction failed:", error); + } +}; diff --git a/packages/client/src/zetachainCall.ts b/packages/client/src/zetachainCall.ts index 6f4d43a6..10a3692c 100644 --- a/packages/client/src/zetachainCall.ts +++ b/packages/client/src/zetachainCall.ts @@ -32,7 +32,7 @@ export const zetachainCall = async function ( args: { callOptions: any; function: string; - gatewayZetaChain: string; + gatewayZetaChain?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -43,9 +43,10 @@ export const zetachainCall = async function ( ) { const signer = this.signer; const { utils } = ethers; - + const gatewayZetaChainAddress = + args.gatewayZetaChain || (await this.getGatewayAddress()); const gateway = new ethers.Contract( - args.gatewayZetaChain, + gatewayZetaChainAddress, GatewayABI.abi, signer ); @@ -92,7 +93,7 @@ export const zetachainCall = async function ( ); const gasZRC20Contract = new ethers.Contract(gasZRC20, ZRC20ABI.abi, signer); const approve = await gasZRC20Contract.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, gasFee, args.txOptions ); diff --git a/packages/client/src/zetachainWithdraw.ts b/packages/client/src/zetachainWithdraw.ts index 5fdb7993..2c599989 100644 --- a/packages/client/src/zetachainWithdraw.ts +++ b/packages/client/src/zetachainWithdraw.ts @@ -28,7 +28,7 @@ export const zetachainWithdraw = async function ( this: ZetaChainClient, args: { amount: string; - gatewayZetaChain: string; + gatewayZetaChain?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -38,8 +38,10 @@ export const zetachainWithdraw = async function ( const signer = this.signer; const { utils } = ethers; + const gatewayZetaChainAddress = + args.gatewayZetaChain || (await this.getGatewayAddress()); const gateway = new ethers.Contract( - args.gatewayZetaChain, + gatewayZetaChainAddress, GatewayABI.abi, signer ); @@ -60,7 +62,7 @@ export const zetachainWithdraw = async function ( const [gasZRC20, gasFee] = await zrc20.withdrawGasFee(); if (args.zrc20 === gasZRC20) { const approveGasAndWithdraw = await zrc20.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, value.add(gasFee), args.txOptions ); @@ -72,13 +74,13 @@ export const zetachainWithdraw = async function ( signer ); const approveGas = await gasZRC20Contract.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, gasFee, args.txOptions ); await approveGas.wait(); const approveWithdraw = await zrc20.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, value, args.txOptions ); diff --git a/packages/client/src/zetachainWithdrawAndCall.ts b/packages/client/src/zetachainWithdrawAndCall.ts index 63ecc46c..cb296c5e 100644 --- a/packages/client/src/zetachainWithdrawAndCall.ts +++ b/packages/client/src/zetachainWithdrawAndCall.ts @@ -34,7 +34,7 @@ export const zetachainWithdrawAndCall = async function ( amount: string; callOptions: any; function?: string; - gatewayZetaChain: string; + gatewayZetaChain?: string; receiver: string; revertOptions: revertOptions; txOptions: txOptions; @@ -46,8 +46,10 @@ export const zetachainWithdrawAndCall = async function ( const signer = this.signer; const { utils } = ethers; + const gatewayZetaChainAddress = + args.gatewayZetaChain || (await this.getGatewayAddress()); const gateway = new ethers.Contract( - args.gatewayZetaChain, + gatewayZetaChainAddress, GatewayABI.abi, signer ); @@ -102,7 +104,7 @@ export const zetachainWithdrawAndCall = async function ( ); if (args.zrc20 === gasZRC20) { const approveGasAndWithdraw = await zrc20.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, value.add(gasFee), args.txOptions ); @@ -114,13 +116,13 @@ export const zetachainWithdrawAndCall = async function ( signer ); const approveGas = await gasZRC20Contract.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, gasFee, args.txOptions ); await approveGas.wait(); const approveWithdraw = await zrc20.approve( - args.gatewayZetaChain, + gatewayZetaChainAddress, value, args.txOptions ); diff --git a/packages/tasks/src/evmCall.ts b/packages/tasks/src/evmCall.ts index 6258c936..8c255fdf 100644 --- a/packages/tasks/src/evmCall.ts +++ b/packages/tasks/src/evmCall.ts @@ -6,7 +6,8 @@ import { ZetaChainClient } from "../../client/src/"; export const evmCall = async (args: any, hre: HardhatRuntimeEnvironment) => { try { const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const tx = await client.evmCall({ gatewayEvm: args.gatewayEvm, receiver: args.receiver, @@ -32,11 +33,7 @@ export const evmCall = async (args: any, hre: HardhatRuntimeEnvironment) => { task("evm-call", "Call a universal app", evmCall) .addParam("receiver", "Receiver address on ZetaChain") - .addOptionalParam( - "gatewayEvm", - "contract address of gateway on EVM", - "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" - ) + .addOptionalParam("gatewayEvm", "contract address of gateway on EVM") .addFlag("callOnRevert", "Whether to call on revert") .addOptionalParam( "revertAddress", diff --git a/packages/tasks/src/evmDeposit.ts b/packages/tasks/src/evmDeposit.ts index f2568af2..c078ef97 100644 --- a/packages/tasks/src/evmDeposit.ts +++ b/packages/tasks/src/evmDeposit.ts @@ -6,7 +6,8 @@ import { ZetaChainClient } from "../../client/src/"; export const evmDeposit = async (args: any, hre: HardhatRuntimeEnvironment) => { try { const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const tx = await client.evmDeposit({ amount: args.amount, erc20: args.erc20, @@ -34,11 +35,7 @@ export const evmDeposit = async (args: any, hre: HardhatRuntimeEnvironment) => { task("evm-deposit", "Deposit tokens", evmDeposit) .addParam("receiver", "Receiver address on ZetaChain") - .addOptionalParam( - "gatewayEvm", - "contract address of gateway on EVM", - "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" - ) + .addOptionalParam("gatewayEvm", "contract address of gateway on EVM") .addFlag("callOnRevert", "Whether to call on revert") .addOptionalParam( "revertAddress", diff --git a/packages/tasks/src/evmDepositAndCall.ts b/packages/tasks/src/evmDepositAndCall.ts index 02ccead7..d439a47e 100644 --- a/packages/tasks/src/evmDepositAndCall.ts +++ b/packages/tasks/src/evmDepositAndCall.ts @@ -9,7 +9,8 @@ export const evmDepositAndCall = async ( ) => { try { const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const tx = await client.evmDepositAndCall({ amount: args.amount, erc20: args.erc20, @@ -39,11 +40,7 @@ export const evmDepositAndCall = async ( task("evm-deposit-and-call", "Deposit tokens", evmDepositAndCall) .addParam("receiver", "Receiver address on ZetaChain") - .addOptionalParam( - "gatewayEvm", - "contract address of gateway on EVM", - "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0" - ) + .addOptionalParam("gatewayEvm", "contract address of gateway on EVM") .addFlag("callOnRevert", "Whether to call on revert") .addOptionalParam( "revertAddress", diff --git a/packages/tasks/src/index.ts b/packages/tasks/src/index.ts index e03682c5..e69b6d60 100644 --- a/packages/tasks/src/index.ts +++ b/packages/tasks/src/index.ts @@ -12,6 +12,7 @@ export { poolsTask } from "./pools"; export { sendBTCTask } from "./sendBTC"; export { sendZETATask } from "./sendZETA"; export { solanaDeposit } from "./solanaDeposit"; +export { solanaDepositAndCall } from "./solanaDepositAndCall"; export { tokensTask } from "./tokens"; export { zetachainCall } from "./zetachainCall"; export { zetachainWithdraw } from "./zetachainWithdraw"; diff --git a/packages/tasks/src/solanaDeposit.ts b/packages/tasks/src/solanaDeposit.ts index adf6a602..cb9eba47 100644 --- a/packages/tasks/src/solanaDeposit.ts +++ b/packages/tasks/src/solanaDeposit.ts @@ -30,18 +30,9 @@ export const solanaDeposit = async ( recipient = args.recipient; } const { amount, idPath } = args; - const params = [JSON.parse(args.types), args.values]; - await client.solanaDeposit({ amount, params, recipient }); + await client.solanaDeposit({ amount, recipient }); }; -task("solana-deposit", "Solana deposit", solanaDeposit) - .addParam("amount", "Amount of SOL to deposit") - .addParam("recipient", "Universal contract address") - .addOptionalParam("solanaNetwork", "Solana Network", "devnet") - .addOptionalParam("idPath", "Path to id.json", "~/.config/solana/id.json") - .addParam("types", "The types of the parameters (example: ['string'])") - .addVariadicPositionalParam("values", "The values of the parameters"); - export const getKeypairFromFile = async (filepath: string) => { const path = await import("path"); if (filepath[0] === "~") { @@ -72,3 +63,9 @@ export const getKeypairFromFile = async (filepath: string) => { } return Keypair.fromSecretKey(parsedFileContents); }; + +task("solana-deposit", "Solana deposit", solanaDeposit) + .addParam("amount", "Amount of SOL to deposit") + .addParam("recipient", "Universal contract address") + .addOptionalParam("solanaNetwork", "Solana Network", "devnet") + .addOptionalParam("idPath", "Path to id.json", "~/.config/solana/id.json"); diff --git a/packages/tasks/src/solanaDepositAndCall.ts b/packages/tasks/src/solanaDepositAndCall.ts new file mode 100644 index 00000000..b2e6ebac --- /dev/null +++ b/packages/tasks/src/solanaDepositAndCall.ts @@ -0,0 +1,80 @@ +import { Wallet } from "@coral-xyz/anchor"; +import { Keypair } from "@solana/web3.js"; +import bech32 from "bech32"; +import { utils } from "ethers"; +import { task } from "hardhat/config"; +import type { HardhatRuntimeEnvironment } from "hardhat/types"; + +import { ZetaChainClient } from "../../client/src"; + +export const solanaDepositAndCall = async ( + args: any, + hre: HardhatRuntimeEnvironment +) => { + const keypair = await getKeypairFromFile(args.idPath); + const wallet = new Wallet(keypair); + + const client = new ZetaChainClient({ + network: args.solanaNetwork, + solanaWallet: wallet, + }); + let recipient; + try { + if ((bech32 as any).decode(args.recipient)) { + recipient = utils.solidityPack( + ["bytes"], + [utils.toUtf8Bytes(args.recipient)] + ); + } + } catch (e) { + recipient = args.recipient; + } + const { amount, idPath } = args; + let paramTypes; + try { + paramTypes = JSON.parse(args.types); + } catch (error: any) { + throw new Error(`Invalid JSON in 'types' parameter: ${error.message}`); + } + const params = [paramTypes, args.values]; + await client.solanaDepositAndCall({ amount, params, recipient }); +}; + +export const getKeypairFromFile = async (filepath: string) => { + const path = await import("path"); + if (filepath[0] === "~") { + const home = process.env.HOME || null; + if (home) { + filepath = path.join(home, filepath.slice(1)); + } + } + // Get contents of file + let fileContents; + try { + const { readFile } = await import("fs/promises"); + const fileContentsBuffer = await readFile(filepath); + fileContents = fileContentsBuffer.toString(); + } catch (error) { + throw new Error(`Could not read keypair from file at '${filepath}'`); + } + // Parse contents of file + let parsedFileContents; + try { + parsedFileContents = Uint8Array.from(JSON.parse(fileContents)); + } catch (thrownObject) { + const error: any = thrownObject; + if (!error.message.includes("Unexpected token")) { + throw error; + } + throw new Error(`Invalid secret key file at '${filepath}'!`); + } + return Keypair.fromSecretKey(parsedFileContents); +}; + +task("solana-deposit-and-call", "Solana deposit and call", solanaDepositAndCall) + .addParam("amount", "Amount of SOL to deposit") + .addParam("recipient", "Universal contract address") + .addOptionalParam("solanaNetwork", "Solana Network", "devnet") + .addOptionalParam("idPath", "Path to id.json", "~/.config/solana/id.json") + .addParam("types", "The types of the parameters (example: ['string'])") + .addVariadicPositionalParam("values", "The values of the parameters"); diff --git a/packages/tasks/src/zetachainCall.ts b/packages/tasks/src/zetachainCall.ts index 0599e4e0..d40785c3 100644 --- a/packages/tasks/src/zetachainCall.ts +++ b/packages/tasks/src/zetachainCall.ts @@ -14,7 +14,8 @@ export const zetachainCall = async ( try { const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const response = await client.zetachainCall({ callOptions, function: args.function, @@ -44,8 +45,7 @@ export const zetachainCall = async ( task("zetachain-call", "Call a contract on a connected chain", zetachainCall) .addOptionalParam( "gatewayZetaChain", - "contract address of gateway on ZetaChain", - "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" + "contract address of gateway on ZetaChain" ) .addParam("zrc20", "The address of ZRC-20 to pay fees") .addFlag("callOnRevert", "Whether to call on revert") diff --git a/packages/tasks/src/zetachainWithdraw.ts b/packages/tasks/src/zetachainWithdraw.ts index da26a60e..d46551a2 100644 --- a/packages/tasks/src/zetachainWithdraw.ts +++ b/packages/tasks/src/zetachainWithdraw.ts @@ -9,7 +9,8 @@ export const zetachainWithdraw = async ( ) => { try { const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const response = await client.zetachainWithdraw({ amount: args.amount, gatewayZetaChain: args.gatewayZetaChain, @@ -37,8 +38,7 @@ export const zetachainWithdraw = async ( task("zetachain-withdraw", "Withdraw tokens from ZetaChain", zetachainWithdraw) .addOptionalParam( "gatewayZetaChain", - "contract address of gateway on ZetaChain", - "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" + "contract address of gateway on ZetaChain" ) .addOptionalParam("zrc20", "The address of the ZRC20 token") .addFlag("callOnRevert", "Whether to call on revert") diff --git a/packages/tasks/src/zetachainWithdrawAndCall.ts b/packages/tasks/src/zetachainWithdrawAndCall.ts index 5f8fef4c..18af8b10 100644 --- a/packages/tasks/src/zetachainWithdrawAndCall.ts +++ b/packages/tasks/src/zetachainWithdrawAndCall.ts @@ -14,7 +14,8 @@ export const zetachainWithdrawAndCall = async ( }; const [signer] = await hre.ethers.getSigners(); - const client = new ZetaChainClient({ network: "testnet", signer }); + const network = hre.network.name; + const client = new ZetaChainClient({ network, signer }); const response = await client.zetachainWithdrawAndCall({ amount: args.amount, callOptions, @@ -50,8 +51,7 @@ task( ) .addOptionalParam( "gatewayZetaChain", - "contract address of gateway on ZetaChain", - "0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0" + "contract address of gateway on ZetaChain" ) .addOptionalParam("zrc20", "The address of the ZRC20 token") .addFlag("callOnRevert", "Whether to call on revert") diff --git a/typechain-types/factories/contracts/SwapHelperLib__factory.ts b/typechain-types/factories/contracts/SwapHelperLib__factory.ts index 297f2e3f..19079f0c 100644 --- a/typechain-types/factories/contracts/SwapHelperLib__factory.ts +++ b/typechain-types/factories/contracts/SwapHelperLib__factory.ts @@ -136,7 +136,7 @@ const _abi = [ ] as const; const _bytecode = - "0x6111d5610052600b82828239805160001a6073146045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806354ce67ae14610045578063c63585cc14610075575b600080fd5b61005f600480360381019061005a9190610c69565b6100a5565b60405161006c9190610cdf565b60405180910390f35b61008f600480360381019061008a9190610cfa565b610489565b60405161009c9190610d5c565b60405180910390f35b6000808573ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610d8c565b905060008673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610166573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018a9190610d8c565b90506060600267ffffffffffffffff8111156101a9576101a8610db9565b5b6040519080825280602002602001820160405280156101d75781602001602082028036833780820191505090505b50905086816000815181106101ef576101ee610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160018151811061023e5761023d610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006102858487846104fb565b9050600367ffffffffffffffff8111156102a2576102a1610db9565b5b6040519080825280602002602001820160405280156102d05781602001602082028036833780820191505090505b50915087826000815181106102e8576102e7610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828260018151811061033757610336610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050868260028151811061038657610385610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006103cd8588856104fb565b905080600182516103de9190610e46565b815181106103ef576103ee610de8565b5b602002602001015182600184516104069190610e46565b8151811061041757610416610de8565b5b6020026020010151116104515780600182516104339190610e46565b8151811061044457610443610de8565b5b602002602001015161047a565b81600183516104609190610e46565b8151811061047157610470610de8565b5b60200260200101515b95505050505050949350505050565b60008060006104988585610677565b915091508582826040516020016104b0929190610ec2565b604051602081830303815290604052805190602001206040516020016104d7929190610fbc565b6040516020818303038152906040528051906020012060001c925050509392505050565b6060600282511015610539576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815167ffffffffffffffff81111561055457610553610db9565b5b6040519080825280602002602001820160405280156105825781602001602082028036833780820191505090505b509050828160008151811061059a57610599610de8565b5b60200260200101818152505060005b600183516105b79190610e46565b81101561066f5760008061060c878685815181106105d8576105d7610de8565b5b6020026020010151876001876105ee9190610ffe565b815181106105ff576105fe610de8565b5b6020026020010151610791565b9150915061063584848151811061062657610625610de8565b5b60200260200101518383610894565b846001856106439190610ffe565b8151811061065457610653610de8565b5b602002602001018181525050505080806001019150506105a9565b509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036106df576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061071957828461071c565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361078a576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008060006107a08585610988565b5090506000806107b1888888610aa2565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906110b4565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461087e578082610881565b81815b8095508196505050505050935093915050565b60008084036108cf576040517f098fb56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008314806108de5750600082145b15610915576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061092c6103e586610b2990919063ffffffff16565b905060006109438483610b2990919063ffffffff16565b9050600061096e836109606103e889610b2990919063ffffffff16565b610b8990919063ffffffff16565b9050808261097c9190611136565b93505050509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109f0576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610a2a578284610a2d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a9b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008373ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401610adf929190611176565b602060405180830381865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190610d8c565b90509392505050565b600080831480610b4d5750818383850292508281610b4a57610b49611107565b5b04145b610b83576040517f5797276a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b6000818301905082811015610bca576040517fa259879500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c0082610bd5565b9050919050565b610c1081610bf5565b8114610c1b57600080fd5b50565b600081359050610c2d81610c07565b92915050565b6000819050919050565b610c4681610c33565b8114610c5157600080fd5b50565b600081359050610c6381610c3d565b92915050565b60008060008060808587031215610c8357610c82610bd0565b5b6000610c9187828801610c1e565b9450506020610ca287828801610c1e565b9350506040610cb387828801610c1e565b9250506060610cc487828801610c54565b91505092959194509250565b610cd981610c33565b82525050565b6000602082019050610cf46000830184610cd0565b92915050565b600080600060608486031215610d1357610d12610bd0565b5b6000610d2186828701610c1e565b9350506020610d3286828701610c1e565b9250506040610d4386828701610c1e565b9150509250925092565b610d5681610bf5565b82525050565b6000602082019050610d716000830184610d4d565b92915050565b600081519050610d8681610c07565b92915050565b600060208284031215610da257610da1610bd0565b5b6000610db084828501610d77565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e5182610c33565b9150610e5c83610c33565b9250828203905081811115610e7457610e73610e17565b5b92915050565b60008160601b9050919050565b6000610e9282610e7a565b9050919050565b6000610ea482610e87565b9050919050565b610ebc610eb782610bf5565b610e99565b82525050565b6000610ece8285610eab565b601482019150610ede8284610eab565b6014820191508190509392505050565b600081905092915050565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b6000610f2f600183610eee565b9150610f3a82610ef9565b600182019050919050565b6000819050919050565b6000819050919050565b610f6a610f6582610f45565b610f4f565b82525050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b6000610fa6602083610eee565b9150610fb182610f70565b602082019050919050565b6000610fc782610f22565b9150610fd38285610eab565b601482019150610fe38284610f59565b602082019150610ff282610f99565b91508190509392505050565b600061100982610c33565b915061101483610c33565b925082820190508082111561102c5761102b610e17565b5b92915050565b60006dffffffffffffffffffffffffffff82169050919050565b61105581611032565b811461106057600080fd5b50565b6000815190506110728161104c565b92915050565b600063ffffffff82169050919050565b61109181611078565b811461109c57600080fd5b50565b6000815190506110ae81611088565b92915050565b6000806000606084860312156110cd576110cc610bd0565b5b60006110db86828701611063565b93505060206110ec86828701611063565b92505060406110fd8682870161109f565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061114182610c33565b915061114c83610c33565b92508261115c5761115b611107565b5b828204905092915050565b61117081610bf5565b82525050565b600060408201905061118b6000830185611167565b6111986020830184611167565b939250505056fea2646970667358221220dadd3e100ef04c85d5a02036fa4da1104bb792971aa4fa9f47b428d6687d283564736f6c634300081a0033"; + "0x6111d5610052600b82828239805160001a6073146045577f4e487b7100000000000000000000000000000000000000000000000000000000600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100405760003560e01c806354ce67ae14610045578063c63585cc14610075575b600080fd5b61005f600480360381019061005a9190610c69565b6100a5565b60405161006c9190610cdf565b60405180910390f35b61008f600480360381019061008a9190610cfa565b610489565b60405161009c9190610d5c565b60405180910390f35b6000808573ffffffffffffffffffffffffffffffffffffffff1663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101179190610d8c565b905060008673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610166573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061018a9190610d8c565b90506060600267ffffffffffffffff8111156101a9576101a8610db9565b5b6040519080825280602002602001820160405280156101d75781602001602082028036833780820191505090505b50905086816000815181106101ef576101ee610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050858160018151811061023e5761023d610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006102858487846104fb565b9050600367ffffffffffffffff8111156102a2576102a1610db9565b5b6040519080825280602002602001820160405280156102d05781602001602082028036833780820191505090505b50915087826000815181106102e8576102e7610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828260018151811061033757610336610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050868260028151811061038657610385610de8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff168152505060006103cd8588856104fb565b905080600182516103de9190610e46565b815181106103ef576103ee610de8565b5b602002602001015182600184516104069190610e46565b8151811061041757610416610de8565b5b6020026020010151116104515780600182516104339190610e46565b8151811061044457610443610de8565b5b602002602001015161047a565b81600183516104609190610e46565b8151811061047157610470610de8565b5b60200260200101515b95505050505050949350505050565b60008060006104988585610677565b915091508582826040516020016104b0929190610ec2565b604051602081830303815290604052805190602001206040516020016104d7929190610fbc565b6040516020818303038152906040528051906020012060001c925050509392505050565b6060600282511015610539576040517f20db826700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815167ffffffffffffffff81111561055457610553610db9565b5b6040519080825280602002602001820160405280156105825781602001602082028036833780820191505090505b509050828160008151811061059a57610599610de8565b5b60200260200101818152505060005b600183516105b79190610e46565b81101561066f5760008061060c878685815181106105d8576105d7610de8565b5b6020026020010151876001876105ee9190610ffe565b815181106105ff576105fe610de8565b5b6020026020010151610791565b9150915061063584848151811061062657610625610de8565b5b60200260200101518383610894565b846001856106439190610ffe565b8151811061065457610653610de8565b5b602002602001018181525050505080806001019150506105a9565b509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036106df576040517fcb1e7cfe00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161061071957828461071c565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff160361078a576040517f78b507da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008060006107a08585610988565b5090506000806107b1888888610aa2565b73ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156107fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081f91906110b4565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff1691508273ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff161461087e578082610881565b81815b8095508196505050505050935093915050565b60008084036108cf576040517f098fb56100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008314806108de5750600082145b15610915576040517fbb55fd2700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061092c6103e586610b2990919063ffffffff16565b905060006109438483610b2990919063ffffffff16565b9050600061096e836109606103e889610b2990919063ffffffff16565b610b8990919063ffffffff16565b9050808261097c9190611136565b93505050509392505050565b6000808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036109f0576040517fbd969eb000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610610a2a578284610a2d565b83835b8092508193505050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610a9b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b9250929050565b60008373ffffffffffffffffffffffffffffffffffffffff1663e6a4390584846040518363ffffffff1660e01b8152600401610adf929190611176565b602060405180830381865afa158015610afc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b209190610d8c565b90509392505050565b600080831480610b4d5750818383850292508281610b4a57610b49611107565b5b04145b610b83576040517f5797276a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b6000818301905082811015610bca576040517fa259879500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000610c0082610bd5565b9050919050565b610c1081610bf5565b8114610c1b57600080fd5b50565b600081359050610c2d81610c07565b92915050565b6000819050919050565b610c4681610c33565b8114610c5157600080fd5b50565b600081359050610c6381610c3d565b92915050565b60008060008060808587031215610c8357610c82610bd0565b5b6000610c9187828801610c1e565b9450506020610ca287828801610c1e565b9350506040610cb387828801610c1e565b9250506060610cc487828801610c54565b91505092959194509250565b610cd981610c33565b82525050565b6000602082019050610cf46000830184610cd0565b92915050565b600080600060608486031215610d1357610d12610bd0565b5b6000610d2186828701610c1e565b9350506020610d3286828701610c1e565b9250506040610d4386828701610c1e565b9150509250925092565b610d5681610bf5565b82525050565b6000602082019050610d716000830184610d4d565b92915050565b600081519050610d8681610c07565b92915050565b600060208284031215610da257610da1610bd0565b5b6000610db084828501610d77565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000610e5182610c33565b9150610e5c83610c33565b9250828203905081811115610e7457610e73610e17565b5b92915050565b60008160601b9050919050565b6000610e9282610e7a565b9050919050565b6000610ea482610e87565b9050919050565b610ebc610eb782610bf5565b610e99565b82525050565b6000610ece8285610eab565b601482019150610ede8284610eab565b6014820191508190509392505050565b600081905092915050565b7fff00000000000000000000000000000000000000000000000000000000000000600082015250565b6000610f2f600183610eee565b9150610f3a82610ef9565b600182019050919050565b6000819050919050565b6000819050919050565b610f6a610f6582610f45565b610f4f565b82525050565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f600082015250565b6000610fa6602083610eee565b9150610fb182610f70565b602082019050919050565b6000610fc782610f22565b9150610fd38285610eab565b601482019150610fe38284610f59565b602082019150610ff282610f99565b91508190509392505050565b600061100982610c33565b915061101483610c33565b925082820190508082111561102c5761102b610e17565b5b92915050565b60006dffffffffffffffffffffffffffff82169050919050565b61105581611032565b811461106057600080fd5b50565b6000815190506110728161104c565b92915050565b600063ffffffff82169050919050565b61109181611078565b811461109c57600080fd5b50565b6000815190506110ae81611088565b92915050565b6000806000606084860312156110cd576110cc610bd0565b5b60006110db86828701611063565b93505060206110ec86828701611063565b92505060406110fd8682870161109f565b9150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061114182610c33565b915061114c83610c33565b92508261115c5761115b611107565b5b828204905092915050565b61117081610bf5565b82525050565b600060408201905061118b6000830185611167565b6111986020830184611167565b939250505056fea2646970667358221220f8a7cdfbaca1847a7b2c275e0e78c76b49768d9d7d65b0a93b0510b44467fa2864736f6c634300081a0033"; type SwapHelperLibConstructorParams = | [signer?: Signer] diff --git a/yarn.lock b/yarn.lock index c0e78488..d82f9f82 100644 --- a/yarn.lock +++ b/yarn.lock @@ -313,7 +313,7 @@ resolved "https://registry.yarnpkg.com/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz#bdfd3a353131345244546876eb4afc0e125bec30" integrity sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ== -"@coral-xyz/anchor@^0.30.1": +"@coral-xyz/anchor@^0.30.0", "@coral-xyz/anchor@^0.30.1": version "0.30.1" resolved "https://registry.yarnpkg.com/@coral-xyz/anchor/-/anchor-0.30.1.tgz#17f3e9134c28cd0ea83574c6bab4e410bcecec5d" integrity sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ== @@ -2003,13 +2003,118 @@ optionalDependencies: "@react-native-async-storage/async-storage" "^1.17.7" -"@solana/buffer-layout@^4.0.1": +"@solana/buffer-layout-utils@^0.2.0": + version "0.2.0" + resolved "https://registry.yarnpkg.com/@solana/buffer-layout-utils/-/buffer-layout-utils-0.2.0.tgz#b45a6cab3293a2eb7597cceb474f229889d875ca" + integrity sha512-szG4sxgJGktbuZYDg2FfNmkMi0DYQoVjN2h7ta1W1hPrwzarcFLBq9UpX1UjNXsNpT9dn+chgprtWGioUAr4/g== + dependencies: + "@solana/buffer-layout" "^4.0.0" + "@solana/web3.js" "^1.32.0" + bigint-buffer "^1.1.5" + bignumber.js "^9.0.1" + +"@solana/buffer-layout@^4.0.0", "@solana/buffer-layout@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15" integrity sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA== dependencies: buffer "~6.0.3" +"@solana/codecs-core@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-core/-/codecs-core-2.0.0-rc.1.tgz#1a2d76b9c7b9e7b7aeb3bd78be81c2ba21e3ce22" + integrity sha512-bauxqMfSs8EHD0JKESaNmNuNvkvHSuN3bbWAF5RjOfDu2PugxHrvRebmYauvSumZ3cTfQ4HJJX6PG5rN852qyQ== + dependencies: + "@solana/errors" "2.0.0-rc.1" + +"@solana/codecs-data-structures@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-data-structures/-/codecs-data-structures-2.0.0-rc.1.tgz#d47b2363d99fb3d643f5677c97d64a812982b888" + integrity sha512-rinCv0RrAVJ9rE/rmaibWJQxMwC5lSaORSZuwjopSUE6T0nb/MVg6Z1siNCXhh/HFTOg0l8bNvZHgBcN/yvXog== + dependencies: + "@solana/codecs-core" "2.0.0-rc.1" + "@solana/codecs-numbers" "2.0.0-rc.1" + "@solana/errors" "2.0.0-rc.1" + +"@solana/codecs-numbers@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-numbers/-/codecs-numbers-2.0.0-rc.1.tgz#f34978ddf7ea4016af3aaed5f7577c1d9869a614" + integrity sha512-J5i5mOkvukXn8E3Z7sGIPxsThRCgSdgTWJDQeZvucQ9PT6Y3HiVXJ0pcWiOWAoQ3RX8e/f4I3IC+wE6pZiJzDQ== + dependencies: + "@solana/codecs-core" "2.0.0-rc.1" + "@solana/errors" "2.0.0-rc.1" + +"@solana/codecs-strings@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/codecs-strings/-/codecs-strings-2.0.0-rc.1.tgz#e1d9167075b8c5b0b60849f8add69c0f24307018" + integrity sha512-9/wPhw8TbGRTt6mHC4Zz1RqOnuPTqq1Nb4EyuvpZ39GW6O2t2Q7Q0XxiB3+BdoEjwA2XgPw6e2iRfvYgqty44g== + dependencies: + "@solana/codecs-core" "2.0.0-rc.1" + "@solana/codecs-numbers" "2.0.0-rc.1" + "@solana/errors" "2.0.0-rc.1" + +"@solana/codecs@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/codecs/-/codecs-2.0.0-rc.1.tgz#146dc5db58bd3c28e04b4c805e6096c2d2a0a875" + integrity sha512-qxoR7VybNJixV51L0G1RD2boZTcxmwUWnKCaJJExQ5qNKwbpSyDdWfFJfM5JhGyKe9DnPVOZB+JHWXnpbZBqrQ== + dependencies: + "@solana/codecs-core" "2.0.0-rc.1" + "@solana/codecs-data-structures" "2.0.0-rc.1" + "@solana/codecs-numbers" "2.0.0-rc.1" + "@solana/codecs-strings" "2.0.0-rc.1" + "@solana/options" "2.0.0-rc.1" + +"@solana/errors@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/errors/-/errors-2.0.0-rc.1.tgz#3882120886eab98a37a595b85f81558861b29d62" + integrity sha512-ejNvQ2oJ7+bcFAYWj225lyRkHnixuAeb7RQCixm+5mH4n1IA4Qya/9Bmfy5RAAHQzxK43clu3kZmL5eF9VGtYQ== + dependencies: + chalk "^5.3.0" + commander "^12.1.0" + +"@solana/options@2.0.0-rc.1": + version "2.0.0-rc.1" + resolved "https://registry.yarnpkg.com/@solana/options/-/options-2.0.0-rc.1.tgz#06924ba316dc85791fc46726a51403144a85fc4d" + integrity sha512-mLUcR9mZ3qfHlmMnREdIFPf9dpMc/Bl66tLSOOWxw4ml5xMT2ohFn7WGqoKcu/UHkT9CrC6+amEdqCNvUqI7AA== + dependencies: + "@solana/codecs-core" "2.0.0-rc.1" + "@solana/codecs-data-structures" "2.0.0-rc.1" + "@solana/codecs-numbers" "2.0.0-rc.1" + "@solana/codecs-strings" "2.0.0-rc.1" + "@solana/errors" "2.0.0-rc.1" + +"@solana/spl-memo@^0.2.5": + version "0.2.5" + resolved "https://registry.yarnpkg.com/@solana/spl-memo/-/spl-memo-0.2.5.tgz#a7828cdd1e810ff77c7c015ac97dfa166d0651fe" + integrity sha512-0Zx5t3gAdcHlRTt2O3RgGlni1x7vV7Xq7j4z9q8kKOMgU03PyoTbFQ/BSYCcICHzkaqD7ZxAiaJ6dlXolg01oA== + dependencies: + buffer "^6.0.3" + +"@solana/spl-token-group@^0.0.7": + version "0.0.7" + resolved "https://registry.yarnpkg.com/@solana/spl-token-group/-/spl-token-group-0.0.7.tgz#83c00f0cd0bda33115468cd28b89d94f8ec1fee4" + integrity sha512-V1N/iX7Cr7H0uazWUT2uk27TMqlqedpXHRqqAbVO2gvmJyT0E0ummMEAVQeXZ05ZhQ/xF39DLSdBp90XebWEug== + dependencies: + "@solana/codecs" "2.0.0-rc.1" + +"@solana/spl-token-metadata@^0.1.6": + version "0.1.6" + resolved "https://registry.yarnpkg.com/@solana/spl-token-metadata/-/spl-token-metadata-0.1.6.tgz#d240947aed6e7318d637238022a7b0981b32ae80" + integrity sha512-7sMt1rsm/zQOQcUWllQX9mD2O6KhSAtY1hFR2hfFwgqfFWzSY9E9GDvFVNYUI1F0iQKcm6HmePU9QbKRXTEBiA== + dependencies: + "@solana/codecs" "2.0.0-rc.1" + +"@solana/spl-token@^0.4.6": + version "0.4.9" + resolved "https://registry.yarnpkg.com/@solana/spl-token/-/spl-token-0.4.9.tgz#24d032d2935f237925c3b058ba6bb1e1ece5428c" + integrity sha512-g3wbj4F4gq82YQlwqhPB0gHFXfgsC6UmyGMxtSLf/BozT/oKd59465DbnlUK8L8EcimKMavxsVAMoLcEdeCicg== + dependencies: + "@solana/buffer-layout" "^4.0.0" + "@solana/buffer-layout-utils" "^0.2.0" + "@solana/spl-token-group" "^0.0.7" + "@solana/spl-token-metadata" "^0.1.6" + buffer "^6.0.3" + "@solana/wallet-adapter-base@^0.9.23": version "0.9.23" resolved "https://registry.yarnpkg.com/@solana/wallet-adapter-base/-/wallet-adapter-base-0.9.23.tgz#3b17c28afd44e173f44f658bf9700fd637e12a11" @@ -2101,6 +2206,27 @@ "@solana/wallet-standard-core" "^1.1.1" "@solana/wallet-standard-wallet-adapter" "^1.1.2" +"@solana/web3.js@^1.32.0": + version "1.95.8" + resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.95.8.tgz#2d49abda23f7a79a3cc499ab6680f7be11786ee1" + integrity sha512-sBHzNh7dHMrmNS5xPD1d0Xa2QffW/RXaxu/OysRXBfwTp+LYqGGmMtCYYwrHPrN5rjAmJCsQRNAwv4FM0t3B6g== + dependencies: + "@babel/runtime" "^7.25.0" + "@noble/curves" "^1.4.2" + "@noble/hashes" "^1.4.0" + "@solana/buffer-layout" "^4.0.1" + agentkeepalive "^4.5.0" + bigint-buffer "^1.1.5" + bn.js "^5.2.1" + borsh "^0.7.0" + bs58 "^4.0.1" + buffer "6.0.3" + fast-stable-stringify "^1.0.0" + jayson "^4.1.1" + node-fetch "^2.7.0" + rpc-websockets "^9.0.2" + superstruct "^2.0.2" + "@solana/web3.js@^1.68.0", "@solana/web3.js@^1.95.3": version "1.95.3" resolved "https://registry.yarnpkg.com/@solana/web3.js/-/web3.js-1.95.3.tgz#70b5f4d76823f56b5af6403da51125fffeb65ff3" @@ -2669,10 +2795,22 @@ dependencies: dotenv "^16.1.4" -"@zetachain/protocol-contracts@11.0.0-rc3": - version "11.0.0-rc3" - resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc3.tgz#9b719391d0728fd1b4e046c5f496180a45ecf0d5" - integrity sha512-Q8lOFOi7S1wdOfOBZPTxsOoyV6kyWwYEhg4vk+HmB36n0Q6A2VvTI7qmw8rxCvq0a5BUASC8IYx0+HzsOPvNOw== +"@zetachain/protocol-contracts-solana@2.0.0-rc1": + version "2.0.0-rc1" + resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts-solana/-/protocol-contracts-solana-2.0.0-rc1.tgz#6dec49165a5a711c4aa5cec41ac3eed259b0e276" + integrity sha512-49mjRwXcIZfNXPcG9e8XUY2ve6kxJLqbB7CIlTT+IZFW5RzXnoUclynycQeOLEJrpaVVSFz8q0s1alnv/zVvMQ== + dependencies: + "@coral-xyz/anchor" "^0.30.0" + "@solana/spl-memo" "^0.2.5" + "@solana/spl-token" "^0.4.6" + elliptic "^6.5.7" + ethereumjs-util "^7.1.5" + secp256k1 "^5.0.0" + +"@zetachain/protocol-contracts@11.0.0-rc4": + version "11.0.0-rc4" + resolved "https://registry.yarnpkg.com/@zetachain/protocol-contracts/-/protocol-contracts-11.0.0-rc4.tgz#2e2df98734793873e9c50629f6ec9f5eec6f9f54" + integrity sha512-7MJzEyUad7JgHucveIhtU8aaPkoMMzsfhKkh9MDMdxUzlaOmmxrQw2hi5B2b7UPxw2K9vFffkmIox6gd6c1+Yw== dependencies: "@openzeppelin/contracts" "^5.0.2" "@openzeppelin/contracts-upgradeable" "^5.0.2" @@ -3227,6 +3365,11 @@ bigint-buffer@^1.1.5: dependencies: bindings "^1.3.0" +bignumber.js@^9.0.1: + version "9.1.2" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.2.tgz#b7c4242259c008903b13707983b5f4bbd31eda0c" + integrity sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug== + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -4818,7 +4961,7 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethereumjs-util@^7.1.4: +ethereumjs-util@^7.1.4, ethereumjs-util@^7.1.5: version "7.1.5" resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== @@ -8422,6 +8565,15 @@ secp256k1@^4.0.1: node-addon-api "^5.0.0" node-gyp-build "^4.2.0" +secp256k1@^5.0.0: + version "5.0.1" + resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-5.0.1.tgz#dc2c86187d48ff2da756f0f7e96417ee03c414b1" + integrity sha512-lDFs9AAIaWP9UCdtWrotXWWF9t8PWgQDcxqgAnpM9rMqxb3Oaq2J0thzPVSxBwdJgyQtkU/sYtFtbM1RSt/iYA== + dependencies: + elliptic "^6.5.7" + node-addon-api "^5.0.0" + node-gyp-build "^4.2.0" + secure-compare@3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/secure-compare/-/secure-compare-3.0.1.tgz#f1a0329b308b221fae37b9974f3d578d0ca999e3" @@ -8814,7 +8966,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -8831,15 +8983,6 @@ string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -8891,7 +9034,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -8912,13 +9055,6 @@ strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -9928,7 +10064,7 @@ workerpool@^6.5.1: resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.5.1.tgz#060f73b39d0caf97c6db64da004cd01b4c099544" integrity sha512-Fs4dNYcsdpYSAfVxhnl1L5zTksjvOJxtC5hzMNl+1t9B8hTJTdKDyZ5ju7ztgPy+ft9tBFXoOlDNiOT9WUXZlA== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -9946,15 +10082,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"