From 021b43ae69ad69ac4c77326d8285b2f6d0ea7537 Mon Sep 17 00:00:00 2001 From: mrlotfi Date: Tue, 18 Feb 2025 23:01:13 +0330 Subject: [PATCH] Initial swift v2 implementation --- .env.sample | 3 + package-lock.json | 3885 ++++++++++++++++- package.json | 3 + ...auction.idl.ts => swift-auction-v2.idl.ts} | 634 +-- src/abis/swift-v2.idl.ts | 2940 +++++++++++++ src/abis/swift.idl.ts | 2373 ---------- src/config/chains.ts | 17 + src/config/contracts.ts | 19 +- src/config/init.ts | 4 +- src/config/rpc.ts | 2 + src/config/tokens.ts | 71 +- src/config/wallet.ts | 6 + src/driver.conf.ts | 3 + src/driver/driver.ts | 110 +- src/driver/evm.ts | 27 +- src/driver/routers.ts | 99 + src/driver/solana-ix.ts | 93 +- src/driver/solana.ts | 62 +- src/driver/sui.ts | 212 + src/driver/unlocker.ts | 14 +- src/driver/wallet-helper.ts | 6 +- src/index.ts | 44 +- src/relayer.ts | 102 +- src/swap.dto.ts | 12 +- src/utils/buffer.ts | 19 +- src/utils/finality.ts | 20 +- src/utils/order-hash.ts | 115 +- src/utils/state-parser.ts | 46 +- src/utils/sui.ts | 0 src/utils/wormhole.ts | 27 + src/watchers/mayan-explorer.ts | 32 +- 31 files changed, 7849 insertions(+), 3151 deletions(-) rename src/abis/{swift-auction.idl.ts => swift-auction-v2.idl.ts} (68%) create mode 100644 src/abis/swift-v2.idl.ts delete mode 100644 src/abis/swift.idl.ts create mode 100644 src/driver/sui.ts create mode 100644 src/utils/sui.ts diff --git a/.env.sample b/.env.sample index b2e176e..4d00010 100644 --- a/.env.sample +++ b/.env.sample @@ -1,5 +1,7 @@ SOLANA_PRIVATE_KEY="" EVM_PRIVATE_KEY="" +SUI_PRIVATE_KEY="suiprivkey1qpnt9cfvz0h25c0zggsw9y7g29adgzgyecmf2gpzdn2l4zhplnu4jn7fquy" + SOLANA_PRIORITY_FEE=10000 ONE_INCH_API_KEY="" OKX_API_KEY="" @@ -11,6 +13,7 @@ WORMHOLE_GUARDIAN_RPCS="https://wormhole-v2-mainnet-api.mcf.rocks,https://wormho JUP_V6_ENDPOINT="https://quote-api.jup.ag/v6" JUP_EXCLUDED_DEXES="" +SUI_FULL_NODE="https://fullnode.mainnet.sui.io:443" SOLANA_RPC="https://api.mainnet-beta.solana.com" SOLANA_SEND_RPCS="https://mainnet.block-engine.jito.wtf/api/v1/transactions,https://api.tatum.io/v3/blockchain/node/solana-mainnet" AVALANCHE_RPC="https://1rpc.io/avax/c" diff --git a/package-lock.json b/package-lock.json index f635ca2..75a26f6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,9 +13,12 @@ "@certusone/wormhole-sdk-proto-web": "^0.0.7", "@coral-xyz/anchor": "^0.29.0", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", + "@mysten/sui": "^1.21.2", "@solana/buffer-layout": "^4.0.1", "@solana/spl-token": "^0.4.6", "@solana/web3.js": "^1.91.8", + "aftermath-ts-sdk": "^1.2.51", + "anchor30": "npm:@coral-xyz/anchor@^0.30.1", "axios": "^1.7.2", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", @@ -35,6 +38,32 @@ "typescript-eslint": "^7.10.0" } }, + "node_modules/@0no-co/graphql.web": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@0no-co/graphql.web/-/graphql.web-1.1.1.tgz", + "integrity": "sha512-F2i3xdycesw78QCOBHmpTn7eaD2iNXGwB2gkfwxcOfBbeauYpr8RBSyJOkDrFtKtVRMclg8Sg3n1ip0ACyUuag==", + "peerDependencies": { + "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0" + }, + "peerDependenciesMeta": { + "graphql": { + "optional": true + } + } + }, + "node_modules/@0no-co/graphqlsp": { + "version": "1.12.16", + "resolved": "https://registry.npmjs.org/@0no-co/graphqlsp/-/graphqlsp-1.12.16.tgz", + "integrity": "sha512-B5pyYVH93Etv7xjT6IfB7QtMBdaaC07yjbhN6v8H7KgFStMkPvi+oWYBTibMFRMY89qwc9H8YixXg8SXDVgYWw==", + "dependencies": { + "@gql.tada/internal": "^1.0.0", + "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0" + }, + "peerDependencies": { + "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0", + "typescript": "^5.0.0" + } + }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", @@ -166,6 +195,43 @@ "@solana/web3.js": "^1.2.0" } }, + "node_modules/@certusone/wormhole-sdk/node_modules/@mysten/bcs": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.1.tgz", + "integrity": "sha512-wFPb8bkhwrbiStfZMV5rFM7J+umpke59/dNjDp+UYJKykNlW23LCk2ePyEUvGdb62HGJM1jyOJ8g4egE3OmdKA==", + "dependencies": { + "bs58": "^5.0.0" + } + }, + "node_modules/@certusone/wormhole-sdk/node_modules/@mysten/bcs/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@certusone/wormhole-sdk/node_modules/@mysten/sui.js": { + "version": "0.32.2", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.32.2.tgz", + "integrity": "sha512-/Hm4xkGolJhqj8FvQr7QSHDTlxIvL52mtbOao9f75YjrBh7y1Uh9kbJSY7xiTF1NY9sv6p5hUVlYRJuM0Hvn9A==", + "deprecated": "This package has been renamed to @mysten/sui, please update to use the renamed package.", + "dependencies": { + "@mysten/bcs": "0.7.1", + "@noble/curves": "^1.0.0", + "@noble/hashes": "^1.3.0", + "@scure/bip32": "^1.3.0", + "@scure/bip39": "^1.2.0", + "@suchipi/femver": "^1.0.0", + "jayson": "^4.0.0", + "rpc-websockets": "^7.5.1", + "superstruct": "^1.0.3", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=16" + } + }, "node_modules/@certusone/wormhole-sdk/node_modules/@solana/spl-token": { "version": "0.3.11", "resolved": "https://registry.npmjs.org/@solana/spl-token/-/spl-token-0.3.11.tgz", @@ -191,6 +257,19 @@ "follow-redirects": "^1.14.4" } }, + "node_modules/@certusone/wormhole-sdk/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "node_modules/@certusone/wormhole-sdk/node_modules/superstruct": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.4.tgz", + "integrity": "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@classic-terra/terra.proto": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@classic-terra/terra.proto/-/terra.proto-1.1.0.tgz", @@ -317,6 +396,14 @@ "node": ">=11" } }, + "node_modules/@coral-xyz/anchor-errors": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz", + "integrity": "sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ==", + "engines": { + "node": ">=10" + } + }, "node_modules/@coral-xyz/anchor/node_modules/superstruct": { "version": "0.15.5", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", @@ -1367,11 +1454,47 @@ "@ethersproject/strings": "^5.7.0" } }, + "node_modules/@gql.tada/cli-utils": { + "version": "1.6.3", + "resolved": "https://registry.npmjs.org/@gql.tada/cli-utils/-/cli-utils-1.6.3.tgz", + "integrity": "sha512-jFFSY8OxYeBxdKi58UzeMXG1tdm4FVjXa8WHIi66Gzu9JWtCE6mqom3a8xkmSw+mVaybFW5EN2WXf1WztJVNyQ==", + "dependencies": { + "@0no-co/graphqlsp": "^1.12.13", + "@gql.tada/internal": "1.0.8", + "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0" + }, + "peerDependencies": { + "@0no-co/graphqlsp": "^1.12.13", + "@gql.tada/svelte-support": "1.0.1", + "@gql.tada/vue-support": "1.0.1", + "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0", + "typescript": "^5.0.0" + }, + "peerDependenciesMeta": { + "@gql.tada/svelte-support": { + "optional": true + }, + "@gql.tada/vue-support": { + "optional": true + } + } + }, + "node_modules/@gql.tada/internal": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@gql.tada/internal/-/internal-1.0.8.tgz", + "integrity": "sha512-XYdxJhtHC5WtZfdDqtKjcQ4d7R1s0d1rnlSs3OcBEUbYiPoJJfZU7tWsVXuv047Z6msvmr4ompJ7eLSK5Km57g==", + "dependencies": { + "@0no-co/graphql.web": "^1.0.5" + }, + "peerDependencies": { + "graphql": "^15.5.0 || ^16.0.0 || ^17.0.0", + "typescript": "^5.0.0" + } + }, "node_modules/@graphql-typed-document-node/core": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/@graphql-typed-document-node/core/-/core-3.2.0.tgz", "integrity": "sha512-mB9oAsNCm9aM3/SOv4YtBMqZbYj10R7dkq8byBqxGY/ncFwhf2oQzMV+LCRlWoDSEBJ3COiR1yeDvMtsoOsuFQ==", - "optional": true, "peerDependencies": { "graphql": "^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" } @@ -1754,9 +1877,10 @@ } }, "node_modules/@mysten/bcs": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.1.tgz", - "integrity": "sha512-wFPb8bkhwrbiStfZMV5rFM7J+umpke59/dNjDp+UYJKykNlW23LCk2ePyEUvGdb62HGJM1jyOJ8g4egE3OmdKA==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.11.1.tgz", + "integrity": "sha512-xP85isNSYUCHd3O/g+TmZYmg4wK6cU8q/n/MebkIGP4CYVJZz2wU/G24xIZ3wI+0iTop4dfgA5kYrg/DQKCUzA==", + "peer": true, "dependencies": { "bs58": "^5.0.0" } @@ -1764,29 +1888,58 @@ "node_modules/@mysten/bcs/node_modules/base-x": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", - "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==", + "peer": true }, "node_modules/@mysten/bcs/node_modules/bs58": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "peer": true, "dependencies": { "base-x": "^4.0.0" } }, + "node_modules/@mysten/sui": { + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/@mysten/sui/-/sui-1.21.2.tgz", + "integrity": "sha512-8AesvczokAUv796XiOo8af2+1IYA9bRon11Ra+rwehvqhz+sMRT8A+Cw5sDnlSc9/aQwM51JQKUnvMczNbpfYA==", + "dependencies": { + "@graphql-typed-document-node/core": "^3.2.0", + "@mysten/bcs": "1.4.0", + "@noble/curves": "^1.4.2", + "@noble/hashes": "^1.4.0", + "@scure/bip32": "^1.4.0", + "@scure/bip39": "^1.3.0", + "@suchipi/femver": "^1.0.0", + "bech32": "^2.0.0", + "gql.tada": "^1.8.2", + "graphql": "^16.9.0", + "jose": "^5.6.3", + "poseidon-lite": "^0.2.0", + "valibot": "^0.36.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/@mysten/sui.js": { - "version": "0.32.2", - "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.32.2.tgz", - "integrity": "sha512-/Hm4xkGolJhqj8FvQr7QSHDTlxIvL52mtbOao9f75YjrBh7y1Uh9kbJSY7xiTF1NY9sv6p5hUVlYRJuM0Hvn9A==", + "version": "0.54.1", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.54.1.tgz", + "integrity": "sha512-TSmGIX7U9O/uS9EKIQdv7/S69KTbBhMJVelXCafJE6IJw8iB9cN9uLu0+uklkBSDrbRmLSEY70jMr3uRFjReIg==", + "deprecated": "This package has been renamed to @mysten/sui, please update to use the renamed package.", + "peer": true, "dependencies": { - "@mysten/bcs": "0.7.1", - "@noble/curves": "^1.0.0", - "@noble/hashes": "^1.3.0", - "@scure/bip32": "^1.3.0", - "@scure/bip39": "^1.2.0", + "@graphql-typed-document-node/core": "^3.2.0", + "@mysten/bcs": "0.11.1", + "@noble/curves": "^1.1.0", + "@noble/hashes": "^1.3.1", + "@scure/bip32": "^1.3.1", + "@scure/bip39": "^1.2.1", "@suchipi/femver": "^1.0.0", - "jayson": "^4.0.0", - "rpc-websockets": "^7.5.1", + "bech32": "^2.0.0", + "gql.tada": "^1.7.0", + "graphql": "^16.8.1", "superstruct": "^1.0.3", "tweetnacl": "^1.0.3" }, @@ -1798,10 +1951,57 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.4.tgz", "integrity": "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==", + "peer": true, "engines": { "node": ">=14.0.0" } }, + "node_modules/@mysten/sui/node_modules/@mysten/bcs": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-1.4.0.tgz", + "integrity": "sha512-YwDYspceLt8b7v6ohPvy8flQEi+smtfSG5d2A98CbUA48XBmOqTSPNmpw9wsZVVnrH2avr+BS5uVhDZT+EquYA==", + "dependencies": { + "bs58": "^6.0.0" + } + }, + "node_modules/@mysten/sui/node_modules/@noble/curves": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.8.1.tgz", + "integrity": "sha512-warwspo+UYUPep0Q+vtdVB4Ugn8GGQj8iyB3gnRWsztmUHTI3S1nhdiWNsPUGL0vud7JlRRk1XEu7Lq1KGTnMQ==", + "dependencies": { + "@noble/hashes": "1.7.1" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@mysten/sui/node_modules/@noble/hashes": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.7.1.tgz", + "integrity": "sha512-B8XBPsn4vT/KJAGqDzbwztd+6Yte3P4V7iafm24bxgDe/mlRuK6xmWPuCNrKt2vDafZ8MfJLlchDG/vYafQEjQ==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@mysten/sui/node_modules/base-x": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", + "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==" + }, + "node_modules/@mysten/sui/node_modules/bs58": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", + "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", + "dependencies": { + "base-x": "^5.0.0" + } + }, "node_modules/@noble/curves": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.4.0.tgz", @@ -1859,6 +2059,45 @@ "node": ">= 8" } }, + "node_modules/@open-rpc/client-js": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/@open-rpc/client-js/-/client-js-1.8.1.tgz", + "integrity": "sha512-vV+Hetl688nY/oWI9IFY0iKDrWuLdYhf7OIKI6U1DcnJV7r4gAgwRJjEr1QVYszUc0gjkHoQJzqevmXMGLyA0g==", + "dependencies": { + "isomorphic-fetch": "^3.0.0", + "isomorphic-ws": "^5.0.0", + "strict-event-emitter-types": "^2.0.0", + "ws": "^7.0.0" + } + }, + "node_modules/@open-rpc/client-js/node_modules/isomorphic-ws": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz", + "integrity": "sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==", + "peerDependencies": { + "ws": "*" + } + }, + "node_modules/@open-rpc/client-js/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/@project-serum/anchor": { "version": "0.25.0", "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.25.0.tgz", @@ -1966,6 +2205,97 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, + "node_modules/@pythnetwork/price-service-client": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-client/-/price-service-client-1.9.0.tgz", + "integrity": "sha512-SLm3IFcfmy9iMqHeT4Ih6qMNZhJEefY14T9yTlpsH2D/FE5+BaGGnfcexUifVlfH6M7mwRC4hEFdNvZ6ebZjJg==", + "deprecated": "This package is deprecated and is no longer maintained. Please use @pythnetwork/hermes-client instead.", + "dependencies": { + "@pythnetwork/price-service-sdk": "*", + "@types/ws": "^8.5.3", + "axios": "^1.5.1", + "axios-retry": "^3.8.0", + "isomorphic-ws": "^4.0.1", + "ts-log": "^2.2.4", + "ws": "^8.6.0" + } + }, + "node_modules/@pythnetwork/price-service-client/node_modules/@types/ws": { + "version": "8.5.14", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", + "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", + "dependencies": { + "@types/node": "*" + } + }, + "node_modules/@pythnetwork/price-service-sdk": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@pythnetwork/price-service-sdk/-/price-service-sdk-1.8.0.tgz", + "integrity": "sha512-tFZ1thj3Zja06DzPIX2dEWSi7kIfIyqreoywvw5NQ3Z1pl5OJHQGMEhxt6Li3UCGSp2ooYZS9wl8/8XfrfrNSA==", + "dependencies": { + "bn.js": "^5.2.1" + } + }, + "node_modules/@pythnetwork/pyth-sui-js": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/@pythnetwork/pyth-sui-js/-/pyth-sui-js-1.2.5.tgz", + "integrity": "sha512-rzbRVWJ4E5FjYZ+rJ817QHh8hT/l7YG5W/TGthhNMcwIhD4CG4tcpuuAoLSbphaww7fhFri7jFEWYp/WOm4iPw==", + "dependencies": { + "@mysten/sui.js": "^0.37.1", + "@pythnetwork/price-service-client": "*", + "buffer": "^6.0.3" + } + }, + "node_modules/@pythnetwork/pyth-sui-js/node_modules/@mysten/bcs": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@mysten/bcs/-/bcs-0.7.3.tgz", + "integrity": "sha512-fbusBfsyc2MpTACi72H5edWJ670T84va+qn9jSPpb5BzZ+pzUM1Q0ApPrF5OT+mB1o5Ng+mxPQpBCZQkfiV2TA==", + "dependencies": { + "bs58": "^5.0.0" + } + }, + "node_modules/@pythnetwork/pyth-sui-js/node_modules/@mysten/sui.js": { + "version": "0.37.1", + "resolved": "https://registry.npmjs.org/@mysten/sui.js/-/sui.js-0.37.1.tgz", + "integrity": "sha512-nEOqnjUqb/VJcVk23LgZOX1FmBib/mBCwAWaJhtsCHLwv2jIAfCPY/fpB9lJ62QHrM8UFclpWxsLkqcUkKyPgA==", + "deprecated": "This package has been renamed to @mysten/sui, please update to use the renamed package.", + "dependencies": { + "@mysten/bcs": "0.7.3", + "@noble/curves": "^1.0.0", + "@noble/hashes": "^1.3.0", + "@open-rpc/client-js": "^1.8.1", + "@scure/bip32": "^1.3.0", + "@scure/bip39": "^1.2.0", + "@suchipi/femver": "^1.0.0", + "events": "^3.3.0", + "superstruct": "^1.0.3", + "tweetnacl": "^1.0.3" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@pythnetwork/pyth-sui-js/node_modules/base-x": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-4.0.0.tgz", + "integrity": "sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==" + }, + "node_modules/@pythnetwork/pyth-sui-js/node_modules/bs58": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-5.0.0.tgz", + "integrity": "sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==", + "dependencies": { + "base-x": "^4.0.0" + } + }, + "node_modules/@pythnetwork/pyth-sui-js/node_modules/superstruct": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.4.tgz", + "integrity": "sha512-7JpaAoX2NGyoFlI9NBh66BQXGONc+uE+MRS5i2iOBKuS4e+ccgMDjATgZldkah+33DakBxDHiss9kvUcGAO8UQ==", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@scure/base": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz", @@ -2796,6 +3126,41 @@ "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" }, + "node_modules/aftermath-ts-sdk": { + "version": "1.2.51", + "resolved": "https://registry.npmjs.org/aftermath-ts-sdk/-/aftermath-ts-sdk-1.2.51.tgz", + "integrity": "sha512-syo91oCW3uKRUMy3tGtPH/aStNEoDcP89NTLAGni6Cvf/YliScuZpOwIafNqRFtrBh9oPTac86YFUKmPtoIX3g==", + "dependencies": { + "@pythnetwork/pyth-sui-js": "^1.2.3", + "bn.js": "^5.2.1", + "dayjs": "^1.11.7", + "i": "^0.3.7", + "node-fetch": "^3.3.1", + "npm": "^9.6.2", + "priority-queue-typescript": "^1.0.1" + }, + "peerDependencies": { + "@mysten/sui": "^1.12.0", + "@mysten/sui.js": "^0.54.1" + } + }, + "node_modules/aftermath-ts-sdk/node_modules/node-fetch": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", + "dependencies": { + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" + }, + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" + } + }, "node_modules/agentkeepalive": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", @@ -2851,20 +3216,66 @@ "node": ">=18.0.0" } }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "devOptional": true, + "node_modules/anchor30": { + "name": "@coral-xyz/anchor", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.30.1.tgz", + "integrity": "sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ==", + "dependencies": { + "@coral-xyz/anchor-errors": "^0.30.1", + "@coral-xyz/borsh": "^0.30.1", + "@noble/hashes": "^1.3.1", + "@solana/web3.js": "^1.68.0", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^6.3.0", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "superstruct": "^0.15.4", + "toml": "^3.0.0" + }, "engines": { - "node": ">=8" + "node": ">=11" } }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "devOptional": true, + "node_modules/anchor30/node_modules/@coral-xyz/borsh": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.30.1.tgz", + "integrity": "sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ==", + "dependencies": { + "bn.js": "^5.1.2", + "buffer-layout": "^1.2.0" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "@solana/web3.js": "^1.68.0" + } + }, + "node_modules/anchor30/node_modules/superstruct": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.15.5.tgz", + "integrity": "sha512-4AOeU+P5UuE/4nOUkmcQdW5y7i9ndt1cQd/3iUe+LTz3RxESf/W/5lg4B74HbDMMv8PHnPnGCQFH45kBcrQYoQ==" + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "devOptional": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "devOptional": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -2984,11 +3395,19 @@ "proxy-from-env": "^1.1.0" } }, + "node_modules/axios-retry": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/axios-retry/-/axios-retry-3.9.1.tgz", + "integrity": "sha512-8PJDLJv7qTTMMwdnbMvrLYuvB47M81wRtxQmEdV5w4rgbTXTt+vtPkXwajOfOdSyv/wZICJOC+/UhXH4aQ/R+w==", + "dependencies": { + "@babel/runtime": "^7.15.4", + "is-retry-allowed": "^2.2.0" + } + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "devOptional": true + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" }, "node_modules/base-x": { "version": "3.0.9", @@ -3129,7 +3548,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "devOptional": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3367,8 +3785,7 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "devOptional": true + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" }, "node_modules/copyfiles": { "version": "2.4.1", @@ -3527,6 +3944,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, + "node_modules/dayjs": { + "version": "1.11.13", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", + "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==" + }, "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", @@ -4334,6 +4764,14 @@ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -4425,6 +4863,28 @@ "resolved": "https://registry.npmjs.org/fecha/-/fecha-4.2.3.tgz", "integrity": "sha512-OP2IUU6HeYKJi3i0z4A19kHMQoLVs4Hc+DPqqxI2h/DPZHTm/vjsfC6P0b4jCMy14XizLBqvndQ+UilD7707Jw==" }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -4531,6 +4991,17 @@ "node": ">= 6" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/fraction.js": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", @@ -4546,8 +5017,7 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "devOptional": true + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, "node_modules/function-bind": { "version": "1.1.2", @@ -4590,7 +5060,6 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "devOptional": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -4688,6 +5157,24 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/gql.tada": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/gql.tada/-/gql.tada-1.8.10.tgz", + "integrity": "sha512-FrvSxgz838FYVPgZHGOSgbpOjhR+yq44rCzww3oOPJYi0OvBJjAgCiP6LEokZIYND2fUTXzQAyLgcvgw1yNP5A==", + "dependencies": { + "@0no-co/graphql.web": "^1.0.5", + "@0no-co/graphqlsp": "^1.12.13", + "@gql.tada/cli-utils": "1.6.3", + "@gql.tada/internal": "1.0.8" + }, + "bin": { + "gql-tada": "bin/cli.js", + "gql.tada": "bin/cli.js" + }, + "peerDependencies": { + "typescript": "^5.0.0" + } + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -4695,10 +5182,9 @@ "dev": true }, "node_modules/graphql": { - "version": "16.8.2", - "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.2.tgz", - "integrity": "sha512-cvVIBILwuoSyD54U4cF/UXDh5yAobhNV/tPygI4lZhgOIJQE/WLWC4waBRb4I6bDVYb3OVx3lfHbaQOEoUD5sg==", - "optional": true, + "version": "16.10.0", + "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.10.0.tgz", + "integrity": "sha512-AjqGKbDGUFRKIRCP9tCKiIGHyriz2oHEbPIbEtcSLSs4YjReZOIPQQWek4+6hjw62H9QShXHyaGivGiYVLeYFQ==", "engines": { "node": "^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0" } @@ -4722,8 +5208,6 @@ "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "peer": true, "engines": { "node": ">=8" } @@ -4859,6 +5343,14 @@ "ms": "^2.0.0" } }, + "node_modules/i": { + "version": "0.3.7", + "resolved": "https://registry.npmjs.org/i/-/i-0.3.7.tgz", + "integrity": "sha512-FYz4wlXgkQwIPqhzC5TdNMLSE5+GS1IIDJZY/1ZiEPCT2S3COUVZeT5OW4BmW4r5LHLQuOosSwsvnroG9GR59Q==", + "engines": { + "node": ">=0.4" + } + }, "node_modules/ieee754": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", @@ -4919,7 +5411,6 @@ "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "devOptional": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -5015,6 +5506,17 @@ "node": ">=8" } }, + "node_modules/is-retry-allowed": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-2.2.0.tgz", + "integrity": "sha512-XVm7LOeLpTW4jV19QSH38vkswxoLud8sQ57YwJVTPWdiaI9I8keEhGFpBlslyVsgdQy4Opg8QOLb8YRgsyZiQg==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -5035,9 +5537,16 @@ "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "peer": true + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/isomorphic-fetch": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-3.0.0.tgz", + "integrity": "sha512-qvUtwJ3j6qwsF3jLxkZ72qCgjMysPzDfeV240JHiGZsANBYd+EEuu35v7dfrJ9Up0Ak07D7GGSkGhCHTqg/5wA==", + "dependencies": { + "node-fetch": "^2.6.1", + "whatwg-fetch": "^3.4.1" + } }, "node_modules/isomorphic-ws": { "version": "4.0.1", @@ -5107,6 +5616,14 @@ } } }, + "node_modules/jose": { + "version": "5.9.6", + "resolved": "https://registry.npmjs.org/jose/-/jose-5.9.6.tgz", + "integrity": "sha512-AMlnetc9+CV9asI19zHmrgS/WYsWUwCn2R7RzlbJWD7F9eWYUTGyBmU9o6PxngtLGOiDGPRu+Uc4fhKzbpteZQ==", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, "node_modules/js-base64": { "version": "3.7.7", "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-3.7.7.tgz", @@ -5540,7 +6057,6 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "devOptional": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -5625,6 +6141,24 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { "version": "2.7.0", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", @@ -5682,145 +6216,3167 @@ "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", "optional": true }, - "node_modules/o3": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/o3/-/o3-1.0.3.tgz", - "integrity": "sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ==", + "node_modules/npm": { + "version": "9.9.4", + "resolved": "https://registry.npmjs.org/npm/-/npm-9.9.4.tgz", + "integrity": "sha512-NzcQiLpqDuLhavdyJ2J3tGJ/ni/ebcqHVFZkv1C4/6lblraUPbPgCJ4Vhb4oa3FFhRa2Yj9gA58jGH/ztKueNQ==", + "bundleDependencies": [ + "@isaacs/string-locale-compare", + "@npmcli/arborist", + "@npmcli/config", + "@npmcli/fs", + "@npmcli/map-workspaces", + "@npmcli/package-json", + "@npmcli/promise-spawn", + "@npmcli/run-script", + "abbrev", + "archy", + "cacache", + "chalk", + "ci-info", + "cli-columns", + "cli-table3", + "columnify", + "fastest-levenshtein", + "fs-minipass", + "glob", + "graceful-fs", + "hosted-git-info", + "ini", + "init-package-json", + "is-cidr", + "json-parse-even-better-errors", + "libnpmaccess", + "libnpmdiff", + "libnpmexec", + "libnpmfund", + "libnpmhook", + "libnpmorg", + "libnpmpack", + "libnpmpublish", + "libnpmsearch", + "libnpmteam", + "libnpmversion", + "make-fetch-happen", + "minimatch", + "minipass", + "minipass-pipeline", + "ms", + "node-gyp", + "nopt", + "normalize-package-data", + "npm-audit-report", + "npm-install-checks", + "npm-package-arg", + "npm-pick-manifest", + "npm-profile", + "npm-registry-fetch", + "npm-user-validate", + "npmlog", + "p-map", + "pacote", + "parse-conflict-json", + "proc-log", + "qrcode-terminal", + "read", + "semver", + "sigstore", + "spdx-expression-parse", + "ssri", + "supports-color", + "tar", + "text-table", + "tiny-relative-date", + "treeverse", + "validate-npm-package-name", + "which", + "write-file-atomic" + ], + "workspaces": [ + "docs", + "smoke-tests", + "mock-globals", + "mock-registry", + "workspaces/*" + ], "dependencies": { - "capability": "^0.2.5" + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/arborist": "^6.5.0", + "@npmcli/config": "^6.4.0", + "@npmcli/fs": "^3.1.0", + "@npmcli/map-workspaces": "^3.0.4", + "@npmcli/package-json": "^4.0.1", + "@npmcli/promise-spawn": "^6.0.2", + "@npmcli/run-script": "^6.0.2", + "abbrev": "^2.0.0", + "archy": "~1.0.0", + "cacache": "^17.1.4", + "chalk": "^5.3.0", + "ci-info": "^4.0.0", + "cli-columns": "^4.0.0", + "cli-table3": "^0.6.3", + "columnify": "^1.6.0", + "fastest-levenshtein": "^1.0.16", + "fs-minipass": "^3.0.3", + "glob": "^10.3.10", + "graceful-fs": "^4.2.11", + "hosted-git-info": "^6.1.3", + "ini": "^4.1.1", + "init-package-json": "^5.0.0", + "is-cidr": "^4.0.2", + "json-parse-even-better-errors": "^3.0.1", + "libnpmaccess": "^7.0.2", + "libnpmdiff": "^5.0.20", + "libnpmexec": "^6.0.4", + "libnpmfund": "^4.2.1", + "libnpmhook": "^9.0.3", + "libnpmorg": "^5.0.4", + "libnpmpack": "^5.0.20", + "libnpmpublish": "^7.5.1", + "libnpmsearch": "^6.0.2", + "libnpmteam": "^5.0.3", + "libnpmversion": "^4.0.2", + "make-fetch-happen": "^11.1.1", + "minimatch": "^9.0.3", + "minipass": "^7.0.4", + "minipass-pipeline": "^1.2.4", + "ms": "^2.1.2", + "node-gyp": "^9.4.1", + "nopt": "^7.2.0", + "normalize-package-data": "^5.0.0", + "npm-audit-report": "^5.0.0", + "npm-install-checks": "^6.3.0", + "npm-package-arg": "^10.1.0", + "npm-pick-manifest": "^8.0.2", + "npm-profile": "^7.0.1", + "npm-registry-fetch": "^14.0.5", + "npm-user-validate": "^2.0.0", + "npmlog": "^7.0.1", + "p-map": "^4.0.0", + "pacote": "^15.2.0", + "parse-conflict-json": "^3.0.1", + "proc-log": "^3.0.0", + "qrcode-terminal": "^0.12.0", + "read": "^2.1.0", + "semver": "^7.6.0", + "sigstore": "^1.9.0", + "spdx-expression-parse": "^3.0.1", + "ssri": "^10.0.5", + "supports-color": "^9.4.0", + "tar": "^6.2.1", + "text-table": "~0.2.0", + "tiny-relative-date": "^1.3.0", + "treeverse": "^3.0.0", + "validate-npm-package-name": "^5.0.0", + "which": "^3.0.1", + "write-file-atomic": "^5.0.1" + }, + "bin": { + "npm": "bin/npm-cli.js", + "npx": "bin/npx-cli.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "node_modules/npm/node_modules/@colors/colors": { + "version": "1.5.0", + "inBundle": true, + "license": "MIT", "optional": true, "engines": { - "node": ">=0.10.0" + "node": ">=0.1.90" } }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "optional": true, + "node_modules/npm/node_modules/@gar/promisify": { + "version": "1.1.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, "engines": { - "node": ">= 0.4" + "node": ">=12" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "devOptional": true, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT", "dependencies": { - "wrappy": "1" + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/one-time": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", - "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "node_modules/npm/node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "inBundle": true, + "license": "MIT", "dependencies": { - "fn.name": "1.x.x" + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" } }, - "node_modules/optimism": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", - "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", - "optional": true, + "node_modules/npm/node_modules/@isaacs/string-locale-compare": { + "version": "1.1.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/@npmcli/arborist": { + "version": "6.5.1", + "inBundle": true, + "license": "ISC", "dependencies": { - "@wry/caches": "^1.0.0", - "@wry/context": "^0.7.0", - "@wry/trie": "^0.4.3", - "tslib": "^2.3.0" + "@isaacs/string-locale-compare": "^1.1.0", + "@npmcli/fs": "^3.1.0", + "@npmcli/installed-package-contents": "^2.0.2", + "@npmcli/map-workspaces": "^3.0.2", + "@npmcli/metavuln-calculator": "^5.0.0", + "@npmcli/name-from-folder": "^2.0.0", + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/package-json": "^4.0.0", + "@npmcli/query": "^3.1.0", + "@npmcli/run-script": "^6.0.0", + "bin-links": "^4.0.1", + "cacache": "^17.0.4", + "common-ancestor-path": "^1.0.1", + "hosted-git-info": "^6.1.1", + "json-parse-even-better-errors": "^3.0.0", + "json-stringify-nice": "^1.1.4", + "minimatch": "^9.0.0", + "nopt": "^7.0.0", + "npm-install-checks": "^6.2.0", + "npm-package-arg": "^10.1.0", + "npm-pick-manifest": "^8.0.1", + "npm-registry-fetch": "^14.0.3", + "npmlog": "^7.0.1", + "pacote": "^15.0.8", + "parse-conflict-json": "^3.0.0", + "proc-log": "^3.0.0", + "promise-all-reject-late": "^1.0.0", + "promise-call-limit": "^1.0.2", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "ssri": "^10.0.1", + "treeverse": "^3.0.0", + "walk-up-path": "^3.0.1" + }, + "bin": { + "arborist": "bin/index.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/optimism/node_modules/@wry/trie": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", - "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", - "optional": true, + "node_modules/npm/node_modules/@npmcli/config": { + "version": "6.4.1", + "inBundle": true, + "license": "ISC", "dependencies": { - "tslib": "^2.3.0" + "@npmcli/map-workspaces": "^3.0.2", + "ci-info": "^4.0.0", + "ini": "^4.1.0", + "nopt": "^7.0.0", + "proc-log": "^3.0.0", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.5", + "walk-up-path": "^3.0.1" }, "engines": { - "node": ">=8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/optionator": { - "version": "0.9.4", - "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", - "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", - "dev": true, - "peer": true, + "node_modules/npm/node_modules/@npmcli/disparity-colors": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", "dependencies": { - "deep-is": "^0.1.3", - "fast-levenshtein": "^2.0.6", - "levn": "^0.4.1", - "prelude-ls": "^1.2.1", - "type-check": "^0.4.0", - "word-wrap": "^1.2.5" + "ansi-styles": "^4.3.0" }, "engines": { - "node": ">= 0.8.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/p-limit": { + "node_modules/npm/node_modules/@npmcli/fs": { "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "peer": true, + "inBundle": true, + "license": "ISC", "dependencies": { - "yocto-queue": "^0.1.0" + "semver": "^7.3.5" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "peer": true, + "node_modules/npm/node_modules/@npmcli/git": { + "version": "4.1.0", + "inBundle": true, + "license": "ISC", "dependencies": { - "p-limit": "^3.0.2" + "@npmcli/promise-spawn": "^6.0.0", + "lru-cache": "^7.4.4", + "npm-pick-manifest": "^8.0.0", + "proc-log": "^3.0.0", + "promise-inflight": "^1.0.1", + "promise-retry": "^2.0.1", + "semver": "^7.3.5", + "which": "^3.0.0" }, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/pako": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", - "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" - }, - "node_modules/parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "peer": true, + "node_modules/npm/node_modules/@npmcli/installed-package-contents": { + "version": "2.0.2", + "inBundle": true, + "license": "ISC", "dependencies": { - "callsites": "^3.0.0" + "npm-bundled": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "bin": { + "installed-package-contents": "lib/index.js" }, "engines": { - "node": ">=6" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "node_modules/npm/node_modules/@npmcli/map-workspaces": { + "version": "3.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/name-from-folder": "^2.0.0", + "glob": "^10.2.2", + "minimatch": "^9.0.0", + "read-package-json-fast": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { + "version": "5.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cacache": "^17.0.0", + "json-parse-even-better-errors": "^3.0.0", + "pacote": "^15.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/move-file": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/name-from-folder": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/node-gyp": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/package-json": { + "version": "4.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.1.0", + "glob": "^10.2.2", + "hosted-git-info": "^6.1.1", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^5.0.0", + "proc-log": "^3.0.0", + "semver": "^7.5.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/promise-spawn": { + "version": "6.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/query": { + "version": "3.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "postcss-selector-parser": "^6.0.10" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@npmcli/run-script": { + "version": "6.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/node-gyp": "^3.0.0", + "@npmcli/promise-spawn": "^6.0.0", + "node-gyp": "^9.0.0", + "read-package-json-fast": "^3.0.0", + "which": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "inBundle": true, + "license": "MIT", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/npm/node_modules/@sigstore/bundle": { + "version": "1.1.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/protobuf-specs": { + "version": "0.2.1", + "inBundle": true, + "license": "Apache-2.0", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/sign": { + "version": "1.0.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^1.1.0", + "@sigstore/protobuf-specs": "^0.2.0", + "make-fetch-happen": "^11.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@sigstore/tuf": { + "version": "1.0.3", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/protobuf-specs": "^0.2.0", + "tuf-js": "^1.1.7" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@tootallnate/once": { + "version": "2.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/@tufjs/canonical-json": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/@tufjs/models": { + "version": "1.0.4", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/canonical-json": "1.0.0", + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/abbrev": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/agent-base": { + "version": "6.0.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/npm/node_modules/agentkeepalive": { + "version": "4.5.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, + "node_modules/npm/node_modules/aggregate-error": { + "version": "3.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "clean-stack": "^2.0.0", + "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/ansi-regex": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/ansi-styles": { + "version": "4.3.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/aproba": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/archy": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/are-we-there-yet": { + "version": "4.0.2", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/balanced-match": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/bin-links": { + "version": "4.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cmd-shim": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "read-cmd-shim": "^4.0.0", + "write-file-atomic": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/binary-extensions": { + "version": "2.2.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/brace-expansion": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/builtins": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "semver": "^7.0.0" + } + }, + "node_modules/npm/node_modules/cacache": { + "version": "17.1.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", + "lru-cache": "^7.7.1", + "minipass": "^7.0.3", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "p-map": "^4.0.0", + "ssri": "^10.0.0", + "tar": "^6.1.11", + "unique-filename": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/chalk": { + "version": "5.3.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/npm/node_modules/chownr": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/ci-info": { + "version": "4.0.0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/cidr-regex": { + "version": "3.1.1", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "ip-regex": "^4.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/clean-stack": { + "version": "2.2.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/npm/node_modules/cli-columns": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/cli-table3": { + "version": "0.6.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "string-width": "^4.2.0" + }, + "engines": { + "node": "10.* || >= 12.*" + }, + "optionalDependencies": { + "@colors/colors": "1.5.0" + } + }, + "node_modules/npm/node_modules/clone": { + "version": "1.0.4", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8" + } + }, + "node_modules/npm/node_modules/cmd-shim": { + "version": "6.0.2", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/color-convert": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/npm/node_modules/color-name": { + "version": "1.1.4", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/color-support": { + "version": "1.1.3", + "inBundle": true, + "license": "ISC", + "bin": { + "color-support": "bin.js" + } + }, + "node_modules/npm/node_modules/columnify": { + "version": "1.6.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "strip-ansi": "^6.0.1", + "wcwidth": "^1.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/npm/node_modules/common-ancestor-path": { + "version": "1.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/concat-map": { + "version": "0.0.1", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/console-control-strings": { + "version": "1.1.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/cross-spawn": { + "version": "7.0.6", + "inBundle": true, + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/cssesc": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/debug": { + "version": "4.3.7", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/npm/node_modules/defaults": { + "version": "1.0.4", + "inBundle": true, + "license": "MIT", + "dependencies": { + "clone": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/delegates": { + "version": "1.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/diff": { + "version": "5.2.0", + "inBundle": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/npm/node_modules/eastasianwidth": { + "version": "0.2.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/emoji-regex": { + "version": "8.0.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/encoding": { + "version": "0.1.13", + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "iconv-lite": "^0.6.2" + } + }, + "node_modules/npm/node_modules/env-paths": { + "version": "2.2.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/npm/node_modules/err-code": { + "version": "2.0.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/exponential-backoff": { + "version": "3.1.1", + "inBundle": true, + "license": "Apache-2.0" + }, + "node_modules/npm/node_modules/fastest-levenshtein": { + "version": "1.0.16", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4.9.1" + } + }, + "node_modules/npm/node_modules/foreground-child": { + "version": "3.1.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/fs-minipass": { + "version": "3.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/fs.realpath": { + "version": "1.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/function-bind": { + "version": "1.1.2", + "inBundle": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/npm/node_modules/gauge": { + "version": "5.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^4.0.1", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/glob": { + "version": "10.3.10", + "inBundle": true, + "license": "ISC", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/graceful-fs": { + "version": "4.2.11", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/has-unicode": { + "version": "2.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/hasown": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/npm/node_modules/hosted-git-info": { + "version": "6.1.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^7.5.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/http-cache-semantics": { + "version": "4.1.1", + "inBundle": true, + "license": "BSD-2-Clause" + }, + "node_modules/npm/node_modules/http-proxy-agent": { + "version": "5.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/https-proxy-agent": { + "version": "5.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/humanize-ms": { + "version": "1.2.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ms": "^2.0.0" + } + }, + "node_modules/npm/node_modules/iconv-lite": { + "version": "0.6.3", + "inBundle": true, + "license": "MIT", + "optional": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/ignore-walk": { + "version": "6.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minimatch": "^9.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/imurmurhash": { + "version": "0.1.4", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/npm/node_modules/indent-string": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/infer-owner": { + "version": "1.0.4", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/inflight": { + "version": "1.0.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/npm/node_modules/inherits": { + "version": "2.0.4", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/ini": { + "version": "4.1.1", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/init-package-json": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^10.0.0", + "promzard": "^1.0.0", + "read": "^2.0.0", + "read-package-json": "^6.0.0", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/ip-address": { + "version": "9.0.5", + "inBundle": true, + "license": "MIT", + "dependencies": { + "jsbn": "1.1.0", + "sprintf-js": "^1.1.3" + }, + "engines": { + "node": ">= 12" + } + }, + "node_modules/npm/node_modules/ip-address/node_modules/sprintf-js": { + "version": "1.1.3", + "inBundle": true, + "license": "BSD-3-Clause" + }, + "node_modules/npm/node_modules/ip-regex": { + "version": "4.3.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/is-cidr": { + "version": "4.0.2", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "cidr-regex": "^3.1.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/is-core-module": { + "version": "2.13.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/npm/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/is-lambda": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/isexe": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/jackspeak": { + "version": "2.3.6", + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/npm/node_modules/jsbn": { + "version": "1.1.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/json-parse-even-better-errors": { + "version": "3.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/json-stringify-nice": { + "version": "1.1.4", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/jsonparse": { + "version": "1.3.1", + "engines": [ + "node >= 0.2.0" + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff": { + "version": "6.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/just-diff-apply": { + "version": "5.5.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/libnpmaccess": { + "version": "7.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-package-arg": "^10.1.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmdiff": { + "version": "5.0.21", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/disparity-colors": "^3.0.0", + "@npmcli/installed-package-contents": "^2.0.2", + "binary-extensions": "^2.2.0", + "diff": "^5.1.0", + "minimatch": "^9.0.0", + "npm-package-arg": "^10.1.0", + "pacote": "^15.0.8", + "tar": "^6.1.13" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmexec": { + "version": "6.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/run-script": "^6.0.0", + "ci-info": "^4.0.0", + "npm-package-arg": "^10.1.0", + "npmlog": "^7.0.1", + "pacote": "^15.0.8", + "proc-log": "^3.0.0", + "read": "^2.0.0", + "read-package-json-fast": "^3.0.2", + "semver": "^7.3.7", + "walk-up-path": "^3.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmfund": { + "version": "4.2.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmhook": { + "version": "9.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmorg": { + "version": "5.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmpack": { + "version": "5.0.21", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/arborist": "^6.5.0", + "@npmcli/run-script": "^6.0.0", + "npm-package-arg": "^10.1.0", + "pacote": "^15.0.8" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmpublish": { + "version": "7.5.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "ci-info": "^4.0.0", + "normalize-package-data": "^5.0.0", + "npm-package-arg": "^10.1.0", + "npm-registry-fetch": "^14.0.3", + "proc-log": "^3.0.0", + "semver": "^7.3.7", + "sigstore": "^1.4.0", + "ssri": "^10.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmsearch": { + "version": "6.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmteam": { + "version": "5.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^2.0.0", + "npm-registry-fetch": "^14.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/libnpmversion": { + "version": "4.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.0.1", + "@npmcli/run-script": "^6.0.0", + "json-parse-even-better-errors": "^3.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.7" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/lru-cache": { + "version": "7.18.3", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=12" + } + }, + "node_modules/npm/node_modules/make-fetch-happen": { + "version": "11.1.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^17.0.0", + "http-cache-semantics": "^4.1.1", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^10.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/make-fetch-happen/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minimatch": { + "version": "9.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/minipass": { + "version": "7.0.4", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/npm/node_modules/minipass-collect": { + "version": "1.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minipass-collect/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-fetch": { + "version": "3.0.4", + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^7.0.3", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/npm/node_modules/minipass-flush": { + "version": "1.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-json-stream": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "jsonparse": "^1.3.1", + "minipass": "^3.0.0" + } + }, + "node_modules/npm/node_modules/minipass-json-stream/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline": { + "version": "1.2.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized": { + "version": "1.0.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/minizlib": { + "version": "2.1.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.0.0", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/mkdirp": { + "version": "1.0.4", + "inBundle": true, + "license": "MIT", + "bin": { + "mkdirp": "bin/cmd.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/ms": { + "version": "2.1.3", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/mute-stream": { + "version": "1.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/negotiator": { + "version": "0.6.3", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/npm/node_modules/node-gyp": { + "version": "9.4.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", + "glob": "^7.1.4", + "graceful-fs": "^4.2.6", + "make-fetch-happen": "^10.0.3", + "nopt": "^6.0.0", + "npmlog": "^6.0.0", + "rimraf": "^3.0.2", + "semver": "^7.3.5", + "tar": "^6.1.2", + "which": "^2.0.2" + }, + "bin": { + "node-gyp": "bin/node-gyp.js" + }, + "engines": { + "node": "^12.13 || ^14.13 || >=16" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/@npmcli/fs": { + "version": "2.1.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@gar/promisify": "^1.1.3", + "semver": "^7.3.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/abbrev": { + "version": "1.1.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/node-gyp/node_modules/are-we-there-yet": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "delegates": "^1.0.0", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/brace-expansion": { + "version": "1.1.11", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache": { + "version": "16.1.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/fs": "^2.1.0", + "@npmcli/move-file": "^2.0.0", + "chownr": "^2.0.0", + "fs-minipass": "^2.1.0", + "glob": "^8.0.1", + "infer-owner": "^1.0.4", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "mkdirp": "^1.0.4", + "p-map": "^4.0.0", + "promise-inflight": "^1.0.1", + "rimraf": "^3.0.2", + "ssri": "^9.0.0", + "tar": "^6.1.11", + "unique-filename": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/brace-expansion": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/glob": { + "version": "8.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/cacache/node_modules/minimatch": { + "version": "5.1.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/fs-minipass": { + "version": "2.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/gauge": { + "version": "4.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "aproba": "^1.0.3 || ^2.0.0", + "color-support": "^1.1.3", + "console-control-strings": "^1.1.0", + "has-unicode": "^2.0.1", + "signal-exit": "^3.0.7", + "string-width": "^4.2.3", + "strip-ansi": "^6.0.1", + "wide-align": "^1.1.5" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/glob": { + "version": "7.2.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/make-fetch-happen": { + "version": "10.2.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "agentkeepalive": "^4.2.1", + "cacache": "^16.1.0", + "http-cache-semantics": "^4.1.0", + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "is-lambda": "^1.0.1", + "lru-cache": "^7.7.1", + "minipass": "^3.1.6", + "minipass-collect": "^1.0.2", + "minipass-fetch": "^2.0.3", + "minipass-flush": "^1.0.5", + "minipass-pipeline": "^1.2.4", + "negotiator": "^0.6.3", + "promise-retry": "^2.0.1", + "socks-proxy-agent": "^7.0.0", + "ssri": "^9.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minimatch": { + "version": "3.1.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/minipass-fetch": { + "version": "2.1.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "minipass": "^3.1.6", + "minipass-sized": "^1.0.3", + "minizlib": "^2.1.2" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + }, + "optionalDependencies": { + "encoding": "^0.1.13" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/nopt": { + "version": "6.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "abbrev": "^1.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/npmlog": { + "version": "6.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^3.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^4.0.3", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/signal-exit": { + "version": "3.0.7", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/node-gyp/node_modules/ssri": { + "version": "9.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.1.1" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/unique-filename": { + "version": "2.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^3.0.0" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/unique-slug": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + } + }, + "node_modules/npm/node_modules/node-gyp/node_modules/which": { + "version": "2.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/nopt": { + "version": "7.2.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "abbrev": "^2.0.0" + }, + "bin": { + "nopt": "bin/nopt.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/normalize-package-data": { + "version": "5.0.0", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "hosted-git-info": "^6.0.0", + "is-core-module": "^2.8.1", + "semver": "^7.3.5", + "validate-npm-package-license": "^3.0.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-audit-report": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-bundled": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-install-checks": { + "version": "6.3.0", + "inBundle": true, + "license": "BSD-2-Clause", + "dependencies": { + "semver": "^7.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-normalize-package-bin": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-package-arg": { + "version": "10.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "hosted-git-info": "^6.0.0", + "proc-log": "^3.0.0", + "semver": "^7.3.5", + "validate-npm-package-name": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-packlist": { + "version": "7.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "ignore-walk": "^6.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-pick-manifest": { + "version": "8.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-install-checks": "^6.0.0", + "npm-normalize-package-bin": "^3.0.0", + "npm-package-arg": "^10.0.0", + "semver": "^7.3.5" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-profile": { + "version": "7.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "npm-registry-fetch": "^14.0.0", + "proc-log": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-registry-fetch": { + "version": "14.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "make-fetch-happen": "^11.0.0", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", + "minipass-json-stream": "^1.0.1", + "minizlib": "^2.1.2", + "npm-package-arg": "^10.0.0", + "proc-log": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npm-registry-fetch/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/npm-user-validate": { + "version": "2.0.0", + "inBundle": true, + "license": "BSD-2-Clause", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/npmlog": { + "version": "7.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "are-we-there-yet": "^4.0.0", + "console-control-strings": "^1.1.0", + "gauge": "^5.0.0", + "set-blocking": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/once": { + "version": "1.4.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/npm/node_modules/p-map": { + "version": "4.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/pacote": { + "version": "15.2.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "@npmcli/git": "^4.0.0", + "@npmcli/installed-package-contents": "^2.0.1", + "@npmcli/promise-spawn": "^6.0.1", + "@npmcli/run-script": "^6.0.0", + "cacache": "^17.0.0", + "fs-minipass": "^3.0.0", + "minipass": "^5.0.0", + "npm-package-arg": "^10.0.0", + "npm-packlist": "^7.0.0", + "npm-pick-manifest": "^8.0.0", + "npm-registry-fetch": "^14.0.0", + "proc-log": "^3.0.0", + "promise-retry": "^2.0.1", + "read-package-json": "^6.0.0", + "read-package-json-fast": "^3.0.0", + "sigstore": "^1.3.0", + "ssri": "^10.0.0", + "tar": "^6.1.11" + }, + "bin": { + "pacote": "lib/bin.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/pacote/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/parse-conflict-json": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "just-diff": "^6.0.0", + "just-diff-apply": "^5.2.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/path-is-absolute": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/npm/node_modules/path-key": { + "version": "3.1.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/path-scurry": { + "version": "1.10.1", + "inBundle": true, + "license": "BlueOak-1.0.0", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.2.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/npm/node_modules/postcss-selector-parser": { + "version": "6.0.15", + "inBundle": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/npm/node_modules/proc-log": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/promise-all-reject-late": { + "version": "1.0.1", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-call-limit": { + "version": "1.0.2", + "inBundle": true, + "license": "ISC", + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/promise-inflight": { + "version": "1.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/promise-retry": { + "version": "2.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "err-code": "^2.0.2", + "retry": "^0.12.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/promzard": { + "version": "1.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "read": "^2.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/qrcode-terminal": { + "version": "0.12.0", + "inBundle": true, + "bin": { + "qrcode-terminal": "bin/qrcode-terminal.js" + } + }, + "node_modules/npm/node_modules/read": { + "version": "2.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "mute-stream": "~1.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-cmd-shim": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-package-json": { + "version": "6.0.4", + "inBundle": true, + "license": "ISC", + "dependencies": { + "glob": "^10.2.2", + "json-parse-even-better-errors": "^3.0.0", + "normalize-package-data": "^5.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/read-package-json-fast": { + "version": "3.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "json-parse-even-better-errors": "^3.0.0", + "npm-normalize-package-bin": "^3.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/readable-stream": { + "version": "3.6.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/npm/node_modules/retry": { + "version": "0.12.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/npm/node_modules/rimraf": { + "version": "3.0.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/brace-expansion": { + "version": "1.1.11", + "inBundle": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/glob": { + "version": "7.2.3", + "inBundle": true, + "license": "ISC", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/rimraf/node_modules/minimatch": { + "version": "3.1.2", + "inBundle": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/npm/node_modules/safe-buffer": { + "version": "5.2.1", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/safer-buffer": { + "version": "2.1.2", + "inBundle": true, + "license": "MIT", + "optional": true + }, + "node_modules/npm/node_modules/semver": { + "version": "7.6.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/semver/node_modules/lru-cache": { + "version": "6.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/set-blocking": { + "version": "2.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/shebang-command": { + "version": "2.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/shebang-regex": { + "version": "3.0.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/signal-exit": { + "version": "4.1.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/npm/node_modules/sigstore": { + "version": "1.9.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "@sigstore/bundle": "^1.1.0", + "@sigstore/protobuf-specs": "^0.2.0", + "@sigstore/sign": "^1.0.0", + "@sigstore/tuf": "^1.0.3", + "make-fetch-happen": "^11.0.1" + }, + "bin": { + "sigstore": "bin/sigstore.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/smart-buffer": { + "version": "4.2.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">= 6.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks": { + "version": "2.8.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ip-address": "^9.0.5", + "smart-buffer": "^4.2.0" + }, + "engines": { + "node": ">= 10.0.0", + "npm": ">= 3.0.0" + } + }, + "node_modules/npm/node_modules/socks-proxy-agent": { + "version": "7.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "agent-base": "^6.0.2", + "debug": "^4.3.3", + "socks": "^2.6.2" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/npm/node_modules/spdx-correct": { + "version": "3.2.0", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-expression-parse": "^3.0.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-exceptions": { + "version": "2.5.0", + "inBundle": true, + "license": "CC-BY-3.0" + }, + "node_modules/npm/node_modules/spdx-expression-parse": { + "version": "3.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "spdx-exceptions": "^2.1.0", + "spdx-license-ids": "^3.0.0" + } + }, + "node_modules/npm/node_modules/spdx-license-ids": { + "version": "3.0.17", + "inBundle": true, + "license": "CC0-1.0" + }, + "node_modules/npm/node_modules/ssri": { + "version": "10.0.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/string_decoder": { + "version": "1.3.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/npm/node_modules/string-width": { + "version": "4.2.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "inBundle": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi": { + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/supports-color": { + "version": "9.4.0", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/npm/node_modules/tar": { + "version": "6.2.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "chownr": "^2.0.0", + "fs-minipass": "^2.0.0", + "minipass": "^5.0.0", + "minizlib": "^2.1.1", + "mkdirp": "^1.0.3", + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/npm/node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/npm/node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "inBundle": true, + "license": "ISC", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/tar/node_modules/minipass": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": ">=8" + } + }, + "node_modules/npm/node_modules/text-table": { + "version": "0.2.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/tiny-relative-date": { + "version": "1.3.0", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/treeverse": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/tuf-js": { + "version": "1.1.7", + "inBundle": true, + "license": "MIT", + "dependencies": { + "@tufjs/models": "1.0.4", + "debug": "^4.3.4", + "make-fetch-happen": "^11.1.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/unique-filename": { + "version": "3.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "unique-slug": "^4.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/unique-slug": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/util-deprecate": { + "version": "1.0.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/validate-npm-package-license": { + "version": "3.0.4", + "inBundle": true, + "license": "Apache-2.0", + "dependencies": { + "spdx-correct": "^3.0.0", + "spdx-expression-parse": "^3.0.0" + } + }, + "node_modules/npm/node_modules/validate-npm-package-name": { + "version": "5.0.0", + "inBundle": true, + "license": "ISC", + "dependencies": { + "builtins": "^5.0.0" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/walk-up-path": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/wcwidth": { + "version": "1.0.1", + "inBundle": true, + "license": "MIT", + "dependencies": { + "defaults": "^1.0.3" + } + }, + "node_modules/npm/node_modules/which": { + "version": "3.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/wide-align": { + "version": "1.1.5", + "inBundle": true, + "license": "ISC", + "dependencies": { + "string-width": "^1.0.2 || 2 || 3 || 4" + } + }, + "node_modules/npm/node_modules/wrap-ansi": { + "version": "8.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "inBundle": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/emoji-regex": { + "version": "9.2.2", + "inBundle": true, + "license": "MIT" + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/string-width": { + "version": "5.1.2", + "inBundle": true, + "license": "MIT", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/npm/node_modules/wrap-ansi/node_modules/strip-ansi": { + "version": "7.1.0", + "inBundle": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/npm/node_modules/wrappy": { + "version": "1.0.2", + "inBundle": true, + "license": "ISC" + }, + "node_modules/npm/node_modules/write-file-atomic": { + "version": "5.0.1", + "inBundle": true, + "license": "ISC", + "dependencies": { + "imurmurhash": "^0.1.4", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/npm/node_modules/yallist": { + "version": "4.0.0", + "inBundle": true, + "license": "ISC" + }, + "node_modules/o3": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/o3/-/o3-1.0.3.tgz", + "integrity": "sha512-f+4n+vC6s4ysy7YO7O2gslWZBUu8Qj2i2OUJOvjRxQva7jVjYjB29jrr9NCjmxZQR0gzrOcv1RnqoYOeMs5VRQ==", + "dependencies": { + "capability": "^0.2.5" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "optional": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "optional": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/one-time": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/one-time/-/one-time-1.0.0.tgz", + "integrity": "sha512-5DXOiRKwuSEcQ/l0kGCF6Q3jcADFv5tSmRaJck/OqkVFcOzutB134KRSfF0xDrL39MNnqxbHBbUUcjZIhTgb2g==", + "dependencies": { + "fn.name": "1.x.x" + } + }, + "node_modules/optimism": { + "version": "0.18.0", + "resolved": "https://registry.npmjs.org/optimism/-/optimism-0.18.0.tgz", + "integrity": "sha512-tGn8+REwLRNFnb9WmcY5IfpOqeX2kpaYJ1s6Ae3mn12AeydLkR3j+jSCmVQFoXqU8D41PAJ1RG1rCRNWmNZVmQ==", + "optional": true, + "dependencies": { + "@wry/caches": "^1.0.0", + "@wry/context": "^0.7.0", + "@wry/trie": "^0.4.3", + "tslib": "^2.3.0" + } + }, + "node_modules/optimism/node_modules/@wry/trie": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@wry/trie/-/trie-0.4.3.tgz", + "integrity": "sha512-I6bHwH0fSf6RqQcnnXLJKhkSXG45MFral3GxPaY4uAl0LYDZM+YDVDAiU9bYwjTuysy1S0IeecWtmq1SZA3M1w==", + "optional": true, + "dependencies": { + "tslib": "^2.3.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dev": true, + "peer": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "peer": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "peer": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/pako": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==" + }, + "node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "peer": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, "peer": true, "engines": { @@ -5831,7 +9387,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "devOptional": true, "engines": { "node": ">=0.10.0" } @@ -5888,6 +9443,11 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/poseidon-lite": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/poseidon-lite/-/poseidon-lite-0.2.1.tgz", + "integrity": "sha512-xIr+G6HeYfOhCuswdqcFpSX47SPhm0EpisWJ6h7fHlWwaVIvH3dLnejpatrtw6Xc6HaLrpq05y7VRfvDmDGIog==" + }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -5913,6 +9473,11 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/priority-queue-typescript": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/priority-queue-typescript/-/priority-queue-typescript-1.0.1.tgz", + "integrity": "sha512-Apycf6CgjdPRNfpZ8qgQeHVRe4B6R51QAd94k6fE13tGUpW1RLv8+ZeJipl2f0j/No3nt2Gk7dF2f+i1Au/I2w==" + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -6259,7 +9824,6 @@ "version": "7.6.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", - "dev": true, "bin": { "semver": "bin/semver.js" }, @@ -6453,6 +10017,11 @@ "integrity": "sha512-4QcZ+yx7nzEFiV4BMLnr/pRa5HYzNITX2ri0Zh6sT9EyQHbBHacC6YigllUPU9X3D0f/22QCgfokpKs52YRrUg==", "optional": true }, + "node_modules/strict-event-emitter-types": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strict-event-emitter-types/-/strict-event-emitter-types-2.0.0.tgz", + "integrity": "sha512-Nk/brWYpD85WlOgzw5h173aci0Teyv8YdIAEtV+N88nDB0dLlazZyJMIsN6eo1/AR61l+p6CJTG1JIyFaoNEEA==" + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -6522,8 +10091,6 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "peer": true, "dependencies": { "has-flag": "^4.0.0" }, @@ -6565,9 +10132,7 @@ "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", - "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", - "dev": true, - "peer": true + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" }, "node_modules/through": { "version": "2.3.8", @@ -6716,6 +10281,11 @@ "node": ">=8" } }, + "node_modules/ts-log": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/ts-log/-/ts-log-2.2.7.tgz", + "integrity": "sha512-320x5Ggei84AxzlXp91QkIGSw5wgaLT6GeAH0KsqDmRZdVWW2OiSeVvElVoatk3f7nicwXlElXsoFkARiGE2yg==" + }, "node_modules/ts-node": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", @@ -6910,16 +10480,34 @@ "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==" }, + "node_modules/valibot": { + "version": "0.36.0", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-0.36.0.tgz", + "integrity": "sha512-CjF1XN4sUce8sBK9TixrDqFM7RwNkuXdJu174/AwmQUB62QbCQADg5lLe8ldBalFgtj1uKj+pKwDJiNo4Mn+eQ==" + }, "node_modules/vlq": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/vlq/-/vlq-2.0.4.tgz", "integrity": "sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==" }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "engines": { + "node": ">= 8" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" }, + "node_modules/whatwg-fetch": { + "version": "3.6.20", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz", + "integrity": "sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg==" + }, "node_modules/whatwg-url": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", @@ -6933,8 +10521,6 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "peer": true, "dependencies": { "isexe": "^2.0.0" }, @@ -7017,8 +10603,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "devOptional": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/ws": { "version": "8.18.0", diff --git a/package.json b/package.json index a9aa8d3..f90ab87 100644 --- a/package.json +++ b/package.json @@ -28,9 +28,12 @@ "@certusone/wormhole-sdk-proto-web": "^0.0.7", "@coral-xyz/anchor": "^0.29.0", "@improbable-eng/grpc-web-node-http-transport": "^0.15.0", + "@mysten/sui": "^1.21.2", "@solana/buffer-layout": "^4.0.1", "@solana/spl-token": "^0.4.6", "@solana/web3.js": "^1.91.8", + "aftermath-ts-sdk": "^1.2.51", + "anchor30": "npm:@coral-xyz/anchor@^0.30.1", "axios": "^1.7.2", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", diff --git a/src/abis/swift-auction.idl.ts b/src/abis/swift-auction-v2.idl.ts similarity index 68% rename from src/abis/swift-auction.idl.ts rename to src/abis/swift-auction-v2.idl.ts index 01b15ea..256d2e4 100644 --- a/src/abis/swift-auction.idl.ts +++ b/src/abis/swift-auction-v2.idl.ts @@ -1,62 +1,39 @@ -export type SwiftAuction = { - version: '0.1.0'; - name: 'swift_auction'; +export type SwiftV2Auction = { + address: '9bh7SPjkNPgmq7HHWQxgCFJEnMPvAPdLcBEQL1FSG1YR'; + metadata: { + name: 'swiftAuction'; + version: '0.1.0'; + spec: '0.1.0'; + description: 'Created with Anchor'; + }; instructions: [ - { - name: 'updateConfig'; - accounts: [ - { - name: 'updater'; - isMut: true; - isSigner: true; - }, - { - name: 'config'; - isMut: true; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'auctionTime'; - type: 'u64'; - }, - ]; - }, { name: 'bid'; + discriminator: [199, 56, 85, 38, 146, 243, 37, 158]; accounts: [ { name: 'config'; - isMut: false; - isSigner: false; }, { name: 'driver'; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: 'auctionState'; - isMut: true; - isSigner: false; + writable: true; }, { name: 'systemProgram'; - isMut: false; - isSigner: false; }, ]; args: [ { name: 'order'; type: { - defined: 'OrderInfo'; + defined: { + name: 'orderInfo'; + }; }; }, { @@ -65,70 +42,74 @@ export type SwiftAuction = { }, ]; }, + { + name: 'closeAuction'; + discriminator: [225, 129, 91, 48, 215, 73, 203, 172]; + accounts: [ + { + name: 'auction'; + writable: true; + }, + { + name: 'initializer'; + writable: true; + }, + ]; + args: []; + }, { name: 'postAuction'; + discriminator: [62, 30, 249, 94, 9, 182, 79, 198]; accounts: [ { name: 'auction'; - isMut: true; - isSigner: false; + writable: true; }, { name: 'driver'; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: 'emitter'; - isMut: false; - isSigner: false; }, { name: 'config'; - isMut: true; - isSigner: false; + writable: true; }, { name: 'emitterSequence'; - isMut: true; - isSigner: false; + writable: true; }, { name: 'feeCollector'; - isMut: true; - isSigner: false; + writable: true; }, { name: 'message'; - isMut: true; - isSigner: true; + writable: true; + signer: true; }, { name: 'coreBridgeProgram'; - isMut: false; - isSigner: false; }, { name: 'systemProgram'; - isMut: false; - isSigner: false; }, { name: 'clock'; - isMut: false; - isSigner: false; }, { name: 'rent'; - isMut: false; - isSigner: false; }, ]; args: [ { name: 'order'; type: { - defined: 'OrderInfo'; + defined: { + name: 'orderInfo'; + }; }; }, { @@ -140,23 +121,116 @@ export type SwiftAuction = { ]; }, { - name: 'closeAuction'; + name: 'updateConfig'; + discriminator: [29, 158, 252, 191, 10, 83, 219, 99]; accounts: [ { - name: 'auction'; - isMut: true; - isSigner: false; + name: 'updater'; + writable: true; + signer: true; }, { - name: 'initializer'; - isMut: true; - isSigner: false; + name: 'config'; + writable: true; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'auctionTime'; + type: 'u64'; }, ]; - args: []; }, ]; accounts: [ + { + name: 'auctionState'; + discriminator: [252, 227, 205, 147, 72, 64, 250, 126]; + }, + { + name: 'config'; + discriminator: [155, 12, 170, 224, 30, 250, 204, 130]; + }, + ]; + errors: [ + { + code: 6000; + name: 'amountBidLessThanMinimumAmountOut'; + msg: 'amount bid is less than the minimum amount out'; + }, + { + code: 6001; + name: 'amountBidNotGreaterThanLastBidAmount'; + msg: 'amount bid is not greater than the last bid amount'; + }, + { + code: 6002; + name: 'auctionClosed'; + msg: 'auction is closed'; + }, + { + code: 6003; + name: 'driverIsNotWinner'; + msg: 'driver is not winner'; + }, + { + code: 6004; + name: 'auctionIsNotClosed'; + msg: 'auction is not closed'; + }, + { + code: 6005; + name: 'invalidAuctionMode'; + msg: 'invalid auction mode'; + }, + { + code: 6006; + name: 'whCpiError'; + msg: 'wh cpi error'; + }, + { + code: 6007; + name: 'invalidOrderInfo'; + msg: 'Invalid order info'; + }, + { + code: 6008; + name: 'invalidDestChain'; + msg: 'Order with dest Solana could not be published'; + }, + { + code: 6009; + name: 'invalidPayloadLen'; + msg: 'Invalid payload len'; + }, + { + code: 6010; + name: 'invalidInitializer'; + }, + { + code: 6011; + name: 'closeEpochNotReached'; + }, + { + code: 6012; + name: 'driverNotWhitelisted'; + msg: 'Driver is not whitelisted'; + }, + { + code: 6013; + name: 'auctionAlreadyPosted'; + msg: 'Auction already posted'; + }, + { + code: 6014; + name: 'invalidRefAddress'; + msg: 'Invalid ref address'; + }, + ]; + types: [ { name: 'auctionState'; type: { @@ -174,7 +248,7 @@ export type SwiftAuction = { }, { name: 'initializer'; - type: 'publicKey'; + type: 'pubkey'; }, { name: 'closeEpoch'; @@ -186,7 +260,7 @@ export type SwiftAuction = { }, { name: 'winner'; - type: 'publicKey'; + type: 'pubkey'; }, { name: 'amountPromised'; @@ -215,13 +289,15 @@ export type SwiftAuction = { ]; }; }, - ]; - types: [ { - name: 'OrderInfo'; + name: 'orderInfo'; type: { kind: 'struct'; fields: [ + { + name: 'payloadType'; + type: 'u8'; + }, { name: 'trader'; type: { @@ -274,6 +350,10 @@ export type SwiftAuction = { name: 'deadline'; type: 'u64'; }, + { + name: 'penaltyPeriod'; + type: 'u16'; + }, { name: 'addrRef'; type: { @@ -292,152 +372,68 @@ export type SwiftAuction = { name: 'auctionMode'; type: 'u8'; }, + { + name: 'baseBond'; + type: 'u64'; + }, + { + name: 'perBpsBond'; + type: 'u64'; + }, { name: 'keyRnd'; type: { array: ['u8', 32]; }; }, + { + name: 'customPayload'; + type: { + array: ['u8', 32]; + }; + }, ]; }; }, ]; - errors: [ - { - code: 6000; - name: 'AmountBidLessThanMinimumAmountOut'; - msg: 'amount bid is less than the minimum amount out'; - }, - { - code: 6001; - name: 'AmountBidNotGreaterThanLastBidAmount'; - msg: 'amount bid is not greater than the last bid amount'; - }, - { - code: 6002; - name: 'AuctionClosed'; - msg: 'auction is closed'; - }, - { - code: 6003; - name: 'DriverIsNotWinner'; - msg: 'driver is not winner'; - }, - { - code: 6004; - name: 'AuctionIsNotClosed'; - msg: 'auction is not closed'; - }, - { - code: 6005; - name: 'InvalidAuctionMode'; - msg: 'invalid auction mode'; - }, - { - code: 6006; - name: 'WhCpiError'; - msg: 'wh cpi error'; - }, - { - code: 6007; - name: 'InvalidOrderInfo'; - msg: 'Invalid order info'; - }, - { - code: 6008; - name: 'InvalidDestChain'; - msg: 'Order with dest Solana could not be published'; - }, - { - code: 6009; - name: 'InvalidPayloadLen'; - msg: 'Invalid payload len'; - }, - { - code: 6010; - name: 'InvalidInitializer'; - }, - { - code: 6011; - name: 'CloseEpochNotReached'; - }, - { - code: 6012; - name: 'DriverNotWhitelisted'; - msg: 'Driver is not whitelisted'; - }, - { - code: 6013; - name: 'AuctionAlreadyPosted'; - msg: 'Auction already posted'; - }, - { - code: 6014; - name: 'InvalidRefAddress'; - msg: 'Invalid ref address'; - }, - ]; }; -export const IDL: SwiftAuction = { - version: '0.1.0', - name: 'swift_auction', +export const SwiftV2AuctionIdl: SwiftV2Auction = { + address: '9bh7SPjkNPgmq7HHWQxgCFJEnMPvAPdLcBEQL1FSG1YR', + metadata: { + name: 'swiftAuction', + version: '0.1.0', + spec: '0.1.0', + description: 'Created with Anchor', + }, instructions: [ - { - name: 'updateConfig', - accounts: [ - { - name: 'updater', - isMut: true, - isSigner: true, - }, - { - name: 'config', - isMut: true, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'auctionTime', - type: 'u64', - }, - ], - }, { name: 'bid', + discriminator: [199, 56, 85, 38, 146, 243, 37, 158], accounts: [ { name: 'config', - isMut: false, - isSigner: false, }, { name: 'driver', - isMut: true, - isSigner: true, + writable: true, + signer: true, }, { name: 'auctionState', - isMut: true, - isSigner: false, + writable: true, }, { name: 'systemProgram', - isMut: false, - isSigner: false, }, ], args: [ { name: 'order', type: { - defined: 'OrderInfo', + defined: { + name: 'orderInfo', + }, }, }, { @@ -446,70 +442,74 @@ export const IDL: SwiftAuction = { }, ], }, + { + name: 'closeAuction', + discriminator: [225, 129, 91, 48, 215, 73, 203, 172], + accounts: [ + { + name: 'auction', + writable: true, + }, + { + name: 'initializer', + writable: true, + }, + ], + args: [], + }, { name: 'postAuction', + discriminator: [62, 30, 249, 94, 9, 182, 79, 198], accounts: [ { name: 'auction', - isMut: true, - isSigner: false, + writable: true, }, { name: 'driver', - isMut: true, - isSigner: true, + writable: true, + signer: true, }, { name: 'emitter', - isMut: false, - isSigner: false, }, { name: 'config', - isMut: true, - isSigner: false, + writable: true, }, { name: 'emitterSequence', - isMut: true, - isSigner: false, + writable: true, }, { name: 'feeCollector', - isMut: true, - isSigner: false, + writable: true, }, { name: 'message', - isMut: true, - isSigner: true, + writable: true, + signer: true, }, { name: 'coreBridgeProgram', - isMut: false, - isSigner: false, }, { name: 'systemProgram', - isMut: false, - isSigner: false, }, { name: 'clock', - isMut: false, - isSigner: false, }, { name: 'rent', - isMut: false, - isSigner: false, }, ], args: [ { name: 'order', type: { - defined: 'OrderInfo', + defined: { + name: 'orderInfo', + }, }, }, { @@ -521,23 +521,116 @@ export const IDL: SwiftAuction = { ], }, { - name: 'closeAuction', + name: 'updateConfig', + discriminator: [29, 158, 252, 191, 10, 83, 219, 99], accounts: [ { - name: 'auction', - isMut: true, - isSigner: false, + name: 'updater', + writable: true, + signer: true, }, { - name: 'initializer', - isMut: true, - isSigner: false, + name: 'config', + writable: true, + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'auctionTime', + type: 'u64', }, ], - args: [], }, ], accounts: [ + { + name: 'auctionState', + discriminator: [252, 227, 205, 147, 72, 64, 250, 126], + }, + { + name: 'config', + discriminator: [155, 12, 170, 224, 30, 250, 204, 130], + }, + ], + errors: [ + { + code: 6000, + name: 'amountBidLessThanMinimumAmountOut', + msg: 'amount bid is less than the minimum amount out', + }, + { + code: 6001, + name: 'amountBidNotGreaterThanLastBidAmount', + msg: 'amount bid is not greater than the last bid amount', + }, + { + code: 6002, + name: 'auctionClosed', + msg: 'auction is closed', + }, + { + code: 6003, + name: 'driverIsNotWinner', + msg: 'driver is not winner', + }, + { + code: 6004, + name: 'auctionIsNotClosed', + msg: 'auction is not closed', + }, + { + code: 6005, + name: 'invalidAuctionMode', + msg: 'invalid auction mode', + }, + { + code: 6006, + name: 'whCpiError', + msg: 'wh cpi error', + }, + { + code: 6007, + name: 'invalidOrderInfo', + msg: 'Invalid order info', + }, + { + code: 6008, + name: 'invalidDestChain', + msg: 'Order with dest Solana could not be published', + }, + { + code: 6009, + name: 'invalidPayloadLen', + msg: 'Invalid payload len', + }, + { + code: 6010, + name: 'invalidInitializer', + }, + { + code: 6011, + name: 'closeEpochNotReached', + }, + { + code: 6012, + name: 'driverNotWhitelisted', + msg: 'Driver is not whitelisted', + }, + { + code: 6013, + name: 'auctionAlreadyPosted', + msg: 'Auction already posted', + }, + { + code: 6014, + name: 'invalidRefAddress', + msg: 'Invalid ref address', + }, + ], + types: [ { name: 'auctionState', type: { @@ -555,7 +648,7 @@ export const IDL: SwiftAuction = { }, { name: 'initializer', - type: 'publicKey', + type: 'pubkey', }, { name: 'closeEpoch', @@ -567,7 +660,7 @@ export const IDL: SwiftAuction = { }, { name: 'winner', - type: 'publicKey', + type: 'pubkey', }, { name: 'amountPromised', @@ -596,13 +689,15 @@ export const IDL: SwiftAuction = { ], }, }, - ], - types: [ { - name: 'OrderInfo', + name: 'orderInfo', type: { kind: 'struct', fields: [ + { + name: 'payloadType', + type: 'u8', + }, { name: 'trader', type: { @@ -655,6 +750,10 @@ export const IDL: SwiftAuction = { name: 'deadline', type: 'u64', }, + { + name: 'penaltyPeriod', + type: 'u16', + }, { name: 'addrRef', type: { @@ -673,89 +772,28 @@ export const IDL: SwiftAuction = { name: 'auctionMode', type: 'u8', }, + { + name: 'baseBond', + type: 'u64', + }, + { + name: 'perBpsBond', + type: 'u64', + }, { name: 'keyRnd', type: { array: ['u8', 32], }, }, + { + name: 'customPayload', + type: { + array: ['u8', 32], + }, + }, ], }, }, ], - errors: [ - { - code: 6000, - name: 'AmountBidLessThanMinimumAmountOut', - msg: 'amount bid is less than the minimum amount out', - }, - { - code: 6001, - name: 'AmountBidNotGreaterThanLastBidAmount', - msg: 'amount bid is not greater than the last bid amount', - }, - { - code: 6002, - name: 'AuctionClosed', - msg: 'auction is closed', - }, - { - code: 6003, - name: 'DriverIsNotWinner', - msg: 'driver is not winner', - }, - { - code: 6004, - name: 'AuctionIsNotClosed', - msg: 'auction is not closed', - }, - { - code: 6005, - name: 'InvalidAuctionMode', - msg: 'invalid auction mode', - }, - { - code: 6006, - name: 'WhCpiError', - msg: 'wh cpi error', - }, - { - code: 6007, - name: 'InvalidOrderInfo', - msg: 'Invalid order info', - }, - { - code: 6008, - name: 'InvalidDestChain', - msg: 'Order with dest Solana could not be published', - }, - { - code: 6009, - name: 'InvalidPayloadLen', - msg: 'Invalid payload len', - }, - { - code: 6010, - name: 'InvalidInitializer', - }, - { - code: 6011, - name: 'CloseEpochNotReached', - }, - { - code: 6012, - name: 'DriverNotWhitelisted', - msg: 'Driver is not whitelisted', - }, - { - code: 6013, - name: 'AuctionAlreadyPosted', - msg: 'Auction already posted', - }, - { - code: 6014, - name: 'InvalidRefAddress', - msg: 'Invalid ref address', - }, - ], }; diff --git a/src/abis/swift-v2.idl.ts b/src/abis/swift-v2.idl.ts new file mode 100644 index 0000000..47038e3 --- /dev/null +++ b/src/abis/swift-v2.idl.ts @@ -0,0 +1,2940 @@ +export type SwiftV2 = { + address: '92peaC8g5ANAxpK2aCfLTC12JgPncRKCGULQNB2DMvRH'; + metadata: { + name: 'swift'; + version: '0.1.0'; + spec: '0.1.0'; + description: 'Created with Anchor'; + }; + instructions: [ + { + name: 'cancel'; + discriminator: [232, 219, 223, 41, 219, 236, 220, 190]; + accounts: [ + { + name: 'state'; + writable: true; + }, + { + name: 'relayer'; + writable: true; + signer: true; + }, + { + name: 'emitter'; + }, + { + name: 'config'; + writable: true; + }, + { + name: 'emitterSequence'; + writable: true; + }, + { + name: 'feeCollector'; + writable: true; + }, + { + name: 'message'; + writable: true; + signer: true; + }, + { + name: 'coreBridgeProgram'; + }, + { + name: 'systemProgram'; + }, + { + name: 'clock'; + }, + { + name: 'rent'; + }, + ]; + args: [ + { + name: 'foreignFeeCollector'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }, + { + name: 'close'; + discriminator: [98, 165, 201, 177, 108, 65, 206, 96]; + accounts: [ + { + name: 'state'; + docs: ['but as we want to close it and change its type we should use AccountInfo type']; + writable: true; + }, + { + name: 'relayer'; + writable: true; + }, + { + name: 'systemProgram'; + }, + ]; + args: []; + }, + { + name: 'closeCompactUnlock'; + discriminator: [150, 245, 132, 228, 182, 180, 180, 140]; + accounts: [ + { + name: 'compactUnlock'; + writable: true; + }, + { + name: 'initializer'; + signer: true; + }, + ]; + args: []; + }, + { + name: 'fulfill'; + discriminator: [143, 2, 52, 206, 174, 164, 247, 72]; + accounts: [ + { + name: 'state'; + writable: true; + }, + { + name: 'driver'; + writable: true; + signer: true; + }, + { + name: 'stateToAcc'; + }, + { + name: 'mintTo'; + }, + { + name: 'dest'; + docs: ['CHECK this should be equal to addr_dest']; + writable: true; + }, + { + name: 'systemProgram'; + }, + { + name: 'tokenProgram'; + }, + ]; + args: [ + { + name: 'unlockReceiver'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }, + { + name: 'initCompactUnlock'; + discriminator: [45, 148, 157, 145, 94, 113, 164, 139]; + accounts: [ + { + name: 'vaa'; + docs: ["at this step we don't check the VAA, we just use it as the seeds"]; + }, + { + name: 'compactUnlock'; + writable: true; + }, + { + name: 'relayer'; + writable: true; + signer: true; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'itemsCount'; + type: 'u16'; + }, + ]; + }, + { + name: 'initOrder'; + discriminator: [32, 76, 41, 12, 39, 162, 132, 219]; + accounts: [ + { + name: 'trader'; + docs: [ + 'must be transferred to the state account in the same transaction as the order', + 'initialization. This ensures the state seeds remain valid and prevents any risk', + 'of losing them.', + '', + 'With this requirement, we can be certain that the funders have already signed', + 'this instruction, mitigating potential risks.', + ]; + }, + { + name: 'relayer'; + writable: true; + signer: true; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'stateFromAcc'; + }, + { + name: 'relayerFeeAcc'; + writable: true; + }, + { + name: 'customPayloadStore'; + docs: ['We will hash all data of it and store it in ledger as custom payload.']; + optional: true; + }, + { + name: 'mintFrom'; + }, + { + name: 'feeManagerProgram'; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'params'; + type: { + defined: { + name: 'initOrderParams'; + }; + }; + }, + ]; + }, + { + name: 'postUnlock'; + discriminator: [105, 29, 80, 28, 81, 250, 231, 185]; + accounts: [ + { + name: 'driver'; + writable: true; + signer: true; + }, + { + name: 'emitter'; + }, + { + name: 'config'; + writable: true; + }, + { + name: 'emitterSequence'; + writable: true; + }, + { + name: 'feeCollector'; + writable: true; + }, + { + name: 'message'; + writable: true; + signer: true; + }, + { + name: 'coreBridgeProgram'; + }, + { + name: 'systemProgram'; + }, + { + name: 'clock'; + }, + { + name: 'rent'; + }, + ]; + args: [ + { + name: 'compactMode'; + type: 'bool'; + }, + ]; + }, + { + name: 'refund'; + discriminator: [2, 96, 183, 251, 63, 208, 46, 46]; + accounts: [ + { + name: 'vaaCancel'; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'stateFromAcc'; + writable: true; + }, + { + name: 'trader'; + writable: true; + }, + { + name: 'traderAcc'; + writable: true; + optional: true; + }, + { + name: 'mintFrom'; + }, + { + name: 'relayerRefund'; + writable: true; + signer: true; + }, + { + name: 'relayerRefundAcc'; + writable: true; + }, + { + name: 'relayerCancel'; + }, + { + name: 'relayerCancelAcc'; + writable: true; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: []; + }, + { + name: 'registerOrder'; + discriminator: [92, 37, 29, 46, 77, 250, 219, 6]; + accounts: [ + { + name: 'relayer'; + writable: true; + signer: true; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'args'; + type: { + defined: { + name: 'orderInfo'; + }; + }; + }, + ]; + }, + { + name: 'setAuctionWinner'; + discriminator: [63, 231, 14, 33, 159, 196, 43, 39]; + accounts: [ + { + name: 'state'; + writable: true; + }, + { + name: 'auction'; + }, + ]; + args: [ + { + name: 'expectedWinner'; + type: 'pubkey'; + }, + ]; + }, + { + name: 'settle'; + discriminator: [175, 42, 185, 87, 144, 131, 102, 212]; + accounts: [ + { + name: 'state'; + writable: true; + }, + { + name: 'stateToAcc'; + writable: true; + }, + { + name: 'relayer'; + writable: true; + signer: true; + }, + { + name: 'mintTo'; + }, + { + name: 'dest'; + writable: true; + }, + { + name: 'destSigner'; + signer: true; + }, + { + name: 'destAcc'; + writable: true; + optional: true; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'tryCloseAta'; + type: 'bool'; + }, + ]; + }, + { + name: 'unlock'; + discriminator: [101, 155, 40, 21, 158, 189, 56, 203]; + accounts: [ + { + name: 'vaaUnlock'; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'stateFromAcc'; + writable: true; + }, + { + name: 'mintFrom'; + }, + { + name: 'unlockReceiver'; + docs: ['transfer to the driver ATA account.']; + writable: true; + }, + { + name: 'unlockReceiverAcc'; + writable: true; + }, + { + name: 'referrer'; + }, + { + name: 'feeCollector'; + }, + { + name: 'referrerFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'mayanFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'tryCloseAta'; + type: 'bool'; + }, + ]; + }, + { + name: 'unlockBatch'; + discriminator: [167, 114, 53, 218, 111, 158, 170, 38]; + accounts: [ + { + name: 'vaaUnlock'; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'stateFromAcc'; + writable: true; + }, + { + name: 'mintFrom'; + }, + { + name: 'unlockReceiver'; + docs: ['transfer to the unlock receiver ATA account.']; + writable: true; + }, + { + name: 'unlockReceiverAcc'; + writable: true; + }, + { + name: 'referrer'; + }, + { + name: 'feeCollector'; + }, + { + name: 'referrerFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'mayanFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'index'; + type: 'u16'; + }, + { + name: 'tryCloseAta'; + type: 'bool'; + }, + ]; + }, + { + name: 'unlockBatchCompact'; + discriminator: [130, 18, 228, 224, 180, 84, 29, 177]; + accounts: [ + { + name: 'compactUnlock'; + writable: true; + }, + { + name: 'state'; + writable: true; + }, + { + name: 'stateFromAcc'; + writable: true; + }, + { + name: 'mintFrom'; + }, + { + name: 'unlockReceiver'; + docs: ['transfer to the driver ATA account.']; + writable: true; + }, + { + name: 'unlockReceiverAcc'; + writable: true; + }, + { + name: 'referrer'; + }, + { + name: 'feeCollector'; + }, + { + name: 'referrerFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'mayanFeeAcc'; + writable: true; + optional: true; + }, + { + name: 'tokenProgram'; + }, + { + name: 'systemProgram'; + }, + ]; + args: [ + { + name: 'index'; + type: 'u16'; + }, + { + name: 'tryCloseAta'; + type: 'bool'; + }, + ]; + }, + { + name: 'verifyCompactUnlock'; + discriminator: [25, 168, 186, 127, 55, 168, 207, 62]; + accounts: [ + { + name: 'vaaUnlock'; + }, + { + name: 'compactUnlock'; + writable: true; + }, + { + name: 'initializer'; + signer: true; + }, + ]; + args: []; + }, + { + name: 'writeCompactUnlock'; + discriminator: [183, 56, 194, 178, 205, 214, 144, 196]; + accounts: [ + { + name: 'compactUnlock'; + writable: true; + }, + { + name: 'initializer'; + signer: true; + }, + ]; + args: [ + { + name: 'start'; + type: 'u16'; + }, + { + name: 'end'; + type: 'u16'; + }, + { + name: 'slice'; + type: 'bytes'; + }, + ]; + }, + ]; + accounts: [ + { + name: 'auctionState'; + discriminator: [252, 227, 205, 147, 72, 64, 250, 126]; + }, + { + name: 'compactUnlockState'; + discriminator: [254, 246, 114, 147, 47, 219, 201, 148]; + }, + { + name: 'swiftDestSolanaState'; + discriminator: [124, 172, 240, 168, 249, 92, 241, 163]; + }, + { + name: 'swiftSourceSolanaState'; + discriminator: [107, 149, 204, 128, 198, 155, 3, 162]; + }, + ]; + events: [ + { + name: 'orderInitialized'; + discriminator: [180, 118, 44, 249, 166, 25, 40, 81]; + }, + ]; + errors: [ + { + code: 6000; + name: 'orderDestChainIsNotSolana'; + msg: 'Order dest chain is not solana'; + }, + { + code: 6001; + name: 'chainIdNotMayanSupported'; + msg: 'Chain id is not Evm supported chain'; + }, + { + code: 6002; + name: 'invalidStateStatus'; + msg: 'Invalid state status'; + }, + { + code: 6003; + name: 'orderIsNotCreated'; + msg: 'Order is not created'; + }, + { + code: 6004; + name: 'invalidOrderAuctionType'; + msg: 'Order state is not fulfilled'; + }, + { + code: 6005; + name: 'deadlineIsPassed'; + msg: 'Order deadline is passed'; + }, + { + code: 6006; + name: 'auctionIsNotClosed'; + msg: 'Auction is not closed'; + }, + { + code: 6007; + name: 'auctionHashMismatch'; + msg: 'Auction hash mismatch'; + }, + { + code: 6008; + name: 'auctionIsNotFinished'; + msg: 'Auction is not valid yet'; + }, + { + code: 6009; + name: 'invalidExpectedWinner'; + msg: 'Invalid expected winner'; + }, + { + code: 6010; + name: 'orderCannotBeFulfilled'; + msg: 'Order cannot be fulfilled'; + }, + { + code: 6011; + name: 'driverIsNotWinner'; + msg: 'Invalid auction winner'; + }, + { + code: 6012; + name: 'invalidMint'; + msg: 'Invalid mint'; + }, + { + code: 6013; + name: 'invalidDestinationAddress'; + msg: 'Destination account address is wrong'; + }, + { + code: 6014; + name: 'outputIsLessThanPromised'; + msg: 'amount output < amount promised'; + }, + { + code: 6015; + name: 'minAmountOutNotSatisfied'; + msg: 'amount output < amount out min + fees'; + }, + { + code: 6016; + name: 'winnerIsPrivilegedYet'; + msg: 'winner is privileged yet'; + }, + { + code: 6017; + name: 'missingRequiredOptionalAccount'; + msg: 'missing required optional account'; + }, + { + code: 6018; + name: 'invalidStateAccount'; + msg: 'Invalid state account'; + }, + { + code: 6019; + name: 'orderFulfillInfoMissed'; + msg: 'Order fulfill info is missing'; + }, + { + code: 6020; + name: 'invalidRelayer'; + msg: 'Invalid Relayer for close state'; + }, + { + code: 6021; + name: 'overflow'; + msg: 'overflow'; + }, + { + code: 6022; + name: 'deadlineIsNotPassed'; + msg: 'Deadline is not passed yet'; + }, + { + code: 6023; + name: 'invalidPayloadLength'; + msg: 'Payload is invalid'; + }, + { + code: 6024; + name: 'amountInTooSmall'; + msg: 'Amount in too small'; + }, + { + code: 6025; + name: 'invalidZeroAmount'; + msg: 'Invalid zero amount'; + }, + { + code: 6026; + name: 'insufficientFundsToPayLockFee'; + msg: 'Insufficient funds to pay lock fee'; + }, + { + code: 6027; + name: 'protocolFeeRateTooHigh'; + msg: 'Protocol fee rate too high'; + }, + { + code: 6028; + name: 'protocolFeeRateMismatch'; + msg: 'Param protocol fee rate is wrong'; + }, + { + code: 6029; + name: 'referrerFeeRateTooHigh'; + msg: 'Referrer fee rate too high'; + }, + { + code: 6030; + name: 'gasDropNotAllowed'; + msg: 'Could not receive gas drop when token out is native'; + }, + { + code: 6031; + name: 'destSolanaNotAllowed'; + msg: 'Destination chain could not be Solana'; + }, + { + code: 6032; + name: 'invalidParam'; + msg: 'Invalid order parameter'; + }, + { + code: 6033; + name: 'feesOverflow'; + msg: 'fee cancel + fee refund -> overflow'; + }, + { + code: 6034; + name: 'feesTooHigh'; + msg: 'fee cancel + fee refund >= amount_in'; + }, + { + code: 6035; + name: 'feeRateRefIsNotZero'; + msg: 'fee rate ref is not zero'; + }, + { + code: 6036; + name: 'relayerIsTraderFeeSubmit'; + msg: 'relayer is trader but fee_submit > 0'; + }, + { + code: 6037; + name: 'mintAndTokenProgramMismatch'; + msg: 'Mint is not match with token program'; + }, + { + code: 6038; + name: 'invalidUnlockBatchVaa'; + msg: 'Invalid unlock batch message'; + }, + { + code: 6039; + name: 'invalidUnlockVaa'; + msg: 'Invalid unlock message'; + }, + { + code: 6040; + name: 'invalidUnlockBatchCompactVaa'; + msg: 'Invalid unlock batch compact message'; + }, + { + code: 6041; + name: 'unlockReceiverIsNotCorrect'; + msg: 'Unlock receiver account is not equal to message unlock receiver'; + }, + { + code: 6042; + name: 'mintIsNotTokenIn'; + msg: 'Mint is not equal to message token in'; + }, + { + code: 6043; + name: 'invalidRemainingAccountsCount'; + }, + { + code: 6044; + name: 'invalidTokenAccountMint'; + }, + { + code: 6045; + name: 'invalidTokenAccountOwner'; + }, + { + code: 6046; + name: 'invalidEmitterChain'; + }, + { + code: 6047; + name: 'invalidEmitterAddress'; + }, + { + code: 6048; + name: 'destShouldSignCustomPayload'; + }, + { + code: 6049; + name: 'invalidReferrerAddress'; + }, + { + code: 6050; + name: 'invalidCancelVaa'; + msg: 'Invalid cancel message'; + }, + { + code: 6051; + name: 'wrongCancelRelayerAddress'; + }, + { + code: 6052; + name: 'insufficientFundsToRefundFee'; + }, + { + code: 6053; + name: 'invalidTrader'; + }, + { + code: 6054; + name: 'invalidAccountStatus'; + }, + { + code: 6055; + name: 'invalidSlice'; + }, + { + code: 6056; + name: 'invalidCompactUnlockItemsCount'; + }, + { + code: 6057; + name: 'invalidCompactUnlockHash'; + }, + ]; + types: [ + { + name: 'auctionState'; + type: { + kind: 'struct'; + fields: [ + { + name: 'bump'; + type: 'u8'; + }, + { + name: 'hash'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'initializer'; + type: 'pubkey'; + }, + { + name: 'closeEpoch'; + type: 'u64'; + }, + { + name: 'amountOutMin'; + type: 'u64'; + }, + { + name: 'winner'; + type: 'pubkey'; + }, + { + name: 'amountPromised'; + type: 'u64'; + }, + { + name: 'validFrom'; + type: 'u64'; + }, + { + name: 'seqMsg'; + type: 'u64'; + }, + ]; + }; + }, + { + name: 'compactUnlockState'; + type: { + kind: 'struct'; + fields: [ + { + name: 'seeds'; + type: { + defined: { + name: 'compactUnlockStateSeeds'; + }; + }; + }, + { + name: 'info'; + type: { + defined: { + name: 'compactUnlockStateInfo'; + }; + }; + }, + { + name: 'items'; + type: 'bytes'; + }, + ]; + }; + }, + { + name: 'compactUnlockStateInfo'; + type: { + kind: 'struct'; + fields: [ + { + name: 'status'; + type: { + defined: { + name: 'compactUnlockStatus'; + }; + }; + }, + { + name: 'emitterChain'; + type: 'u16'; + }, + { + name: 'messageHash'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'itemsCount'; + type: 'u16'; + }, + ]; + }; + }, + { + name: 'compactUnlockStateSeeds'; + type: { + kind: 'struct'; + fields: [ + { + name: 'bump'; + type: 'u8'; + }, + { + name: 'vaa'; + type: 'pubkey'; + }, + { + name: 'initializer'; + type: 'pubkey'; + }, + ]; + }; + }, + { + name: 'compactUnlockStatus'; + repr: { + kind: 'rust'; + }; + type: { + kind: 'enum'; + variants: [ + { + name: 'none'; + }, + { + name: 'created'; + }, + { + name: 'verified'; + }, + ]; + }; + }, + { + name: 'fulfillInfo'; + type: { + kind: 'struct'; + fields: [ + { + name: 'winner'; + type: 'pubkey'; + }, + { + name: 'amountPromised'; + type: 'u64'; + }, + { + name: 'amountFulfill'; + type: 'u64'; + }, + { + name: 'patchVersion'; + type: 'u8'; + }, + { + name: 'timeFulfill'; + type: 'u64'; + }, + { + name: 'unlockReceiver'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }; + }, + { + name: 'initOrderParams'; + type: { + kind: 'struct'; + fields: [ + { + name: 'amountInMin'; + type: 'u64'; + }, + { + name: 'nativeInput'; + type: 'bool'; + }, + { + name: 'feeSubmit'; + type: 'u64'; + }, + { + name: 'addrDest'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'chainDest'; + type: 'u16'; + }, + { + name: 'tokenOut'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'amountOutMin'; + type: 'u64'; + }, + { + name: 'gasDrop'; + type: 'u64'; + }, + { + name: 'feeCancel'; + type: 'u64'; + }, + { + name: 'feeRefund'; + type: 'u64'; + }, + { + name: 'deadline'; + type: 'u64'; + }, + { + name: 'penaltyPeriod'; + type: 'u16'; + }, + { + name: 'addrRef'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'feeRateRef'; + type: 'u8'; + }, + { + name: 'feeRateMayan'; + type: 'u8'; + }, + { + name: 'baseBond'; + type: 'u64'; + }, + { + name: 'perBpsBond'; + type: 'u64'; + }, + { + name: 'auctionMode'; + type: 'u8'; + }, + { + name: 'keyRnd'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }; + }, + { + name: 'orderInfo'; + type: { + kind: 'struct'; + fields: [ + { + name: 'payloadType'; + type: 'u8'; + }, + { + name: 'trader'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'chainSource'; + type: 'u16'; + }, + { + name: 'tokenIn'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'addrDest'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'chainDest'; + type: 'u16'; + }, + { + name: 'tokenOut'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'amountOutMin'; + type: 'u64'; + }, + { + name: 'gasDrop'; + type: 'u64'; + }, + { + name: 'feeCancel'; + type: 'u64'; + }, + { + name: 'feeRefund'; + type: 'u64'; + }, + { + name: 'deadline'; + type: 'u64'; + }, + { + name: 'penaltyPeriod'; + type: 'u16'; + }, + { + name: 'addrRef'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'feeRateRef'; + type: 'u8'; + }, + { + name: 'feeRateMayan'; + type: 'u8'; + }, + { + name: 'auctionMode'; + type: 'u8'; + }, + { + name: 'baseBond'; + type: 'u64'; + }, + { + name: 'perBpsBond'; + type: 'u64'; + }, + { + name: 'keyRnd'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'customPayload'; + type: { + array: ['u8', 32]; + }; + }, + ]; + }; + }, + { + name: 'orderInitialized'; + type: { + kind: 'struct'; + fields: [ + { + name: 'orderHash'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'amountIn'; + type: 'u64'; + }, + ]; + }; + }, + { + name: 'swiftDestSolanaState'; + type: { + kind: 'struct'; + fields: [ + { + name: 'bump'; + type: 'u8'; + }, + { + name: 'status'; + type: { + defined: { + name: 'swiftDestSolanaStatus'; + }; + }; + }, + { + name: 'isSettled'; + type: 'bool'; + }, + { + name: 'isPosted'; + type: 'bool'; + }, + { + name: 'order'; + type: { + defined: { + name: 'orderInfo'; + }; + }; + }, + { + name: 'hash'; + type: { + array: ['u8', 32]; + }; + }, + { + name: 'relayer'; + type: 'pubkey'; + }, + { + name: 'fulfill'; + type: { + defined: { + name: 'fulfillInfo'; + }; + }; + }, + ]; + }; + }, + { + name: 'swiftDestSolanaStatus'; + repr: { + kind: 'rust'; + }; + type: { + kind: 'enum'; + variants: [ + { + name: 'none'; + }, + { + name: 'created'; + }, + { + name: 'fulfilled'; + }, + { + name: 'cancelled'; + }, + { + name: 'closed'; + }, + ]; + }; + }, + { + name: 'swiftSourceSolanaState'; + type: { + kind: 'struct'; + fields: [ + { + name: 'bump'; + type: 'u8'; + }, + { + name: 'status'; + type: { + defined: { + name: 'swiftSourceSolanaStatus'; + }; + }; + }, + ]; + }; + }, + { + name: 'swiftSourceSolanaStatus'; + repr: { + kind: 'rust'; + }; + type: { + kind: 'enum'; + variants: [ + { + name: 'none'; + }, + { + name: 'locked'; + }, + { + name: 'unlocked'; + }, + { + name: 'refunded'; + }, + ]; + }; + }, + ]; +}; +export const SwiftV2Idl: SwiftV2 = { + address: '92peaC8g5ANAxpK2aCfLTC12JgPncRKCGULQNB2DMvRH', + metadata: { + name: 'swift', + version: '0.1.0', + spec: '0.1.0', + description: 'Created with Anchor', + }, + instructions: [ + { + name: 'cancel', + discriminator: [232, 219, 223, 41, 219, 236, 220, 190], + accounts: [ + { + name: 'state', + writable: true, + }, + { + name: 'relayer', + writable: true, + signer: true, + }, + { + name: 'emitter', + }, + { + name: 'config', + writable: true, + }, + { + name: 'emitterSequence', + writable: true, + }, + { + name: 'feeCollector', + writable: true, + }, + { + name: 'message', + writable: true, + signer: true, + }, + { + name: 'coreBridgeProgram', + }, + { + name: 'systemProgram', + }, + { + name: 'clock', + }, + { + name: 'rent', + }, + ], + args: [ + { + name: 'foreignFeeCollector', + type: { + array: ['u8', 32], + }, + }, + ], + }, + { + name: 'close', + discriminator: [98, 165, 201, 177, 108, 65, 206, 96], + accounts: [ + { + name: 'state', + docs: ['but as we want to close it and change its type we should use AccountInfo type'], + writable: true, + }, + { + name: 'relayer', + writable: true, + }, + { + name: 'systemProgram', + }, + ], + args: [], + }, + { + name: 'closeCompactUnlock', + discriminator: [150, 245, 132, 228, 182, 180, 180, 140], + accounts: [ + { + name: 'compactUnlock', + writable: true, + }, + { + name: 'initializer', + signer: true, + }, + ], + args: [], + }, + { + name: 'fulfill', + discriminator: [143, 2, 52, 206, 174, 164, 247, 72], + accounts: [ + { + name: 'state', + writable: true, + }, + { + name: 'driver', + writable: true, + signer: true, + }, + { + name: 'stateToAcc', + }, + { + name: 'mintTo', + }, + { + name: 'dest', + docs: ['CHECK this should be equal to addr_dest'], + writable: true, + }, + { + name: 'systemProgram', + }, + { + name: 'tokenProgram', + }, + ], + args: [ + { + name: 'unlockReceiver', + type: { + array: ['u8', 32], + }, + }, + ], + }, + { + name: 'initCompactUnlock', + discriminator: [45, 148, 157, 145, 94, 113, 164, 139], + accounts: [ + { + name: 'vaa', + docs: ["at this step we don't check the VAA, we just use it as the seeds"], + }, + { + name: 'compactUnlock', + writable: true, + }, + { + name: 'relayer', + writable: true, + signer: true, + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'itemsCount', + type: 'u16', + }, + ], + }, + { + name: 'initOrder', + discriminator: [32, 76, 41, 12, 39, 162, 132, 219], + accounts: [ + { + name: 'trader', + docs: [ + 'must be transferred to the state account in the same transaction as the order', + 'initialization. This ensures the state seeds remain valid and prevents any risk', + 'of losing them.', + '', + 'With this requirement, we can be certain that the funders have already signed', + 'this instruction, mitigating potential risks.', + ], + }, + { + name: 'relayer', + writable: true, + signer: true, + }, + { + name: 'state', + writable: true, + }, + { + name: 'stateFromAcc', + }, + { + name: 'relayerFeeAcc', + writable: true, + }, + { + name: 'customPayloadStore', + docs: ['We will hash all data of it and store it in ledger as custom payload.'], + optional: true, + }, + { + name: 'mintFrom', + }, + { + name: 'feeManagerProgram', + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'params', + type: { + defined: { + name: 'initOrderParams', + }, + }, + }, + ], + }, + { + name: 'postUnlock', + discriminator: [105, 29, 80, 28, 81, 250, 231, 185], + accounts: [ + { + name: 'driver', + writable: true, + signer: true, + }, + { + name: 'emitter', + }, + { + name: 'config', + writable: true, + }, + { + name: 'emitterSequence', + writable: true, + }, + { + name: 'feeCollector', + writable: true, + }, + { + name: 'message', + writable: true, + signer: true, + }, + { + name: 'coreBridgeProgram', + }, + { + name: 'systemProgram', + }, + { + name: 'clock', + }, + { + name: 'rent', + }, + ], + args: [ + { + name: 'compactMode', + type: 'bool', + }, + ], + }, + { + name: 'refund', + discriminator: [2, 96, 183, 251, 63, 208, 46, 46], + accounts: [ + { + name: 'vaaCancel', + }, + { + name: 'state', + writable: true, + }, + { + name: 'stateFromAcc', + writable: true, + }, + { + name: 'trader', + writable: true, + }, + { + name: 'traderAcc', + writable: true, + optional: true, + }, + { + name: 'mintFrom', + }, + { + name: 'relayerRefund', + writable: true, + signer: true, + }, + { + name: 'relayerRefundAcc', + writable: true, + }, + { + name: 'relayerCancel', + }, + { + name: 'relayerCancelAcc', + writable: true, + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [], + }, + { + name: 'registerOrder', + discriminator: [92, 37, 29, 46, 77, 250, 219, 6], + accounts: [ + { + name: 'relayer', + writable: true, + signer: true, + }, + { + name: 'state', + writable: true, + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'args', + type: { + defined: { + name: 'orderInfo', + }, + }, + }, + ], + }, + { + name: 'setAuctionWinner', + discriminator: [63, 231, 14, 33, 159, 196, 43, 39], + accounts: [ + { + name: 'state', + writable: true, + }, + { + name: 'auction', + }, + ], + args: [ + { + name: 'expectedWinner', + type: 'pubkey', + }, + ], + }, + { + name: 'settle', + discriminator: [175, 42, 185, 87, 144, 131, 102, 212], + accounts: [ + { + name: 'state', + writable: true, + }, + { + name: 'stateToAcc', + writable: true, + }, + { + name: 'relayer', + writable: true, + signer: true, + }, + { + name: 'mintTo', + }, + { + name: 'dest', + writable: true, + }, + { + name: 'destSigner', + signer: true, + }, + { + name: 'destAcc', + writable: true, + optional: true, + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'tryCloseAta', + type: 'bool', + }, + ], + }, + { + name: 'unlock', + discriminator: [101, 155, 40, 21, 158, 189, 56, 203], + accounts: [ + { + name: 'vaaUnlock', + }, + { + name: 'state', + writable: true, + }, + { + name: 'stateFromAcc', + writable: true, + }, + { + name: 'mintFrom', + }, + { + name: 'unlockReceiver', + docs: ['transfer to the driver ATA account.'], + writable: true, + }, + { + name: 'unlockReceiverAcc', + writable: true, + }, + { + name: 'referrer', + }, + { + name: 'feeCollector', + }, + { + name: 'referrerFeeAcc', + writable: true, + optional: true, + }, + { + name: 'mayanFeeAcc', + writable: true, + optional: true, + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'tryCloseAta', + type: 'bool', + }, + ], + }, + { + name: 'unlockBatch', + discriminator: [167, 114, 53, 218, 111, 158, 170, 38], + accounts: [ + { + name: 'vaaUnlock', + }, + { + name: 'state', + writable: true, + }, + { + name: 'stateFromAcc', + writable: true, + }, + { + name: 'mintFrom', + }, + { + name: 'unlockReceiver', + docs: ['transfer to the unlock receiver ATA account.'], + writable: true, + }, + { + name: 'unlockReceiverAcc', + writable: true, + }, + { + name: 'referrer', + }, + { + name: 'feeCollector', + }, + { + name: 'referrerFeeAcc', + writable: true, + optional: true, + }, + { + name: 'mayanFeeAcc', + writable: true, + optional: true, + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'index', + type: 'u16', + }, + { + name: 'tryCloseAta', + type: 'bool', + }, + ], + }, + { + name: 'unlockBatchCompact', + discriminator: [130, 18, 228, 224, 180, 84, 29, 177], + accounts: [ + { + name: 'compactUnlock', + writable: true, + }, + { + name: 'state', + writable: true, + }, + { + name: 'stateFromAcc', + writable: true, + }, + { + name: 'mintFrom', + }, + { + name: 'unlockReceiver', + docs: ['transfer to the driver ATA account.'], + writable: true, + }, + { + name: 'unlockReceiverAcc', + writable: true, + }, + { + name: 'referrer', + }, + { + name: 'feeCollector', + }, + { + name: 'referrerFeeAcc', + writable: true, + optional: true, + }, + { + name: 'mayanFeeAcc', + writable: true, + optional: true, + }, + { + name: 'tokenProgram', + }, + { + name: 'systemProgram', + }, + ], + args: [ + { + name: 'index', + type: 'u16', + }, + { + name: 'tryCloseAta', + type: 'bool', + }, + ], + }, + { + name: 'verifyCompactUnlock', + discriminator: [25, 168, 186, 127, 55, 168, 207, 62], + accounts: [ + { + name: 'vaaUnlock', + }, + { + name: 'compactUnlock', + writable: true, + }, + { + name: 'initializer', + signer: true, + }, + ], + args: [], + }, + { + name: 'writeCompactUnlock', + discriminator: [183, 56, 194, 178, 205, 214, 144, 196], + accounts: [ + { + name: 'compactUnlock', + writable: true, + }, + { + name: 'initializer', + signer: true, + }, + ], + args: [ + { + name: 'start', + type: 'u16', + }, + { + name: 'end', + type: 'u16', + }, + { + name: 'slice', + type: 'bytes', + }, + ], + }, + ], + accounts: [ + { + name: 'auctionState', + discriminator: [252, 227, 205, 147, 72, 64, 250, 126], + }, + { + name: 'compactUnlockState', + discriminator: [254, 246, 114, 147, 47, 219, 201, 148], + }, + { + name: 'swiftDestSolanaState', + discriminator: [124, 172, 240, 168, 249, 92, 241, 163], + }, + { + name: 'swiftSourceSolanaState', + discriminator: [107, 149, 204, 128, 198, 155, 3, 162], + }, + ], + events: [ + { + name: 'orderInitialized', + discriminator: [180, 118, 44, 249, 166, 25, 40, 81], + }, + ], + errors: [ + { + code: 6000, + name: 'orderDestChainIsNotSolana', + msg: 'Order dest chain is not solana', + }, + { + code: 6001, + name: 'chainIdNotMayanSupported', + msg: 'Chain id is not Evm supported chain', + }, + { + code: 6002, + name: 'invalidStateStatus', + msg: 'Invalid state status', + }, + { + code: 6003, + name: 'orderIsNotCreated', + msg: 'Order is not created', + }, + { + code: 6004, + name: 'invalidOrderAuctionType', + msg: 'Order state is not fulfilled', + }, + { + code: 6005, + name: 'deadlineIsPassed', + msg: 'Order deadline is passed', + }, + { + code: 6006, + name: 'auctionIsNotClosed', + msg: 'Auction is not closed', + }, + { + code: 6007, + name: 'auctionHashMismatch', + msg: 'Auction hash mismatch', + }, + { + code: 6008, + name: 'auctionIsNotFinished', + msg: 'Auction is not valid yet', + }, + { + code: 6009, + name: 'invalidExpectedWinner', + msg: 'Invalid expected winner', + }, + { + code: 6010, + name: 'orderCannotBeFulfilled', + msg: 'Order cannot be fulfilled', + }, + { + code: 6011, + name: 'driverIsNotWinner', + msg: 'Invalid auction winner', + }, + { + code: 6012, + name: 'invalidMint', + msg: 'Invalid mint', + }, + { + code: 6013, + name: 'invalidDestinationAddress', + msg: 'Destination account address is wrong', + }, + { + code: 6014, + name: 'outputIsLessThanPromised', + msg: 'amount output < amount promised', + }, + { + code: 6015, + name: 'minAmountOutNotSatisfied', + msg: 'amount output < amount out min + fees', + }, + { + code: 6016, + name: 'winnerIsPrivilegedYet', + msg: 'winner is privileged yet', + }, + { + code: 6017, + name: 'missingRequiredOptionalAccount', + msg: 'missing required optional account', + }, + { + code: 6018, + name: 'invalidStateAccount', + msg: 'Invalid state account', + }, + { + code: 6019, + name: 'orderFulfillInfoMissed', + msg: 'Order fulfill info is missing', + }, + { + code: 6020, + name: 'invalidRelayer', + msg: 'Invalid Relayer for close state', + }, + { + code: 6021, + name: 'overflow', + msg: 'overflow', + }, + { + code: 6022, + name: 'deadlineIsNotPassed', + msg: 'Deadline is not passed yet', + }, + { + code: 6023, + name: 'invalidPayloadLength', + msg: 'Payload is invalid', + }, + { + code: 6024, + name: 'amountInTooSmall', + msg: 'Amount in too small', + }, + { + code: 6025, + name: 'invalidZeroAmount', + msg: 'Invalid zero amount', + }, + { + code: 6026, + name: 'insufficientFundsToPayLockFee', + msg: 'Insufficient funds to pay lock fee', + }, + { + code: 6027, + name: 'protocolFeeRateTooHigh', + msg: 'Protocol fee rate too high', + }, + { + code: 6028, + name: 'protocolFeeRateMismatch', + msg: 'Param protocol fee rate is wrong', + }, + { + code: 6029, + name: 'referrerFeeRateTooHigh', + msg: 'Referrer fee rate too high', + }, + { + code: 6030, + name: 'gasDropNotAllowed', + msg: 'Could not receive gas drop when token out is native', + }, + { + code: 6031, + name: 'destSolanaNotAllowed', + msg: 'Destination chain could not be Solana', + }, + { + code: 6032, + name: 'invalidParam', + msg: 'Invalid order parameter', + }, + { + code: 6033, + name: 'feesOverflow', + msg: 'fee cancel + fee refund -> overflow', + }, + { + code: 6034, + name: 'feesTooHigh', + msg: 'fee cancel + fee refund >= amount_in', + }, + { + code: 6035, + name: 'feeRateRefIsNotZero', + msg: 'fee rate ref is not zero', + }, + { + code: 6036, + name: 'relayerIsTraderFeeSubmit', + msg: 'relayer is trader but fee_submit > 0', + }, + { + code: 6037, + name: 'mintAndTokenProgramMismatch', + msg: 'Mint is not match with token program', + }, + { + code: 6038, + name: 'invalidUnlockBatchVaa', + msg: 'Invalid unlock batch message', + }, + { + code: 6039, + name: 'invalidUnlockVaa', + msg: 'Invalid unlock message', + }, + { + code: 6040, + name: 'invalidUnlockBatchCompactVaa', + msg: 'Invalid unlock batch compact message', + }, + { + code: 6041, + name: 'unlockReceiverIsNotCorrect', + msg: 'Unlock receiver account is not equal to message unlock receiver', + }, + { + code: 6042, + name: 'mintIsNotTokenIn', + msg: 'Mint is not equal to message token in', + }, + { + code: 6043, + name: 'invalidRemainingAccountsCount', + }, + { + code: 6044, + name: 'invalidTokenAccountMint', + }, + { + code: 6045, + name: 'invalidTokenAccountOwner', + }, + { + code: 6046, + name: 'invalidEmitterChain', + }, + { + code: 6047, + name: 'invalidEmitterAddress', + }, + { + code: 6048, + name: 'destShouldSignCustomPayload', + }, + { + code: 6049, + name: 'invalidReferrerAddress', + }, + { + code: 6050, + name: 'invalidCancelVaa', + msg: 'Invalid cancel message', + }, + { + code: 6051, + name: 'wrongCancelRelayerAddress', + }, + { + code: 6052, + name: 'insufficientFundsToRefundFee', + }, + { + code: 6053, + name: 'invalidTrader', + }, + { + code: 6054, + name: 'invalidAccountStatus', + }, + { + code: 6055, + name: 'invalidSlice', + }, + { + code: 6056, + name: 'invalidCompactUnlockItemsCount', + }, + { + code: 6057, + name: 'invalidCompactUnlockHash', + }, + ], + types: [ + { + name: 'auctionState', + type: { + kind: 'struct', + fields: [ + { + name: 'bump', + type: 'u8', + }, + { + name: 'hash', + type: { + array: ['u8', 32], + }, + }, + { + name: 'initializer', + type: 'pubkey', + }, + { + name: 'closeEpoch', + type: 'u64', + }, + { + name: 'amountOutMin', + type: 'u64', + }, + { + name: 'winner', + type: 'pubkey', + }, + { + name: 'amountPromised', + type: 'u64', + }, + { + name: 'validFrom', + type: 'u64', + }, + { + name: 'seqMsg', + type: 'u64', + }, + ], + }, + }, + { + name: 'compactUnlockState', + type: { + kind: 'struct', + fields: [ + { + name: 'seeds', + type: { + defined: { + name: 'compactUnlockStateSeeds', + }, + }, + }, + { + name: 'info', + type: { + defined: { + name: 'compactUnlockStateInfo', + }, + }, + }, + { + name: 'items', + type: 'bytes', + }, + ], + }, + }, + { + name: 'compactUnlockStateInfo', + type: { + kind: 'struct', + fields: [ + { + name: 'status', + type: { + defined: { + name: 'compactUnlockStatus', + }, + }, + }, + { + name: 'emitterChain', + type: 'u16', + }, + { + name: 'messageHash', + type: { + array: ['u8', 32], + }, + }, + { + name: 'itemsCount', + type: 'u16', + }, + ], + }, + }, + { + name: 'compactUnlockStateSeeds', + type: { + kind: 'struct', + fields: [ + { + name: 'bump', + type: 'u8', + }, + { + name: 'vaa', + type: 'pubkey', + }, + { + name: 'initializer', + type: 'pubkey', + }, + ], + }, + }, + { + name: 'compactUnlockStatus', + repr: { + kind: 'rust', + }, + type: { + kind: 'enum', + variants: [ + { + name: 'none', + }, + { + name: 'created', + }, + { + name: 'verified', + }, + ], + }, + }, + { + name: 'fulfillInfo', + type: { + kind: 'struct', + fields: [ + { + name: 'winner', + type: 'pubkey', + }, + { + name: 'amountPromised', + type: 'u64', + }, + { + name: 'amountFulfill', + type: 'u64', + }, + { + name: 'patchVersion', + type: 'u8', + }, + { + name: 'timeFulfill', + type: 'u64', + }, + { + name: 'unlockReceiver', + type: { + array: ['u8', 32], + }, + }, + ], + }, + }, + { + name: 'initOrderParams', + type: { + kind: 'struct', + fields: [ + { + name: 'amountInMin', + type: 'u64', + }, + { + name: 'nativeInput', + type: 'bool', + }, + { + name: 'feeSubmit', + type: 'u64', + }, + { + name: 'addrDest', + type: { + array: ['u8', 32], + }, + }, + { + name: 'chainDest', + type: 'u16', + }, + { + name: 'tokenOut', + type: { + array: ['u8', 32], + }, + }, + { + name: 'amountOutMin', + type: 'u64', + }, + { + name: 'gasDrop', + type: 'u64', + }, + { + name: 'feeCancel', + type: 'u64', + }, + { + name: 'feeRefund', + type: 'u64', + }, + { + name: 'deadline', + type: 'u64', + }, + { + name: 'penaltyPeriod', + type: 'u16', + }, + { + name: 'addrRef', + type: { + array: ['u8', 32], + }, + }, + { + name: 'feeRateRef', + type: 'u8', + }, + { + name: 'feeRateMayan', + type: 'u8', + }, + { + name: 'baseBond', + type: 'u64', + }, + { + name: 'perBpsBond', + type: 'u64', + }, + { + name: 'auctionMode', + type: 'u8', + }, + { + name: 'keyRnd', + type: { + array: ['u8', 32], + }, + }, + ], + }, + }, + { + name: 'orderInfo', + type: { + kind: 'struct', + fields: [ + { + name: 'payloadType', + type: 'u8', + }, + { + name: 'trader', + type: { + array: ['u8', 32], + }, + }, + { + name: 'chainSource', + type: 'u16', + }, + { + name: 'tokenIn', + type: { + array: ['u8', 32], + }, + }, + { + name: 'addrDest', + type: { + array: ['u8', 32], + }, + }, + { + name: 'chainDest', + type: 'u16', + }, + { + name: 'tokenOut', + type: { + array: ['u8', 32], + }, + }, + { + name: 'amountOutMin', + type: 'u64', + }, + { + name: 'gasDrop', + type: 'u64', + }, + { + name: 'feeCancel', + type: 'u64', + }, + { + name: 'feeRefund', + type: 'u64', + }, + { + name: 'deadline', + type: 'u64', + }, + { + name: 'penaltyPeriod', + type: 'u16', + }, + { + name: 'addrRef', + type: { + array: ['u8', 32], + }, + }, + { + name: 'feeRateRef', + type: 'u8', + }, + { + name: 'feeRateMayan', + type: 'u8', + }, + { + name: 'auctionMode', + type: 'u8', + }, + { + name: 'baseBond', + type: 'u64', + }, + { + name: 'perBpsBond', + type: 'u64', + }, + { + name: 'keyRnd', + type: { + array: ['u8', 32], + }, + }, + { + name: 'customPayload', + type: { + array: ['u8', 32], + }, + }, + ], + }, + }, + { + name: 'orderInitialized', + type: { + kind: 'struct', + fields: [ + { + name: 'orderHash', + type: { + array: ['u8', 32], + }, + }, + { + name: 'amountIn', + type: 'u64', + }, + ], + }, + }, + { + name: 'swiftDestSolanaState', + type: { + kind: 'struct', + fields: [ + { + name: 'bump', + type: 'u8', + }, + { + name: 'status', + type: { + defined: { + name: 'swiftDestSolanaStatus', + }, + }, + }, + { + name: 'isSettled', + type: 'bool', + }, + { + name: 'isPosted', + type: 'bool', + }, + { + name: 'order', + type: { + defined: { + name: 'orderInfo', + }, + }, + }, + { + name: 'hash', + type: { + array: ['u8', 32], + }, + }, + { + name: 'relayer', + type: 'pubkey', + }, + { + name: 'fulfill', + type: { + defined: { + name: 'fulfillInfo', + }, + }, + }, + ], + }, + }, + { + name: 'swiftDestSolanaStatus', + repr: { + kind: 'rust', + }, + type: { + kind: 'enum', + variants: [ + { + name: 'none', + }, + { + name: 'created', + }, + { + name: 'fulfilled', + }, + { + name: 'cancelled', + }, + { + name: 'closed', + }, + ], + }, + }, + { + name: 'swiftSourceSolanaState', + type: { + kind: 'struct', + fields: [ + { + name: 'bump', + type: 'u8', + }, + { + name: 'status', + type: { + defined: { + name: 'swiftSourceSolanaStatus', + }, + }, + }, + ], + }, + }, + { + name: 'swiftSourceSolanaStatus', + repr: { + kind: 'rust', + }, + type: { + kind: 'enum', + variants: [ + { + name: 'none', + }, + { + name: 'locked', + }, + { + name: 'unlocked', + }, + { + name: 'refunded', + }, + ], + }, + }, + ], +}; diff --git a/src/abis/swift.idl.ts b/src/abis/swift.idl.ts deleted file mode 100644 index 9956a5f..0000000 --- a/src/abis/swift.idl.ts +++ /dev/null @@ -1,2373 +0,0 @@ -export type Swift = { - version: '0.1.0'; - name: 'swift'; - instructions: [ - { - name: 'registerOrder'; - accounts: [ - { - name: 'relayer'; - isMut: true; - isSigner: true; - }, - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'args'; - type: { - defined: 'OrderInfo'; - }; - }, - ]; - }, - { - name: 'setAuctionWinner'; - accounts: [ - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'auction'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'expectedWinner'; - type: 'publicKey'; - }, - ]; - }, - { - name: 'fulfill'; - accounts: [ - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'driver'; - isMut: true; - isSigner: true; - }, - { - name: 'stateToAcc'; - isMut: false; - isSigner: false; - }, - { - name: 'mintTo'; - isMut: false; - isSigner: false; - }, - { - name: 'dest'; - isMut: true; - isSigner: false; - docs: ['CHECK this should be equal to addr_dest']; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'addrUnlocker'; - type: { - array: ['u8', 32]; - }; - }, - ]; - }, - { - name: 'settle'; - accounts: [ - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'stateToAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'relayer'; - isMut: true; - isSigner: true; - }, - { - name: 'mintTo'; - isMut: false; - isSigner: false; - }, - { - name: 'dest'; - isMut: true; - isSigner: false; - }, - { - name: 'referrer'; - isMut: false; - isSigner: false; - }, - { - name: 'feeCollector'; - isMut: false; - isSigner: false; - }, - { - name: 'referrerFeeAcc'; - isMut: true; - isSigner: false; - isOptional: true; - }, - { - name: 'mayanFeeAcc'; - isMut: true; - isSigner: false; - isOptional: true; - }, - { - name: 'destAcc'; - isMut: true; - isSigner: false; - isOptional: true; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'associatedTokenProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'tryCloseAta'; - type: 'bool'; - }, - ]; - }, - { - name: 'postUnlock'; - accounts: [ - { - name: 'driver'; - isMut: true; - isSigner: true; - }, - { - name: 'emitter'; - isMut: false; - isSigner: false; - }, - { - name: 'config'; - isMut: true; - isSigner: false; - }, - { - name: 'emitterSequence'; - isMut: true; - isSigner: false; - }, - { - name: 'feeCollector'; - isMut: true; - isSigner: false; - }, - { - name: 'message'; - isMut: true; - isSigner: true; - }, - { - name: 'coreBridgeProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'clock'; - isMut: false; - isSigner: false; - }, - { - name: 'rent'; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: 'cancel'; - accounts: [ - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'relayer'; - isMut: true; - isSigner: true; - }, - { - name: 'emitter'; - isMut: false; - isSigner: false; - }, - { - name: 'config'; - isMut: true; - isSigner: false; - }, - { - name: 'emitterSequence'; - isMut: true; - isSigner: false; - }, - { - name: 'feeCollector'; - isMut: true; - isSigner: false; - }, - { - name: 'message'; - isMut: true; - isSigner: true; - }, - { - name: 'coreBridgeProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'clock'; - isMut: false; - isSigner: false; - }, - { - name: 'rent'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'foreignFeeCollector'; - type: { - array: ['u8', 32]; - }; - }, - ]; - }, - { - name: 'close'; - accounts: [ - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'relayer'; - isMut: true; - isSigner: false; - docs: ['CHECK this should be equal to state.relayer\\']; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: 'initOrder'; - accounts: [ - { - name: 'trader'; - isMut: false; - isSigner: true; - }, - { - name: 'relayer'; - isMut: true; - isSigner: true; - }, - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'stateFromAcc'; - isMut: false; - isSigner: false; - }, - { - name: 'relayerFeeAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'mintFrom'; - isMut: false; - isSigner: false; - }, - { - name: 'feeManagerProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'params'; - type: { - defined: 'InitOrderParams'; - }; - }, - ]; - }, - { - name: 'unlockBatch'; - accounts: [ - { - name: 'vaaUnlock'; - isMut: false; - isSigner: false; - }, - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'stateFromAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'mintFrom'; - isMut: false; - isSigner: false; - }, - { - name: 'driver'; - isMut: true; - isSigner: true; - }, - { - name: 'driverAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: [ - { - name: 'index'; - type: 'u16'; - }, - ]; - }, - { - name: 'unlock'; - accounts: [ - { - name: 'vaaUnlock'; - isMut: false; - isSigner: false; - }, - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'stateFromAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'mintFrom'; - isMut: false; - isSigner: false; - }, - { - name: 'driver'; - isMut: true; - isSigner: true; - }, - { - name: 'driverAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - { - name: 'refund'; - accounts: [ - { - name: 'vaaCancel'; - isMut: false; - isSigner: false; - }, - { - name: 'state'; - isMut: true; - isSigner: false; - }, - { - name: 'stateFromAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'trader'; - isMut: true; - isSigner: false; - }, - { - name: 'traderAcc'; - isMut: true; - isSigner: false; - isOptional: true; - }, - { - name: 'mintFrom'; - isMut: false; - isSigner: false; - }, - { - name: 'relayerRefund'; - isMut: true; - isSigner: true; - }, - { - name: 'relayerRefundAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'relayerCancel'; - isMut: false; - isSigner: false; - }, - { - name: 'relayerCancelAcc'; - isMut: true; - isSigner: false; - }, - { - name: 'tokenProgram'; - isMut: false; - isSigner: false; - }, - { - name: 'systemProgram'; - isMut: false; - isSigner: false; - }, - ]; - args: []; - }, - ]; - accounts: [ - { - name: 'swiftDestSolanaState'; - type: { - kind: 'struct'; - fields: [ - { - name: 'bump'; - type: 'u8'; - }, - { - name: 'status'; - type: { - defined: 'SwiftDestSolanaStatus'; - }; - }, - { - name: 'order'; - type: { - defined: 'OrderInfo'; - }; - }, - { - name: 'hash'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'relayer'; - type: 'publicKey'; - }, - { - name: 'fulfill'; - type: { - defined: 'FulfillInfo'; - }; - }, - ]; - }; - }, - { - name: 'swiftSourceSolanaState'; - type: { - kind: 'struct'; - fields: [ - { - name: 'bump'; - type: 'u8'; - }, - { - name: 'status'; - type: { - defined: 'SwiftSourceSolanaStatus'; - }; - }, - ]; - }; - }, - { - name: 'auctionState'; - type: { - kind: 'struct'; - fields: [ - { - name: 'bump'; - type: 'u8'; - }, - { - name: 'hash'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'initializer'; - type: 'publicKey'; - }, - { - name: 'closeEpoch'; - type: 'u64'; - }, - { - name: 'amountOutMin'; - type: 'u64'; - }, - { - name: 'winner'; - type: 'publicKey'; - }, - { - name: 'amountPromised'; - type: 'u64'; - }, - { - name: 'validFrom'; - type: 'u64'; - }, - { - name: 'seqMsg'; - type: 'u64'; - }, - ]; - }; - }, - ]; - types: [ - { - name: 'InitOrderParams'; - type: { - kind: 'struct'; - fields: [ - { - name: 'amountInMin'; - type: 'u64'; - }, - { - name: 'nativeInput'; - type: 'bool'; - }, - { - name: 'feeSubmit'; - type: 'u64'; - }, - { - name: 'addrDest'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'chainDest'; - type: 'u16'; - }, - { - name: 'tokenOut'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'amountOutMin'; - type: 'u64'; - }, - { - name: 'gasDrop'; - type: 'u64'; - }, - { - name: 'feeCancel'; - type: 'u64'; - }, - { - name: 'feeRefund'; - type: 'u64'; - }, - { - name: 'deadline'; - type: 'u64'; - }, - { - name: 'addrRef'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'feeRateRef'; - type: 'u8'; - }, - { - name: 'feeRateMayan'; - type: 'u8'; - }, - { - name: 'auctionMode'; - type: 'u8'; - }, - { - name: 'keyRnd'; - type: { - array: ['u8', 32]; - }; - }, - ]; - }; - }, - { - name: 'FulfillInfo'; - type: { - kind: 'struct'; - fields: [ - { - name: 'winner'; - type: 'publicKey'; - }, - { - name: 'amountPromised'; - type: 'u64'; - }, - { - name: 'amountOutput'; - type: 'u64'; - }, - { - name: 'patchVersion'; - type: 'u8'; - }, - { - name: 'timeFulfill'; - type: 'u64'; - }, - { - name: 'addrUnlocker'; - type: { - array: ['u8', 32]; - }; - }, - ]; - }; - }, - { - name: 'SwiftDestSolanaStatus'; - type: { - kind: 'enum'; - variants: [ - { - name: 'NONE'; - }, - { - name: 'CREATED'; - }, - { - name: 'FULFILLED'; - }, - { - name: 'SETTLED'; - }, - { - name: 'POSTED'; - }, - { - name: 'CANCELLED'; - }, - { - name: 'CLOSED'; - }, - ]; - }; - }, - { - name: 'SwiftSourceSolanaStatus'; - type: { - kind: 'enum'; - variants: [ - { - name: 'NONE'; - }, - { - name: 'LOCKED'; - }, - { - name: 'UNLOCKED'; - }, - { - name: 'REFUNDED'; - }, - ]; - }; - }, - { - name: 'OrderInfo'; - type: { - kind: 'struct'; - fields: [ - { - name: 'trader'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'chainSource'; - type: 'u16'; - }, - { - name: 'tokenIn'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'addrDest'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'chainDest'; - type: 'u16'; - }, - { - name: 'tokenOut'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'amountOutMin'; - type: 'u64'; - }, - { - name: 'gasDrop'; - type: 'u64'; - }, - { - name: 'feeCancel'; - type: 'u64'; - }, - { - name: 'feeRefund'; - type: 'u64'; - }, - { - name: 'deadline'; - type: 'u64'; - }, - { - name: 'addrRef'; - type: { - array: ['u8', 32]; - }; - }, - { - name: 'feeRateRef'; - type: 'u8'; - }, - { - name: 'feeRateMayan'; - type: 'u8'; - }, - { - name: 'auctionMode'; - type: 'u8'; - }, - { - name: 'keyRnd'; - type: { - array: ['u8', 32]; - }; - }, - ]; - }; - }, - ]; - events: [ - { - name: 'OrderInitialized'; - fields: [ - { - name: 'orderHash'; - type: { - array: ['u8', 32]; - }; - index: false; - }, - { - name: 'amountIn'; - type: 'u64'; - index: false; - }, - ]; - }, - ]; - errors: [ - { - code: 6000; - name: 'OrderDestChainIsNotSolana'; - msg: 'Order dest chain is not solana'; - }, - { - code: 6001; - name: 'ChainIdNotEvmSupported'; - msg: 'Chain id is not Evm supported chain'; - }, - { - code: 6002; - name: 'InvalidStateStatus'; - msg: 'Invalid state status'; - }, - { - code: 6003; - name: 'OrderIsNotCreated'; - msg: 'Order is not created'; - }, - { - code: 6004; - name: 'InvalidOrderAuctionType'; - msg: 'Order state is not fulfilled'; - }, - { - code: 6005; - name: 'DeadlineIsPassed'; - msg: 'Order deadline is passed'; - }, - { - code: 6006; - name: 'AuctionIsNotClosed'; - msg: 'Auction is not closed'; - }, - { - code: 6007; - name: 'AuctionHashMismatch'; - msg: 'Auction hash mismatch'; - }, - { - code: 6008; - name: 'AuctionIsNotFinished'; - msg: 'Auction is not valid yet'; - }, - { - code: 6009; - name: 'InvalidExpectedWinner'; - msg: 'Invalid expected winner'; - }, - { - code: 6010; - name: 'OrderCannotBeFulfilled'; - msg: 'Order cannot be fulfilled'; - }, - { - code: 6011; - name: 'DriverIsNotWinner'; - msg: 'Invalid auction winner'; - }, - { - code: 6012; - name: 'InvalidMint'; - msg: 'Invalid mint'; - }, - { - code: 6013; - name: 'InvalidDestinationAddress'; - msg: 'Destination account address is wrong'; - }, - { - code: 6014; - name: 'OutputIsLessThanPromised'; - msg: 'amount output < amount promised'; - }, - { - code: 6015; - name: 'MinAmountOutNotSatisfied'; - msg: 'amount output < amount out min + fees'; - }, - { - code: 6016; - name: 'WinnerIsPrivilegedYet'; - msg: 'winner is privileged yet'; - }, - { - code: 6017; - name: 'MissingRequiredOptionalAccount'; - msg: 'missing required optional account'; - }, - { - code: 6018; - name: 'InvalidStateAccount'; - msg: 'Invalid state account'; - }, - { - code: 6019; - name: 'OrderFulfillInfoMissed'; - msg: 'Order fulfill info is missing'; - }, - { - code: 6020; - name: 'InvalidRelayer'; - msg: 'Invalid Relayer for close state'; - }, - { - code: 6021; - name: 'Overflow'; - msg: 'Overflow'; - }, - { - code: 6022; - name: 'DeadlineIsNotPassed'; - msg: 'Deadline is not passed yet'; - }, - { - code: 6023; - name: 'InvalidPayloadLength'; - msg: 'Payload is invalid'; - }, - { - code: 6024; - name: 'AmountInTooSmall'; - msg: 'Amount in too small'; - }, - { - code: 6025; - name: 'InvalidZeroAmount'; - msg: 'Invalid zero amount'; - }, - { - code: 6026; - name: 'InsufficientFundsToPayLockFee'; - msg: 'Insufficient funds to pay lock fee'; - }, - { - code: 6027; - name: 'ProtocolFeeRateTooHigh'; - msg: 'Protocol fee rate too high'; - }, - { - code: 6028; - name: 'ProtocolFeeRateMismatch'; - msg: 'Param protocol fee rate is wrong'; - }, - { - code: 6029; - name: 'ReferrerFeeRateTooHigh'; - msg: 'Referrer fee rate too high'; - }, - { - code: 6030; - name: 'GasDropNotAllowed'; - msg: 'Could not receive gas drop when token out is native'; - }, - { - code: 6031; - name: 'DestSolanaNotAllowed'; - msg: 'Destination chain could not be Solana'; - }, - { - code: 6032; - name: 'InvalidParam'; - msg: 'Invalid order parameter'; - }, - { - code: 6033; - name: 'FeesOverflow'; - msg: 'fee cancel + fee refund -> overflow'; - }, - { - code: 6034; - name: 'FeesTooHigh'; - msg: 'fee cancel + fee refund >= amount_in'; - }, - { - code: 6035; - name: 'FeeRateRefIsNotZero'; - msg: 'fee rate ref is not zero'; - }, - { - code: 6036; - name: 'RelayerIsTraderFeeSubmit'; - msg: 'relayer is trader but fee_submit > 0'; - }, - { - code: 6037; - name: 'MintAndTokenProgramMismatch'; - msg: 'Mint is not match with token program'; - }, - { - code: 6038; - name: 'InvalidUnlockBatchVAA'; - msg: 'Invalid unlock batch vaa'; - }, - { - code: 6039; - name: 'InvalidUnlockVAA'; - msg: 'Invalid unlock vaa'; - }, - { - code: 6040; - name: 'DriverIsNotUnlocker'; - msg: 'Driver is not equal to vaa unlocker'; - }, - { - code: 6041; - name: 'MintIsNotTokenIn'; - msg: 'Mint is not equal to vaa token in'; - }, - { - code: 6042; - name: 'InvalidRemainingAccountsCount'; - }, - { - code: 6043; - name: 'InvalidTokenAccountMint'; - }, - { - code: 6044; - name: 'InvalidTokenAccountOwner'; - }, - { - code: 6045; - name: 'InvalidEmitterChain'; - }, - { - code: 6046; - name: 'InvalidEmitterAddress'; - }, - { - code: 6047; - name: 'InvalidCancelVAA'; - msg: 'Invalid cancel vaa'; - }, - { - code: 6048; - name: 'WrongCancelRelayerAddress'; - }, - { - code: 6049; - name: 'InsufficientFundsToRefundFee'; - }, - { - code: 6050; - name: 'InvalidTrader'; - }, - { - code: 6051; - name: 'InvalidOneOwner'; - }, - { - code: 6052; - name: 'InvalidTwoOwner'; - }, - { - code: 6053; - name: 'InvalidThreeOwner'; - }, - ]; -}; - -export const IDL: Swift = { - version: '0.1.0', - name: 'swift', - instructions: [ - { - name: 'registerOrder', - accounts: [ - { - name: 'relayer', - isMut: true, - isSigner: true, - }, - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'args', - type: { - defined: 'OrderInfo', - }, - }, - ], - }, - { - name: 'setAuctionWinner', - accounts: [ - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'auction', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'expectedWinner', - type: 'publicKey', - }, - ], - }, - { - name: 'fulfill', - accounts: [ - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'driver', - isMut: true, - isSigner: true, - }, - { - name: 'stateToAcc', - isMut: false, - isSigner: false, - }, - { - name: 'mintTo', - isMut: false, - isSigner: false, - }, - { - name: 'dest', - isMut: true, - isSigner: false, - docs: ['CHECK this should be equal to addr_dest'], - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'addrUnlocker', - type: { - array: ['u8', 32], - }, - }, - ], - }, - { - name: 'settle', - accounts: [ - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'stateToAcc', - isMut: true, - isSigner: false, - }, - { - name: 'relayer', - isMut: true, - isSigner: true, - }, - { - name: 'mintTo', - isMut: false, - isSigner: false, - }, - { - name: 'dest', - isMut: true, - isSigner: false, - }, - { - name: 'referrer', - isMut: false, - isSigner: false, - }, - { - name: 'feeCollector', - isMut: false, - isSigner: false, - }, - { - name: 'referrerFeeAcc', - isMut: true, - isSigner: false, - isOptional: true, - }, - { - name: 'mayanFeeAcc', - isMut: true, - isSigner: false, - isOptional: true, - }, - { - name: 'destAcc', - isMut: true, - isSigner: false, - isOptional: true, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'associatedTokenProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'tryCloseAta', - type: 'bool', - }, - ], - }, - { - name: 'postUnlock', - accounts: [ - { - name: 'driver', - isMut: true, - isSigner: true, - }, - { - name: 'emitter', - isMut: false, - isSigner: false, - }, - { - name: 'config', - isMut: true, - isSigner: false, - }, - { - name: 'emitterSequence', - isMut: true, - isSigner: false, - }, - { - name: 'feeCollector', - isMut: true, - isSigner: false, - }, - { - name: 'message', - isMut: true, - isSigner: true, - }, - { - name: 'coreBridgeProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: 'cancel', - accounts: [ - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'relayer', - isMut: true, - isSigner: true, - }, - { - name: 'emitter', - isMut: false, - isSigner: false, - }, - { - name: 'config', - isMut: true, - isSigner: false, - }, - { - name: 'emitterSequence', - isMut: true, - isSigner: false, - }, - { - name: 'feeCollector', - isMut: true, - isSigner: false, - }, - { - name: 'message', - isMut: true, - isSigner: true, - }, - { - name: 'coreBridgeProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - { - name: 'clock', - isMut: false, - isSigner: false, - }, - { - name: 'rent', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'foreignFeeCollector', - type: { - array: ['u8', 32], - }, - }, - ], - }, - { - name: 'close', - accounts: [ - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'relayer', - isMut: true, - isSigner: false, - docs: ['CHECK this should be equal to state.relayer\\'], - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: 'initOrder', - accounts: [ - { - name: 'trader', - isMut: false, - isSigner: true, - }, - { - name: 'relayer', - isMut: true, - isSigner: true, - }, - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'stateFromAcc', - isMut: false, - isSigner: false, - }, - { - name: 'relayerFeeAcc', - isMut: true, - isSigner: false, - }, - { - name: 'mintFrom', - isMut: false, - isSigner: false, - }, - { - name: 'feeManagerProgram', - isMut: false, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'params', - type: { - defined: 'InitOrderParams', - }, - }, - ], - }, - { - name: 'unlockBatch', - accounts: [ - { - name: 'vaaUnlock', - isMut: false, - isSigner: false, - }, - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'stateFromAcc', - isMut: true, - isSigner: false, - }, - { - name: 'mintFrom', - isMut: false, - isSigner: false, - }, - { - name: 'driver', - isMut: true, - isSigner: true, - }, - { - name: 'driverAcc', - isMut: true, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [ - { - name: 'index', - type: 'u16', - }, - ], - }, - { - name: 'unlock', - accounts: [ - { - name: 'vaaUnlock', - isMut: false, - isSigner: false, - }, - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'stateFromAcc', - isMut: true, - isSigner: false, - }, - { - name: 'mintFrom', - isMut: false, - isSigner: false, - }, - { - name: 'driver', - isMut: true, - isSigner: true, - }, - { - name: 'driverAcc', - isMut: true, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - { - name: 'refund', - accounts: [ - { - name: 'vaaCancel', - isMut: false, - isSigner: false, - }, - { - name: 'state', - isMut: true, - isSigner: false, - }, - { - name: 'stateFromAcc', - isMut: true, - isSigner: false, - }, - { - name: 'trader', - isMut: true, - isSigner: false, - }, - { - name: 'traderAcc', - isMut: true, - isSigner: false, - isOptional: true, - }, - { - name: 'mintFrom', - isMut: false, - isSigner: false, - }, - { - name: 'relayerRefund', - isMut: true, - isSigner: true, - }, - { - name: 'relayerRefundAcc', - isMut: true, - isSigner: false, - }, - { - name: 'relayerCancel', - isMut: false, - isSigner: false, - }, - { - name: 'relayerCancelAcc', - isMut: true, - isSigner: false, - }, - { - name: 'tokenProgram', - isMut: false, - isSigner: false, - }, - { - name: 'systemProgram', - isMut: false, - isSigner: false, - }, - ], - args: [], - }, - ], - accounts: [ - { - name: 'swiftDestSolanaState', - type: { - kind: 'struct', - fields: [ - { - name: 'bump', - type: 'u8', - }, - { - name: 'status', - type: { - defined: 'SwiftDestSolanaStatus', - }, - }, - { - name: 'order', - type: { - defined: 'OrderInfo', - }, - }, - { - name: 'hash', - type: { - array: ['u8', 32], - }, - }, - { - name: 'relayer', - type: 'publicKey', - }, - { - name: 'fulfill', - type: { - defined: 'FulfillInfo', - }, - }, - ], - }, - }, - { - name: 'swiftSourceSolanaState', - type: { - kind: 'struct', - fields: [ - { - name: 'bump', - type: 'u8', - }, - { - name: 'status', - type: { - defined: 'SwiftSourceSolanaStatus', - }, - }, - ], - }, - }, - { - name: 'auctionState', - type: { - kind: 'struct', - fields: [ - { - name: 'bump', - type: 'u8', - }, - { - name: 'hash', - type: { - array: ['u8', 32], - }, - }, - { - name: 'initializer', - type: 'publicKey', - }, - { - name: 'closeEpoch', - type: 'u64', - }, - { - name: 'amountOutMin', - type: 'u64', - }, - { - name: 'winner', - type: 'publicKey', - }, - { - name: 'amountPromised', - type: 'u64', - }, - { - name: 'validFrom', - type: 'u64', - }, - { - name: 'seqMsg', - type: 'u64', - }, - ], - }, - }, - ], - types: [ - { - name: 'InitOrderParams', - type: { - kind: 'struct', - fields: [ - { - name: 'amountInMin', - type: 'u64', - }, - { - name: 'nativeInput', - type: 'bool', - }, - { - name: 'feeSubmit', - type: 'u64', - }, - { - name: 'addrDest', - type: { - array: ['u8', 32], - }, - }, - { - name: 'chainDest', - type: 'u16', - }, - { - name: 'tokenOut', - type: { - array: ['u8', 32], - }, - }, - { - name: 'amountOutMin', - type: 'u64', - }, - { - name: 'gasDrop', - type: 'u64', - }, - { - name: 'feeCancel', - type: 'u64', - }, - { - name: 'feeRefund', - type: 'u64', - }, - { - name: 'deadline', - type: 'u64', - }, - { - name: 'addrRef', - type: { - array: ['u8', 32], - }, - }, - { - name: 'feeRateRef', - type: 'u8', - }, - { - name: 'feeRateMayan', - type: 'u8', - }, - { - name: 'auctionMode', - type: 'u8', - }, - { - name: 'keyRnd', - type: { - array: ['u8', 32], - }, - }, - ], - }, - }, - { - name: 'FulfillInfo', - type: { - kind: 'struct', - fields: [ - { - name: 'winner', - type: 'publicKey', - }, - { - name: 'amountPromised', - type: 'u64', - }, - { - name: 'amountOutput', - type: 'u64', - }, - { - name: 'patchVersion', - type: 'u8', - }, - { - name: 'timeFulfill', - type: 'u64', - }, - { - name: 'addrUnlocker', - type: { - array: ['u8', 32], - }, - }, - ], - }, - }, - { - name: 'SwiftDestSolanaStatus', - type: { - kind: 'enum', - variants: [ - { - name: 'NONE', - }, - { - name: 'CREATED', - }, - { - name: 'FULFILLED', - }, - { - name: 'SETTLED', - }, - { - name: 'POSTED', - }, - { - name: 'CANCELLED', - }, - { - name: 'CLOSED', - }, - ], - }, - }, - { - name: 'SwiftSourceSolanaStatus', - type: { - kind: 'enum', - variants: [ - { - name: 'NONE', - }, - { - name: 'LOCKED', - }, - { - name: 'UNLOCKED', - }, - { - name: 'REFUNDED', - }, - ], - }, - }, - { - name: 'OrderInfo', - type: { - kind: 'struct', - fields: [ - { - name: 'trader', - type: { - array: ['u8', 32], - }, - }, - { - name: 'chainSource', - type: 'u16', - }, - { - name: 'tokenIn', - type: { - array: ['u8', 32], - }, - }, - { - name: 'addrDest', - type: { - array: ['u8', 32], - }, - }, - { - name: 'chainDest', - type: 'u16', - }, - { - name: 'tokenOut', - type: { - array: ['u8', 32], - }, - }, - { - name: 'amountOutMin', - type: 'u64', - }, - { - name: 'gasDrop', - type: 'u64', - }, - { - name: 'feeCancel', - type: 'u64', - }, - { - name: 'feeRefund', - type: 'u64', - }, - { - name: 'deadline', - type: 'u64', - }, - { - name: 'addrRef', - type: { - array: ['u8', 32], - }, - }, - { - name: 'feeRateRef', - type: 'u8', - }, - { - name: 'feeRateMayan', - type: 'u8', - }, - { - name: 'auctionMode', - type: 'u8', - }, - { - name: 'keyRnd', - type: { - array: ['u8', 32], - }, - }, - ], - }, - }, - ], - events: [ - { - name: 'OrderInitialized', - fields: [ - { - name: 'orderHash', - type: { - array: ['u8', 32], - }, - index: false, - }, - { - name: 'amountIn', - type: 'u64', - index: false, - }, - ], - }, - ], - errors: [ - { - code: 6000, - name: 'OrderDestChainIsNotSolana', - msg: 'Order dest chain is not solana', - }, - { - code: 6001, - name: 'ChainIdNotEvmSupported', - msg: 'Chain id is not Evm supported chain', - }, - { - code: 6002, - name: 'InvalidStateStatus', - msg: 'Invalid state status', - }, - { - code: 6003, - name: 'OrderIsNotCreated', - msg: 'Order is not created', - }, - { - code: 6004, - name: 'InvalidOrderAuctionType', - msg: 'Order state is not fulfilled', - }, - { - code: 6005, - name: 'DeadlineIsPassed', - msg: 'Order deadline is passed', - }, - { - code: 6006, - name: 'AuctionIsNotClosed', - msg: 'Auction is not closed', - }, - { - code: 6007, - name: 'AuctionHashMismatch', - msg: 'Auction hash mismatch', - }, - { - code: 6008, - name: 'AuctionIsNotFinished', - msg: 'Auction is not valid yet', - }, - { - code: 6009, - name: 'InvalidExpectedWinner', - msg: 'Invalid expected winner', - }, - { - code: 6010, - name: 'OrderCannotBeFulfilled', - msg: 'Order cannot be fulfilled', - }, - { - code: 6011, - name: 'DriverIsNotWinner', - msg: 'Invalid auction winner', - }, - { - code: 6012, - name: 'InvalidMint', - msg: 'Invalid mint', - }, - { - code: 6013, - name: 'InvalidDestinationAddress', - msg: 'Destination account address is wrong', - }, - { - code: 6014, - name: 'OutputIsLessThanPromised', - msg: 'amount output < amount promised', - }, - { - code: 6015, - name: 'MinAmountOutNotSatisfied', - msg: 'amount output < amount out min + fees', - }, - { - code: 6016, - name: 'WinnerIsPrivilegedYet', - msg: 'winner is privileged yet', - }, - { - code: 6017, - name: 'MissingRequiredOptionalAccount', - msg: 'missing required optional account', - }, - { - code: 6018, - name: 'InvalidStateAccount', - msg: 'Invalid state account', - }, - { - code: 6019, - name: 'OrderFulfillInfoMissed', - msg: 'Order fulfill info is missing', - }, - { - code: 6020, - name: 'InvalidRelayer', - msg: 'Invalid Relayer for close state', - }, - { - code: 6021, - name: 'Overflow', - msg: 'Overflow', - }, - { - code: 6022, - name: 'DeadlineIsNotPassed', - msg: 'Deadline is not passed yet', - }, - { - code: 6023, - name: 'InvalidPayloadLength', - msg: 'Payload is invalid', - }, - { - code: 6024, - name: 'AmountInTooSmall', - msg: 'Amount in too small', - }, - { - code: 6025, - name: 'InvalidZeroAmount', - msg: 'Invalid zero amount', - }, - { - code: 6026, - name: 'InsufficientFundsToPayLockFee', - msg: 'Insufficient funds to pay lock fee', - }, - { - code: 6027, - name: 'ProtocolFeeRateTooHigh', - msg: 'Protocol fee rate too high', - }, - { - code: 6028, - name: 'ProtocolFeeRateMismatch', - msg: 'Param protocol fee rate is wrong', - }, - { - code: 6029, - name: 'ReferrerFeeRateTooHigh', - msg: 'Referrer fee rate too high', - }, - { - code: 6030, - name: 'GasDropNotAllowed', - msg: 'Could not receive gas drop when token out is native', - }, - { - code: 6031, - name: 'DestSolanaNotAllowed', - msg: 'Destination chain could not be Solana', - }, - { - code: 6032, - name: 'InvalidParam', - msg: 'Invalid order parameter', - }, - { - code: 6033, - name: 'FeesOverflow', - msg: 'fee cancel + fee refund -> overflow', - }, - { - code: 6034, - name: 'FeesTooHigh', - msg: 'fee cancel + fee refund >= amount_in', - }, - { - code: 6035, - name: 'FeeRateRefIsNotZero', - msg: 'fee rate ref is not zero', - }, - { - code: 6036, - name: 'RelayerIsTraderFeeSubmit', - msg: 'relayer is trader but fee_submit > 0', - }, - { - code: 6037, - name: 'MintAndTokenProgramMismatch', - msg: 'Mint is not match with token program', - }, - { - code: 6038, - name: 'InvalidUnlockBatchVAA', - msg: 'Invalid unlock batch vaa', - }, - { - code: 6039, - name: 'InvalidUnlockVAA', - msg: 'Invalid unlock vaa', - }, - { - code: 6040, - name: 'DriverIsNotUnlocker', - msg: 'Driver is not equal to vaa unlocker', - }, - { - code: 6041, - name: 'MintIsNotTokenIn', - msg: 'Mint is not equal to vaa token in', - }, - { - code: 6042, - name: 'InvalidRemainingAccountsCount', - }, - { - code: 6043, - name: 'InvalidTokenAccountMint', - }, - { - code: 6044, - name: 'InvalidTokenAccountOwner', - }, - { - code: 6045, - name: 'InvalidEmitterChain', - }, - { - code: 6046, - name: 'InvalidEmitterAddress', - }, - { - code: 6047, - name: 'InvalidCancelVAA', - msg: 'Invalid cancel vaa', - }, - { - code: 6048, - name: 'WrongCancelRelayerAddress', - }, - { - code: 6049, - name: 'InsufficientFundsToRefundFee', - }, - { - code: 6050, - name: 'InvalidTrader', - }, - { - code: 6051, - name: 'InvalidOneOwner', - }, - { - code: 6052, - name: 'InvalidTwoOwner', - }, - { - code: 6053, - name: 'InvalidThreeOwner', - }, - ], -}; diff --git a/src/config/chains.ts b/src/config/chains.ts index 696cd9d..a5156e3 100644 --- a/src/config/chains.ts +++ b/src/config/chains.ts @@ -4,6 +4,7 @@ export const CHAIN_ID_ETH = 2; export const CHAIN_ID_BSC = 4; export const CHAIN_ID_POLYGON = 5; export const CHAIN_ID_AVAX = 6; +export const CHAIN_ID_SUI = 21; export const CHAIN_ID_ARBITRUM = 23; export const CHAIN_ID_OPTIMISM = 24; export const CHAIN_ID_BASE = 30; @@ -34,9 +35,11 @@ export const chainMap: { [key: string]: number } = { arbitrum: CHAIN_ID_ARBITRUM, optimism: CHAIN_ID_OPTIMISM, base: CHAIN_ID_BASE, + sui: CHAIN_ID_SUI, }; export const supportedChainIds: number[] = [ + CHAIN_ID_SUI, CHAIN_ID_SOLANA, CHAIN_ID_ETH, CHAIN_ID_BSC, @@ -60,3 +63,17 @@ export const WhChainIdToEvm: { [chainId: number]: number } = { }; export const WORMHOLE_DECIMALS = 8; + +const evmChains = new Set([ + CHAIN_ID_ETH, + CHAIN_ID_OPTIMISM, + CHAIN_ID_BASE, + CHAIN_ID_ARBITRUM, + CHAIN_ID_BSC, + CHAIN_ID_POLYGON, + CHAIN_ID_AVAX, +]); + +export function isEvmChainId(chainId: number): boolean { + return evmChains.has(chainId); +} diff --git a/src/config/contracts.ts b/src/config/contracts.ts index 88cc47e..c0bf42b 100644 --- a/src/config/contracts.ts +++ b/src/config/contracts.ts @@ -9,22 +9,33 @@ import { } from './chains'; export type ContractsConfig = { - contracts: { + contractsV2: { [chainId: number]: string; }; evmFulfillHelpers: { [chainId: number]: string; }; - auctionAddr: string; + suiIds: { + packageId: string; + stateId: string; + feeManagerStateId: string; + emitterId: string; + }; + auctionAddrV2: string; feeCollectorSolana: string; }; -export const SolanaProgram = 'BLZRi6frs4X4DNLw56V4EXai1b6QVESN1BhHBTYM9VcY'; -export const AuctionAddressSolana = '9w1D9okTM8xNE7Ntb7LpaAaoLc6LfU9nHFs2h2KTpX1H'; +export const SolanaProgramV2 = '92peaC8g5ANAxpK2aCfLTC12JgPncRKCGULQNB2DMvRH'; +export const AuctionAddressV2Solana = '9bh7SPjkNPgmq7HHWQxgCFJEnMPvAPdLcBEQL1FSG1YR'; export const FeeCollectorSolana = 'pSwTTFE92RsRtvMCpb3mjruv5ww2KgBNVPscwdWwbxk'; export const MayanForwarderAddress = '0x0654874eb7F59C6f5b39931FC45dC45337c967c3'; +export const SuiPackageId = '0x5b7716fc5f08c1e25a642f32df7b145503707e304102d1bb8296bc13bd169ea7'; +export const SuiStateId = '0x0d63681bd62e0ee1ccd133a94ee8a0a3bbe4c2ae24eaefb47ec0c4f2b1191619'; +export const SuiFeeMgrStateId = '0xe42174b6d742f40bd2b67b967542b21e6d7433f2d277a80bb59866ac73ff3f52'; +export const SuiEmitterId = '0x9d412b8d5e20748f415655facf91aea8a5a67803ab018d81041ad1de18a8d7f6'; + export const fulfillHelpers: { [key: number]: string } = { [CHAIN_ID_ARBITRUM]: '0xBC0663ef63ADD180609944c58BA7D4851890cA45', [CHAIN_ID_BASE]: '0xBC0663ef63ADD180609944c58BA7D4851890cA45', diff --git a/src/config/init.ts b/src/config/init.ts index 14becf8..67bc69d 100644 --- a/src/config/init.ts +++ b/src/config/init.ts @@ -37,8 +37,8 @@ export async function refershAndPatchConfigs(gConf: GlobalConfig, contracts: Con const data = await fetchDynamicSdkParams(); for (let key of Object.keys(data.swiftContracts)) { - if (contracts.contracts[+key]) { - contracts.contracts[+key] = data.swiftContracts[key]; + if (contracts.contractsV2[+key]) { + contracts.contractsV2[+key] = data.swiftContracts[key]; } } diff --git a/src/config/rpc.ts b/src/config/rpc.ts index 25e2c2f..3f62cbd 100644 --- a/src/config/rpc.ts +++ b/src/config/rpc.ts @@ -1,4 +1,5 @@ export type RpcConfig = { + suiFullNode: string; solana: { fulfillTxMode: 'NORMAL' | 'JITO'; jitoEndpoint: string; @@ -34,6 +35,7 @@ export type RpcConfig = { }; export const rpcConfig: RpcConfig = { + suiFullNode: process.env.SUI_FULL_NODE || 'https://fullnode.mainnet.sui.io:443', solana: { fulfillTxMode: process.env.SOLANA_TX_MODE === 'JITO' ? 'JITO' : 'NORMAL', jitoEndpoint: process.env.JITO_ENDPOINT || 'https://frankfurt.mainnet.block-engine.jito.wtf', diff --git a/src/config/tokens.ts b/src/config/tokens.ts index c5228c0..9ece636 100644 --- a/src/config/tokens.ts +++ b/src/config/tokens.ts @@ -1,6 +1,9 @@ +import { CHAIN_ID_SUI } from '@certusone/wormhole-sdk'; +import { SuiClient } from '@mysten/sui/client'; import { TOKEN_2022_PROGRAM_ID } from '@solana/spl-token'; import { Connection, ParsedAccountData, PublicKey } from '@solana/web3.js'; import axios from 'axios'; +import { hexToUint8Array, tryNativeToUint8Array } from '../utils/buffer'; import { getDecimals, getSymbol } from '../utils/erc20'; import { EvmProviders } from '../utils/evm-providers'; import logger from '../utils/logger'; @@ -13,6 +16,7 @@ import { CHAIN_ID_OPTIMISM, CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, + isEvmChainId, mapNameToWormholeChainId, WhChainIdToEvm, } from './chains'; @@ -34,19 +38,30 @@ export type Token = { pythUsdPriceId?: string; supportsPermit?: boolean; hasTransferFee?: boolean; - standard: 'native' | 'erc20' | 'spl' | 'spl2022'; + standard: 'native' | 'erc20' | 'spl' | 'spl2022' | 'suicoin'; + verifiedAddress?: string; // for sui only }; +export function tokenTo32ByteAddress(t: Token): Buffer { + if (t.wChainId === CHAIN_ID_SUI || t.realOriginChainId === CHAIN_ID_SUI) { + return Buffer.from(hexToUint8Array(t.verifiedAddress!)); + } else { + return Buffer.from(tryNativeToUint8Array(t.contract, t.wChainId || t.realOriginChainId)); + } +} + export class TokenList { private endpoints: MayanEndpoints; private tokensPerChain: { [key: number]: Token[] } = {}; public nativeTokens: { [index: string]: Token } = {}; private allPythIds: string[] = []; private readonly pythToCoingeckoIds: { [pythId: string]: Set } = {}; - private pythPrices: { [coingeckoId: string]: { - updatedAt: Date; - price: number; - } } = {}; + private pythPrices: { + [coingeckoId: string]: { + updatedAt: Date; + price: number; + }; + } = {}; private pythLock = false; private initialized = false; @@ -54,6 +69,7 @@ export class TokenList { endpoints: MayanEndpoints, private readonly evmProviders: EvmProviders, private readonly connection: Connection, + private readonly suiClient: SuiClient, ) { this.endpoints = endpoints; } @@ -115,7 +131,6 @@ export class TokenList { this.pythPrices['usd-coin']?.price && this.pythPrices['tether']?.updatedAt > new Date(Date.now() - 60 * 1000) ) { - return this.pythPrices['tether'].price / this.pythPrices['usd-coin'].price; } return null; @@ -124,7 +139,11 @@ export class TokenList { async updateList() { try { let tokenCount = 0; - const allTokens = await axios.get(this.endpoints.priceApiUrl + '/v3/tokens'); + const allTokens = await axios.get(this.endpoints.priceApiUrl + '/v3/tokens', { + params: { + standard: 'erc20,native,spl,spl2022,suicoin', + }, + }); for (const chainName of Object.keys(allTokens.data)) { const chainId = mapNameToWormholeChainId(chainName); if (!!chainId) { @@ -135,7 +154,9 @@ export class TokenList { this.nativeTokens = Object.entries(this.tokensPerChain).reduce( (acc, [chainId, tokens]) => { const token = tokens.find( - (token) => token.contract === '0x0000000000000000000000000000000000000000', + (token) => + token.contract === '0x0000000000000000000000000000000000000000' || + token.contract === '0x2::sui::SUI', ) as Token; if (!token) { logger.info(`Native token not found for chain ${chainId} and ignored`); @@ -194,9 +215,38 @@ export class TokenList { if (tokenChain === CHAIN_ID_SOLANA) { return await this.fetchSolanaTokenData(tokenContract); - } else { + } else if (isEvmChainId(tokenChain)) { return await this.fetchErc20TokenData(tokenChain, tokenContract); + } else if (tokenChain === CHAIN_ID_SUI) { + return await this.fetchSuiTokenData(tokenContract); + } else { + throw new Error(`token Chain ${tokenChain} is not supported`); + } + } + + async fetchSuiTokenData(coinType: string): Promise { + const coinMeta = await this.suiClient.getCoinMetadata({ + coinType: coinType, + }); + if (!coinMeta || !coinMeta.id) { + throw new Error(`Coin ${coinType} not found on Sui chain`); } + + return { + chainId: 101, + coingeckoId: '', + contract: coinType, + decimals: coinMeta.decimals, + logoURI: coinMeta.iconUrl!, + mint: '', + name: coinMeta.name, + standard: 'suicoin', + realOriginChainId: CHAIN_ID_SUI, + realOriginContractAddress: coinType, + symbol: coinMeta.symbol, + wChainId: CHAIN_ID_SUI, + verifiedAddress: coinMeta.id, + }; } async fetchErc20TokenData(chainId: number, tokenContract: string): Promise { @@ -278,6 +328,8 @@ export class TokenList { tokenContract = '0x0000000000000000000000000000000000000000'; } return t.contract === tokenContract; + case CHAIN_ID_SUI: + return t.contract === tokenContract || t.verifiedAddress === tokenContract; // both coinType and verifiedAddress searched for sui default: return t.contract.toLowerCase() === tokenContract.toLowerCase(); } @@ -295,6 +347,7 @@ const UsdcContracts: { [key: number]: string } = { [CHAIN_ID_ARBITRUM]: '0xaf88d065e77c8cc2239327c5edb3a432268e5831', [CHAIN_ID_OPTIMISM]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85', [CHAIN_ID_BASE]: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', + [CHAIN_ID_SUI]: '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC', }; const UsdtContracts: { [key: number]: string } = { diff --git a/src/config/wallet.ts b/src/config/wallet.ts index af7ed01..183af05 100644 --- a/src/config/wallet.ts +++ b/src/config/wallet.ts @@ -1,3 +1,4 @@ +import { Ed25519Keypair } from '@mysten/sui/keypairs/ed25519'; import { Keypair } from '@solana/web3.js'; import { ethers } from 'ethers6'; import { base58_to_binary } from '../utils/base58'; @@ -5,6 +6,7 @@ import { base58_to_binary } from '../utils/base58'; export type WalletConfig = { solana: Keypair; evm: ethers.Wallet; + sui: Ed25519Keypair; }; export function getWalletConfig(): WalletConfig { @@ -14,8 +16,12 @@ export function getWalletConfig(): WalletConfig { if (!process.env.EVM_PRIVATE_KEY) { throw new Error('EVM_PRIVATE_KEY is not set in the environment variables'); } + if (!process.env.SUI_PRIVATE_KEY) { + throw new Error('SUI_PRIVATE_KEY is not set in the environment variables'); + } return { solana: Keypair.fromSecretKey(base58_to_binary(process.env.SOLANA_PRIVATE_KEY)), evm: new ethers.Wallet(process.env.EVM_PRIVATE_KEY), + sui: Ed25519Keypair.fromSecretKey(process.env.SUI_PRIVATE_KEY), }; } diff --git a/src/driver.conf.ts b/src/driver.conf.ts index 4677da7..9496605 100644 --- a/src/driver.conf.ts +++ b/src/driver.conf.ts @@ -7,6 +7,7 @@ import { CHAIN_ID_OPTIMISM, CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, + CHAIN_ID_SUI, } from './config/chains'; export const driverConfig = { @@ -22,6 +23,7 @@ export const driverConfig = { CHAIN_ID_OPTIMISM, CHAIN_ID_BASE, CHAIN_ID_SOLANA, + CHAIN_ID_SUI, ]), acceptedOutputChains: new Set([ CHAIN_ID_BSC, @@ -32,5 +34,6 @@ export const driverConfig = { CHAIN_ID_OPTIMISM, CHAIN_ID_BASE, CHAIN_ID_SOLANA, + CHAIN_ID_SUI, ]), }; diff --git a/src/driver/driver.ts b/src/driver/driver.ts index 8121478..f8dc094 100644 --- a/src/driver/driver.ts +++ b/src/driver/driver.ts @@ -1,3 +1,4 @@ +import { CHAIN_ID_SUI } from '@certusone/wormhole-sdk'; import { createAssociatedTokenAccountIdempotentInstruction, getAssociatedTokenAddressSync, @@ -6,7 +7,7 @@ import { } from '@solana/spl-token'; import { AddressLookupTableAccount, Connection, Keypair, PublicKey, TransactionInstruction } from '@solana/web3.js'; import { AuctionFulfillerConfig } from '../auction'; -import { CHAIN_ID_SOLANA, WORMHOLE_DECIMALS } from '../config/chains'; +import { CHAIN_ID_SOLANA, isEvmChainId, WORMHOLE_DECIMALS } from '../config/chains'; import { ContractsConfig } from '../config/contracts'; import { RpcConfig } from '../config/rpc'; import { Token, TokenList } from '../config/tokens'; @@ -24,6 +25,7 @@ import { get_wormhole_core_accounts, getWormholeSequenceFromPostedMessage } from import { EvmFulfiller } from './evm'; import { SolanaFulfiller } from './solana'; import { NewSolanaIxHelper } from './solana-ix'; +import { SuiFulfiller } from './sui'; import { WalletsHelper } from './wallet-helper'; export class DriverService { @@ -41,11 +43,12 @@ export class DriverService { private readonly solanaFulfiller: SolanaFulfiller, private readonly walletsHelper: WalletsHelper, private readonly evmFulFiller: EvmFulfiller, + private readonly suiFulfiller: SuiFulfiller, private readonly tokenList: TokenList, private readonly solanaSender: SolanaMultiTxSender, ) { - this.swiftProgram = new PublicKey(contractsConfig.contracts[CHAIN_ID_SOLANA]); - this.swiftAuctionProgram = new PublicKey(contractsConfig.auctionAddr); + this.swiftProgram = new PublicKey(contractsConfig.contractsV2[CHAIN_ID_SOLANA]); + this.swiftAuctionProgram = new PublicKey(contractsConfig.auctionAddrV2); } getStateAddr(swap: Swap): PublicKey { @@ -119,13 +122,10 @@ export class DriverService { } async getRegisterOrderFromSwap(swap: Swap): Promise { - const fromToken = swap.fromToken; - const instruction = await this.solanaIxService.getRegisterOrderIx( this.walletConfig.solana.publicKey, new PublicKey(swap.stateAddr), swap, - fromToken.decimals, ); return instruction; } @@ -168,6 +168,17 @@ export class DriverService { } } + getDriverSuiTokenForBidAndSwap(srcChain: number, fromToken: Token): Token { + const fromNativeUSDT = this.tokenList.getNativeUsdt(srcChain); + const fromNativeUSDC = this.tokenList.getNativeUsdc(srcChain); + + if (fromToken.contract === fromNativeUSDC?.contract || fromToken.contract === fromNativeUSDT?.contract) { + return this.tokenList.getNativeUsdc(CHAIN_ID_SUI)!; + } else { + throw new Error(`Unsupported input token ${fromToken.contract} for sui driver! not bidding or swapping`); + } + } + async bid(swap: Swap): Promise { const srcChain = swap.sourceChain; const dstChain = swap.destChain; @@ -219,7 +230,6 @@ export class DriverService { new PublicKey(swap.auctionStateAddr), normalizedBidAmount, swap, - fromToken.decimals, ); let instructions = [bidIx]; @@ -250,8 +260,6 @@ export class DriverService { [], this.rpcConfig.solana.sendCount, true, - undefined, - 50_000, ); logger.info(`Sent register-order for ${swap.sourceTxHash} with ${hash}`); } @@ -290,6 +298,18 @@ export class DriverService { const wormholeAccs = get_wormhole_core_accounts(auctionEmitter); newMessageAccount = Keypair.generate(); + let remoteDriverWallet32: Uint8Array; + if (isEvmChainId(dstChain)) { + remoteDriverWallet32 = tryNativeToUint8Array( + this.walletsHelper.getDriverWallet(dstChain).address, + dstChain, + ); + } else if (dstChain === CHAIN_ID_SUI) { + remoteDriverWallet32 = Buffer.from(this.walletConfig.sui.getPublicKey().toSuiAddress().slice(2), 'hex'); + } else { + throw new Error(`Unsupported dest chain ${dstChain} for driver! not bidding or swapping`); + } + const postAuctionIx = await this.solanaIxService.getPostAuctionIx( this.walletConfig.solana.publicKey, new PublicKey(swap.auctionStateAddr), @@ -300,8 +320,7 @@ export class DriverService { wormholeAccs.sequence_key, newMessageAccount.publicKey, swap, - swap.fromToken.decimals, - tryNativeToUint8Array(this.walletsHelper.getDriverWallet(dstChain).address, dstChain), + remoteDriverWallet32, ); instructions.push(postAuctionIx); } @@ -411,8 +430,12 @@ export class DriverService { let driverToken: Token; if (swap.destChain === CHAIN_ID_SOLANA) { driverToken = this.getDriverSolanaTokenForBidAndSwap(srcChain, fromToken); - } else { + } else if (isEvmChainId(swap.destChain)) { driverToken = this.getDriverEvmTokenForBidAndSwap(srcChain, dstChain, fromToken); + } else if (swap.destChain === CHAIN_ID_SUI) { + driverToken = this.getDriverSuiTokenForBidAndSwap(srcChain, fromToken); + } else { + throw new Error(`Unable to determine driver token for chain ${swap.destChain}`); } const fulfillAmount = await this.auctionFulfillerCfg.fulfillAmount( @@ -467,7 +490,7 @@ export class DriverService { true, ); logger.info(`Sent fulfill transaction for ${swap.sourceTxHash} with ${hash}`); - } else { + } else if (isEvmChainId(swap.destChain)) { const normalizeMinAmountOut = BigInt(swap.minAmountOut64); const realMinAmountOut = normalizeMinAmountOut * BigInt(Math.ceil(10 ** Math.max(0, toToken.decimals - WORMHOLE_DECIMALS))); @@ -482,6 +505,20 @@ export class DriverService { expenses.dstGasPrice, postAuctionSignedVaa, ); + } else if (swap.destChain === CHAIN_ID_SUI) { + const normalizeMinAmountOut = BigInt(swap.minAmountOut64); + const realMinAmountOut = + normalizeMinAmountOut * BigInt(Math.ceil(10 ** Math.max(0, toToken.decimals - WORMHOLE_DECIMALS))); + + await this.suiFulfiller.fulfillAuction( + swap, + fulfillAmount, + driverToken, + realMinAmountOut, + postAuctionSignedVaa, + ); + } else { + throw new Error(`Unsupported dest chain ${swap.destChain} for driver! not bidding or swapping`); } } @@ -589,33 +626,38 @@ export class DriverService { async solanaFulfillAndSettleJitoBundle(swap: Swap) { logger.info(`Getting jito fulfill-settle package for ${swap.sourceTxHash}`); + let isCustomPayload = + swap.payloadId === 2 && + swap.customPayload && + swap.customPayload !== '0x0000000000000000000000000000000000000000000000000000000000000000'; + const [postBidData, fulfillData, settleData] = await Promise.all([ this.postBid(swap, true, false, true), this.fulfill(swap, undefined, true), - this.settle(swap, true), + isCustomPayload ? null : this.settle(swap, true), ]); logger.info(`Sending jito fulfill-settle package for ${swap.sourceTxHash}`); - await this.solanaSender.createAndSendJitoBundle( - [ - { - instructions: postBidData!.instructions!, - signers: postBidData!.signers!, - lookupTables: [], - }, - { - instructions: fulfillData!.instructions!, - signers: fulfillData!.signers!, - lookupTables: fulfillData!.lookupTables, - }, - { - instructions: [...settleData!.instructions!], - signers: [], - lookupTables: [], - }, - ], - 4, - ); + let bundles = [ + { + instructions: postBidData!.instructions!, + signers: postBidData!.signers!, + lookupTables: [], + }, + { + instructions: fulfillData!.instructions!, + signers: fulfillData!.signers!, + lookupTables: fulfillData!.lookupTables, + }, + ]; + if (!isCustomPayload) { + bundles.push({ + instructions: [...settleData!.instructions!], + signers: [], + lookupTables: [], + }); + } + await this.solanaSender.createAndSendJitoBundle(bundles, 4); logger.info(`Sent jito fulfill-settle package for ${swap.sourceTxHash}`); } } diff --git a/src/driver/evm.ts b/src/driver/evm.ts index 675cfdb..cab901e 100644 --- a/src/driver/evm.ts +++ b/src/driver/evm.ts @@ -4,9 +4,11 @@ import { abi as SwiftAbi } from '../abis/swift.abi'; import { CHAIN_ID_BSC, CHAIN_ID_SOLANA, + CHAIN_ID_SUI, ETH_CHAINS, WORMHOLE_DECIMALS, WhChainIdToEvm, + isEvmChainId, supportedChainIds, } from '../config/chains'; import { ContractsConfig } from '../config/contracts'; @@ -15,7 +17,7 @@ import { RpcConfig } from '../config/rpc'; import { Token, TokenList } from '../config/tokens'; import { WalletConfig } from '../config/wallet'; import { SWAP_STATUS, Swap } from '../swap.dto'; -import { tryNativeToHexString, tryNativeToUint8Array } from '../utils/buffer'; +import { hexToUint8Array, tryNativeToHexString, tryNativeToUint8Array } from '../utils/buffer'; import { getErc20Allowance, getErc20Balance, getEthBalance, giveErc20Allowance } from '../utils/erc20'; import { EvmProviders } from '../utils/evm-providers'; import { getSuggestedOverrides, getTypicalBlocksToConfirm } from '../utils/evm-trx'; @@ -44,8 +46,15 @@ export class EvmFulfiller { for (let chainId of supportedChainIds) { if (chainId === CHAIN_ID_SOLANA) { this.unlockWallets32.set(chainId, this.walletConfig.solana.publicKey.toBuffer()); - } else { + } else if (isEvmChainId(chainId)) { this.unlockWallets32.set(chainId, Buffer.from(tryNativeToUint8Array(evmWalletAddr, chainId))); + } else if (chainId === CHAIN_ID_SUI) { + this.unlockWallets32.set( + chainId, + Buffer.from(hexToUint8Array(this.walletConfig.sui.getPublicKey().toSuiAddress())), + ); + } else { + throw new Error(`Can not determine evm unlock addr for ${chainId}`); } } } @@ -61,7 +70,7 @@ export class EvmFulfiller { private async lazySetAllowances() { let promises = []; for (let chainId of supportedChainIds) { - if (chainId === CHAIN_ID_SOLANA) { + if (!isEvmChainId(chainId)) { continue; } let networkFeeData = await this.evmProviders[chainId].getFeeData(); @@ -81,7 +90,7 @@ export class EvmFulfiller { this.walletHelper.getDriverWallet(chainId), driverToken.contract, this.walletHelper.getDriverWallet(chainId).address, - this.contractsConfig.contracts[chainId], + this.contractsConfig.contractsV2[chainId], ); console.log(`Current allowance for ${driverToken.contract} on chain ${chainId}: ${current}`); @@ -90,7 +99,7 @@ export class EvmFulfiller { await giveErc20Allowance( this.walletHelper.getDriverWallet(chainId), driverToken.contract, - this.contractsConfig.contracts[chainId], + this.contractsConfig.contractsV2[chainId], ethers.MaxUint256, chainId, networkFeeData, @@ -301,7 +310,7 @@ export class EvmFulfiller { const args = [ driverToken.contract, amountIn64, - this.contractsConfig.contracts[swap.destChain], + this.contractsConfig.contractsV2[swap.destChain], swiftCallData, { value: permit.value, @@ -346,7 +355,7 @@ export class EvmFulfiller { toToken.contract, swapParams.evmRouterAddress, swapParams.evmRouterCalldata, - this.contractsConfig.contracts[targetChain], + this.contractsConfig.contractsV2[targetChain], swiftCallData, overrides, ]; @@ -368,7 +377,7 @@ export class EvmFulfiller { toToken.contract, swapParams.evmRouterAddress, swapParams.evmRouterCalldata, - this.contractsConfig.contracts[targetChain], + this.contractsConfig.contractsV2[targetChain], swiftCallData, { value: permit.value, @@ -628,7 +637,7 @@ export class EvmFulfiller { const args = [ driverToken.contract, amountIn64, - this.contractsConfig.contracts[swap.destChain], + this.contractsConfig.contractsV2[swap.destChain], callData, { value: permit.value, diff --git a/src/driver/routers.ts b/src/driver/routers.ts index 03aa44b..5b3d288 100644 --- a/src/driver/routers.ts +++ b/src/driver/routers.ts @@ -18,6 +18,11 @@ import { RpcConfig } from '../config/rpc'; import { writeUint24BE } from '../utils/buffer'; import { EvmProviders } from '../utils/evm-providers'; import { hmac256base64 } from '../utils/hmac'; +import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'; +import { Aftermath, Router, RouterCompleteTradeRoute } from 'aftermath-ts-sdk'; +import logger from '../utils/logger'; +let aftermathRouter: Router; + const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); const okxWebsite = 'https://www.okx.com'; @@ -45,6 +50,18 @@ export class SwapRouters { } } + async getSuiQuote(params: { + coinIn: string; + cointOut: string; + amount64: string; + }) { + + } + + async addSuiSwapTx() { + + } + async getQuote( swapParams: { whChainId: number; @@ -558,3 +575,85 @@ const OkxDexRouterContracts: { [chainId: number]: string } = { [CHAIN_ID_OPTIMISM]: '0xf332761c673b59B21fF6dfa8adA44d78c12dEF09', [CHAIN_ID_BASE]: '0x6b2C0c7be2048Daa9b5527982C29f48062B34D58', }; + + +export async function getSuiSwapQuote( + params: { + coinInType: string; + coinOutType: string; + coinInAmount: bigint; + }, + config?: { + timeout?: number; + retries?: number; + }, +): Promise<{ + outAmount: bigint; + route: RouterCompleteTradeRoute; +}> { + let timeoutId: NodeJS.Timeout | null = null; + + try { + if (!aftermathRouter) { + aftermathRouter = new Aftermath('MAINNET').Router(); + } + + const controller = new globalThis.AbortController(); + timeoutId = setTimeout(() => controller.abort(), config?.timeout || 5000); + + const route = await aftermathRouter.getCompleteTradeRouteGivenAmountIn( + { + coinInType: params.coinInType, + coinOutType: params.coinOutType, + coinInAmount: params.coinInAmount, + }, + controller.signal, + ); + return { + outAmount: route.coinOut.amount, + route: route, + }; + } catch (err) { + logger.warn(`Failed to fetch Sui swap quote: ${params} ${err}`); + if (!!config?.retries && config?.retries > 0) { + return getSuiSwapQuote(params, { + ...config, + retries: config.retries - 1, + }); + } + throw err; + } finally { + if (timeoutId) { + clearTimeout(timeoutId); + } + } +} + +export async function addSuiSwapTx( + tx: Transaction, + wallet: string, + route: RouterCompleteTradeRoute, +): Promise<[TransactionObjectArgument, Transaction]> { + const router = new Aftermath('MAINNET').Router(); + const res = await router.addTransactionForCompleteTradeRoute({ + completeRoute: route, + slippage: 0.01, + tx, + walletAddress: wallet, + }); + return [res.coinOutId!, res.tx]; +} + +export async function getAftermathSuiTx(swapParams: { + route: RouterCompleteTradeRoute; + walletAddress: string; + slippageBps: number; +}): Promise { + const router = new Aftermath('MAINNET').Router(); + const tx = await router.getTransactionForCompleteTradeRoute({ + walletAddress: swapParams.walletAddress, + completeRoute: swapParams.route, + slippage: swapParams.slippageBps / 10000, + }); + return tx; +} \ No newline at end of file diff --git a/src/driver/solana-ix.ts b/src/driver/solana-ix.ts index b678071..c2c673f 100644 --- a/src/driver/solana-ix.ts +++ b/src/driver/solana-ix.ts @@ -1,4 +1,3 @@ -import { AnchorProvider, BN, Program, Wallet } from '@coral-xyz/anchor'; import { ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID } from '@solana/spl-token'; import { ComputeBudgetProgram, @@ -10,17 +9,17 @@ import { SystemProgram, TransactionInstruction, } from '@solana/web3.js'; -import Decimal from 'decimal.js'; -import { ethers } from 'ethers6'; -import { IDL as AuctionIdl, SwiftAuction as AuctionT } from '../abis/swift-auction.idl'; -import { IDL as SwiftIdl, Swift as SwiftT } from '../abis/swift.idl'; -import { WORMHOLE_DECIMALS } from '../config/chains'; +import { AnchorProvider, BN, Program, Wallet } from 'anchor30'; +import { SwiftV2Auction, SwiftV2AuctionIdl } from '../abis/swift-auction-v2.idl'; +import { SwiftV2, SwiftV2Idl } from '../abis/swift-v2.idl'; +import { FeeCollectorSolana } from '../config/contracts'; +import { tokenTo32ByteAddress } from '../config/tokens'; import { Swap } from '../swap.dto'; -import { hexToUint8Array, tryNativeToUint8Array } from '../utils/buffer'; +import { hexToUint8Array } from '../utils/buffer'; export class NewSolanaIxHelper { - private readonly swiftProgram: Program; - private readonly auctionProgram: Program; + private readonly swiftProgram: Program; + private readonly auctionProgram: Program; private readonly auctionConfig: PublicKey; constructor(swiftProgramId: PublicKey, auctionProgramId: PublicKey, connection: Connection) { @@ -28,44 +27,35 @@ export class NewSolanaIxHelper { const provider = new AnchorProvider(connection, new Wallet(Keypair.generate()), { commitment: 'confirmed', }); - this.swiftProgram = new Program(SwiftIdl, swiftProgramId, provider); - this.auctionProgram = new Program(AuctionIdl, auctionProgramId, provider); + this.swiftProgram = new Program(SwiftV2Idl, provider); + this.auctionProgram = new Program(SwiftV2AuctionIdl, provider); this.auctionConfig = PublicKey.findProgramAddressSync([Buffer.from('CONFIG')], auctionProgramId)[0]; } - private createOrderParams(swap: Swap, fromTokenDecimals: number) { + private createOrderParams(swap: Swap) { return { - addrDest: Array.from(tryNativeToUint8Array(swap.destAddress, swap.destChain)), - addrRef: Array.from(tryNativeToUint8Array(swap.referrerAddress, swap.destChain)), + payloadType: swap.payloadId, + penaltyPeriod: swap.penaltyPeriod, + baseBond: new BN(swap.baseBond.toString()), + perBpsBond: new BN(swap.perBpsBond.toString()), + customPayload: Array.from(swap.customPayload ? hexToUint8Array(swap.customPayload) : Buffer.alloc(32)), + addrDest: Array.from(swap.destAddress32), + addrRef: Array.from(swap.referrerAddress32), amountOutMin: new BN(swap.minAmountOut64.toString()), auctionMode: swap.auctionMode, chainDest: swap.destChain, chainSource: swap.sourceChain, deadline: new BN(Math.floor(swap.deadline.getTime() / 1000)), - feeRefund: new BN( - ethers - .parseUnits( - swap.refundRelayerFee.toFixed(Math.min(8, fromTokenDecimals), Decimal.ROUND_DOWN), - Math.min(WORMHOLE_DECIMALS, fromTokenDecimals), - ) - .toString(), - ), - feeCancel: new BN( - ethers - .parseUnits( - swap.redeemRelayerFee.toFixed(Math.min(8, fromTokenDecimals), Decimal.ROUND_DOWN), // redeem relayer fee is considered as dst refund fee for swifts - Math.min(WORMHOLE_DECIMALS, fromTokenDecimals), - ) - .toString(), - ), // redeem relayer fee is considered as dst refund fee (cancel fee) for swifts + feeRefund: new BN(swap.refundRelayerFee64.toString()), + feeCancel: new BN(swap.redeemRelayerFee64.toString()), // redeem relayer fee is considered as dst refund fee (cancel fee) for swifts feeRateMayan: swap.mayanBps, feeRateRef: swap.referrerBps, gasDrop: new BN(swap.gasDrop64.toString()), keyRnd: Array.from(hexToUint8Array(swap.randomKey)), - tokenIn: Array.from(tryNativeToUint8Array(swap.fromTokenAddress, swap.sourceChain)), - tokenOut: Array.from(tryNativeToUint8Array(swap.toTokenAddress, swap.destChain)), - trader: Array.from(tryNativeToUint8Array(swap.trader, swap.sourceChain)), + tokenIn: Array.from(tokenTo32ByteAddress(swap.fromToken)), + tokenOut: Array.from(tokenTo32ByteAddress(swap.toToken)), + trader: Array.from(swap.trader32), }; } @@ -79,16 +69,20 @@ export class NewSolanaIxHelper { vaa: PublicKey, ): Promise { return this.swiftProgram.methods - .unlockBatch(stateIdxInVaa) + .unlockBatch(stateIdxInVaa, true) .accounts({ vaaUnlock: vaa, - driver: driver, - driverAcc: driverFromAss, + unlockReceiver: driver, + unlockReceiverAcc: driverFromAss, mintFrom: mintFrom, state: state, stateFromAcc: stateFromAss, systemProgram: SystemProgram.programId, tokenProgram: TOKEN_PROGRAM_ID, + feeCollector: FeeCollectorSolana, + mayanFeeAcc: FeeCollectorSolana, + referrer: FeeCollectorSolana, + referrerFeeAcc: FeeCollectorSolana, // TODO }) .instruction(); } @@ -102,10 +96,14 @@ export class NewSolanaIxHelper { vaa: PublicKey, ): Promise { return this.swiftProgram.methods - .unlock() + .unlock(true) .accounts({ - driver: driver, - driverAcc: driverFromAss, + unlockReceiver: driver, + unlockReceiverAcc: driverFromAss, + feeCollector: FeeCollectorSolana, + mayanFeeAcc: FeeCollectorSolana, + referrer: FeeCollectorSolana, + referrerFeeAcc: FeeCollectorSolana, // TODO mintFrom: mintFrom, state: state, stateFromAcc: stateFromAss, @@ -127,7 +125,7 @@ export class NewSolanaIxHelper { states: PublicKey[], ): Promise { return this.swiftProgram.methods - .postUnlock() + .postUnlock(false) .accounts({ clock: SYSVAR_CLOCK_PUBKEY, rent: SYSVAR_RENT_PUBKEY, @@ -155,10 +153,9 @@ export class NewSolanaIxHelper { state: PublicKey, swap: Swap, - fromTokenDecimals: number, ): Promise { return this.swiftProgram.methods - .registerOrder(this.createOrderParams(swap, fromTokenDecimals)) + .registerOrder(this.createOrderParams(swap)) .accounts({ relayer: relayer, state: state, @@ -196,10 +193,9 @@ export class NewSolanaIxHelper { normalizedBidAmount: bigint, swap: Swap, - fromTokenDecimals: number, ): Promise { return this.auctionProgram.methods - .bid(this.createOrderParams(swap, fromTokenDecimals), new BN(normalizedBidAmount.toString())) + .bid(this.createOrderParams(swap), new BN(normalizedBidAmount.toString())) .accounts({ config: this.auctionConfig, systemProgram: SystemProgram.programId, @@ -220,11 +216,10 @@ export class NewSolanaIxHelper { whMessage: PublicKey, swap: Swap, - fromTokenDecimals: number, driverDestChainAddress: Uint8Array, ): Promise { return this.auctionProgram.methods - .postAuction(this.createOrderParams(swap, fromTokenDecimals), Array.from(driverDestChainAddress)) + .postAuction(this.createOrderParams(swap), Array.from(driverDestChainAddress)) .accounts({ driver: driver, systemProgram: SystemProgram.programId, @@ -273,16 +268,12 @@ export class NewSolanaIxHelper { .settle(closeAta) .accounts({ relayer: driver, + destSigner: driver, state: state, stateToAcc: stateToAss, - associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID, dest: destAddr, destAcc: destAssAddr, - feeCollector: mayanFeeCollector, - mayanFeeAcc: mayanFeeCollectorAss, mintTo, - referrer: referrerAddr, - referrerFeeAcc: referrerAddrAss, systemProgram: SystemProgram.programId, tokenProgram: isToken2022 ? TOKEN_2022_PROGRAM_ID : TOKEN_PROGRAM_ID, }) diff --git a/src/driver/solana.ts b/src/driver/solana.ts index f62aa87..602fdff 100644 --- a/src/driver/solana.ts +++ b/src/driver/solana.ts @@ -9,12 +9,12 @@ import { VersionedTransaction, } from '@solana/web3.js'; import axios from 'axios'; -import { CHAIN_ID_SOLANA, supportedChainIds } from '../config/chains'; +import { CHAIN_ID_SOLANA, CHAIN_ID_SUI, isEvmChainId, supportedChainIds } from '../config/chains'; import { RpcConfig } from '../config/rpc'; import { Token, TokenList } from '../config/tokens'; import { WalletConfig } from '../config/wallet'; import { Swap } from '../swap.dto'; -import { tryNativeToUint8Array } from '../utils/buffer'; +import { hexToUint8Array, tryNativeToUint8Array } from '../utils/buffer'; import logger from '../utils/logger'; import { LookupTableOptimizer } from '../utils/lut'; import { NewSolanaIxHelper } from './solana-ix'; @@ -34,7 +34,7 @@ type WalletInfo = { export class SolanaFulfiller { private wallets: WalletAss[] = []; - private readonly unlockWallets: Map = new Map(); + private readonly unlockWallets32: Map = new Map(); constructor( private readonly solanaConnection: Connection, @@ -42,7 +42,6 @@ export class SolanaFulfiller { private readonly walletConfig: WalletConfig, private readonly solanaIxHelper: NewSolanaIxHelper, private readonly lutOptimizer: LookupTableOptimizer, - walletHelper: WalletsHelper, tokenList: TokenList, ) { for (let token of [tokenList.getNativeUsdc(CHAIN_ID_SOLANA)!, tokenList.getWethSol()]) { @@ -55,9 +54,17 @@ export class SolanaFulfiller { for (let chainId of supportedChainIds) { if (chainId === CHAIN_ID_SOLANA) { - continue; + this.unlockWallets32.set(chainId, this.walletConfig.solana.publicKey.toBuffer()); + } else if (chainId === CHAIN_ID_SUI) { + this.unlockWallets32.set( + chainId, + Buffer.from(this.walletConfig.sui.getPublicKey().toSuiAddress().slice(2), 'hex'), + ); + } else if (isEvmChainId(chainId)) { + this.unlockWallets32.set(chainId, Buffer.from(tryNativeToUint8Array(walletConfig.evm.address, chainId))); + } else { + throw new Error(`Invalid chainId for unlock wallet sui: ${chainId}`); } - this.unlockWallets.set(chainId, walletHelper.getDriverWallet(chainId).address); } } @@ -125,43 +132,6 @@ export class SolanaFulfiller { return result; } - async getNormalizedBid( - driverToken: Token, - effectiveAmountInDriverToken: number, - normalizedMinAmountOut: bigint, - toToken: Token, - ): Promise { - let bidAmount: bigint; - if (driverToken.contract === toToken.contract) { - bidAmount = BigInt(Math.floor(effectiveAmountInDriverToken * 0.99 * 10 ** driverToken.decimals)); - } else { - const quoteRes = await this.getQuoteWithRetry( - BigInt(Math.floor(effectiveAmountInDriverToken * 10 ** driverToken.decimals)), - driverToken.mint, - toToken.mint, - 0.1, // 10% - ); - - if (!quoteRes || !quoteRes.raw) { - throw new Error('jupiter quote for bid in swift failed'); - } - - bidAmount = BigInt(Math.floor(Number(quoteRes.expectedAmountOut) * Number(0.99))); - } - - let normalizedBidAmount = bidAmount; - if (toToken.decimals > 8) { - normalizedBidAmount = bidAmount / BigInt(10 ** (toToken.decimals - 8)); - } - - if (normalizedBidAmount < normalizedMinAmountOut) { - logger.warn(`normalizedBidAmount is less than minAmountOut`); - normalizedBidAmount = normalizedMinAmountOut; - } - - return normalizedBidAmount; - } - async getSimpleFulfillIxPackage( swiftProgram: PublicKey, stateAddress: PublicKey, @@ -341,8 +311,12 @@ export class SolanaFulfiller { getUnlockAddress(sourceChainId: number): Uint8Array { if (sourceChainId === CHAIN_ID_SOLANA) { return tryNativeToUint8Array(this.walletConfig.solana.publicKey.toString(), CHAIN_ID_SOLANA); - } else { + } else if (isEvmChainId(sourceChainId)) { return tryNativeToUint8Array(this.walletConfig.evm.address, sourceChainId); + } else if (sourceChainId === CHAIN_ID_SUI) { + return hexToUint8Array(this.walletConfig.sui.getPublicKey().toSuiAddress()); + } else { + throw new Error(`unsupported chain id for getting solana unlock addr ${sourceChainId}`); } } } diff --git a/src/driver/sui.ts b/src/driver/sui.ts new file mode 100644 index 0000000..5dca13e --- /dev/null +++ b/src/driver/sui.ts @@ -0,0 +1,212 @@ +import { parseVaa } from '@certusone/wormhole-sdk'; +import { SuiClient } from '@mysten/sui/client'; +import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions'; +import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'; +import { ethers } from 'ethers6'; +import { CHAIN_ID_SOLANA, CHAIN_ID_SUI, isEvmChainId, supportedChainIds } from '../config/chains'; +import { ContractsConfig } from '../config/contracts'; +import { Token, TokenList, tokenTo32ByteAddress } from '../config/tokens'; +import { WalletConfig } from '../config/wallet'; +import { Swap } from '../swap.dto'; +import { tryNativeToUint8Array } from '../utils/buffer'; +import logger from '../utils/logger'; +import { addParseAndVerifySui } from '../utils/wormhole'; +import { addSuiSwapTx, getSuiSwapQuote } from './routers'; + +export class SuiFulfiller { + private readonly unlockWallets32: Map = new Map(); + private readonly suiFulfillTxHelper: SuiFulfillTxHelper; + + constructor( + private readonly suiClient: SuiClient, + private readonly walletConfig: WalletConfig, + private readonly contracts: ContractsConfig, + private readonly tokenList: TokenList, + ) { + this.suiFulfillTxHelper = new SuiFulfillTxHelper(contracts); + + const evmWalletAddr = this.walletConfig.evm.address; + + for (let chainId of supportedChainIds) { + if (chainId === CHAIN_ID_SOLANA) { + this.unlockWallets32.set(chainId, this.walletConfig.solana.publicKey.toBuffer()); + } else if (chainId === CHAIN_ID_SUI) { + this.unlockWallets32.set( + chainId, + Buffer.from(this.walletConfig.sui.getPublicKey().toSuiAddress().slice(2), 'hex'), + ); + } else if (isEvmChainId(chainId)) { + this.unlockWallets32.set(chainId, Buffer.from(tryNativeToUint8Array(evmWalletAddr, chainId))); + } else { + throw new Error(`Invalid chainId for unlock wallet sui: ${chainId}`); + } + } + } + + async fulfillAuction( + swap: Swap, + availableAmountIn: number, + driverToken: Token, + realMinAmountOut: bigint, + postAuctionSignedVaa?: Uint8Array, + ): Promise { + const nativeCurrency = this.tokenList.nativeTokens[CHAIN_ID_SUI]; + + let gasDrop = swap.gasDrop64; + if (nativeCurrency.decimals > 8) { + gasDrop = gasDrop * 10n ** (BigInt(nativeCurrency.decimals) - 8n); + } + const amountIn64 = ethers.parseUnits(availableAmountIn.toFixed(driverToken.decimals), driverToken.decimals); + + let tx = new Transaction(); + + const vaa = addParseAndVerifySui(tx, postAuctionSignedVaa!).vaa; + const fulfillTicket = this.suiFulfillTxHelper.addFulfillTicket(tx, vaa, swap); + + const coins = await this.suiClient.getCoins({ + owner: this.walletConfig.sui.getPublicKey().toSuiAddress(), + coinType: driverToken.contract, + }); + + let fulfillCoinFund; + if (driverToken.contract === swap.toToken.contract) { + const usdcCoin = coins.data[0]; + if (coins.data.length > 1) { + tx.mergeCoins( + tx.object(usdcCoin.coinObjectId), + coins.data.slice(1).map((c) => tx.object(c.coinObjectId)), + ); + } + const [coin] = tx.splitCoins(tx.object(usdcCoin.coinObjectId), [tx.pure.u64(amountIn64)]); + + fulfillCoinFund = coin; + } else { + // TODO: provide fulfillCoinFund from Swap + const quote = await getSuiSwapQuote({ + coinInAmount: amountIn64, + coinInType: driverToken.contract, + coinOutType: swap.toToken.contract, + }); + + const results = await addSuiSwapTx(tx, this.walletConfig.sui.getPublicKey().toSuiAddress(), quote.route); + fulfillCoinFund = results[0]; + tx = results[1]; + } + + const gasDropMetadata = nativeCurrency.verifiedAddress!; + const [gasDropCoin] = tx.splitCoins(tx.gas, [gasDrop]); + + this.suiFulfillTxHelper.addCompleteFulfill( + tx, + swap, + fulfillTicket, + fulfillCoinFund, + gasDropCoin, + gasDropMetadata, + this.unlockWallets32.get(swap.sourceChain)!, + ); + + logger.info(`Fulfilling auction on SUI with amountIn64: ${amountIn64}, realMinAmountOut: ${realMinAmountOut}`); + const result = await this.suiClient.signAndExecuteTransaction({ + signer: this.walletConfig.sui, + transaction: tx, + options: { + showEvents: true, + showEffects: true, + }, + }); + + if (!!result.errors) { + throw new Error(`Error fulfilling auction on SUI ${result.errors}`); + } + + logger.info(`Fulfilled auction on SUI with ${result.digest}`); + } +} + +class SuiFulfillTxHelper { + constructor(private readonly contracts: ContractsConfig) {} + + addFulfillTicket(tx: Transaction, vaa: TransactionObjectArgument, swap: Swap): TransactionObjectArgument { + return tx.moveCall({ + package: this.contracts.suiIds.packageId, + module: 'fulfill', + function: 'prepare_fulfill_winner', + arguments: [ + tx.object(this.contracts.suiIds.stateId), + vaa, + tx.object(SUI_CLOCK_OBJECT_ID), + tx.pure.u8(swap.payloadId), + tx.pure.address('0x' + swap.trader32.toString('hex')), + tx.pure.u16(swap.sourceChain), + tx.pure.address('0x' + tokenTo32ByteAddress(swap.fromToken).toString('hex')), + tx.pure.address('0x' + swap.destAddress32.toString('hex')), + tx.pure.u16(swap.destChain), + tx.pure.address('0x' + tokenTo32ByteAddress(swap.toToken).toString('hex')), + tx.pure.u64(swap.minAmountOut64), + tx.pure.u64(swap.gasDrop64), + tx.pure.u64(swap.redeemRelayerFee64), + tx.pure.u64(swap.refundRelayerFee64), + tx.pure.u64(BigInt(swap.deadline.getTime() / 1000)), + tx.pure.u16(swap.penaltyPeriod), + tx.pure.address('0x' + swap.referrerAddress32.toString('hex')), + tx.pure.u8(swap.referrerBps), + tx.pure.u8(swap.mayanBps), + tx.pure.u8(swap.auctionMode), + tx.pure.u64(swap.baseBond), + tx.pure.u64(swap.perBpsBond), + tx.pure.address(swap.randomKey), + tx.pure.address(swap.customPayload!), + ], + }); + } + + addPrepareFulfillWinner( + tx: Transaction, + signedVaa: Uint8Array, + ): { + fulfillMsg: { + $kind: 'NestedResult'; + NestedResult: [number, number]; + }; + } { + const parsed = parseVaa(signedVaa); + const results = addParseAndVerifySui(tx, signedVaa); + + const [fulfillMsg] = tx.moveCall({ + target: `${this.contracts.suiIds.packageId}::fulfill::prepare_fulfill_winner`, + arguments: [tx.object(this.contracts.suiIds.stateId), results.vaa], + }); + + return { + fulfillMsg: fulfillMsg, + }; + } + + addCompleteFulfill( + tx: Transaction, + swap: Swap, + fulfillTicket: TransactionObjectArgument, + fulfillCoinFund: TransactionObjectArgument, + gasDropCoin: any, + gasDropCoinMetadataId: any, + addrUnlocker32: Buffer, + ) { + tx.moveCall({ + package: this.contracts.suiIds.packageId, + module: 'fulfill', + function: 'complete_fulfill', + typeArguments: [swap.toToken.contract], + arguments: [ + tx.object(this.contracts.suiIds.stateId), + tx.object(SUI_CLOCK_OBJECT_ID), + fulfillTicket!, + fulfillCoinFund, + tx.object(swap.toToken.verifiedAddress!), + gasDropCoin, + tx.object(gasDropCoinMetadataId), + tx.pure.address('0x' + addrUnlocker32.toString('hex')), + ], + }); + } +} diff --git a/src/driver/unlocker.ts b/src/driver/unlocker.ts index fe4118f..a9898c1 100644 --- a/src/driver/unlocker.ts +++ b/src/driver/unlocker.ts @@ -14,7 +14,7 @@ import { CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, } from '../config/chains'; -import { ContractsConfig, SolanaProgram } from '../config/contracts'; +import { ContractsConfig, SolanaProgramV2 } from '../config/contracts'; import { MayanEndpoints } from '../config/endpoints'; import { GlobalConfig } from '../config/global'; import { RpcConfig } from '../config/rpc'; @@ -68,7 +68,7 @@ export type UnlockableSwapSingleItem = { const MAX_BATCH_SIZE = 8; export class Unlocker { - private readonly solprogram = new PublicKey(SolanaProgram); + private readonly solprogram = new PublicKey(SolanaProgramV2); private readonly driverAddresses: string[] = []; private locks: { [key: string]: boolean } = {}; private readonly wormholeInterface = new ethers.Interface(WormholeAbi); @@ -363,7 +363,7 @@ export class Unlocker { fromTokenAddress: string, ): Promise { const stateAddr = getSwiftStateAddrSrc( - new PublicKey(SolanaProgram), + new PublicKey(SolanaProgramV2), Buffer.from(orderHash.replace('0x', ''), 'hex'), ); const fromMint = new PublicKey(fromTokenAddress); @@ -404,7 +404,7 @@ export class Unlocker { const foundStates = orders.map((ord) => getSwiftStateAddrSrc( - new PublicKey(SolanaProgram), + new PublicKey(SolanaProgramV2), Buffer.from(ord.orderHash.replace('0x', ''), 'hex'), ).toString(), ); @@ -426,7 +426,7 @@ export class Unlocker { const driverAss = getAssociatedTokenAddressSync(fromMint, driver, false); const state = getSwiftStateAddrSrc( - new PublicKey(SolanaProgram), + new PublicKey(SolanaProgramV2), Buffer.from(ord.orderHash.replace('0x', ''), 'hex'), ); if (!foundStates.includes(state.toString())) { @@ -581,7 +581,7 @@ export class Unlocker { sequence: bigint; txHash: string; }> { - const swiftProgram = new PublicKey(this.contracts.contracts[CHAIN_ID_SOLANA]); + const swiftProgram = new PublicKey(this.contracts.contractsV2[CHAIN_ID_SOLANA]); const [swiftEmitter, _] = PublicKey.findProgramAddressSync([Buffer.from('emitter')], swiftProgram); const wormholeAccs = get_wormhole_core_accounts(swiftEmitter); const newMessageAccount = Keypair.generate(); @@ -769,7 +769,7 @@ export class Unlocker { } private async getSignedVaa(sequence: string, destChainId: number, deadlineSeconds?: number): Promise { - const contractAddress = this.contracts.contracts[destChainId]; + const contractAddress = this.contracts.contractsV2[destChainId]; let mayanBridgeEmitterAddress; if (ethers.isAddress(contractAddress)) { mayanBridgeEmitterAddress = getEmitterAddressEth(contractAddress); diff --git a/src/driver/wallet-helper.ts b/src/driver/wallet-helper.ts index 1fb795a..83d7f8f 100644 --- a/src/driver/wallet-helper.ts +++ b/src/driver/wallet-helper.ts @@ -28,11 +28,11 @@ export class WalletsHelper { private readonly rpcConfig: RpcConfig, private readonly contracts: ContractsConfig, ) { - for (let chainId of Object.keys(this.contracts.contracts)) { + for (let chainId of Object.keys(this.contracts.contractsV2)) { if (+chainId === CHAIN_ID_SOLANA) { continue; } - let contractAddr = this.contracts.contracts[+chainId]; + let contractAddr = this.contracts.contractsV2[+chainId]; let wallet = new ethers.Wallet(this.walletConfig.evm.privateKey, this.evmProviders[chainId]); this.evmWallets[+chainId] = wallet; @@ -52,7 +52,7 @@ export class WalletsHelper { const flashbotWallet = new ethers.Wallet(this.walletConfig.evm.privateKey, flashbotsProvider); this.flashBotWallet = flashbotWallet; this.flashBotSwiftContract = new ethers.Contract( - this.contracts.contracts[CHAIN_ID_ETH], + this.contracts.contractsV2[CHAIN_ID_ETH], SwiftAbi, flashbotWallet, ); diff --git a/src/index.ts b/src/index.ts index 4570070..5212807 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,13 +1,19 @@ import { PublicKey } from '@solana/web3.js'; +import { SuiClient } from '@mysten/sui/client'; +import { Connection, PublicKey } from '@solana/web3.js'; import 'dotenv/config'; import { AuctionFulfillerConfig } from './auction'; import { CHAIN_ID_SOLANA, supportedChainIds } from './config/chains'; import { - AuctionAddressSolana, + AuctionAddressV2Solana, ContractsConfig, FeeCollectorSolana, fulfillHelpers, - SolanaProgram, + SolanaProgramV2, + SuiEmitterId, + SuiFeeMgrStateId, + SuiPackageId, + SuiStateId, } from './config/contracts'; import { mayanEndpoints } from './config/endpoints'; import { GlobalConfig } from './config/global'; @@ -23,6 +29,7 @@ import { SwapRouters } from './driver/routers'; import { SolanaFulfiller } from './driver/solana'; import { NewSolanaIxHelper } from './driver/solana-ix'; import { StateCloser } from './driver/state-closer'; +import { SuiFulfiller } from './driver/sui'; import { Unlocker } from './driver/unlocker'; import { WalletsHelper } from './driver/wallet-helper'; import { Relayer } from './relayer'; @@ -41,7 +48,7 @@ export async function main() { createDatabase(DB_PATH); const walletConf = getWalletConfig(); logger.info( - `Solana Wallet is ${walletConf.solana.publicKey.toString()} and Ethereum Wallet is ${walletConf.evm.address}`, + ` \nSolana Wallet is ${walletConf.solana.publicKey.toString()} \nEthereum Wallet is ${walletConf.evm.address} \nSui Wallet is ${walletConf.sui.getPublicKey().toSuiAddress()}`, ); const initialDynamicConfig = await fetchDynamicSdkParams(); @@ -73,10 +80,16 @@ export async function main() { }; const contracts: ContractsConfig = { - auctionAddr: AuctionAddressSolana, + auctionAddrV2: AuctionAddressV2Solana, evmFulfillHelpers: fulfillHelpers, - contracts: { ...initialDynamicConfig.swiftContracts, [CHAIN_ID_SOLANA]: SolanaProgram }, + contractsV2: { ...initialDynamicConfig.swiftContracts, [CHAIN_ID_SOLANA]: SolanaProgramV2 }, feeCollectorSolana: FeeCollectorSolana, + suiIds: { + emitterId: SuiEmitterId, + feeManagerStateId: SuiFeeMgrStateId, + packageId: SuiPackageId, + stateId: SuiStateId, + }, }; setInterval(() => { refershAndPatchConfigs(globalConfig, contracts, rpcConfig); @@ -93,12 +106,16 @@ export async function main() { const walletHelper = new WalletsHelper(evmProviders, walletConf, rpcConfig, contracts); - const tokenList = new TokenList(mayanEndpoints, evmProviders, solanaConnection); + const suiClient = new SuiClient({ + url: rpcConfig.suiFullNode, + }); + + const tokenList = new TokenList(mayanEndpoints, evmProviders, solanaConnection, suiClient); await tokenList.init(); const solanaIxHelper = new NewSolanaIxHelper( - new PublicKey(contracts.contracts[CHAIN_ID_SOLANA]), - new PublicKey(contracts.auctionAddr), + new PublicKey(contracts.contractsV2[CHAIN_ID_SOLANA]), + new PublicKey(contracts.auctionAddrV2), solanaConnection, ); @@ -141,7 +158,6 @@ export async function main() { walletConf, solanaIxHelper, lutOptimizer, - walletHelper, tokenList, ); const evmFulFiller = new EvmFulfiller( @@ -155,6 +171,7 @@ export async function main() { swapRouters, ); await evmFulFiller.init(); + const suiFulfiller = new SuiFulfiller(suiClient, walletConf, contracts, tokenList); const driverSvc = new DriverService( new SimpleFulfillerConfig(), new AuctionFulfillerConfig(rpcConfig, solanaConnection, evmProviders, walletConf, swapRouters), @@ -167,16 +184,11 @@ export async function main() { solanaFulfiller, walletHelper, evmFulFiller, + suiFulfiller, tokenList, solanaTxSender, ); - const chainFinalitySvc = new ChainFinality( - solanaConnection, - contracts, - rpcConfig, - evmProviders, - secondaryEvmProviders, - ); + const chainFinalitySvc = new ChainFinality(solanaConnection, suiClient, evmProviders, secondaryEvmProviders); const relayer = new Relayer( rpcConfig, mayanEndpoints, diff --git a/src/relayer.ts b/src/relayer.ts index 42fa84f..08333bd 100644 --- a/src/relayer.ts +++ b/src/relayer.ts @@ -1,22 +1,22 @@ import { TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync } from '@solana/spl-token'; import { Connection, PublicKey } from '@solana/web3.js'; import axios from 'axios'; -import Decimal from 'decimal.js'; import { ethers } from 'ethers6'; -import { CHAIN_ID_BSC, CHAIN_ID_SOLANA, WORMHOLE_DECIMALS, supportedChainIds } from './config/chains'; +import { CHAIN_ID_BSC, CHAIN_ID_SOLANA, CHAIN_ID_SUI, isEvmChainId, supportedChainIds } from './config/chains'; import { ContractsConfig } from './config/contracts'; import { MayanEndpoints } from './config/endpoints'; import { GlobalConfig } from './config/global'; import { RpcConfig } from './config/rpc'; -import { TokenList } from './config/tokens'; +import { TokenList, tokenTo32ByteAddress } from './config/tokens'; import { WalletConfig } from './config/wallet'; import { driverConfig } from './driver.conf'; import { DriverService } from './driver/driver'; import { WalletsHelper } from './driver/wallet-helper'; import { SWAP_STATUS, Swap } from './swap.dto'; +import { hexToUint8Array } from './utils/buffer'; import { ChainFinality } from './utils/finality'; import logger from './utils/logger'; -import { verifyOrderHash } from './utils/order-hash'; +import { reconstructOrderHashV2 } from './utils/order-hash'; import { getCurrentSolanaTimeMS } from './utils/solana-trx'; import { AUCTION_MODES, @@ -53,11 +53,15 @@ export class Relayer { private async tryProgressFulfill(swap: Swap) { const isSolDst = swap.destChain === CHAIN_ID_SOLANA; const isSolSrc = swap.sourceChain === CHAIN_ID_SOLANA; + const isEvmSrc = isEvmChainId(swap.sourceChain); + const isSuiSrc = swap.sourceChain === CHAIN_ID_SUI; + const isEvmDst = isEvmChainId(swap.destChain); + const isSuiDst = swap.destChain === CHAIN_ID_SUI; let [destState, destEvmOrder, sourceState, sourceEvmOrder] = await Promise.all([ isSolDst ? getSwiftStateDest(this.solanaConnection, new PublicKey(swap.stateAddr)) : null, - !isSolDst ? this.walletHelper.getReadContract(swap.destChain).orders(swap.orderHash) : null, + isEvmSrc ? this.walletHelper.getReadContract(swap.destChain).orders(swap.orderHash) : null, isSolSrc ? getSwiftStateSrc(this.solanaConnection, new PublicKey(swap.stateAddr)) : null, - !isSolSrc ? this.walletHelper.getReadContract(swap.sourceChain).orders(swap.orderHash) : null, + isEvmDst ? this.walletHelper.getReadContract(swap.sourceChain).orders(swap.orderHash) : null, ]); switch (swap.status) { @@ -69,22 +73,30 @@ export class Relayer { break; } - if (swap.destChain === CHAIN_ID_SOLANA) { + if (isSolDst) { if (swap.auctionMode === AUCTION_MODES.ENGLISH || swap.auctionMode === AUCTION_MODES.DONT_CARE) { await this.bidAndFulfillSolana(swap, destState!, sourceState, sourceEvmOrder); } else { throw new Error('Unrecognized Auction mode'); } - } else { + } else if (isSuiDst) { + if (swap.auctionMode === AUCTION_MODES.ENGLISH) { + await this.bidAndFulfillNonSolana(swap, sourceState, sourceEvmOrder, destEvmOrder!); + } else { + throw new Error('Unrecognized or unimplemented Auction mode for sui dest'); + } + } else if (isEvmDst) { if (swap.auctionMode === AUCTION_MODES.ENGLISH || swap.auctionMode === AUCTION_MODES.DONT_CARE) { - await this.bidAndFulfillEvm(swap, sourceState, sourceEvmOrder, destEvmOrder!); + await this.bidAndFulfillNonSolana(swap, sourceState, sourceEvmOrder, destEvmOrder!); } else { throw new Error('Unrecognized Auction mode'); } + } else { + throw new Error(`Unrecognized destination chain when trying to fulfill ${swap.destChain}`); } break; case SWAP_STATUS.ORDER_FULFILLED: - if (swap.destChain === CHAIN_ID_SOLANA) { + if (isSolDst) { if (destState && POST_FULFILL_STATUSES.includes(destState.status)) { logger.info(`Order is already settled on solana for ${swap.sourceTxHash}`); swap.status = SWAP_STATUS.ORDER_SETTLED; @@ -136,28 +148,35 @@ export class Relayer { return; } - verifyOrderHash( - swap.orderHash, - swap.trader, + const orderHashV2 = reconstructOrderHashV2( + swap.payloadId, + swap.penaltyPeriod, + swap.baseBond, + swap.perBpsBond, + swap.customPayload ? Buffer.from(hexToUint8Array(swap.customPayload)) : Buffer.alloc(32), + swap.trader32, swap.sourceChain, - swap.fromTokenAddress, - swap.fromToken.decimals, + tokenTo32ByteAddress(swap.fromToken), swap.destChain, - swap.toTokenAddress, - swap.toToken.decimals, - swap.minAmountOut.toFixed(Math.min(swap.toToken.decimals, WORMHOLE_DECIMALS), Decimal.ROUND_DOWN), - swap.gasDrop.toFixed(8, Decimal.ROUND_DOWN), - swap.redeemRelayerFee.toFixed(Math.min(swap.fromToken.decimals, WORMHOLE_DECIMALS), Decimal.ROUND_DOWN), - swap.refundRelayerFee.toFixed(Math.min(swap.fromToken.decimals, 8), Decimal.ROUND_DOWN), + tokenTo32ByteAddress(swap.toToken), + swap.minAmountOut64, + swap.gasDrop64, + swap.redeemRelayerFee64, + swap.refundRelayerFee64, swap.deadline.getTime() / 1000, // better to throw error if deadline is not in seconds - swap.destAddress, - swap.referrerAddress, + swap.destAddress32, + swap.referrerAddress32, swap.referrerBps, swap.mayanBps, swap.auctionMode, swap.randomKey, ); + if (`0x${orderHashV2.toString('hex')}` !== swap.orderHash) { + logger.warn(`Order hash mismatch for ${swap.sourceTxHash}. discarding...`); + return; + } + if (this.relayingSwaps.find((rs) => rs.orderHash === swap.orderHash)) { return; } else { @@ -220,23 +239,21 @@ export class Relayer { } } - async bidAndFulfillEvm( + async bidAndFulfillNonSolana( swap: Swap, srcState: SwiftSourceState | null, sourceEvmOrder: EvmStoredOrder | null, destEvmOrder: EvmStoredOrder, ) { - if (await this.checkAlreadyFulfilledOrCanceledOnEvm(swap, destEvmOrder)) { - return; + if (isEvmChainId(swap.destChain)) { + if (await this.checkAlreadyFulfilledOrCanceledOnEvm(swap, destEvmOrder)) { + return; + } } let auctionSignedVaa: Uint8Array | undefined; if (swap.auctionMode === AUCTION_MODES.ENGLISH) { const solanaTime = await getCurrentSolanaTimeMS(this.solanaConnection); - // swap.auctionStateAddr = PublicKey.findProgramAddressSync( - // [Buffer.from('AUCTION'), hexToUint8Array(swap.orderHash)], - // new PublicKey(this.contractsConfig.auctionAddr), - // )[0].toString(); let auctionState = await getAuctionState(this.solanaConnection, new PublicKey(swap.auctionStateAddr)); if (!!auctionState && auctionState.winner !== this.walletConfig.solana.publicKey.toBase58()) { const openToBid = this.isAuctionOpenToBid(auctionState, solanaTime); @@ -250,11 +267,11 @@ export class Relayer { } if (!auctionState) { - logger.info(`In bid-and-fullfilll evm Bidding for ${swap.sourceTxHash}...`); + logger.info(`In bid-and-fullfilll Non-solana Bidding for ${swap.sourceTxHash}...`); await this.driverService.bid(swap); - logger.info(`In bid-and-fullfilll evm done bid for ${swap.sourceTxHash}...`); + logger.info(`In bid-and-fullfilll Non-solana done bid for ${swap.sourceTxHash}...`); await delay(this.gConf.auctionTimeSeconds * 1000); - logger.info(`Finished waiting for auction time for ${swap.sourceTxHash}`); + logger.info(`Finished waiting Non-solana auction time for ${swap.sourceTxHash}`); } auctionState = await getAuctionState(this.solanaConnection, new PublicKey(swap.auctionStateAddr)); @@ -283,7 +300,7 @@ export class Relayer { auctionSignedVaa = await getSignedVaa( this.rpcConfig.wormholeGuardianRpcs, CHAIN_ID_SOLANA, - this.contractsConfig.auctionAddr, + this.contractsConfig.auctionAddrV2, sequence!.toString(), 500, ); @@ -324,11 +341,11 @@ export class Relayer { } if (!auctionState) { - logger.info(`In bid-and-fullfilll Bidding for ${swap.sourceTxHash}...`); + logger.info(`In bid-and-fullfilll solana Bidding for ${swap.sourceTxHash}...`); await this.driverService.bid(swap); - logger.info(`In bid-and-fullfilll done bid for ${swap.sourceTxHash}...`); + logger.info(`In bid-and-fullfilll solana done bid for ${swap.sourceTxHash}...`); await delay(this.gConf.auctionTimeSeconds * 1000); - logger.info(`Finished waiting for auction time for ${swap.sourceTxHash}`); + logger.info(`Finished waiting auction solana time for ${swap.sourceTxHash}`); } auctionState = await getAuctionState(this.solanaConnection, new PublicKey(swap.auctionStateAddr)); @@ -507,7 +524,6 @@ export class Relayer { swap.status === SWAP_STATUS.ORDER_SETTLED || swap.status === SWAP_STATUS.ORDER_REFUNDED || swap.status === SWAP_STATUS.ORDER_UNLOCKED || - swap.status === SWAP_STATUS.UNLOCK_SEQUENCE_RECEIVED || swap.status === SWAP_STATUS.ORDER_EXPIRED ); } @@ -527,11 +543,15 @@ export class Relayer { } private isMayanInitiatedSwap(swap: Swap) { - // Only fulfill swaps that were initiated via mayan + // Only fulfill swaps that were initiated via mayan swift V2 if (swap.sourceChain === CHAIN_ID_SOLANA) { - return swap.mayanAddress === this.contractsConfig.contracts[swap.sourceChain]; + return swap.mayanAddress === this.contractsConfig.contractsV2[swap.sourceChain]; + } else if (swap.sourceChain === CHAIN_ID_SUI) { + return swap.mayanAddress === this.contractsConfig.suiIds.packageId; + } else if (isEvmChainId(swap.sourceChain)) { + return ethers.getAddress(swap.mayanAddress) === this.contractsConfig.contractsV2[swap.sourceChain]; } else { - return ethers.getAddress(swap.mayanAddress) === this.contractsConfig.contracts[swap.sourceChain]; + throw new Error(`Unrecognized chain id to determine mayan address ${swap.sourceChain}`); } } } diff --git a/src/swap.dto.ts b/src/swap.dto.ts index 82b4918..09e67a0 100644 --- a/src/swap.dto.ts +++ b/src/swap.dto.ts @@ -4,6 +4,7 @@ import { Token } from './config/tokens'; export type Swap = { orderId: string; trader: string; + trader32: Buffer; sourceTxHash: string; orderHash: string; status: string; @@ -12,6 +13,7 @@ export type Swap = { sourceChain: number; destChain: number; destAddress: string; + destAddress32: Buffer; fromToken: Token; fromTokenAddress: string; fromTokenSymbol: string; @@ -26,11 +28,14 @@ export type Swap = { initiatedAt: Date; swapRelayerFee: Decimal; redeemRelayerFee: Decimal; + redeemRelayerFee64: bigint; refundRelayerFee: Decimal; + refundRelayerFee64: bigint; auctionAddress: string; posAddress: string; mayanAddress: string; referrerAddress: string; + referrerAddress32: Buffer; unlockRecipient: string; minAmountOut: Decimal; minAmountOut64: bigint; @@ -49,6 +54,12 @@ export type Swap = { gaslessSignature: string; gaslessPermit: string; + payloadId: number; + customPayload?: string; + penaltyPeriod: number; + baseBond: bigint; + perBpsBond: bigint; + createTxHash: string; retries: number; @@ -65,7 +76,6 @@ export const SWAP_STATUS = { ORDER_FULFILLED: 'ORDER_FULFILLED', ORDER_SETTLED: 'ORDER_SETTLED', ORDER_UNLOCKED: 'ORDER_UNLOCKED', - UNLOCK_SEQUENCE_RECEIVED: 'UNLOCK_SEQUENCE_RECEIVED', ORDER_CANCELED: 'ORDER_CANCELED', ORDER_REFUNDED: 'ORDER_REFUNDED', }; diff --git a/src/utils/buffer.ts b/src/utils/buffer.ts index 84671cc..6fab135 100644 --- a/src/utils/buffer.ts +++ b/src/utils/buffer.ts @@ -1,6 +1,7 @@ import { PublicKey } from '@solana/web3.js'; import { ethers, zeroPadValue } from 'ethers6'; -import { CHAIN_ID_SOLANA, supportedChainIds } from '../config/chains'; +import { CHAIN_ID_SOLANA, CHAIN_ID_SUI, supportedChainIds } from '../config/chains'; +import { Token } from '../config/tokens'; const MAX_U64 = BigInt(2) ** BigInt(64) - BigInt(1); export function getSafeU64Blob(value: bigint): Buffer { @@ -19,6 +20,22 @@ export const hexToUint8Array = (h: string): Uint8Array => { export const uint8ArrayToHex = (a: Uint8Array): string => Buffer.from(a).toString('hex'); +export function tryNativeToUint8ArrayGeneral(address: string, chainId: number): Uint8Array { + if (chainId === CHAIN_ID_SUI) { + return hexToUint8Array(address); + } else { + return tryNativeToUint8Array(address, chainId); + } +} + +export function tryTokenToUint8ArrayGeneral(token: Token, chainId: number): Uint8Array { + if (chainId === CHAIN_ID_SUI) { + return hexToUint8Array(token.verifiedAddress!); + } else { + return tryNativeToUint8Array(token.contract, chainId); + } +} + /** * * Convert an address in a chain's native representation into a 32-byte hex string diff --git a/src/utils/finality.ts b/src/utils/finality.ts index d105ec9..da473f5 100644 --- a/src/utils/finality.ts +++ b/src/utils/finality.ts @@ -1,3 +1,4 @@ +import { SuiClient } from '@mysten/sui/client'; import { Connection } from '@solana/web3.js'; import { ethers } from 'ethers6'; import { @@ -9,9 +10,9 @@ import { CHAIN_ID_OPTIMISM, CHAIN_ID_POLYGON, CHAIN_ID_SOLANA, + CHAIN_ID_SUI, + isEvmChainId, } from '../config/chains'; -import { ContractsConfig } from '../config/contracts'; -import { RpcConfig } from '../config/rpc'; import { EvmProviders } from './evm-providers'; import logger from './logger'; import { delay } from './util'; @@ -39,8 +40,7 @@ export class ChainFinality { constructor( private readonly solanaConnection: Connection, - private readonly contracts: ContractsConfig, - private readonly rpcConfig: RpcConfig, + private readonly suiClient: SuiClient, private readonly evmProviders: EvmProviders, private readonly secondaryEvmProviders: EvmProviders, ) { @@ -113,10 +113,18 @@ export class ChainFinality { async waitForFinality(sourceChain: number, sourceTxHash: string, swapValueUsd: number): Promise { if (sourceChain === CHAIN_ID_SOLANA) { await this.solanaConnection.getTransaction(sourceTxHash, { - commitment: 'finalized', + commitment: 'confirmed', maxSupportedTransactionVersion: 2, }); - } else { + } else if (sourceChain === CHAIN_ID_SUI) { + const res = await this.suiClient.getTransactionBlock({ + digest: sourceTxHash, + }); + if (!res) { + throw new Error('Transaction not found in waiting for finality'); + } + // TODO add parser + } else if (isEvmChainId(sourceChain)) { await this.waitForEvm(sourceChain, sourceTxHash, swapValueUsd); } } diff --git a/src/utils/order-hash.ts b/src/utils/order-hash.ts index 086e186..8b52ecb 100644 --- a/src/utils/order-hash.ts +++ b/src/utils/order-hash.ts @@ -1,57 +1,60 @@ import { ethers } from 'ethers6'; -import { WORMHOLE_DECIMALS } from '../config/chains'; -import { hexToUint8Array, tryNativeToUint8Array } from './buffer'; - -export function reconstructOrderHash( - trader: string, +import { hexToUint8Array } from './buffer'; + +export function reconstructOrderHashV2( + payloadId: number, + penaltyPeriod: number, + baseBond: bigint, + perBpsBond: bigint, + customPayload: Buffer, + trader32: Buffer, srcChainId: number, - tokenIn: string, + tokenIn32: Buffer, destChainId: number, - tokenOut: string, + tokenOut32: Buffer, minAmountOut64: bigint, gasDrop64: bigint, refundFeeDest64: bigint, refundFeeSrc64: bigint, deadline: number, - destAddr: string, - referrerAddr: string, + destAddr32: Buffer, + referrerAddr32: Buffer, referrerBps: number, mayanBps: number, auctionMode: number, random: string, -): Buffer { - const writeBuffer = Buffer.alloc(239); +) { + const writeBuffer = Buffer.alloc(290); let offset = 0; - const trader32 = Buffer.from(tryNativeToUint8Array(trader, srcChainId)); + writeBuffer.writeUint8(payloadId); + offset += 1; + writeBuffer.set(trader32, offset); offset += 32; - writeBuffer.writeUInt16BE(srcChainId, offset); + writeBuffer.writeUint16BE(srcChainId); offset += 2; - const tokenIn32 = Buffer.from(tryNativeToUint8Array(tokenIn, srcChainId)); writeBuffer.set(tokenIn32, offset); offset += 32; - const destinationAddress32 = Buffer.from(tryNativeToUint8Array(destAddr, destChainId)); - writeBuffer.set(destinationAddress32, offset); + writeBuffer.set(destAddr32, offset); offset += 32; - writeBuffer.writeUInt16BE(destChainId, offset); + writeBuffer.writeUint16BE(destChainId, offset); offset += 2; - const tokenOut32 = Buffer.from(tryNativeToUint8Array(tokenOut, destChainId)); writeBuffer.set(tokenOut32, offset); offset += 32; - writeBuffer.writeBigUInt64BE(minAmountOut64, offset); + writeBuffer.writeBigUint64BE(minAmountOut64, offset); offset += 8; - writeBuffer.writeBigUInt64BE(gasDrop64, offset); + writeBuffer.writeBigUint64BE(gasDrop64, offset); offset += 8; - writeBuffer.writeBigUInt64BE(refundFeeDest64, offset); + writeBuffer.writeBigInt64BE(refundFeeDest64, offset); offset += 8; writeBuffer.writeBigUInt64BE(refundFeeSrc64, offset); @@ -61,8 +64,10 @@ export function reconstructOrderHash( writeBuffer.writeBigUInt64BE(deadline64, offset); offset += 8; - const referrerAddress32 = Buffer.from(tryNativeToUint8Array(referrerAddr, destChainId)); - writeBuffer.set(referrerAddress32, offset); + writeBuffer.writeUint16BE(penaltyPeriod, offset); + offset += 2; + + writeBuffer.set(referrerAddr32, offset); offset += 32; writeBuffer.writeUInt8(referrerBps, offset); @@ -74,66 +79,24 @@ export function reconstructOrderHash( writeBuffer.writeUInt8(auctionMode, offset); offset += 1; + writeBuffer.writeBigUint64BE(baseBond, offset); + offset += 8; + + writeBuffer.writeBigUint64BE(perBpsBond, offset); + offset += 8; + const randomKey32 = Buffer.from(hexToUint8Array(random)); writeBuffer.set(randomKey32, offset); offset += 32; - if (offset !== 239) { + writeBuffer.set(customPayload, offset); + offset += 32; + + if (offset !== 289) { throw new Error('Invalid offset'); } - const orderHash = ethers.keccak256(writeBuffer); - return Buffer.from(hexToUint8Array(orderHash)); -} - -export function verifyOrderHash( - givenOrderHashHex: string, - trader: string, - srcChainId: number, - tokenIn: string, - tokenInDecimals: number, - destChainId: number, - tokenOut: string, - tokenOutDecimals: number, - minAmountOut: string, - gasDrop: string, - refundFeeDest: string, - refundFeeSrc: string, - deadline: number, - destAddr: string, - referrerAddr: string, - referrerBps: number, - mayanBps: number, - auctionMode: number, - random: string, -) { - const minAmountOut64 = getAmountOfFractionalAmount(minAmountOut, Math.min(WORMHOLE_DECIMALS, tokenOutDecimals)); - const gasDrop64 = getAmountOfFractionalAmount(gasDrop, WORMHOLE_DECIMALS); - const refundFeeDest64 = getAmountOfFractionalAmount(refundFeeDest, Math.min(tokenInDecimals, WORMHOLE_DECIMALS)); - const refundFeeSrc64 = getAmountOfFractionalAmount(refundFeeSrc, Math.min(tokenInDecimals, WORMHOLE_DECIMALS)); - - const orderHash = reconstructOrderHash( - trader, - srcChainId, - tokenIn, - destChainId, - tokenOut, - minAmountOut64, - gasDrop64, - refundFeeDest64, - refundFeeSrc64, - deadline, - destAddr, - referrerAddr, - referrerBps, - mayanBps, - auctionMode, - random, - ); - - if (Buffer.from(givenOrderHashHex.slice(2), 'hex').compare(orderHash) !== 0) { - throw new Error('Invalid order hash'); - } + return writeBuffer; } function truncateExtraFraction(input: string | number, decimals: number): string { diff --git a/src/utils/state-parser.ts b/src/utils/state-parser.ts index 925b8cd..35b249e 100644 --- a/src/utils/state-parser.ts +++ b/src/utils/state-parser.ts @@ -1,12 +1,12 @@ -import { BorshAccountsCoder } from '@coral-xyz/anchor'; import { Connection, PublicKey } from '@solana/web3.js'; -import { IDL as AuctionIdl } from '../abis/swift-auction.idl'; -import { IDL as SwiftIdl } from '../abis/swift.idl'; +import { BorshAccountsCoder } from 'anchor30'; +import { SwiftV2AuctionIdl } from '../abis/swift-auction-v2.idl'; +import { SwiftV2Idl } from '../abis/swift-v2.idl'; const SWIFT_SOLANA_SOURCE_STATE_SEED = Buffer.from('STATE_SOURCE'); const SWIFT_SOLANA_DEST_STATE_SEED = Buffer.from('STATE_DEST'); -const accCoder = new BorshAccountsCoder(SwiftIdl); -const auctionAccCoder = new BorshAccountsCoder(AuctionIdl); +const accCoderV2 = new BorshAccountsCoder(SwiftV2Idl); +const auctionAccCoderV2 = new BorshAccountsCoder(SwiftV2AuctionIdl); export async function getSwiftStateDest(connection: Connection, stateAddr: PublicKey): Promise { const stateAccount = await connection.getAccountInfo(stateAddr); @@ -21,7 +21,7 @@ export async function getSwiftStateDest(connection: Connection, stateAddr: Publi }; } - const data = accCoder.decode('swiftDestSolanaState', stateAccount.data); + const data = accCoderV2.decode('swiftDestSolanaState', stateAccount.data); if (data.status.created) { return { @@ -29,25 +29,27 @@ export async function getSwiftStateDest(connection: Connection, stateAddr: Publi winner: data?.fulfill?.winner?.toString(), }; } else if (data.status.fulfilled) { - return { - status: SOLANA_DEST_STATUSES.FULFILLED, - winner: data.fulfill.winner.toString(), - }; - } else if (data.status.settled) { - return { - status: SOLANA_DEST_STATUSES.SETTLED, - winner: data.fulfill.winner.toString(), - }; - } else if (data.status.posted) { - return { - status: SOLANA_DEST_STATUSES.POSTED, - }; + if (data.isSettled) { + return { + status: SOLANA_DEST_STATUSES.SETTLED, + winner: data.fulfill.winner.toString(), + }; + } else if (data.isPosted) { + return { + status: SOLANA_DEST_STATUSES.POSTED, + }; + } else { + return { + status: SOLANA_DEST_STATUSES.FULFILLED, + winner: data.fulfill.winner.toString(), + }; + } } else if (data.status.cancelled) { return { status: SOLANA_DEST_STATUSES.CANCELLED, }; } else { - throw new Error('Invalid status for dest'); + throw new Error('Invalid v2 status for dest'); } } @@ -62,7 +64,7 @@ export async function getSwiftStateSrc(connection: Connection, stateAddr: Public } export function parseSwiftStateSrc(accountData: Buffer): SwiftSourceState { - const data = accCoder.decode('swiftSourceSolanaState', accountData); + const data = accCoderV2.decode('swiftSourceSolanaState', accountData); if (data.status.locked) { return { @@ -91,7 +93,7 @@ export async function getAuctionState( return null; } - const data = auctionAccCoder.decode('auctionState', stateAccount.data); + const data = auctionAccCoderV2.decode('auctionState', stateAccount.data); return { winner: data.winner.toString(), diff --git a/src/utils/sui.ts b/src/utils/sui.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/utils/wormhole.ts b/src/utils/wormhole.ts index b1ab228..42ef22f 100644 --- a/src/utils/wormhole.ts +++ b/src/utils/wormhole.ts @@ -1,5 +1,7 @@ import { ChainId, getSignedVAAWithRetry, parseVaa } from '@certusone/wormhole-sdk'; import { publicrpc } from '@certusone/wormhole-sdk-proto-web'; +import { Transaction } from '@mysten/sui/transactions'; +import { SUI_CLOCK_OBJECT_ID } from '@mysten/sui/utils'; import { PublicKey } from '@solana/web3.js'; import axios from 'axios'; import { ethers } from 'ethers6'; @@ -11,6 +13,31 @@ const { GrpcWebImpl, PublicRPCServiceClientImpl } = publicrpc; export const WORMHOLE_CORE_BRIDGE = new PublicKey('worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth'); +export const WORMHOLE_SUI_PACKAGE = '0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a'; +export const WORMHOLE_SUI_CORE_ID = '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c'; +export const WORMHOLE_SUI_TOKEN_BRIDGE_ID = '0xc57508ee0d4595e5a8728974a4a93a787d38f339757230d441e895422c07aba9'; + +export function addParseAndVerifySui( + tx: Transaction, + signedVaa: Uint8Array, +): { + tx: Transaction; + vaa: { + $kind: 'NestedResult'; + NestedResult: [number, number]; + }; +} { + const [vaa] = tx.moveCall({ + target: `${WORMHOLE_SUI_PACKAGE}::vaa::parse_and_verify`, + arguments: [tx.object(WORMHOLE_SUI_CORE_ID), tx.pure.vector('u8', signedVaa), tx.object(SUI_CLOCK_OBJECT_ID)], + }); + + return { + tx: tx, + vaa: vaa, + }; +} + function serializePayload(parsedVaa: any) { const x = Buffer.alloc(51 + parsedVaa.payload.length); x.writeUint32BE(parsedVaa.timestamp); diff --git a/src/watchers/mayan-explorer.ts b/src/watchers/mayan-explorer.ts index 2dc765a..9e5cff6 100644 --- a/src/watchers/mayan-explorer.ts +++ b/src/watchers/mayan-explorer.ts @@ -1,6 +1,8 @@ import axios from 'axios'; import Decimal from 'decimal.js'; +import { ethers } from 'ethers6'; import * as io from 'socket.io-client'; +import { WORMHOLE_DECIMALS } from '../config/chains'; import { ContractsConfig, MayanForwarderAddress } from '../config/contracts'; import { MayanEndpoints } from '../config/endpoints'; import { GlobalConfig } from '../config/global'; @@ -9,6 +11,7 @@ import { WalletConfig } from '../config/wallet'; import { StateCloser } from '../driver/state-closer'; import { Relayer } from '../relayer'; import { Swap } from '../swap.dto'; +import { tryNativeToUint8ArrayGeneral } from '../utils/buffer'; import logger from '../utils/logger'; export class MayanExplorerWatcher { @@ -31,18 +34,29 @@ export class MayanExplorerWatcher { this.initiateAddresses = []; this.initiateAddresses.push(MayanForwarderAddress); this.initiateAddresses.push(MayanForwarderAddress.toLowerCase()); - for (let chainId of Object.keys(contracts.contracts)) { - this.initiateAddresses.push(contracts.contracts[+chainId]); - this.initiateAddresses.push(contracts.contracts[+chainId].toLowerCase()); + for (let chainId of Object.keys(contracts.contractsV2)) { + this.initiateAddresses.push(contracts.contractsV2[+chainId]); + this.initiateAddresses.push(contracts.contractsV2[+chainId].toLowerCase()); } } private async createSwapFromJson(rawSwap: any) { const fromToken = await this.tokenList.getTokenData(+rawSwap.sourceChain, rawSwap.fromTokenAddress); const toToken = await this.tokenList.getTokenData(+rawSwap.destChain, rawSwap.toTokenAddress); + const trader32 = Buffer.from(tryNativeToUint8ArrayGeneral(rawSwap.trader, +rawSwap.sourceChain)); + const dest32 = Buffer.from(tryNativeToUint8ArrayGeneral(rawSwap.destAddress, +rawSwap.destChain)); + const ref32 = Buffer.from(tryNativeToUint8ArrayGeneral(rawSwap.referrerAddress, +rawSwap.destChain)); + + const refundFeeDest64 = ethers.parseUnits( + rawSwap.refundFeeDest, + Math.min(fromToken.decimals, WORMHOLE_DECIMALS), + ); + const refundFeeSrc64 = ethers.parseUnits(rawSwap.refundFeeSrc, Math.min(fromToken.decimals, WORMHOLE_DECIMALS)); + const swap: Swap = { retries: 0, trader: rawSwap.trader, + trader32: trader32, orderId: rawSwap.orderId, sourceTxHash: rawSwap.sourceTxHash, gasless: !!rawSwap.gasless, @@ -54,6 +68,7 @@ export class MayanExplorerWatcher { createTxHash: rawSwap.createTxHash, deadline: new Date(rawSwap.deadline), destAddress: rawSwap.destAddress, + destAddress32: dest32, destChain: Number(rawSwap.destChain), driverAddress: rawSwap.driverAddress, fromToken: fromToken, @@ -73,9 +88,12 @@ export class MayanExplorerWatcher { posAddress: rawSwap.posAddress, randomKey: rawSwap.randomKey, redeemRelayerFee: new Decimal(rawSwap.redeemRelayerFee), + redeemRelayerFee64: refundFeeDest64, referrerAddress: rawSwap.referrerAddress, + referrerAddress32: ref32, referrerBps: Number(rawSwap.referrerBps), refundRelayerFee: new Decimal(rawSwap.refundRelayerFee), + refundRelayerFee64: refundFeeSrc64, service: rawSwap.service, sourceChain: Number(rawSwap.sourceChain), stateAddr: rawSwap.stateAddr, @@ -86,6 +104,12 @@ export class MayanExplorerWatcher { toTokenAddress: rawSwap.toTokenAddress, toTokenSymbol: rawSwap.toTokenSymbol, unlockRecipient: rawSwap.unlockRecipient, + penaltyPeriod: rawSwap.penaltyPeriod ? Number(rawSwap.penaltyPeriod) : 0, + baseBond: rawSwap.baseBond ? BigInt(rawSwap.baseBond) : 0n, + perBpsBond: rawSwap.perBpsBond ? BigInt(rawSwap.perBpsBond) : 0n, + + payloadId: rawSwap.payloadId ? Number(rawSwap.payloadId) : 0, + customPayload: rawSwap.customPayload ? rawSwap.customPayload : '0x' + Buffer.alloc(32).toString('hex'), }; return swap; @@ -103,7 +127,7 @@ export class MayanExplorerWatcher { socket.on('SWAP_CREATED', async (data) => { try { const rawSwap = JSON.parse(data); - if (!rawSwap.orderHash || !['SWIFT_NFT', 'SWIFT_SWAP'].includes(rawSwap.service)) { + if (!rawSwap.orderHash || !['SWIFT_SWAP_V2'].includes(rawSwap.service)) { return; }