From 7ce0c745d4a2ea60e7c3d786e2bfd543df9b0a0e Mon Sep 17 00:00:00 2001 From: Koh Wei Jie Date: Tue, 31 Mar 2026 13:54:00 -0700 Subject: [PATCH 1/2] wip --- packages/direct-match/README.md | 7 +++ packages/direct-match/package.json | 41 +++++++++++++++++ packages/direct-match/src/client.ts | 32 ++++++++++++++ packages/direct-match/src/index.ts | 4 ++ packages/direct-match/src/types/index.ts | 4 ++ packages/direct-match/tsconfig.build.json | 8 ++++ packages/direct-match/tsconfig.json | 5 +++ packages/external-match/README.md | 2 +- packages/external-match/package.json | 5 ++- packages/external-match/src/client.ts | 4 +- packages/external-match/src/index.ts | 3 +- packages/external-match/src/types/index.ts | 2 +- packages/http-client/package.json | 44 +++++++++++++++++++ .../src/http.ts => http-client/src/index.ts} | 0 packages/http-client/tsconfig.build.json | 8 ++++ packages/http-client/tsconfig.json | 5 +++ packages/node/package.json | 4 +- pnpm-lock.yaml | 18 ++++++++ 18 files changed, 186 insertions(+), 10 deletions(-) create mode 100644 packages/direct-match/README.md create mode 100644 packages/direct-match/package.json create mode 100644 packages/direct-match/src/client.ts create mode 100644 packages/direct-match/src/index.ts create mode 100644 packages/direct-match/src/types/index.ts create mode 100644 packages/direct-match/tsconfig.build.json create mode 100644 packages/direct-match/tsconfig.json create mode 100644 packages/http-client/package.json rename packages/{external-match/src/http.ts => http-client/src/index.ts} (100%) create mode 100644 packages/http-client/tsconfig.build.json create mode 100644 packages/http-client/tsconfig.json diff --git a/packages/direct-match/README.md b/packages/direct-match/README.md new file mode 100644 index 00000000..fa556a51 --- /dev/null +++ b/packages/direct-match/README.md @@ -0,0 +1,7 @@ +# Renegade Direct Match Client + +A TypeScript client for interacting with the Renegade Darkpool's direct match API. + +## License + +MIT diff --git a/packages/direct-match/package.json b/packages/direct-match/package.json new file mode 100644 index 00000000..3b2899b3 --- /dev/null +++ b/packages/direct-match/package.json @@ -0,0 +1,41 @@ +{ + "name": "@renegade-fi/renegade-sdk", + "version": "2.0.1", + "description": "A TypeScript client for interacting with the Renegade direct matching API", + "repository": { + "type": "git", + "url": "https://github.com/renegade-fi/typescript-sdk.git", + "directory": "packages/direct-match" + }, + "files": [ + "dist/**", + "!dist/**/*.tsbuildinfo", + "src/**/*.ts", + "!src/**/*.test.ts", + "!src/**/*.test-d.ts" + ], + "sideEffects": false, + "type": "module", + "main": "./dist/index.js", + "types": "./dist/types/index.d.ts", + "typings": "./dist/types/index.d.ts", + "exports": { + ".": { + "types": "./dist/types/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "pnpm run clean && pnpm run build:esm+types", + "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", + "clean": "rm -rf dist tsconfig.tsbuildinfo", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + }, + "keywords": [], + "author": "", + "devDependencies": { + } +} diff --git a/packages/direct-match/src/client.ts b/packages/direct-match/src/client.ts new file mode 100644 index 00000000..cbce6c7a --- /dev/null +++ b/packages/direct-match/src/client.ts @@ -0,0 +1,32 @@ +// Constants for v2 relayer server URLs +const ARBITRUM_SEPOLIA_RELAYER_BASE_URL = "https://arbitrum-sepolia.v2.relayer.renegade.fi"; +const ARBITRUM_ONE_BASERELAYER__URL = "https://arbitrum-one.v2.relayer.renegade.fi"; +const BASE_SEPOLIA_BASERELAYER__URL = "https://base-sepolia.v2.relayer.renegade.fi"; +const BASE_MAINNET_BASERELAYER__URL = "https://base-mainnet.v2.relayer.renegade.fi"; + +// The Arbitrum one chain ID +const ARBITRUM_ONE_CHAIN_ID = 42161; +// The Arbitrum Sepolia chain ID +const ARBITRUM_SEPOLIA_CHAIN_ID = 421614; +// The Base mainnet chain ID +const BASE_MAINNET_CHAIN_ID = 8453; +// The Base Sepolia chain ID +const BASE_SEPOLIA_CHAIN_ID = 84532; +// The Ethereum Sepolia chain ID +const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111; + +import { type HttpResponse, RelayerHttpClient } from "@renegade-fi/http-client"; + +/** + * Client for interacting with the Renegade direct match API. + */ +export class DirectMatchClient { + /** + * Initialize a new DirectMatchClient. + * + * @param baseUrl The base URL of the relayer server API + */ + constructor(baseUrl: string) { + this.httpClient = new RelayerHttpClient(baseUrl); + } +} diff --git a/packages/direct-match/src/index.ts b/packages/direct-match/src/index.ts new file mode 100644 index 00000000..2fa8def3 --- /dev/null +++ b/packages/direct-match/src/index.ts @@ -0,0 +1,4 @@ +/** + * A TypeScript client for interacting with the Renegade direct match API. + */ + diff --git a/packages/direct-match/src/types/index.ts b/packages/direct-match/src/types/index.ts new file mode 100644 index 00000000..49290139 --- /dev/null +++ b/packages/direct-match/src/types/index.ts @@ -0,0 +1,4 @@ +/** + * Type definitions for the Renegade Darkpool direct match API. + */ + diff --git a/packages/direct-match/tsconfig.build.json b/packages/direct-match/tsconfig.build.json new file mode 100644 index 00000000..0eee00d7 --- /dev/null +++ b/packages/direct-match/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts", "src/**/*.test-d.ts"], + "compilerOptions": { + "sourceMap": true + } +} diff --git a/packages/direct-match/tsconfig.json b/packages/direct-match/tsconfig.json new file mode 100644 index 00000000..dd44724d --- /dev/null +++ b/packages/direct-match/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.build.json", + "include": ["src/**/*.ts", "test/**/*.ts"], + "exclude": [] +} diff --git a/packages/external-match/README.md b/packages/external-match/README.md index 55b57347..cb7292d4 100644 --- a/packages/external-match/README.md +++ b/packages/external-match/README.md @@ -1,6 +1,6 @@ # Renegade External Match Client -A TypeScript client for interacting with the Renegade Darkpool's External Match API. +A TypeScript client for interacting with the Renegade Darkpool's external match API. ## Installation diff --git a/packages/external-match/package.json b/packages/external-match/package.json index 4b3912d2..d2f90b1f 100644 --- a/packages/external-match/package.json +++ b/packages/external-match/package.json @@ -1,7 +1,7 @@ { "name": "@renegade-fi/renegade-sdk", "version": "2.0.1", - "description": "A TypeScript client for interacting with the Renegade Darkpool API", + "description": "A TypeScript client for interacting with the Renegade external matching API", "repository": { "type": "git", "url": "https://github.com/renegade-fi/typescript-sdk.git", @@ -34,6 +34,7 @@ }, "dependencies": { "@noble/hashes": "^1.7.1", + "@renegade-fi/http-client": "workspace:^", "json-bigint": "^1.0.0", "viem": "^2.23.15" }, @@ -42,4 +43,4 @@ "devDependencies": { "@types/json-bigint": "^1.0.4" } -} \ No newline at end of file +} diff --git a/packages/external-match/src/client.ts b/packages/external-match/src/client.ts index 6af9a27c..ddbd9a45 100644 --- a/packages/external-match/src/client.ts +++ b/packages/external-match/src/client.ts @@ -5,7 +5,7 @@ * assembling matches, and executing trades. */ -import { type HttpResponse, RelayerHttpClient } from "./http.js"; +import { type HttpResponse, RelayerHttpClient } from "@renegade-fi/http-client"; import { ExchangeMetadataResponse, type ExternalMatchResponse, @@ -280,7 +280,7 @@ function buildDirectOrderRequest( } /** - * Client for interacting with the Renegade external matching API. + * Client for interacting with the Renegade external match API. */ export class ExternalMatchClient { private apiKey: string; diff --git a/packages/external-match/src/index.ts b/packages/external-match/src/index.ts index 1b0512ce..b44844a1 100644 --- a/packages/external-match/src/index.ts +++ b/packages/external-match/src/index.ts @@ -1,6 +1,5 @@ /** - * Renegade External Match Client - * A TypeScript client for interacting with the Renegade Darkpool API. + * A TypeScript client for interacting with the Renegade external match API. */ // Export main client diff --git a/packages/external-match/src/types/index.ts b/packages/external-match/src/types/index.ts index 21f64758..4826f108 100644 --- a/packages/external-match/src/types/index.ts +++ b/packages/external-match/src/types/index.ts @@ -1,5 +1,5 @@ /** - * Type definitions for the Renegade Darkpool API. + * Type definitions for the Renegade Darkpool external match API. */ import type { ApiSignedQuoteV2 } from "./v2Types.js"; diff --git a/packages/http-client/package.json b/packages/http-client/package.json new file mode 100644 index 00000000..d63aed18 --- /dev/null +++ b/packages/http-client/package.json @@ -0,0 +1,44 @@ +{ + "name": "@renegade-fi/http-client", + "version": "2.0.1", + "description": "", + "repository": { + "type": "git", + "url": "https://github.com/renegade-fi/typescript-sdk.git", + "directory": "packages/http-client" + }, + "files": [ + "dist/**", + "!dist/**/*.tsbuildinfo", + "src/**/*.ts", + "!src/**/*.test.ts", + "!src/**/*.test-d.ts" + ], + "sideEffects": false, + "type": "module", + "main": "./dist/index.js", + "types": "./dist/types/index.d.ts", + "typings": "./dist/types/index.d.ts", + "exports": { + ".": { + "types": "./dist/types/index.d.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + }, + "scripts": { + "build": "pnpm run clean && pnpm run build:esm+types", + "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", + "clean": "rm -rf dist tsconfig.tsbuildinfo", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "@noble/hashes": "^1.7.1", + "json-bigint": "^1.0.0" + }, + "keywords": [], + "author": "", + "devDependencies": { + "@types/json-bigint": "^1.0.4" + } +} diff --git a/packages/external-match/src/http.ts b/packages/http-client/src/index.ts similarity index 100% rename from packages/external-match/src/http.ts rename to packages/http-client/src/index.ts diff --git a/packages/http-client/tsconfig.build.json b/packages/http-client/tsconfig.build.json new file mode 100644 index 00000000..0eee00d7 --- /dev/null +++ b/packages/http-client/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts", "src/**/*.test-d.ts"], + "compilerOptions": { + "sourceMap": true + } +} diff --git a/packages/http-client/tsconfig.json b/packages/http-client/tsconfig.json new file mode 100644 index 00000000..dd44724d --- /dev/null +++ b/packages/http-client/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "./tsconfig.build.json", + "include": ["src/**/*.ts", "test/**/*.ts"], + "exclude": [] +} diff --git a/packages/node/package.json b/packages/node/package.json index eb12fb5a..eee327cc 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -8,7 +8,7 @@ "directory": "packages/node" }, "scripts": { - "build": "pnpm run clean && pnpm run build:esm+types", + "build": "pnpm run clean && pnpm run build:wasm && pnpm run build:esm+types", "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", "clean": "rm -rf dist tsconfig.tsbuildinfo", "typecheck": "tsc --noEmit" @@ -64,4 +64,4 @@ "dapps", "web3" ] -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8e3f1e36..7d1dbf82 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -648,11 +648,16 @@ importers: specifier: ^1.0.4 version: 1.0.4 + packages/direct-match: {} + packages/external-match: dependencies: '@noble/hashes': specifier: ^1.7.1 version: 1.8.0 + '@renegade-fi/http-client': + specifier: workspace:^ + version: link:../http-client json-bigint: specifier: ^1.0.0 version: 1.0.0 @@ -664,6 +669,19 @@ importers: specifier: ^1.0.4 version: 1.0.4 + packages/http-client: + dependencies: + '@noble/hashes': + specifier: ^1.7.1 + version: 1.8.0 + json-bigint: + specifier: ^1.0.0 + version: 1.0.0 + devDependencies: + '@types/json-bigint': + specifier: ^1.0.4 + version: 1.0.4 + packages/node: dependencies: '@renegade-fi/core': From ea91a14d953ccb7dfd2cafc06400ef26843ca37f Mon Sep 17 00:00:00 2001 From: Koh Wei Jie Date: Wed, 1 Apr 2026 19:09:35 -0700 Subject: [PATCH 2/2] ring0 internal match support and tests --- .github/workflows/code-quality.yml | 2 +- .gitignore | 1 + biome.json | 1 + examples/README.md | 10 - .../external-keychain/cancel-order/README.md | 7 - .../external-keychain/cancel-order/env.ts | 57 - .../external-keychain/cancel-order/index.ts | 23 - .../cancel-order/package.json | 17 - .../cancel-order/tsconfig.json | 19 - .../external-keychain/create-wallet/README.md | 7 - .../external-keychain/create-wallet/env.ts | 57 - .../external-keychain/create-wallet/index.ts | 15 - .../create-wallet/package.json | 17 - .../create-wallet/tsconfig.json | 19 - examples/external-keychain/deposit/README.md | 7 - examples/external-keychain/deposit/env.ts | 57 - examples/external-keychain/deposit/index.ts | 35 - .../external-keychain/deposit/package.json | 17 - .../external-keychain/deposit/tsconfig.json | 19 - .../get-back-of-queue-wallet/README.md | 7 - .../get-back-of-queue-wallet/env.ts | 57 - .../get-back-of-queue-wallet/index.ts | 25 - .../get-back-of-queue-wallet/package.json | 17 - .../get-back-of-queue-wallet/tsconfig.json | 19 - .../get-order-history/README.md | 7 - .../get-order-history/env.ts | 57 - .../get-order-history/index.ts | 13 - .../get-order-history/package.json | 17 - .../get-order-history/tsconfig.json | 19 - .../external-keychain/get-wallet/README.md | 7 - examples/external-keychain/get-wallet/env.ts | 57 - .../external-keychain/get-wallet/index.ts | 25 - .../external-keychain/get-wallet/package.json | 17 - .../get-wallet/tsconfig.json | 19 - .../external-keychain/lookup-wallet/README.md | 7 - .../external-keychain/lookup-wallet/env.ts | 57 - .../external-keychain/lookup-wallet/index.ts | 14 - .../lookup-wallet/package.json | 17 - .../lookup-wallet/tsconfig.json | 19 - examples/external-keychain/pay-fees/README.md | 7 - examples/external-keychain/pay-fees/env.ts | 57 - examples/external-keychain/pay-fees/index.ts | 11 - .../external-keychain/pay-fees/package.json | 17 - .../external-keychain/pay-fees/tsconfig.json | 19 - .../external-keychain/place-order/README.md | 7 - examples/external-keychain/place-order/env.ts | 57 - .../external-keychain/place-order/index.ts | 28 - .../place-order/package.json | 17 - .../place-order/tsconfig.json | 19 - examples/external-keychain/withdraw/README.md | 7 - examples/external-keychain/withdraw/env.ts | 57 - examples/external-keychain/withdraw/index.ts | 25 - .../external-keychain/withdraw/package.json | 17 - .../external-keychain/withdraw/tsconfig.json | 19 - .../external-match/base-sepolia/README.md | 7 - examples/external-match/base-sepolia/env.ts | 27 - examples/external-match/base-sepolia/index.ts | 92 - .../external-match/base-sepolia/package.json | 16 - .../external-match/base-sepolia/tsconfig.json | 19 - examples/external-match/basic/README.md | 7 - examples/external-match/basic/env.ts | 27 - examples/external-match/basic/index.ts | 92 - examples/external-match/basic/package.json | 16 - examples/external-match/basic/tsconfig.json | 19 - .../direct-malleable-match/README.md | 20 - .../direct-malleable-match/env.ts | 33 - .../direct-malleable-match/index.ts | 112 - .../direct-malleable-match/package.json | 16 - .../direct-malleable-match/tsconfig.json | 19 - .../external-match/direct-match/README.md | 7 - examples/external-match/direct-match/env.ts | 27 - examples/external-match/direct-match/index.ts | 92 - .../external-match/direct-match/package.json | 16 - .../external-match/direct-match/tsconfig.json | 19 - .../external-match/exact-output/README.md | 7 - examples/external-match/exact-output/env.ts | 27 - examples/external-match/exact-output/index.ts | 93 - .../external-match/exact-output/package.json | 16 - .../external-match/exact-output/tsconfig.json | 19 - .../exchange-metadata/README.md | 8 - .../external-match/exchange-metadata/env.ts | 27 - .../external-match/exchange-metadata/index.ts | 21 - .../exchange-metadata/package.json | 16 - .../exchange-metadata/tsconfig.json | 19 - .../in-kind-gas-sponsorship/README.md | 7 - .../in-kind-gas-sponsorship/env.ts | 27 - .../in-kind-gas-sponsorship/index.ts | 97 - .../in-kind-gas-sponsorship/package.json | 16 - .../in-kind-gas-sponsorship/tsconfig.json | 19 - examples/external-match/malleable/README.md | 7 - examples/external-match/malleable/env.ts | 27 - examples/external-match/malleable/helpers.ts | 39 - examples/external-match/malleable/index.ts | 61 - .../external-match/malleable/package.json | 16 - .../external-match/malleable/tsconfig.json | 19 - .../native-gas-sponshorship/README.md | 7 - .../native-gas-sponshorship/env.ts | 27 - .../native-gas-sponshorship/index.ts | 97 - .../native-gas-sponshorship/package.json | 16 - .../native-gas-sponshorship/tsconfig.json | 19 - .../order-book-depth-all-pairs/README.md | 8 - .../order-book-depth-all-pairs/env.ts | 27 - .../order-book-depth-all-pairs/index.ts | 16 - .../order-book-depth-all-pairs/package.json | 16 - .../order-book-depth-all-pairs/tsconfig.json | 19 - .../external-match/order-book-depth/README.md | 7 - .../external-match/order-book-depth/env.ts | 27 - .../external-match/order-book-depth/index.ts | 19 - .../order-book-depth/package.json | 16 - .../order-book-depth/tsconfig.json | 19 - .../external-match/supported-tokens/README.md | 7 - .../external-match/supported-tokens/env.ts | 27 - .../external-match/supported-tokens/index.ts | 17 - .../supported-tokens/package.json | 16 - .../supported-tokens/tsconfig.json | 19 - .../external-match/token-prices/README.md | 7 - examples/external-match/token-prices/env.ts | 27 - examples/external-match/token-prices/index.ts | 16 - .../external-match/token-prices/package.json | 16 - .../external-match/token-prices/tsconfig.json | 19 - examples/relayer/cancel-order/README.md | 7 - examples/relayer/cancel-order/env.ts | 8 - examples/relayer/cancel-order/index.ts | 25 - examples/relayer/cancel-order/package.json | 16 - examples/relayer/cancel-order/pnpm-lock.yaml | 435 -- examples/relayer/cancel-order/tsconfig.json | 19 - examples/relayer/create-wallet/README.md | 7 - examples/relayer/create-wallet/env.ts | 8 - examples/relayer/create-wallet/index.ts | 17 - examples/relayer/create-wallet/package.json | 16 - examples/relayer/create-wallet/tsconfig.json | 19 - examples/relayer/deposit/README.md | 7 - examples/relayer/deposit/env.ts | 21 - examples/relayer/deposit/index.ts | 28 - examples/relayer/deposit/package.json | 16 - examples/relayer/deposit/tsconfig.json | 19 - .../get-back-of-queue-wallet/README.md | 7 - .../relayer/get-back-of-queue-wallet/env.ts | 8 - .../relayer/get-back-of-queue-wallet/index.ts | 14 - .../get-back-of-queue-wallet/package.json | 12 - .../get-back-of-queue-wallet/tsconfig.json | 19 - examples/relayer/get-order-history/README.md | 7 - examples/relayer/get-order-history/env.ts | 8 - examples/relayer/get-order-history/index.ts | 15 - .../relayer/get-order-history/package.json | 16 - .../relayer/get-order-history/tsconfig.json | 19 - examples/relayer/get-wallet/README.md | 7 - examples/relayer/get-wallet/env.ts | 8 - examples/relayer/get-wallet/index.ts | 14 - examples/relayer/get-wallet/package.json | 16 - examples/relayer/get-wallet/tsconfig.json | 19 - examples/relayer/lookup-wallet/README.md | 7 - examples/relayer/lookup-wallet/env.ts | 8 - examples/relayer/lookup-wallet/index.ts | 16 - examples/relayer/lookup-wallet/package.json | 16 - examples/relayer/lookup-wallet/tsconfig.json | 19 - examples/relayer/pay-fees/README.md | 7 - examples/relayer/pay-fees/env.ts | 8 - examples/relayer/pay-fees/index.ts | 13 - examples/relayer/pay-fees/package.json | 16 - examples/relayer/pay-fees/tsconfig.json | 19 - examples/relayer/place-order/README.md | 7 - examples/relayer/place-order/env.ts | 8 - examples/relayer/place-order/index.ts | 36 - examples/relayer/place-order/package.json | 16 - examples/relayer/place-order/tsconfig.json | 19 - examples/relayer/withdraw/README.md | 7 - examples/relayer/withdraw/env.ts | 9 - examples/relayer/withdraw/index.ts | 27 - examples/relayer/withdraw/package.json | 16 - examples/relayer/withdraw/tsconfig.json | 19 - examples/token/async-initialization/README.md | 7 - examples/token/async-initialization/env.ts | 5 - examples/token/async-initialization/index.ts | 7 - .../token/async-initialization/package.json | 16 - .../token/async-initialization/tsconfig.json | 19 - examples/token/sync-initialization/README.md | 7 - examples/token/sync-initialization/env.ts | 5 - examples/token/sync-initialization/index.ts | 8 - .../token/sync-initialization/package.json | 16 - examples/token/sync-initialization/remap.json | 306 -- .../token/sync-initialization/tsconfig.json | 19 - package-lock.json | 1440 ++++++ package.json | 4 +- packages/direct-match/package.json | 17 +- .../direct-match/renegade-sdk-wasm/index.d.ts | 15 + .../direct-match/renegade-sdk-wasm/index.js | 182 + .../renegade-sdk-wasm/index_bg.wasm | Bin 0 -> 46531 bytes .../renegade-sdk-wasm/index_bg.wasm.d.ts | 11 + .../renegade-sdk-wasm/package.json | 11 + packages/direct-match/src/client.ts | 534 ++- packages/direct-match/src/index.ts | 36 +- packages/direct-match/src/secrets.ts | 178 + packages/direct-match/src/types.ts | 207 + packages/direct-match/src/types/index.ts | 4 - packages/direct-match/src/utils.ts | 9 + packages/direct-match/test/accountId.test.ts | 31 + .../direct-match/test/cancelOrder.test.ts | 36 + .../test/createAndGetAccount.test.ts | 27 + .../test/getBalanceByMint.test.ts | 17 + .../direct-match/test/getBalances.test.ts | 12 + .../test/getOrderAndPlaceOrder.test.ts | 34 + packages/direct-match/test/getOrders.test.ts | 46 + packages/direct-match/test/helpers.ts | 226 + .../test/matchQuoterOrders.test.ts | 186 + .../direct-match/test/matchSelfOrders.test.ts | 99 + .../direct-match/test/updateOrder.test.ts | 7 + .../direct-match/test_data/test_data.json | 85 + packages/external-match/package.json | 2 +- packages/http-client/src/index.ts | 4 + packages/node/CHANGELOG.md | 1037 ---- packages/node/README.md | 13 - packages/node/package.json | 67 - packages/node/src/actions/executeDeposit.ts | 111 - .../node/src/actions/executeWithdrawal.ts | 34 - .../node/src/actions/generateWalletSecrets.ts | 30 - packages/node/src/clients/relayer/index.ts | 156 - packages/node/src/clients/renegade/admin.ts | 90 - packages/node/src/clients/renegade/base.ts | 481 -- packages/node/src/clients/renegade/index.ts | 2 - packages/node/src/clients/renegade/types.ts | 22 - packages/node/src/exports/actions.ts | 8 - packages/node/src/exports/index.ts | 72 - packages/node/src/services/orderWebSocket.ts | 87 - packages/node/src/utils/permit2.ts | 117 - packages/node/tsconfig.json | 5 - packages/react/CHANGELOG.md | 1030 ---- packages/react/README.md | 13 - packages/react/package.json | 87 - packages/react/src/context.ts | 24 - packages/react/src/errors/base.ts | 11 - packages/react/src/errors/context.ts | 11 - packages/react/src/exports/actions.ts | 5 - packages/react/src/exports/constants.ts | 5 - packages/react/src/exports/index.ts | 231 - packages/react/src/exports/query.ts | 5 - .../react/src/hooks/useBackOfQueueBalances.ts | 23 - .../react/src/hooks/useBackOfQueueOrders.ts | 23 - .../react/src/hooks/useBackOfQueueWallet.ts | 59 - packages/react/src/hooks/useBalances.ts | 22 - packages/react/src/hooks/useCancelOrder.ts | 59 - packages/react/src/hooks/useConfig.ts | 19 - packages/react/src/hooks/useConnect.ts | 49 - packages/react/src/hooks/useCreateOrder.ts | 59 - packages/react/src/hooks/useDeposit.ts | 59 - packages/react/src/hooks/useFees.ts | 24 - packages/react/src/hooks/useIsIndexed.ts | 32 - packages/react/src/hooks/useNetworkOrders.ts | 71 - packages/react/src/hooks/useOpenOrders.ts | 47 - .../react/src/hooks/useOrderBookWebSocket.ts | 57 - packages/react/src/hooks/useOrderHistory.ts | 66 - .../src/hooks/useOrderHistoryWebSocket.ts | 86 - packages/react/src/hooks/useOrderMetadata.ts | 47 - packages/react/src/hooks/useOrders.ts | 22 - packages/react/src/hooks/usePayFees.ts | 59 - packages/react/src/hooks/usePing.ts | 37 - packages/react/src/hooks/usePkRootScalars.ts | 20 - packages/react/src/hooks/useStatus.ts | 30 - packages/react/src/hooks/useTaskHistory.ts | 66 - .../src/hooks/useTaskHistoryWebSocket.ts | 81 - packages/react/src/hooks/useWallet.ts | 56 - packages/react/src/hooks/useWalletBalances.ts | 18 - packages/react/src/hooks/useWalletId.ts | 30 - packages/react/src/hooks/useWalletOrders.ts | 18 - .../react/src/hooks/useWalletWebSocket.ts | 81 - packages/react/src/hooks/useWithdraw.ts | 59 - packages/react/src/hydrate.ts | 66 - packages/react/src/types/properties.ts | 40 - packages/react/src/utils/getVersion.ts | 3 - packages/react/src/utils/query.ts | 118 - packages/react/src/utils/websocket.ts | 21 - packages/react/src/version.ts | 1 - packages/react/src/wasm.ts | 19 - packages/react/tsconfig.build.json | 8 - packages/react/tsconfig.json | 8 - packages/{types => renegade-sdk}/package.json | 28 +- packages/renegade-sdk/src/index.ts | 2 + .../tsconfig.build.json | 0 packages/token-nextjs/CHANGELOG.md | 183 - packages/token-nextjs/README.md | 13 - packages/token-nextjs/package.json | 36 - packages/token-nextjs/src/index.ts | 85 - packages/token-nextjs/tsconfig.build.json | 8 - packages/token-nextjs/tsconfig.json | 5 - packages/types/CHANGELOG.md | 43 - packages/types/README.md | 13 - packages/types/renegade-fi-types-0.0.1.tgz | Bin 2921 -> 0 bytes packages/types/src/common/index.ts | 1 - packages/types/src/common/schema.ts | 4 - packages/types/src/index.ts | 3 - packages/types/src/order/index.ts | 1 - packages/types/src/order/schema.ts | 66 - packages/types/src/ws/index.ts | 12 - packages/types/src/ws/order.ts | 11 - packages/types/src/ws/subscriptions.ts | 5 - packages/types/tsconfig.build.json | 8 - packages/types/tsconfig.json | 5 - pnpm-lock.yaml | 1922 ++++---- wasm/.gitignore | 5 - wasm/Cargo.lock | 4257 +---------------- wasm/Cargo.toml | 51 +- wasm/build.sh | 26 +- wasm/rust-toolchain | 1 + wasm/rust-toolchain.toml | 2 - wasm/src/circuit_types/balance.rs | 67 - wasm/src/circuit_types/elgamal.rs | 65 - wasm/src/circuit_types/fixed_point.rs | 90 - wasm/src/circuit_types/keychain.rs | 388 -- wasm/src/circuit_types/mod.rs | 192 - wasm/src/circuit_types/order.rs | 121 - wasm/src/circuit_types/transfers.rs | 103 - wasm/src/circuit_types/wallet.rs | 87 - wasm/src/common/balances.rs | 136 - wasm/src/common/derivation.rs | 311 -- wasm/src/common/keychain.rs | 215 - wasm/src/common/keyed_list.rs | 201 - wasm/src/common/mod.rs | 6 - wasm/src/common/orders.rs | 88 - wasm/src/common/types.rs | 197 - wasm/src/errors.rs | 22 - wasm/src/external_api/auth/auth_helpers.rs | 82 - wasm/src/external_api/auth/mod.rs | 6 - wasm/src/external_api/create_wallet.rs | 96 - wasm/src/external_api/find_wallet.rs | 88 - wasm/src/external_api/http.rs | 822 ---- wasm/src/external_api/mod.rs | 6 - wasm/src/external_api/types.rs | 429 -- wasm/src/external_api/wallet_utils.rs | 37 - wasm/src/generation.rs | 65 - wasm/src/helpers.rs | 267 -- wasm/src/key_rotation.rs | 80 - wasm/src/lib.rs | 145 +- wasm/src/serde_def_types.rs | 100 - wasm/src/signature.rs | 149 - wasm/src/sol.rs | 18 - wasm/src/types.rs | 204 - wasm/src/utils.rs | 10 - 337 files changed, 4660 insertions(+), 20481 deletions(-) delete mode 100644 examples/README.md delete mode 100644 examples/external-keychain/cancel-order/README.md delete mode 100644 examples/external-keychain/cancel-order/env.ts delete mode 100644 examples/external-keychain/cancel-order/index.ts delete mode 100644 examples/external-keychain/cancel-order/package.json delete mode 100644 examples/external-keychain/cancel-order/tsconfig.json delete mode 100644 examples/external-keychain/create-wallet/README.md delete mode 100644 examples/external-keychain/create-wallet/env.ts delete mode 100644 examples/external-keychain/create-wallet/index.ts delete mode 100644 examples/external-keychain/create-wallet/package.json delete mode 100644 examples/external-keychain/create-wallet/tsconfig.json delete mode 100644 examples/external-keychain/deposit/README.md delete mode 100644 examples/external-keychain/deposit/env.ts delete mode 100644 examples/external-keychain/deposit/index.ts delete mode 100644 examples/external-keychain/deposit/package.json delete mode 100644 examples/external-keychain/deposit/tsconfig.json delete mode 100644 examples/external-keychain/get-back-of-queue-wallet/README.md delete mode 100644 examples/external-keychain/get-back-of-queue-wallet/env.ts delete mode 100644 examples/external-keychain/get-back-of-queue-wallet/index.ts delete mode 100644 examples/external-keychain/get-back-of-queue-wallet/package.json delete mode 100644 examples/external-keychain/get-back-of-queue-wallet/tsconfig.json delete mode 100644 examples/external-keychain/get-order-history/README.md delete mode 100644 examples/external-keychain/get-order-history/env.ts delete mode 100644 examples/external-keychain/get-order-history/index.ts delete mode 100644 examples/external-keychain/get-order-history/package.json delete mode 100644 examples/external-keychain/get-order-history/tsconfig.json delete mode 100644 examples/external-keychain/get-wallet/README.md delete mode 100644 examples/external-keychain/get-wallet/env.ts delete mode 100644 examples/external-keychain/get-wallet/index.ts delete mode 100644 examples/external-keychain/get-wallet/package.json delete mode 100644 examples/external-keychain/get-wallet/tsconfig.json delete mode 100644 examples/external-keychain/lookup-wallet/README.md delete mode 100644 examples/external-keychain/lookup-wallet/env.ts delete mode 100644 examples/external-keychain/lookup-wallet/index.ts delete mode 100644 examples/external-keychain/lookup-wallet/package.json delete mode 100644 examples/external-keychain/lookup-wallet/tsconfig.json delete mode 100644 examples/external-keychain/pay-fees/README.md delete mode 100644 examples/external-keychain/pay-fees/env.ts delete mode 100644 examples/external-keychain/pay-fees/index.ts delete mode 100644 examples/external-keychain/pay-fees/package.json delete mode 100644 examples/external-keychain/pay-fees/tsconfig.json delete mode 100644 examples/external-keychain/place-order/README.md delete mode 100644 examples/external-keychain/place-order/env.ts delete mode 100644 examples/external-keychain/place-order/index.ts delete mode 100644 examples/external-keychain/place-order/package.json delete mode 100644 examples/external-keychain/place-order/tsconfig.json delete mode 100644 examples/external-keychain/withdraw/README.md delete mode 100644 examples/external-keychain/withdraw/env.ts delete mode 100644 examples/external-keychain/withdraw/index.ts delete mode 100644 examples/external-keychain/withdraw/package.json delete mode 100644 examples/external-keychain/withdraw/tsconfig.json delete mode 100644 examples/external-match/base-sepolia/README.md delete mode 100644 examples/external-match/base-sepolia/env.ts delete mode 100644 examples/external-match/base-sepolia/index.ts delete mode 100644 examples/external-match/base-sepolia/package.json delete mode 100644 examples/external-match/base-sepolia/tsconfig.json delete mode 100644 examples/external-match/basic/README.md delete mode 100644 examples/external-match/basic/env.ts delete mode 100644 examples/external-match/basic/index.ts delete mode 100644 examples/external-match/basic/package.json delete mode 100644 examples/external-match/basic/tsconfig.json delete mode 100644 examples/external-match/direct-malleable-match/README.md delete mode 100644 examples/external-match/direct-malleable-match/env.ts delete mode 100644 examples/external-match/direct-malleable-match/index.ts delete mode 100644 examples/external-match/direct-malleable-match/package.json delete mode 100644 examples/external-match/direct-malleable-match/tsconfig.json delete mode 100644 examples/external-match/direct-match/README.md delete mode 100644 examples/external-match/direct-match/env.ts delete mode 100644 examples/external-match/direct-match/index.ts delete mode 100644 examples/external-match/direct-match/package.json delete mode 100644 examples/external-match/direct-match/tsconfig.json delete mode 100644 examples/external-match/exact-output/README.md delete mode 100644 examples/external-match/exact-output/env.ts delete mode 100644 examples/external-match/exact-output/index.ts delete mode 100644 examples/external-match/exact-output/package.json delete mode 100644 examples/external-match/exact-output/tsconfig.json delete mode 100644 examples/external-match/exchange-metadata/README.md delete mode 100644 examples/external-match/exchange-metadata/env.ts delete mode 100644 examples/external-match/exchange-metadata/index.ts delete mode 100644 examples/external-match/exchange-metadata/package.json delete mode 100644 examples/external-match/exchange-metadata/tsconfig.json delete mode 100644 examples/external-match/in-kind-gas-sponsorship/README.md delete mode 100644 examples/external-match/in-kind-gas-sponsorship/env.ts delete mode 100644 examples/external-match/in-kind-gas-sponsorship/index.ts delete mode 100644 examples/external-match/in-kind-gas-sponsorship/package.json delete mode 100644 examples/external-match/in-kind-gas-sponsorship/tsconfig.json delete mode 100644 examples/external-match/malleable/README.md delete mode 100644 examples/external-match/malleable/env.ts delete mode 100644 examples/external-match/malleable/helpers.ts delete mode 100644 examples/external-match/malleable/index.ts delete mode 100644 examples/external-match/malleable/package.json delete mode 100644 examples/external-match/malleable/tsconfig.json delete mode 100644 examples/external-match/native-gas-sponshorship/README.md delete mode 100644 examples/external-match/native-gas-sponshorship/env.ts delete mode 100644 examples/external-match/native-gas-sponshorship/index.ts delete mode 100644 examples/external-match/native-gas-sponshorship/package.json delete mode 100644 examples/external-match/native-gas-sponshorship/tsconfig.json delete mode 100644 examples/external-match/order-book-depth-all-pairs/README.md delete mode 100644 examples/external-match/order-book-depth-all-pairs/env.ts delete mode 100644 examples/external-match/order-book-depth-all-pairs/index.ts delete mode 100644 examples/external-match/order-book-depth-all-pairs/package.json delete mode 100644 examples/external-match/order-book-depth-all-pairs/tsconfig.json delete mode 100644 examples/external-match/order-book-depth/README.md delete mode 100644 examples/external-match/order-book-depth/env.ts delete mode 100644 examples/external-match/order-book-depth/index.ts delete mode 100644 examples/external-match/order-book-depth/package.json delete mode 100644 examples/external-match/order-book-depth/tsconfig.json delete mode 100644 examples/external-match/supported-tokens/README.md delete mode 100644 examples/external-match/supported-tokens/env.ts delete mode 100644 examples/external-match/supported-tokens/index.ts delete mode 100644 examples/external-match/supported-tokens/package.json delete mode 100644 examples/external-match/supported-tokens/tsconfig.json delete mode 100644 examples/external-match/token-prices/README.md delete mode 100644 examples/external-match/token-prices/env.ts delete mode 100644 examples/external-match/token-prices/index.ts delete mode 100644 examples/external-match/token-prices/package.json delete mode 100644 examples/external-match/token-prices/tsconfig.json delete mode 100644 examples/relayer/cancel-order/README.md delete mode 100644 examples/relayer/cancel-order/env.ts delete mode 100644 examples/relayer/cancel-order/index.ts delete mode 100644 examples/relayer/cancel-order/package.json delete mode 100644 examples/relayer/cancel-order/pnpm-lock.yaml delete mode 100644 examples/relayer/cancel-order/tsconfig.json delete mode 100644 examples/relayer/create-wallet/README.md delete mode 100644 examples/relayer/create-wallet/env.ts delete mode 100644 examples/relayer/create-wallet/index.ts delete mode 100644 examples/relayer/create-wallet/package.json delete mode 100644 examples/relayer/create-wallet/tsconfig.json delete mode 100644 examples/relayer/deposit/README.md delete mode 100644 examples/relayer/deposit/env.ts delete mode 100644 examples/relayer/deposit/index.ts delete mode 100644 examples/relayer/deposit/package.json delete mode 100644 examples/relayer/deposit/tsconfig.json delete mode 100644 examples/relayer/get-back-of-queue-wallet/README.md delete mode 100644 examples/relayer/get-back-of-queue-wallet/env.ts delete mode 100644 examples/relayer/get-back-of-queue-wallet/index.ts delete mode 100644 examples/relayer/get-back-of-queue-wallet/package.json delete mode 100644 examples/relayer/get-back-of-queue-wallet/tsconfig.json delete mode 100644 examples/relayer/get-order-history/README.md delete mode 100644 examples/relayer/get-order-history/env.ts delete mode 100644 examples/relayer/get-order-history/index.ts delete mode 100644 examples/relayer/get-order-history/package.json delete mode 100644 examples/relayer/get-order-history/tsconfig.json delete mode 100644 examples/relayer/get-wallet/README.md delete mode 100644 examples/relayer/get-wallet/env.ts delete mode 100644 examples/relayer/get-wallet/index.ts delete mode 100644 examples/relayer/get-wallet/package.json delete mode 100644 examples/relayer/get-wallet/tsconfig.json delete mode 100644 examples/relayer/lookup-wallet/README.md delete mode 100644 examples/relayer/lookup-wallet/env.ts delete mode 100644 examples/relayer/lookup-wallet/index.ts delete mode 100644 examples/relayer/lookup-wallet/package.json delete mode 100644 examples/relayer/lookup-wallet/tsconfig.json delete mode 100644 examples/relayer/pay-fees/README.md delete mode 100644 examples/relayer/pay-fees/env.ts delete mode 100644 examples/relayer/pay-fees/index.ts delete mode 100644 examples/relayer/pay-fees/package.json delete mode 100644 examples/relayer/pay-fees/tsconfig.json delete mode 100644 examples/relayer/place-order/README.md delete mode 100644 examples/relayer/place-order/env.ts delete mode 100644 examples/relayer/place-order/index.ts delete mode 100644 examples/relayer/place-order/package.json delete mode 100644 examples/relayer/place-order/tsconfig.json delete mode 100644 examples/relayer/withdraw/README.md delete mode 100644 examples/relayer/withdraw/env.ts delete mode 100644 examples/relayer/withdraw/index.ts delete mode 100644 examples/relayer/withdraw/package.json delete mode 100644 examples/relayer/withdraw/tsconfig.json delete mode 100644 examples/token/async-initialization/README.md delete mode 100644 examples/token/async-initialization/env.ts delete mode 100644 examples/token/async-initialization/index.ts delete mode 100644 examples/token/async-initialization/package.json delete mode 100644 examples/token/async-initialization/tsconfig.json delete mode 100644 examples/token/sync-initialization/README.md delete mode 100644 examples/token/sync-initialization/env.ts delete mode 100644 examples/token/sync-initialization/index.ts delete mode 100644 examples/token/sync-initialization/package.json delete mode 100644 examples/token/sync-initialization/remap.json delete mode 100644 examples/token/sync-initialization/tsconfig.json create mode 100644 package-lock.json create mode 100644 packages/direct-match/renegade-sdk-wasm/index.d.ts create mode 100644 packages/direct-match/renegade-sdk-wasm/index.js create mode 100644 packages/direct-match/renegade-sdk-wasm/index_bg.wasm create mode 100644 packages/direct-match/renegade-sdk-wasm/index_bg.wasm.d.ts create mode 100644 packages/direct-match/renegade-sdk-wasm/package.json create mode 100644 packages/direct-match/src/secrets.ts create mode 100644 packages/direct-match/src/types.ts delete mode 100644 packages/direct-match/src/types/index.ts create mode 100644 packages/direct-match/src/utils.ts create mode 100644 packages/direct-match/test/accountId.test.ts create mode 100644 packages/direct-match/test/cancelOrder.test.ts create mode 100644 packages/direct-match/test/createAndGetAccount.test.ts create mode 100644 packages/direct-match/test/getBalanceByMint.test.ts create mode 100644 packages/direct-match/test/getBalances.test.ts create mode 100644 packages/direct-match/test/getOrderAndPlaceOrder.test.ts create mode 100644 packages/direct-match/test/getOrders.test.ts create mode 100644 packages/direct-match/test/helpers.ts create mode 100644 packages/direct-match/test/matchQuoterOrders.test.ts create mode 100644 packages/direct-match/test/matchSelfOrders.test.ts create mode 100644 packages/direct-match/test/updateOrder.test.ts create mode 100644 packages/direct-match/test_data/test_data.json delete mode 100644 packages/node/CHANGELOG.md delete mode 100644 packages/node/README.md delete mode 100644 packages/node/package.json delete mode 100644 packages/node/src/actions/executeDeposit.ts delete mode 100644 packages/node/src/actions/executeWithdrawal.ts delete mode 100644 packages/node/src/actions/generateWalletSecrets.ts delete mode 100644 packages/node/src/clients/relayer/index.ts delete mode 100644 packages/node/src/clients/renegade/admin.ts delete mode 100644 packages/node/src/clients/renegade/base.ts delete mode 100644 packages/node/src/clients/renegade/index.ts delete mode 100644 packages/node/src/clients/renegade/types.ts delete mode 100644 packages/node/src/exports/actions.ts delete mode 100644 packages/node/src/exports/index.ts delete mode 100644 packages/node/src/services/orderWebSocket.ts delete mode 100644 packages/node/src/utils/permit2.ts delete mode 100644 packages/node/tsconfig.json delete mode 100644 packages/react/CHANGELOG.md delete mode 100644 packages/react/README.md delete mode 100644 packages/react/package.json delete mode 100644 packages/react/src/context.ts delete mode 100644 packages/react/src/errors/base.ts delete mode 100644 packages/react/src/errors/context.ts delete mode 100644 packages/react/src/exports/actions.ts delete mode 100644 packages/react/src/exports/constants.ts delete mode 100644 packages/react/src/exports/index.ts delete mode 100644 packages/react/src/exports/query.ts delete mode 100644 packages/react/src/hooks/useBackOfQueueBalances.ts delete mode 100644 packages/react/src/hooks/useBackOfQueueOrders.ts delete mode 100644 packages/react/src/hooks/useBackOfQueueWallet.ts delete mode 100644 packages/react/src/hooks/useBalances.ts delete mode 100644 packages/react/src/hooks/useCancelOrder.ts delete mode 100644 packages/react/src/hooks/useConfig.ts delete mode 100644 packages/react/src/hooks/useConnect.ts delete mode 100644 packages/react/src/hooks/useCreateOrder.ts delete mode 100644 packages/react/src/hooks/useDeposit.ts delete mode 100644 packages/react/src/hooks/useFees.ts delete mode 100644 packages/react/src/hooks/useIsIndexed.ts delete mode 100644 packages/react/src/hooks/useNetworkOrders.ts delete mode 100644 packages/react/src/hooks/useOpenOrders.ts delete mode 100644 packages/react/src/hooks/useOrderBookWebSocket.ts delete mode 100644 packages/react/src/hooks/useOrderHistory.ts delete mode 100644 packages/react/src/hooks/useOrderHistoryWebSocket.ts delete mode 100644 packages/react/src/hooks/useOrderMetadata.ts delete mode 100644 packages/react/src/hooks/useOrders.ts delete mode 100644 packages/react/src/hooks/usePayFees.ts delete mode 100644 packages/react/src/hooks/usePing.ts delete mode 100644 packages/react/src/hooks/usePkRootScalars.ts delete mode 100644 packages/react/src/hooks/useStatus.ts delete mode 100644 packages/react/src/hooks/useTaskHistory.ts delete mode 100644 packages/react/src/hooks/useTaskHistoryWebSocket.ts delete mode 100644 packages/react/src/hooks/useWallet.ts delete mode 100644 packages/react/src/hooks/useWalletBalances.ts delete mode 100644 packages/react/src/hooks/useWalletId.ts delete mode 100644 packages/react/src/hooks/useWalletOrders.ts delete mode 100644 packages/react/src/hooks/useWalletWebSocket.ts delete mode 100644 packages/react/src/hooks/useWithdraw.ts delete mode 100644 packages/react/src/hydrate.ts delete mode 100644 packages/react/src/types/properties.ts delete mode 100644 packages/react/src/utils/getVersion.ts delete mode 100644 packages/react/src/utils/query.ts delete mode 100644 packages/react/src/utils/websocket.ts delete mode 100644 packages/react/src/version.ts delete mode 100644 packages/react/src/wasm.ts delete mode 100644 packages/react/tsconfig.build.json delete mode 100644 packages/react/tsconfig.json rename packages/{types => renegade-sdk}/package.json (65%) create mode 100644 packages/renegade-sdk/src/index.ts rename packages/{node => renegade-sdk}/tsconfig.build.json (100%) delete mode 100644 packages/token-nextjs/CHANGELOG.md delete mode 100644 packages/token-nextjs/README.md delete mode 100644 packages/token-nextjs/package.json delete mode 100644 packages/token-nextjs/src/index.ts delete mode 100644 packages/token-nextjs/tsconfig.build.json delete mode 100644 packages/token-nextjs/tsconfig.json delete mode 100644 packages/types/CHANGELOG.md delete mode 100644 packages/types/README.md delete mode 100644 packages/types/renegade-fi-types-0.0.1.tgz delete mode 100644 packages/types/src/common/index.ts delete mode 100644 packages/types/src/common/schema.ts delete mode 100644 packages/types/src/index.ts delete mode 100644 packages/types/src/order/index.ts delete mode 100644 packages/types/src/order/schema.ts delete mode 100644 packages/types/src/ws/index.ts delete mode 100644 packages/types/src/ws/order.ts delete mode 100644 packages/types/src/ws/subscriptions.ts delete mode 100644 packages/types/tsconfig.build.json delete mode 100644 packages/types/tsconfig.json delete mode 100644 wasm/.gitignore create mode 100644 wasm/rust-toolchain delete mode 100644 wasm/rust-toolchain.toml delete mode 100644 wasm/src/circuit_types/balance.rs delete mode 100644 wasm/src/circuit_types/elgamal.rs delete mode 100644 wasm/src/circuit_types/fixed_point.rs delete mode 100644 wasm/src/circuit_types/keychain.rs delete mode 100644 wasm/src/circuit_types/mod.rs delete mode 100644 wasm/src/circuit_types/order.rs delete mode 100644 wasm/src/circuit_types/transfers.rs delete mode 100644 wasm/src/circuit_types/wallet.rs delete mode 100644 wasm/src/common/balances.rs delete mode 100644 wasm/src/common/derivation.rs delete mode 100644 wasm/src/common/keychain.rs delete mode 100644 wasm/src/common/keyed_list.rs delete mode 100644 wasm/src/common/mod.rs delete mode 100644 wasm/src/common/orders.rs delete mode 100644 wasm/src/common/types.rs delete mode 100644 wasm/src/errors.rs delete mode 100644 wasm/src/external_api/auth/auth_helpers.rs delete mode 100644 wasm/src/external_api/auth/mod.rs delete mode 100644 wasm/src/external_api/create_wallet.rs delete mode 100644 wasm/src/external_api/find_wallet.rs delete mode 100644 wasm/src/external_api/http.rs delete mode 100644 wasm/src/external_api/mod.rs delete mode 100644 wasm/src/external_api/types.rs delete mode 100644 wasm/src/external_api/wallet_utils.rs delete mode 100644 wasm/src/generation.rs delete mode 100644 wasm/src/helpers.rs delete mode 100644 wasm/src/key_rotation.rs delete mode 100644 wasm/src/serde_def_types.rs delete mode 100644 wasm/src/signature.rs delete mode 100644 wasm/src/sol.rs delete mode 100644 wasm/src/types.rs delete mode 100644 wasm/src/utils.rs diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 001d2590..7c666039 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -44,6 +44,6 @@ jobs: - name: Setup Biome uses: biomejs/setup-biome@v2 with: - version: latest + version: "2.3.6" - name: Run Biome run: biome ci . \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4e240029..d9c803c5 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ tsconfig.tsbuildinfo **/.env .npmrc CLAUDE*.md +**/target/* diff --git a/biome.json b/biome.json index 633b8bc6..06c55f8e 100644 --- a/biome.json +++ b/biome.json @@ -10,6 +10,7 @@ "!**/wasm", "!**/dist", "!**/renegade-utils", + "!**/renegade-sdk-wasm", "!**/*.d.ts", "!**/version.ts" ] diff --git a/examples/README.md b/examples/README.md deleted file mode 100644 index 199ff21e..00000000 --- a/examples/README.md +++ /dev/null @@ -1,10 +0,0 @@ -### SDK Examples -This directory contains examples of how to use the SDK - -The examples currently available are: -- [`external-match`](./external-match): An example of how to fetch and assemble an external match -- [`gas-sponsorship`](./gas-sponsorship): An example of how to fetch and assemble an external match with gas sponsorship from the auth server - -To run an example, navigate to the example directory and run `pnpm start`. - - diff --git a/examples/external-keychain/cancel-order/README.md b/examples/external-keychain/cancel-order/README.md deleted file mode 100644 index 01fb2726..00000000 --- a/examples/external-keychain/cancel-order/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Cancel Order Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/cancel-order) \ No newline at end of file diff --git a/examples/external-keychain/cancel-order/env.ts b/examples/external-keychain/cancel-order/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/cancel-order/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/cancel-order/index.ts b/examples/external-keychain/cancel-order/index.ts deleted file mode 100644 index 4a8aa24e..00000000 --- a/examples/external-keychain/cancel-order/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -let wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet before cancel order", wallet.orders); - -const orderIds = wallet.orders.map((order) => order.id); - -for (const id of orderIds) { - await client.cancelOrder({ id }); -} - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after cancel order", wallet.orders); diff --git a/examples/external-keychain/cancel-order/package.json b/examples/external-keychain/cancel-order/package.json deleted file mode 100644 index 6c3eddb7..00000000 --- a/examples/external-keychain/cancel-order/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-cancel-order", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/cancel-order/tsconfig.json b/examples/external-keychain/cancel-order/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/cancel-order/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/create-wallet/README.md b/examples/external-keychain/create-wallet/README.md deleted file mode 100644 index c023150c..00000000 --- a/examples/external-keychain/create-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Create Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/create-wallet) \ No newline at end of file diff --git a/examples/external-keychain/create-wallet/env.ts b/examples/external-keychain/create-wallet/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/create-wallet/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/create-wallet/index.ts b/examples/external-keychain/create-wallet/index.ts deleted file mode 100644 index 28c757cf..00000000 --- a/examples/external-keychain/create-wallet/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -await client.createWallet(); - -const wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet ID:", wallet.id); diff --git a/examples/external-keychain/create-wallet/package.json b/examples/external-keychain/create-wallet/package.json deleted file mode 100644 index 92f1e9b2..00000000 --- a/examples/external-keychain/create-wallet/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-create-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/create-wallet/tsconfig.json b/examples/external-keychain/create-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/create-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/deposit/README.md b/examples/external-keychain/deposit/README.md deleted file mode 100644 index 8af5f526..00000000 --- a/examples/external-keychain/deposit/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Deposit Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/deposit) \ No newline at end of file diff --git a/examples/external-keychain/deposit/env.ts b/examples/external-keychain/deposit/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/deposit/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/deposit/index.ts b/examples/external-keychain/deposit/index.ts deleted file mode 100644 index 1103d89c..00000000 --- a/examples/external-keychain/deposit/index.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { parseUnits } from "viem"; -import { - chainId, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -} from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const USDC = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const USDC_DECIMALS = 6; -const amount = parseUnits("1", USDC_DECIMALS); - -let wallet = await client.getBackOfQueueWallet(); -console.log("Wallet before deposit", wallet.balances); - -await client.executeDeposit({ - amount, - mint: USDC, - publicClient, - walletClient, -}); - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after deposit", wallet.balances); diff --git a/examples/external-keychain/deposit/package.json b/examples/external-keychain/deposit/package.json deleted file mode 100644 index 3cee7df8..00000000 --- a/examples/external-keychain/deposit/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-deposit", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/deposit/tsconfig.json b/examples/external-keychain/deposit/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/deposit/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/get-back-of-queue-wallet/README.md b/examples/external-keychain/get-back-of-queue-wallet/README.md deleted file mode 100644 index a969e76b..00000000 --- a/examples/external-keychain/get-back-of-queue-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Back of Queue Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/get-back-of-queue-wallet) \ No newline at end of file diff --git a/examples/external-keychain/get-back-of-queue-wallet/env.ts b/examples/external-keychain/get-back-of-queue-wallet/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/get-back-of-queue-wallet/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/get-back-of-queue-wallet/index.ts b/examples/external-keychain/get-back-of-queue-wallet/index.ts deleted file mode 100644 index 63e488c3..00000000 --- a/examples/external-keychain/get-back-of-queue-wallet/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet ID:", `\n${wallet.id}`); -console.log("-".repeat(100)); -console.log( - "Wallet balances:", - `\n${wallet.balances.map((balance) => `${balance.mint}: ${balance.amount}`).join("\n")}`, -); -console.log("-".repeat(100)); -console.log( - "Wallet orders:", - `\n${wallet.orders - .map((order) => `${order.side} ${order.amount} ${order.base_mint} for ${order.quote_mint}`) - .join("\n")}`, -); diff --git a/examples/external-keychain/get-back-of-queue-wallet/package.json b/examples/external-keychain/get-back-of-queue-wallet/package.json deleted file mode 100644 index fa87e8d3..00000000 --- a/examples/external-keychain/get-back-of-queue-wallet/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-get-back-of-queue-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/get-back-of-queue-wallet/tsconfig.json b/examples/external-keychain/get-back-of-queue-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/get-back-of-queue-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/get-order-history/README.md b/examples/external-keychain/get-order-history/README.md deleted file mode 100644 index f9056774..00000000 --- a/examples/external-keychain/get-order-history/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Order History Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/get-order-history) \ No newline at end of file diff --git a/examples/external-keychain/get-order-history/env.ts b/examples/external-keychain/get-order-history/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/get-order-history/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/get-order-history/index.ts b/examples/external-keychain/get-order-history/index.ts deleted file mode 100644 index cabc1d95..00000000 --- a/examples/external-keychain/get-order-history/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const orderHistory = await client.getOrderHistory({ limit: 10 }); - -console.log("Order history:", orderHistory); diff --git a/examples/external-keychain/get-order-history/package.json b/examples/external-keychain/get-order-history/package.json deleted file mode 100644 index 6580c07a..00000000 --- a/examples/external-keychain/get-order-history/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-get-order-history", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/get-order-history/tsconfig.json b/examples/external-keychain/get-order-history/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/get-order-history/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/get-wallet/README.md b/examples/external-keychain/get-wallet/README.md deleted file mode 100644 index b4060292..00000000 --- a/examples/external-keychain/get-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/get-wallet) \ No newline at end of file diff --git a/examples/external-keychain/get-wallet/env.ts b/examples/external-keychain/get-wallet/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/get-wallet/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/get-wallet/index.ts b/examples/external-keychain/get-wallet/index.ts deleted file mode 100644 index 7234940c..00000000 --- a/examples/external-keychain/get-wallet/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const wallet = await client.getWallet(); - -console.log("Wallet ID:", `\n${wallet.id}`); -console.log("-".repeat(100)); -console.log( - "Wallet balances:", - `\n${wallet.balances.map((balance) => `${balance.mint}: ${balance.amount}`).join("\n")}`, -); -console.log("-".repeat(100)); -console.log( - "Wallet orders:", - `\n${wallet.orders - .map((order) => `${order.side} ${order.amount} ${order.base_mint} for ${order.quote_mint}`) - .join("\n")}`, -); diff --git a/examples/external-keychain/get-wallet/package.json b/examples/external-keychain/get-wallet/package.json deleted file mode 100644 index 0ddc7df0..00000000 --- a/examples/external-keychain/get-wallet/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-get-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/get-wallet/tsconfig.json b/examples/external-keychain/get-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/get-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/lookup-wallet/README.md b/examples/external-keychain/lookup-wallet/README.md deleted file mode 100644 index d789b462..00000000 --- a/examples/external-keychain/lookup-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Lookup Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/lookup-wallet) \ No newline at end of file diff --git a/examples/external-keychain/lookup-wallet/env.ts b/examples/external-keychain/lookup-wallet/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/lookup-wallet/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/lookup-wallet/index.ts b/examples/external-keychain/lookup-wallet/index.ts deleted file mode 100644 index abc0642a..00000000 --- a/examples/external-keychain/lookup-wallet/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -await client.lookupWallet(); - -const wallet = await client.getWallet(); -console.log("Balances:", wallet.balances); diff --git a/examples/external-keychain/lookup-wallet/package.json b/examples/external-keychain/lookup-wallet/package.json deleted file mode 100644 index 21fbbbfd..00000000 --- a/examples/external-keychain/lookup-wallet/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-lookup-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/lookup-wallet/tsconfig.json b/examples/external-keychain/lookup-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/lookup-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/pay-fees/README.md b/examples/external-keychain/pay-fees/README.md deleted file mode 100644 index 4d641a41..00000000 --- a/examples/external-keychain/pay-fees/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Pay Fees Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/pay-fees) \ No newline at end of file diff --git a/examples/external-keychain/pay-fees/env.ts b/examples/external-keychain/pay-fees/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/pay-fees/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/pay-fees/index.ts b/examples/external-keychain/pay-fees/index.ts deleted file mode 100644 index 60931a8e..00000000 --- a/examples/external-keychain/pay-fees/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -await client.payFees(); diff --git a/examples/external-keychain/pay-fees/package.json b/examples/external-keychain/pay-fees/package.json deleted file mode 100644 index c5bf935c..00000000 --- a/examples/external-keychain/pay-fees/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-place-order", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/pay-fees/tsconfig.json b/examples/external-keychain/pay-fees/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/pay-fees/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/place-order/README.md b/examples/external-keychain/place-order/README.md deleted file mode 100644 index 5a6277b5..00000000 --- a/examples/external-keychain/place-order/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Place Order Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/place-order) \ No newline at end of file diff --git a/examples/external-keychain/place-order/env.ts b/examples/external-keychain/place-order/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/place-order/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/place-order/index.ts b/examples/external-keychain/place-order/index.ts deleted file mode 100644 index 65f8ed67..00000000 --- a/examples/external-keychain/place-order/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { parseEther } from "viem"; -import { chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const WETH = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const amount = parseEther("0.001"); -const side = "buy"; - -const order = { - base: WETH, - quote: USDC, - side, - amount, -} as const; - -await client.placeOrder(order); - -const wallet = await client.getBackOfQueueWallet(); - -console.log("Orders in wallet:", wallet.orders); diff --git a/examples/external-keychain/place-order/package.json b/examples/external-keychain/place-order/package.json deleted file mode 100644 index b58faaa9..00000000 --- a/examples/external-keychain/place-order/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-pay-fees", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/place-order/tsconfig.json b/examples/external-keychain/place-order/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/place-order/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-keychain/withdraw/README.md b/examples/external-keychain/withdraw/README.md deleted file mode 100644 index 94700cbf..00000000 --- a/examples/external-keychain/withdraw/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Withdraw Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-keychain/withdraw) \ No newline at end of file diff --git a/examples/external-keychain/withdraw/env.ts b/examples/external-keychain/withdraw/env.ts deleted file mode 100644 index 4d00ddb0..00000000 --- a/examples/external-keychain/withdraw/env.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as secp from "@noble/secp256k1"; -import { RenegadeClient } from "@renegade-fi/node"; -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; -import { concatHex, keccak256, numberToHex } from "viem/utils"; - -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const address = account.address; -const publicKey = account.publicKey; - -const chain = arbitrumSepolia; -const chainId = chain.id; -const walletClient = createWalletClient({ - account, - chain, - transport: http(), -}); - -const publicClient = createPublicClient({ - chain, - transport: http(), -}); - -const signMessage = async (message: string) => { - // Hash the raw message (do not add Ethereum message prefix) - const hashedMessage = keccak256(message as `0x${string}`); - - // Sign the hash with your private key - const sig = await secp.signAsync(hashedMessage.slice(2), privateKey.slice(2), { - lowS: true, - extraEntropy: false, - }); - - // Format signature as r[32] || s[32] || v[1] - return concatHex([ - numberToHex(sig.r, { size: 32 }), // r component - numberToHex(sig.s, { size: 32 }), // s component - numberToHex(sig.recovery ? 1 : 0, { size: 1 }), // recovery bit - ]); -}; - -const walletSecrets = await RenegadeClient.generateKeychain({ - sign: signMessage, -}); - -export { - address, - chainId, - privateKey, - publicClient, - publicKey, - signMessage, - walletClient, - walletSecrets, -}; diff --git a/examples/external-keychain/withdraw/index.ts b/examples/external-keychain/withdraw/index.ts deleted file mode 100644 index 9ced1899..00000000 --- a/examples/external-keychain/withdraw/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { address, chainId, publicKey, signMessage, walletSecrets } from "./env.js"; - -const client = RenegadeClient.newWithExternalKeychain({ - chainId, - publicKey, - signMessage, - walletSecrets, -}); - -const WETH = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; - -let wallet = await client.getBackOfQueueWallet(); -console.log("Wallet before withdraw", wallet.balances); -const balance = wallet.balances.find((balance) => balance.mint === WETH)?.amount ?? BigInt(0); - -await client.executeWithdraw({ - amount: balance, - mint: WETH, - destinationAddr: address, -}); - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after withdraw", wallet.balances); diff --git a/examples/external-keychain/withdraw/package.json b/examples/external-keychain/withdraw/package.json deleted file mode 100644 index 5ace7c04..00000000 --- a/examples/external-keychain/withdraw/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "example-external-keychain-withdraw", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@noble/secp256k1": "2", - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-keychain/withdraw/tsconfig.json b/examples/external-keychain/withdraw/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-keychain/withdraw/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/base-sepolia/README.md b/examples/external-match/base-sepolia/README.md deleted file mode 100644 index 84ae249c..00000000 --- a/examples/external-match/base-sepolia/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Base Sepolia External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/base-sepolia) \ No newline at end of file diff --git a/examples/external-match/base-sepolia/env.ts b/examples/external-match/base-sepolia/env.ts deleted file mode 100644 index 440d6a71..00000000 --- a/examples/external-match/base-sepolia/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { baseSepolia } from "viem/chains"; - -const chainId = baseSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: baseSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: baseSepolia, - transport: http(), -}); - -export { account, API_KEY, API_SECRET, chainId, owner, publicClient, walletClient }; diff --git a/examples/external-match/base-sepolia/index.ts b/examples/external-match/base-sepolia/index.ts deleted file mode 100644 index d09ae895..00000000 --- a/examples/external-match/base-sepolia/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newBaseSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0x31a5552AF53C35097Fdb20FFf294c56dc66FA04c"; -const USDC_ADDRESS = "0xD9961Bb4Cb27192f8dAd20a662be081f546b0E74"; -const quoteAmount = BigInt(2_000_000); // 2 USDC -const side = OrderSide.BUY; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -console.log("Fetching quote..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -console.log("Assmbling quote..."); - -const bundle = await client.assembleQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -const tx = bundle.match_bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell - ? bundle.match_bundle.match_result.base_amount - : bundle.match_bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); - -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/base-sepolia/package.json b/examples/external-match/base-sepolia/package.json deleted file mode 100644 index e3620a69..00000000 --- a/examples/external-match/base-sepolia/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-base-sepolia", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/base-sepolia/tsconfig.json b/examples/external-match/base-sepolia/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/base-sepolia/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/basic/README.md b/examples/external-match/basic/README.md deleted file mode 100644 index d79c9a59..00000000 --- a/examples/external-match/basic/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Basic External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/basic) \ No newline at end of file diff --git a/examples/external-match/basic/env.ts b/examples/external-match/basic/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/basic/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/basic/index.ts b/examples/external-match/basic/index.ts deleted file mode 100644 index 3f7e6648..00000000 --- a/examples/external-match/basic/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(2_000_000); // 2 USDC -const side = OrderSide.BUY; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -console.log("Fetching quote..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -console.log("Assmbling quote..."); - -const bundle = await client.assembleQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -const tx = bundle.match_bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell - ? bundle.match_bundle.match_result.base_amount - : bundle.match_bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); - -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/basic/package.json b/examples/external-match/basic/package.json deleted file mode 100644 index fe8f80d3..00000000 --- a/examples/external-match/basic/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-basic", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/basic/tsconfig.json b/examples/external-match/basic/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/basic/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/direct-malleable-match/README.md b/examples/external-match/direct-malleable-match/README.md deleted file mode 100644 index 90e46618..00000000 --- a/examples/external-match/direct-malleable-match/README.md +++ /dev/null @@ -1,20 +0,0 @@ -# Direct Malleable External Match Example - -This example demonstrates how to request a malleable external match directly using the `requestMalleableExternalMatch` method. Unlike regular matches, malleable matches allow you to adjust the base or quote amount within specified bounds before submitting the transaction. - -## Key Features - -- **Direct Match Request**: Requests a malleable match directly without first getting a quote -- **Partial Fills**: Demonstrates how to set a specific base amount within the allowed bounds - -## Usage - -```bash -bun run index.ts -``` - -Or with environment variables: - -```bash -API_KEY=your_api_key API_SECRET=your_api_secret PKEY=your_private_key bun run index.ts -``` diff --git a/examples/external-match/direct-malleable-match/env.ts b/examples/external-match/direct-malleable-match/env.ts deleted file mode 100644 index 610e977f..00000000 --- a/examples/external-match/direct-malleable-match/env.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKeyRaw = process.env.PKEY; -if (!privateKeyRaw) { - throw new Error("PKEY is not set"); -} - -// Ensure private key has 0x prefix -const privateKey = privateKeyRaw.startsWith("0x") - ? (privateKeyRaw as `0x${string}`) - : (`0x${privateKeyRaw}` as `0x${string}`); - -const account = privateKeyToAccount(privateKey); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/direct-malleable-match/index.ts b/examples/external-match/direct-malleable-match/index.ts deleted file mode 100644 index c3882b3c..00000000 --- a/examples/external-match/direct-malleable-match/index.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { - ExternalMatchClient, - OrderSide, - RequestExternalMatchOptions, -} from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(30_000_000); // 30 USDC -const side = OrderSide.BUY; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -const options = RequestExternalMatchOptions.new().withGasEstimation(true); - -console.log("Requesting malleable external match..."); -const matchResponse = await client.requestMalleableExternalMatchWithOptions(order, options); - -if (!matchResponse) { - console.error("No match available, exiting..."); - process.exit(1); -} - -console.log("Received malleable external match response", { - gasSponsored: matchResponse.gas_sponsorship_info != null, - gasSponsorshipInfo: matchResponse.gas_sponsorship_info, -}); - -// --- Malleable Bundle Manipulation --- // - -// Print bundle info (v2 uses input/output terminology) -console.log("\nBundle bounds:"); -const [minInput, maxInput] = matchResponse.inputBounds(); -const [minOutput, maxOutput] = matchResponse.outputBounds(); -console.log(`Input bounds: ${minInput} - ${maxInput}`); -console.log(`Output bounds: ${minOutput} - ${maxOutput}`); - -// Set a specific input amount on the bundle -// This modifies the settlement transaction calldata to use the specified amount -const targetInputAmount = minInput + (maxInput - minInput) / BigInt(2); -const receiveAmount = matchResponse.setInputAmount(targetInputAmount); -const sendAmount = matchResponse.sendAmount(); - -console.log(`\nSet input amount: ${targetInputAmount}`); -console.log(`Send amount: ${sendAmount}`); -console.log(`Receive amount: ${receiveAmount}`); - -const bundle = matchResponse.match_bundle; -const tx = bundle.settlement_tx; - -// --- Allowance Check --- // - -// The input token is what we send; skip ERC20 approval for native ETH sells -const inputMint = bundle.match_result.input_mint as `0x${string}`; -const amount = sendAmount; // This is the amount that will actually be sent -const spender = tx.to as `0x${string}`; - -if (!matchResponse.isNativeEthSell()) { - console.log("\nChecking allowance..."); - - const allowance = await publicClient.readContract({ - address: inputMint, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], - }); - - if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address: inputMint, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); - } -} - -// --- Submit Bundle --- // - -console.log("\nSubmitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - value: BigInt(tx.value ?? "0x0"), - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/direct-malleable-match/package.json b/examples/external-match/direct-malleable-match/package.json deleted file mode 100644 index 029a655d..00000000 --- a/examples/external-match/direct-malleable-match/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-direct-malleable-match", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/direct-malleable-match/tsconfig.json b/examples/external-match/direct-malleable-match/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/direct-malleable-match/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/direct-match/README.md b/examples/external-match/direct-match/README.md deleted file mode 100644 index b96cc2d3..00000000 --- a/examples/external-match/direct-match/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Direct External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/direct-match) diff --git a/examples/external-match/direct-match/env.ts b/examples/external-match/direct-match/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/direct-match/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/direct-match/index.ts b/examples/external-match/direct-match/index.ts deleted file mode 100644 index 2c03709a..00000000 --- a/examples/external-match/direct-match/index.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - ExternalMatchClient, - OrderSide, - RequestExternalMatchOptions, -} from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(2_000_000); // 2 USDC -const side = OrderSide.BUY; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -const options = RequestExternalMatchOptions.new().withGasEstimation(true); - -console.log("Requesting external match..."); -const matchResponse = await client.requestExternalMatchWithOptions(order, options); - -if (!matchResponse) { - console.error("No match available, exiting..."); - process.exit(1); -} - -console.log("Received external match response", { - gasSponsored: matchResponse.gas_sponsored, - gasSponsorshipInfo: matchResponse.gas_sponsorship_info, -}); - -const bundle = matchResponse.match_bundle; -const tx = bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell ? bundle.match_result.base_amount : bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); - -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/direct-match/package.json b/examples/external-match/direct-match/package.json deleted file mode 100644 index c226148c..00000000 --- a/examples/external-match/direct-match/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-direct-match", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/direct-match/tsconfig.json b/examples/external-match/direct-match/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/direct-match/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/exact-output/README.md b/examples/external-match/exact-output/README.md deleted file mode 100644 index 26de9f9b..00000000 --- a/examples/external-match/exact-output/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Exact External Match Output Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/exact-output) diff --git a/examples/external-match/exact-output/env.ts b/examples/external-match/exact-output/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/exact-output/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/exact-output/index.ts b/examples/external-match/exact-output/index.ts deleted file mode 100644 index 2e1e6ea5..00000000 --- a/examples/external-match/exact-output/index.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; - -// Use exact_quote_output to specify the exact amount of USDC to receive from a sell. -// Unlike quote_amount (which specifies a maximum input), exact_quote_output guarantees -// the exact output amount with no slippage. -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side: OrderSide.SELL, - exact_quote_output: BigInt(2_000_000), // Exactly 2 USDC output -}; - -console.log("Fetching quote with exact output..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -console.log("Assembling quote..."); - -const bundle = await client.assembleQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -const tx = bundle.match_bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell - ? bundle.match_bundle.match_result.base_amount - : bundle.match_bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); - -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/exact-output/package.json b/examples/external-match/exact-output/package.json deleted file mode 100644 index f7ef29b9..00000000 --- a/examples/external-match/exact-output/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-exact-output", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} \ No newline at end of file diff --git a/examples/external-match/exact-output/tsconfig.json b/examples/external-match/exact-output/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/exact-output/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/exchange-metadata/README.md b/examples/external-match/exchange-metadata/README.md deleted file mode 100644 index 6bf6f523..00000000 --- a/examples/external-match/exchange-metadata/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Exchange Metadata External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/exchange-metadata) - diff --git a/examples/external-match/exchange-metadata/env.ts b/examples/external-match/exchange-metadata/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/exchange-metadata/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/exchange-metadata/index.ts b/examples/external-match/exchange-metadata/index.ts deleted file mode 100644 index 98bf2425..00000000 --- a/examples/external-match/exchange-metadata/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ExternalMatchClient } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const metadata = await client.getExchangeMetadata(); - -console.log(`Chain ID: ${metadata.chain_id}`); -console.log(`Settlement Contract Address: ${metadata.settlement_contract_address}`); -console.log(`Supported Tokens (${metadata.supported_tokens.length}):`); -metadata.supported_tokens.forEach((token) => { - console.log(` - ${token.symbol}: ${token.address}`); -}); diff --git a/examples/external-match/exchange-metadata/package.json b/examples/external-match/exchange-metadata/package.json deleted file mode 100644 index addd7765..00000000 --- a/examples/external-match/exchange-metadata/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-exchange-metadata", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/exchange-metadata/tsconfig.json b/examples/external-match/exchange-metadata/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/exchange-metadata/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/in-kind-gas-sponsorship/README.md b/examples/external-match/in-kind-gas-sponsorship/README.md deleted file mode 100644 index 3ffff36b..00000000 --- a/examples/external-match/in-kind-gas-sponsorship/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# In-kind Gas Sponsorship External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/in-kind-gas-sponsorship) \ No newline at end of file diff --git a/examples/external-match/in-kind-gas-sponsorship/env.ts b/examples/external-match/in-kind-gas-sponsorship/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/in-kind-gas-sponsorship/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/in-kind-gas-sponsorship/index.ts b/examples/external-match/in-kind-gas-sponsorship/index.ts deleted file mode 100644 index 3a37b702..00000000 --- a/examples/external-match/in-kind-gas-sponsorship/index.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(20_000_000); // 20 USDC -const side = OrderSide.SELL; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -console.log("Fetching quote..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -const gasSponsorshipInfo = quote.gas_sponsorship_info?.gas_sponsorship_info; -if (!gasSponsorshipInfo) { - throw new Error("Transaction was not sponsored, abandoning..."); -} -console.log("Refund amount:", gasSponsorshipInfo.refund_amount); - -console.log("Assmbling quote..."); - -const bundle = await client.assembleQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -const tx = bundle.match_bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell - ? bundle.match_bundle.match_result.base_amount - : bundle.match_bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/in-kind-gas-sponsorship/package.json b/examples/external-match/in-kind-gas-sponsorship/package.json deleted file mode 100644 index 344ee718..00000000 --- a/examples/external-match/in-kind-gas-sponsorship/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-in-kind-gas-sponsorship", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/in-kind-gas-sponsorship/tsconfig.json b/examples/external-match/in-kind-gas-sponsorship/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/in-kind-gas-sponsorship/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/malleable/README.md b/examples/external-match/malleable/README.md deleted file mode 100644 index 4d0aae85..00000000 --- a/examples/external-match/malleable/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Malleable External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/malleable) \ No newline at end of file diff --git a/examples/external-match/malleable/env.ts b/examples/external-match/malleable/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/malleable/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/malleable/helpers.ts b/examples/external-match/malleable/helpers.ts deleted file mode 100644 index 4b5e91be..00000000 --- a/examples/external-match/malleable/helpers.ts +++ /dev/null @@ -1,39 +0,0 @@ -import type { MalleableExternalMatchResponse } from "@renegade-fi/renegade-sdk"; - -/** - * Set a random input amount on the bundle and print the results - * @param bundle The malleable match bundle - */ -export function setRandomInputAmount(bundle: MalleableExternalMatchResponse) { - // Print bundle info - console.log("\nBundle info:"); - const [minInput, maxInput] = bundle.inputBounds(); - const [minOutput, maxOutput] = bundle.outputBounds(); - console.log(`Input bounds: ${minInput} - ${maxInput}`); - console.log(`Output bounds: ${minOutput} - ${maxOutput}`); - - // Pick a hypothetical input amount and see the receive amount - const dummyInputAmount = randomInRange(minInput, maxInput); - const dummyReceiveAmount = bundle.receiveAmountAtInput(dummyInputAmount); - console.log(`Hypothetical input amount: ${dummyInputAmount}`); - console.log(`Hypothetical send amount: ${dummyInputAmount}`); - console.log(`Hypothetical receive amount: ${dummyReceiveAmount}`); - - // Pick an actual input amount to swap with - const swappedInputAmount = randomInRange(minInput, maxInput); - - // Setting the input amount returns the receive amount at the new input - // You can also call sendAmount() and receiveAmount() to get the amounts - // at the currently set input amount - bundle.setInputAmount(swappedInputAmount); - const send = bundle.sendAmount(); - const recv = bundle.receiveAmount(); - console.log(`Swapped input amount: ${swappedInputAmount}`); - console.log(`Send amount: ${send}`); - console.log(`Receive amount: ${recv}`); -} - -/** Generate a random value in the given range */ -function randomInRange(min: bigint, max: bigint): bigint { - return min + BigInt(Math.floor(Math.random() * (Number(max) - Number(min)))); -} diff --git a/examples/external-match/malleable/index.ts b/examples/external-match/malleable/index.ts deleted file mode 100644 index 18dd275f..00000000 --- a/examples/external-match/malleable/index.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET, walletClient } from "./env"; -import { setRandomInputAmount } from "./helpers"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(2_000_000); // 2 USDC -const side = OrderSide.BUY; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -console.log("Fetching quote..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -console.log("Assembling malleable quote..."); - -const bundle = await client.assembleMalleableQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -// Set a random input amount on the bundle -setRandomInputAmount(bundle); - -const tx = bundle.settlementTx(); - -// --- Submit Bundle --- // - -console.log("\nSubmitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - value: BigInt(tx.value ?? "0x0"), - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/malleable/package.json b/examples/external-match/malleable/package.json deleted file mode 100644 index ade76a80..00000000 --- a/examples/external-match/malleable/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-malleable", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/external-match/malleable/tsconfig.json b/examples/external-match/malleable/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/malleable/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/native-gas-sponshorship/README.md b/examples/external-match/native-gas-sponshorship/README.md deleted file mode 100644 index 5d73a91e..00000000 --- a/examples/external-match/native-gas-sponshorship/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Native Gas Sponsorship External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/native-gas-sponsorship) \ No newline at end of file diff --git a/examples/external-match/native-gas-sponshorship/env.ts b/examples/external-match/native-gas-sponshorship/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/native-gas-sponshorship/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/native-gas-sponshorship/index.ts b/examples/external-match/native-gas-sponshorship/index.ts deleted file mode 100644 index 3a37b702..00000000 --- a/examples/external-match/native-gas-sponshorship/index.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { ExternalMatchClient, OrderSide } from "@renegade-fi/renegade-sdk"; -import { erc20Abi } from "viem"; -import { API_KEY, API_SECRET, owner, publicClient, walletClient } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const quoteAmount = BigInt(20_000_000); // 20 USDC -const side = OrderSide.SELL; - -const order = { - base_mint: WETH_ADDRESS, - quote_mint: USDC_ADDRESS, - side, - quote_amount: quoteAmount, -} as const; - -console.log("Fetching quote..."); - -const quote = await client.requestQuote(order); - -if (!quote) { - console.error("No quote available, exiting..."); - process.exit(1); -} - -const gasSponsorshipInfo = quote.gas_sponsorship_info?.gas_sponsorship_info; -if (!gasSponsorshipInfo) { - throw new Error("Transaction was not sponsored, abandoning..."); -} -console.log("Refund amount:", gasSponsorshipInfo.refund_amount); - -console.log("Assmbling quote..."); - -const bundle = await client.assembleQuote(quote); - -if (!bundle) { - console.error("No bundle available, exiting..."); - process.exit(1); -} - -const tx = bundle.match_bundle.settlement_tx; - -// --- Allowance Check --- // - -const isSell = bundle.match_bundle.match_result.direction === "Sell"; -const address = isSell - ? (bundle.match_bundle.match_result.base_mint as `0x${string}`) - : (bundle.match_bundle.match_result.quote_mint as `0x${string}`); -const amount = isSell - ? bundle.match_bundle.match_result.base_amount - : bundle.match_bundle.match_result.quote_amount; -const spender = tx.to as `0x${string}`; - -console.log("Checking allowance..."); -const allowance = await publicClient.readContract({ - address, - abi: erc20Abi, - functionName: "allowance", - args: [owner, spender], -}); - -if (allowance < amount) { - console.log("Allowance is less than amount, approving..."); - const approveTx = await walletClient.writeContract({ - address, - abi: erc20Abi, - functionName: "approve", - args: [spender, amount], - }); - console.log("Submitting approve transaction..."); - await publicClient.waitForTransactionReceipt({ - hash: approveTx, - }); - console.log("Successfully submitted approve transaction", approveTx); -} - -// --- Submit Bundle --- // - -console.log("Submitting bundle..."); - -const hash = await walletClient.sendTransaction({ - to: tx.to as `0x${string}`, - data: tx.data as `0x${string}`, - type: "eip1559", -}); - -console.log("Successfully submitted transaction", hash); diff --git a/examples/external-match/native-gas-sponshorship/package.json b/examples/external-match/native-gas-sponshorship/package.json deleted file mode 100644 index ec0c2b51..00000000 --- a/examples/external-match/native-gas-sponshorship/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-native-gas-sponsorship", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/native-gas-sponshorship/tsconfig.json b/examples/external-match/native-gas-sponshorship/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/native-gas-sponshorship/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/order-book-depth-all-pairs/README.md b/examples/external-match/order-book-depth-all-pairs/README.md deleted file mode 100644 index 4d1aefe5..00000000 --- a/examples/external-match/order-book-depth-all-pairs/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# Order Book Depth All Pairs External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/order-book-depth-all-pairs) - diff --git a/examples/external-match/order-book-depth-all-pairs/env.ts b/examples/external-match/order-book-depth-all-pairs/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/order-book-depth-all-pairs/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/order-book-depth-all-pairs/index.ts b/examples/external-match/order-book-depth-all-pairs/index.ts deleted file mode 100644 index 60c27f1e..00000000 --- a/examples/external-match/order-book-depth-all-pairs/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ExternalMatchClient } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const depth = await client.getOrderBookDepthAllPairs(); - -console.log(depth); diff --git a/examples/external-match/order-book-depth-all-pairs/package.json b/examples/external-match/order-book-depth-all-pairs/package.json deleted file mode 100644 index 46eb3b97..00000000 --- a/examples/external-match/order-book-depth-all-pairs/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-order-book-depth-all-pairs", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/order-book-depth-all-pairs/tsconfig.json b/examples/external-match/order-book-depth-all-pairs/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/order-book-depth-all-pairs/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/order-book-depth/README.md b/examples/external-match/order-book-depth/README.md deleted file mode 100644 index 593764b4..00000000 --- a/examples/external-match/order-book-depth/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Order Book Depth External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/order-book-depth) \ No newline at end of file diff --git a/examples/external-match/order-book-depth/env.ts b/examples/external-match/order-book-depth/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/order-book-depth/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/order-book-depth/index.ts b/examples/external-match/order-book-depth/index.ts deleted file mode 100644 index 49bc019d..00000000 --- a/examples/external-match/order-book-depth/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { ExternalMatchClient } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -// Example base token mint (WETH) -const WETH = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; - -const depth = await client.getOrderBookDepth(WETH); - -console.log(depth); diff --git a/examples/external-match/order-book-depth/package.json b/examples/external-match/order-book-depth/package.json deleted file mode 100644 index 898bca76..00000000 --- a/examples/external-match/order-book-depth/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-order-book-depth", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/order-book-depth/tsconfig.json b/examples/external-match/order-book-depth/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/order-book-depth/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/supported-tokens/README.md b/examples/external-match/supported-tokens/README.md deleted file mode 100644 index 4414e1be..00000000 --- a/examples/external-match/supported-tokens/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Supported Tokens External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/supported-tokens) \ No newline at end of file diff --git a/examples/external-match/supported-tokens/env.ts b/examples/external-match/supported-tokens/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/supported-tokens/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/supported-tokens/index.ts b/examples/external-match/supported-tokens/index.ts deleted file mode 100644 index 6a137aeb..00000000 --- a/examples/external-match/supported-tokens/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ExternalMatchClient } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const response = await client.getSupportedTokens(); -const tickers = response.tokens.map((token) => token.symbol); - -console.log(`Renegade supports the following tokens: ${tickers.join(", ")}`); diff --git a/examples/external-match/supported-tokens/package.json b/examples/external-match/supported-tokens/package.json deleted file mode 100644 index db5eb051..00000000 --- a/examples/external-match/supported-tokens/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-supported-tokens", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/supported-tokens/tsconfig.json b/examples/external-match/supported-tokens/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/supported-tokens/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/external-match/token-prices/README.md b/examples/external-match/token-prices/README.md deleted file mode 100644 index 555d5bb6..00000000 --- a/examples/external-match/token-prices/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Token Prices External Match Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/external-match/token-prices) \ No newline at end of file diff --git a/examples/external-match/token-prices/env.ts b/examples/external-match/token-prices/env.ts deleted file mode 100644 index 11f41a54..00000000 --- a/examples/external-match/token-prices/env.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = process.env.PKEY; -if (!privateKey) { - throw new Error("PKEY is not set"); -} -const account = privateKeyToAccount(privateKey as `0x${string}`); -const owner = account.address; - -const API_KEY = process.env.API_KEY; -const API_SECRET = process.env.API_SECRET; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, API_KEY, API_SECRET, owner }; diff --git a/examples/external-match/token-prices/index.ts b/examples/external-match/token-prices/index.ts deleted file mode 100644 index bb16decf..00000000 --- a/examples/external-match/token-prices/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { ExternalMatchClient } from "@renegade-fi/renegade-sdk"; -import { API_KEY, API_SECRET } from "./env"; - -if (!API_KEY) { - throw new Error("API_KEY is not set"); -} - -if (!API_SECRET) { - throw new Error("API_SECRET is not set"); -} - -const client = ExternalMatchClient.newArbitrumSepoliaClient(API_KEY, API_SECRET); - -const response = await client.getTokenPrices(); - -console.log(response); diff --git a/examples/external-match/token-prices/package.json b/examples/external-match/token-prices/package.json deleted file mode 100644 index 9973101f..00000000 --- a/examples/external-match/token-prices/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-external-match-token-prices", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/renegade-sdk": "workspace:*", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4", - "typescript": "^5" - } -} diff --git a/examples/external-match/token-prices/tsconfig.json b/examples/external-match/token-prices/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/external-match/token-prices/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/cancel-order/README.md b/examples/relayer/cancel-order/README.md deleted file mode 100644 index 467fcd5a..00000000 --- a/examples/relayer/cancel-order/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Cancel Order Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/cancel-order) \ No newline at end of file diff --git a/examples/relayer/cancel-order/env.ts b/examples/relayer/cancel-order/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/cancel-order/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/cancel-order/index.ts b/examples/relayer/cancel-order/index.ts deleted file mode 100644 index c9a81162..00000000 --- a/examples/relayer/cancel-order/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -let wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet before cancel order", wallet.orders); - -const orderIds = wallet.orders.map((order) => order.id); - -for (const id of orderIds) { - await client.cancelOrder({ id }); -} - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after cancel order", wallet.orders); diff --git a/examples/relayer/cancel-order/package.json b/examples/relayer/cancel-order/package.json deleted file mode 100644 index 4c40e0fc..00000000 --- a/examples/relayer/cancel-order/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-cancel-order", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/cancel-order/pnpm-lock.yaml b/examples/relayer/cancel-order/pnpm-lock.yaml deleted file mode 100644 index de197d84..00000000 --- a/examples/relayer/cancel-order/pnpm-lock.yaml +++ /dev/null @@ -1,435 +0,0 @@ -lockfileVersion: '6.0' - -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - -dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.9(react@19.1.0)(viem@2.32.0)(ws@8.18.3) - viem: - specifier: latest - version: 2.32.0(typescript@5.8.3) - -devDependencies: - typescript: - specifier: ^5.0.3 - version: 5.8.3 - -packages: - - /@adraffy/ens-normalize@1.11.0: - resolution: {integrity: sha512-/3DDPKHqqIqxUULp8yP4zODUY1i+2xvVWsv8A79xGWdCAG+8sb0hRh0Rk2QyOJUnnbyPUAZYcpBuRe3nS2OIUg==} - dev: false - - /@noble/ciphers@1.3.0: - resolution: {integrity: sha512-2I0gnIVPtfnMw9ee9h1dJG7tp81+8Ob3OJb3Mv37rx5L40/b0i7djjCVvGOVqc9AEIQyvyu1i6ypKdFw8R8gQw==} - engines: {node: ^14.21.3 || >=16} - dev: false - - /@noble/curves@1.9.2: - resolution: {integrity: sha512-HxngEd2XUcg9xi20JkwlLCtYwfoFw4JGkuZpT+WlsPD4gB/cxkvTD8fSsoAnphGZhFdZYKeQIPCuFlWPm1uE0g==} - engines: {node: ^14.21.3 || >=16} - dependencies: - '@noble/hashes': 1.8.0 - dev: false - - /@noble/hashes@1.8.0: - resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} - engines: {node: ^14.21.3 || >=16} - dev: false - - /@renegade-fi/core@0.9.7(react@19.1.0)(viem@2.32.0)(ws@8.18.3): - resolution: {integrity: sha512-lZKG+bR29hvH2nkO0KRu4l9xkZQwzOfN1c9SiXPar9CvjhSUgNMhiHSTiWxHW3eGj1qL/tjjdWhr5ejMg5WI0A==} - peerDependencies: - '@tanstack/query-core': '>=5.0.0' - viem: 2.x - peerDependenciesMeta: - '@tanstack/query-core': - optional: true - dependencies: - axios: 1.10.0 - isows: 1.0.7(ws@8.18.3) - json-bigint: 1.0.0 - neverthrow: 8.2.0 - tiny-invariant: 1.3.3 - viem: 2.32.0(typescript@5.8.3) - zustand: 4.5.7(react@19.1.0) - transitivePeerDependencies: - - '@types/react' - - debug - - immer - - react - - ws - dev: false - - /@renegade-fi/node@0.6.9(react@19.1.0)(viem@2.32.0)(ws@8.18.3): - resolution: {integrity: sha512-zlpiy72FwOTYdNaVtH/JxyxA3sJSZFl+4EcPe6NjIkIjJTpUfU6Ol9a4zt+rRGPtKoUrzT9RE0/BF59l0mZXwQ==} - peerDependencies: - viem: 2.x - dependencies: - '@renegade-fi/core': 0.9.7(react@19.1.0)(viem@2.32.0)(ws@8.18.3) - tiny-invariant: 1.3.3 - viem: 2.32.0(typescript@5.8.3) - transitivePeerDependencies: - - '@tanstack/query-core' - - '@types/react' - - debug - - immer - - react - - ws - dev: false - - /@rollup/rollup-linux-x64-gnu@4.45.1: - resolution: {integrity: sha512-+E/lYl6qu1zqgPEnTrs4WysQtvc/Sh4fC2nByfFExqgYrqkKWp1tWIbe+ELhixnenSpBbLXNi6vbEEJ8M7fiHw==} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: false - optional: true - - /@scure/base@1.2.6: - resolution: {integrity: sha512-g/nm5FgUa//MCj1gV09zTJTaM6KBAHqLN907YVQqf7zC49+DcO4B1so4ZX07Ef10Twr6nuqYEH9GEggFXA4Fmg==} - dev: false - - /@scure/bip32@1.7.0: - resolution: {integrity: sha512-E4FFX/N3f4B80AKWp5dP6ow+flD1LQZo/w8UnLGYZO674jS6YnYeepycOOksv+vLPSpgN35wgKgy+ybfTb2SMw==} - dependencies: - '@noble/curves': 1.9.2 - '@noble/hashes': 1.8.0 - '@scure/base': 1.2.6 - dev: false - - /@scure/bip39@1.6.0: - resolution: {integrity: sha512-+lF0BbLiJNwVlev4eKelw1WWLaiKXw7sSl8T6FvBlWkdX+94aGJ4o8XjUdlyhTCjd8c+B3KT3JfS8P0bLRNU6A==} - dependencies: - '@noble/hashes': 1.8.0 - '@scure/base': 1.2.6 - dev: false - - /abitype@1.0.8(typescript@5.8.3): - resolution: {integrity: sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==} - peerDependencies: - typescript: '>=5.0.4' - zod: ^3 >=3.22.0 - peerDependenciesMeta: - typescript: - optional: true - zod: - optional: true - dependencies: - typescript: 5.8.3 - dev: false - - /asynckit@0.4.0: - resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - dev: false - - /axios@1.10.0: - resolution: {integrity: sha512-/1xYAC4MP/HEG+3duIhFr4ZQXR4sQXOIe+o6sdqzeykGLx6Upp/1p8MHqhINOvGeP7xyNHe7tsiJByc4SSVUxw==} - dependencies: - follow-redirects: 1.15.9 - form-data: 4.0.4 - proxy-from-env: 1.1.0 - transitivePeerDependencies: - - debug - dev: false - - /bignumber.js@9.3.1: - resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==} - dev: false - - /call-bind-apply-helpers@1.0.2: - resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==} - engines: {node: '>= 0.4'} - dependencies: - es-errors: 1.3.0 - function-bind: 1.1.2 - dev: false - - /combined-stream@1.0.8: - resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} - engines: {node: '>= 0.8'} - dependencies: - delayed-stream: 1.0.0 - dev: false - - /delayed-stream@1.0.0: - resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} - engines: {node: '>=0.4.0'} - dev: false - - /dunder-proto@1.0.1: - resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} - engines: {node: '>= 0.4'} - dependencies: - call-bind-apply-helpers: 1.0.2 - es-errors: 1.3.0 - gopd: 1.2.0 - dev: false - - /es-define-property@1.0.1: - resolution: {integrity: sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==} - engines: {node: '>= 0.4'} - dev: false - - /es-errors@1.3.0: - resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} - engines: {node: '>= 0.4'} - dev: false - - /es-object-atoms@1.1.1: - resolution: {integrity: sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==} - engines: {node: '>= 0.4'} - dependencies: - es-errors: 1.3.0 - dev: false - - /es-set-tostringtag@2.1.0: - resolution: {integrity: sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==} - engines: {node: '>= 0.4'} - dependencies: - es-errors: 1.3.0 - get-intrinsic: 1.3.0 - has-tostringtag: 1.0.2 - hasown: 2.0.2 - dev: false - - /eventemitter3@5.0.1: - resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} - dev: false - - /follow-redirects@1.15.9: - resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==} - engines: {node: '>=4.0'} - peerDependencies: - debug: '*' - peerDependenciesMeta: - debug: - optional: true - dev: false - - /form-data@4.0.4: - resolution: {integrity: sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==} - engines: {node: '>= 6'} - dependencies: - asynckit: 0.4.0 - combined-stream: 1.0.8 - es-set-tostringtag: 2.1.0 - hasown: 2.0.2 - mime-types: 2.1.35 - dev: false - - /function-bind@1.1.2: - resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} - dev: false - - /get-intrinsic@1.3.0: - resolution: {integrity: sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==} - engines: {node: '>= 0.4'} - dependencies: - call-bind-apply-helpers: 1.0.2 - es-define-property: 1.0.1 - es-errors: 1.3.0 - es-object-atoms: 1.1.1 - function-bind: 1.1.2 - get-proto: 1.0.1 - gopd: 1.2.0 - has-symbols: 1.1.0 - hasown: 2.0.2 - math-intrinsics: 1.1.0 - dev: false - - /get-proto@1.0.1: - resolution: {integrity: sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==} - engines: {node: '>= 0.4'} - dependencies: - dunder-proto: 1.0.1 - es-object-atoms: 1.1.1 - dev: false - - /gopd@1.2.0: - resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} - engines: {node: '>= 0.4'} - dev: false - - /has-symbols@1.1.0: - resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==} - engines: {node: '>= 0.4'} - dev: false - - /has-tostringtag@1.0.2: - resolution: {integrity: sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==} - engines: {node: '>= 0.4'} - dependencies: - has-symbols: 1.1.0 - dev: false - - /hasown@2.0.2: - resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} - engines: {node: '>= 0.4'} - dependencies: - function-bind: 1.1.2 - dev: false - - /isows@1.0.7(ws@8.18.2): - resolution: {integrity: sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==} - peerDependencies: - ws: '*' - dependencies: - ws: 8.18.2 - dev: false - - /isows@1.0.7(ws@8.18.3): - resolution: {integrity: sha512-I1fSfDCZL5P0v33sVqeTDSpcstAg/N+wF5HS033mogOVIp4B+oHC7oOCsA3axAbBSGTJ8QubbNmnIRN/h8U7hg==} - peerDependencies: - ws: '*' - dependencies: - ws: 8.18.3 - dev: false - - /json-bigint@1.0.0: - resolution: {integrity: sha512-SiPv/8VpZuWbvLSMtTDU8hEfrZWg/mH/nV/b4o0CYbSxu1UIQPLdwKOCIyLQX+VIPO5vrLX3i8qtqFyhdPSUSQ==} - dependencies: - bignumber.js: 9.3.1 - dev: false - - /math-intrinsics@1.1.0: - resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} - engines: {node: '>= 0.4'} - dev: false - - /mime-db@1.52.0: - resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} - engines: {node: '>= 0.6'} - dev: false - - /mime-types@2.1.35: - resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} - engines: {node: '>= 0.6'} - dependencies: - mime-db: 1.52.0 - dev: false - - /neverthrow@8.2.0: - resolution: {integrity: sha512-kOCT/1MCPAxY5iUV3wytNFUMUolzuwd/VF/1KCx7kf6CutrOsTie+84zTGTpgQycjvfLdBBdvBvFLqFD2c0wkQ==} - engines: {node: '>=18'} - optionalDependencies: - '@rollup/rollup-linux-x64-gnu': 4.45.1 - dev: false - - /ox@0.8.1(typescript@5.8.3): - resolution: {integrity: sha512-e+z5epnzV+Zuz91YYujecW8cF01mzmrUtWotJ0oEPym/G82uccs7q0WDHTYL3eiONbTUEvcZrptAKLgTBD3u2A==} - peerDependencies: - typescript: '>=5.4.0' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/ciphers': 1.3.0 - '@noble/curves': 1.9.2 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.0.8(typescript@5.8.3) - eventemitter3: 5.0.1 - typescript: 5.8.3 - transitivePeerDependencies: - - zod - dev: false - - /proxy-from-env@1.1.0: - resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==} - dev: false - - /react@19.1.0: - resolution: {integrity: sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==} - engines: {node: '>=0.10.0'} - dev: false - - /tiny-invariant@1.3.3: - resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} - dev: false - - /typescript@5.8.3: - resolution: {integrity: sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==} - engines: {node: '>=14.17'} - hasBin: true - - /use-sync-external-store@1.5.0(react@19.1.0): - resolution: {integrity: sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==} - peerDependencies: - react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - dependencies: - react: 19.1.0 - dev: false - - /viem@2.32.0(typescript@5.8.3): - resolution: {integrity: sha512-pHwKXQSyEWX+8ttOQJdU5dSBfYd6L9JxARY/Sx0MBj3uF/Zaiqt6o1SbzjFjQXkNzWSgtxK7H89ZI1SMIA2iLQ==} - peerDependencies: - typescript: '>=5.0.4' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@noble/curves': 1.9.2 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.0.8(typescript@5.8.3) - isows: 1.0.7(ws@8.18.2) - ox: 0.8.1(typescript@5.8.3) - typescript: 5.8.3 - ws: 8.18.2 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - dev: false - - /ws@8.18.2: - resolution: {integrity: sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - - /ws@8.18.3: - resolution: {integrity: sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==} - engines: {node: '>=10.0.0'} - peerDependencies: - bufferutil: ^4.0.1 - utf-8-validate: '>=5.0.2' - peerDependenciesMeta: - bufferutil: - optional: true - utf-8-validate: - optional: true - dev: false - - /zustand@4.5.7(react@19.1.0): - resolution: {integrity: sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==} - engines: {node: '>=12.7.0'} - peerDependencies: - '@types/react': '>=16.8' - immer: '>=9.0.6' - react: '>=16.8' - peerDependenciesMeta: - '@types/react': - optional: true - immer: - optional: true - react: - optional: true - dependencies: - react: 19.1.0 - use-sync-external-store: 1.5.0(react@19.1.0) - dev: false diff --git a/examples/relayer/cancel-order/tsconfig.json b/examples/relayer/cancel-order/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/cancel-order/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/create-wallet/README.md b/examples/relayer/create-wallet/README.md deleted file mode 100644 index 7bcef23f..00000000 --- a/examples/relayer/create-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Create Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/create-wallet) \ No newline at end of file diff --git a/examples/relayer/create-wallet/env.ts b/examples/relayer/create-wallet/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/create-wallet/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/create-wallet/index.ts b/examples/relayer/create-wallet/index.ts deleted file mode 100644 index 93ebe481..00000000 --- a/examples/relayer/create-wallet/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -await client.createWallet(); - -const wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet ID:", wallet.id); diff --git a/examples/relayer/create-wallet/package.json b/examples/relayer/create-wallet/package.json deleted file mode 100644 index 38bbbb14..00000000 --- a/examples/relayer/create-wallet/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-create-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/create-wallet/tsconfig.json b/examples/relayer/create-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/create-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/deposit/README.md b/examples/relayer/deposit/README.md deleted file mode 100644 index cd4123c3..00000000 --- a/examples/relayer/deposit/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Deposit Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/deposit) \ No newline at end of file diff --git a/examples/relayer/deposit/env.ts b/examples/relayer/deposit/env.ts deleted file mode 100644 index eb9fc401..00000000 --- a/examples/relayer/deposit/env.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { createPublicClient, createWalletClient, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const owner = account.address; - -const publicClient = createPublicClient({ - chain: arbitrumSepolia, - transport: http(), -}); - -const walletClient = createWalletClient({ - account, - chain: arbitrumSepolia, - transport: http(), -}); - -export { account, chainId, publicClient, walletClient, owner }; diff --git a/examples/relayer/deposit/index.ts b/examples/relayer/deposit/index.ts deleted file mode 100644 index 7f37cd04..00000000 --- a/examples/relayer/deposit/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId, publicClient, walletClient } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -const mint = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; // WETH -const amount = BigInt(10000000000000000); // 0.01 WETH - -let wallet = await client.getBackOfQueueWallet(); -console.log("Wallet before deposit", wallet.balances); - -await client.executeDeposit({ - amount, - mint, - publicClient, - walletClient, -}); - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after deposit", wallet.balances); diff --git a/examples/relayer/deposit/package.json b/examples/relayer/deposit/package.json deleted file mode 100644 index c94ef5de..00000000 --- a/examples/relayer/deposit/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-deposit", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/deposit/tsconfig.json b/examples/relayer/deposit/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/deposit/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/get-back-of-queue-wallet/README.md b/examples/relayer/get-back-of-queue-wallet/README.md deleted file mode 100644 index e1bf7161..00000000 --- a/examples/relayer/get-back-of-queue-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Back of Queue Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/get-back-of-queue-wallet) \ No newline at end of file diff --git a/examples/relayer/get-back-of-queue-wallet/env.ts b/examples/relayer/get-back-of-queue-wallet/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/get-back-of-queue-wallet/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/get-back-of-queue-wallet/index.ts b/examples/relayer/get-back-of-queue-wallet/index.ts deleted file mode 100644 index 44d7c57f..00000000 --- a/examples/relayer/get-back-of-queue-wallet/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -const wallet = await client.getBackOfQueueWallet(); -console.log("Wallet ID:", wallet.id); diff --git a/examples/relayer/get-back-of-queue-wallet/package.json b/examples/relayer/get-back-of-queue-wallet/package.json deleted file mode 100644 index 8a15b0db..00000000 --- a/examples/relayer/get-back-of-queue-wallet/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "example-relayer-get-wallet", - "private": true, - "type": "module", - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/get-back-of-queue-wallet/tsconfig.json b/examples/relayer/get-back-of-queue-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/get-back-of-queue-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/get-order-history/README.md b/examples/relayer/get-order-history/README.md deleted file mode 100644 index bdf40131..00000000 --- a/examples/relayer/get-order-history/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Order History Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/get-order-history) \ No newline at end of file diff --git a/examples/relayer/get-order-history/env.ts b/examples/relayer/get-order-history/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/get-order-history/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/get-order-history/index.ts b/examples/relayer/get-order-history/index.ts deleted file mode 100644 index f66592f2..00000000 --- a/examples/relayer/get-order-history/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -const orderHistory = await client.getOrderHistory(); - -console.log("Order history:", orderHistory); diff --git a/examples/relayer/get-order-history/package.json b/examples/relayer/get-order-history/package.json deleted file mode 100644 index b67e61cf..00000000 --- a/examples/relayer/get-order-history/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-get-order-history", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/get-order-history/tsconfig.json b/examples/relayer/get-order-history/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/get-order-history/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/get-wallet/README.md b/examples/relayer/get-wallet/README.md deleted file mode 100644 index 7689294e..00000000 --- a/examples/relayer/get-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Get Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/get-wallet) \ No newline at end of file diff --git a/examples/relayer/get-wallet/env.ts b/examples/relayer/get-wallet/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/get-wallet/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/get-wallet/index.ts b/examples/relayer/get-wallet/index.ts deleted file mode 100644 index 3f537d95..00000000 --- a/examples/relayer/get-wallet/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -const wallet = await client.getWallet(); -console.log("Wallet ID:", wallet.id); diff --git a/examples/relayer/get-wallet/package.json b/examples/relayer/get-wallet/package.json deleted file mode 100644 index 749edba0..00000000 --- a/examples/relayer/get-wallet/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-get-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/get-wallet/tsconfig.json b/examples/relayer/get-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/get-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/lookup-wallet/README.md b/examples/relayer/lookup-wallet/README.md deleted file mode 100644 index f90ab6c7..00000000 --- a/examples/relayer/lookup-wallet/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Lookup Wallet Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/lookup-wallet) \ No newline at end of file diff --git a/examples/relayer/lookup-wallet/env.ts b/examples/relayer/lookup-wallet/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/lookup-wallet/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/lookup-wallet/index.ts b/examples/relayer/lookup-wallet/index.ts deleted file mode 100644 index f4669d2c..00000000 --- a/examples/relayer/lookup-wallet/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -await client.lookupWallet(); - -const wallet = await client.getWallet(); -console.log("Balances:", wallet.balances); diff --git a/examples/relayer/lookup-wallet/package.json b/examples/relayer/lookup-wallet/package.json deleted file mode 100644 index d28168a8..00000000 --- a/examples/relayer/lookup-wallet/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-lookup-wallet", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/lookup-wallet/tsconfig.json b/examples/relayer/lookup-wallet/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/lookup-wallet/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/pay-fees/README.md b/examples/relayer/pay-fees/README.md deleted file mode 100644 index d2fa4adf..00000000 --- a/examples/relayer/pay-fees/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Pay Fees Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/pay-fees) \ No newline at end of file diff --git a/examples/relayer/pay-fees/env.ts b/examples/relayer/pay-fees/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/pay-fees/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/pay-fees/index.ts b/examples/relayer/pay-fees/index.ts deleted file mode 100644 index c3d2a98d..00000000 --- a/examples/relayer/pay-fees/index.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -await client.payFees(); diff --git a/examples/relayer/pay-fees/package.json b/examples/relayer/pay-fees/package.json deleted file mode 100644 index d2361012..00000000 --- a/examples/relayer/pay-fees/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-pay-fees", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/pay-fees/tsconfig.json b/examples/relayer/pay-fees/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/pay-fees/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/place-order/README.md b/examples/relayer/place-order/README.md deleted file mode 100644 index f9728588..00000000 --- a/examples/relayer/place-order/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Place Order Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/place-order) \ No newline at end of file diff --git a/examples/relayer/place-order/env.ts b/examples/relayer/place-order/env.ts deleted file mode 100644 index 19a90c18..00000000 --- a/examples/relayer/place-order/env.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); - -export { account, chainId }; diff --git a/examples/relayer/place-order/index.ts b/examples/relayer/place-order/index.ts deleted file mode 100644 index be24832a..00000000 --- a/examples/relayer/place-order/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -let wallet = await client.getBackOfQueueWallet(); -console.log("Wallet before place order", wallet.orders); - -const WETH_ADDRESS = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; -const USDC_ADDRESS = "0xdf8d259c04020562717557f2b5a3cf28e92707d1"; -const amount = BigInt(10000000000000000); // 0.01 WETH -const worstCasePrice = (4000 * 1.5 * 10 ** (6 - 18)).toString(); // For a buy order: maximum price of 6000 USDC per ETH -const minFillSize = amount; // Minimum fill size of 0.01 ETH -const side = "buy"; - -const order = { - base: WETH_ADDRESS, - quote: USDC_ADDRESS, - side, - amount, - worstCasePrice, - minFillSize, -} as const; - -await client.placeOrder(order); - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after place order", wallet.orders); diff --git a/examples/relayer/place-order/package.json b/examples/relayer/place-order/package.json deleted file mode 100644 index 2ec21da3..00000000 --- a/examples/relayer/place-order/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-place-order", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/place-order/tsconfig.json b/examples/relayer/place-order/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/place-order/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/relayer/withdraw/README.md b/examples/relayer/withdraw/README.md deleted file mode 100644 index fa15fc34..00000000 --- a/examples/relayer/withdraw/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Withdraw Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/relayer/withdraw) \ No newline at end of file diff --git a/examples/relayer/withdraw/env.ts b/examples/relayer/withdraw/env.ts deleted file mode 100644 index e0416964..00000000 --- a/examples/relayer/withdraw/env.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { privateKeyToAccount } from "viem/accounts"; -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; -const privateKey = "0xf22f37f6c5fd89a34c9346e7701b60a385c8c7f485537ba53253e5971a49303c"; // test account -const account = privateKeyToAccount(privateKey); -const owner = account.address; - -export { account, chainId, owner }; diff --git a/examples/relayer/withdraw/index.ts b/examples/relayer/withdraw/index.ts deleted file mode 100644 index 289f1460..00000000 --- a/examples/relayer/withdraw/index.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { RenegadeClient } from "@renegade-fi/node"; -import { account, chainId, owner } from "./env"; - -const seed = await account.signMessage({ - message: RenegadeClient.generateSeedMessage(chainId), -}); - -const client = RenegadeClient.new({ - chainId, - seed, -}); - -const mint = "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a"; // WETH - -let wallet = await client.getBackOfQueueWallet(); -console.log("Wallet before withdraw", wallet.balances); -const balance = wallet.balances.find((balance) => balance.mint === mint)?.amount ?? BigInt(0); - -await client.executeWithdraw({ - amount: balance, - mint, - destinationAddr: owner, -}); - -wallet = await client.getBackOfQueueWallet(); - -console.log("Wallet after withdraw", wallet.balances); diff --git a/examples/relayer/withdraw/package.json b/examples/relayer/withdraw/package.json deleted file mode 100644 index f6e010cd..00000000 --- a/examples/relayer/withdraw/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-relayer-withdraw", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/node": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/relayer/withdraw/tsconfig.json b/examples/relayer/withdraw/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/relayer/withdraw/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/token/async-initialization/README.md b/examples/token/async-initialization/README.md deleted file mode 100644 index 3137a232..00000000 --- a/examples/token/async-initialization/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Token Asynchronous Initialization Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/token/async-initialization) \ No newline at end of file diff --git a/examples/token/async-initialization/env.ts b/examples/token/async-initialization/env.ts deleted file mode 100644 index 2188c4a7..00000000 --- a/examples/token/async-initialization/env.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; - -export { chainId }; diff --git a/examples/token/async-initialization/index.ts b/examples/token/async-initialization/index.ts deleted file mode 100644 index ca840fe1..00000000 --- a/examples/token/async-initialization/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Token } from "@renegade-fi/token"; -import { chainId } from "./env"; - -await Token.fetchRemapFromRepo(chainId); -const WETH = Token.fromTicker("WETH"); -const WETH_ADDRESS = WETH.address; -console.log(`WETH ADDRESS on Chain ${chainId} is ${WETH_ADDRESS}`); diff --git a/examples/token/async-initialization/package.json b/examples/token/async-initialization/package.json deleted file mode 100644 index 2798d674..00000000 --- a/examples/token/async-initialization/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-token-async-initialization", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/token": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/token/async-initialization/tsconfig.json b/examples/token/async-initialization/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/token/async-initialization/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/examples/token/sync-initialization/README.md b/examples/token/sync-initialization/README.md deleted file mode 100644 index 616ef62a..00000000 --- a/examples/token/sync-initialization/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Token Asynchronous Initialization Example - -```bash -bun run index.ts -``` - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/renegade-fi/typescript-sdk/tree/main/examples/token/sync-initialization) \ No newline at end of file diff --git a/examples/token/sync-initialization/env.ts b/examples/token/sync-initialization/env.ts deleted file mode 100644 index 2188c4a7..00000000 --- a/examples/token/sync-initialization/env.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { arbitrumSepolia } from "viem/chains"; - -const chainId = arbitrumSepolia.id; - -export { chainId }; diff --git a/examples/token/sync-initialization/index.ts b/examples/token/sync-initialization/index.ts deleted file mode 100644 index b991fb0d..00000000 --- a/examples/token/sync-initialization/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Token } from "@renegade-fi/token"; -import { chainId } from "./env"; -import remap from "./remap.json"; - -Token.addRemapFromString(chainId, JSON.stringify(remap)); -const WETH = Token.fromTicker("WETH"); -const WETH_ADDRESS = WETH.address; -console.log(`WETH ADDRESS on Chain ${chainId} is ${WETH_ADDRESS}`); diff --git a/examples/token/sync-initialization/package.json b/examples/token/sync-initialization/package.json deleted file mode 100644 index dc25b990..00000000 --- a/examples/token/sync-initialization/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "example-token-sync-initialization", - "private": true, - "type": "module", - "scripts": { - "start": "tsx index.ts" - }, - "dependencies": { - "@renegade-fi/token": "latest", - "viem": "latest" - }, - "devDependencies": { - "tsx": "^4.20.3", - "typescript": "^5.0.3" - } -} diff --git a/examples/token/sync-initialization/remap.json b/examples/token/sync-initialization/remap.json deleted file mode 100644 index 728c0fee..00000000 --- a/examples/token/sync-initialization/remap.json +++ /dev/null @@ -1,306 +0,0 @@ -{ - "tokens": [ - { - "name": "USD Coin", - "ticker": "USDC", - "address": "0xdf8d259c04020562717557f2b5a3cf28e92707d1", - "decimals": 6, - "supported_exchanges": { - "Binance": "USDC", - "Coinbase": "USD", - "Kraken": "USDC", - "Okx": "USDC" - }, - "chain_addresses": { - "1": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", - "1151111081099710": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/usdc.png", - "canonical_exchange": "Binance" - }, - { - "name": "Tether USD", - "ticker": "USDT", - "address": "0x8fda47a4d2885e5aeba699ad967f15e3d9c4e1f7", - "decimals": 6, - "supported_exchanges": { - "Binance": "USDT", - "Coinbase": "USD", - "Kraken": "USD", - "Okx": "USDT" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/usdt.png", - "canonical_exchange": "Binance" - }, - { - "name": "Wrapped BTC", - "ticker": "WBTC", - "address": "0xa6ef8d1359e3be0d091c6339ff74d157d078c46e", - "decimals": 8, - "supported_exchanges": { - "Binance": "WBTC", - "Coinbase": "BTC", - "Kraken": "BTC", - "Okx": "WBTC" - }, - "chain_addresses": { - "1": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/wbtc.png", - "canonical_exchange": "Binance" - }, - { - "name": "Wrapped Ether", - "ticker": "WETH", - "address": "0xc3414a7ef14aaaa9c4522dfc00a4e66e74e9c25a", - "decimals": 18, - "supported_exchanges": { - "Binance": "ETH", - "Coinbase": "ETH", - "Kraken": "ETH", - "Okx": "ETH" - }, - "chain_addresses": { - "1": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/weth.png", - "canonical_exchange": "Binance" - }, - { - "name": "Arbitrum", - "ticker": "ARB", - "address": "0x91bc4f29b85e8000a090dc894617729c71db4fbd", - "decimals": 18, - "supported_exchanges": { - "Binance": "ARB", - "Coinbase": "ARB", - "Kraken": "ARB", - "Okx": "ARB" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/arb.png", - "canonical_exchange": "Binance" - }, - { - "name": "GMX", - "ticker": "GMX", - "address": "0x6840d04f30f645697549c7ab852ddf022bccf7b7", - "decimals": 18, - "supported_exchanges": { - "Binance": "GMX", - "Kraken": "GMX", - "Okx": "GMX" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/gmx.png", - "canonical_exchange": "Binance" - }, - { - "name": "Pendle", - "ticker": "PENDLE", - "address": "0x276e66034cdf2e10a98999be78307bdfb4aa26ef", - "decimals": 18, - "supported_exchanges": { - "Binance": "PENDLE", - "Kraken": "PENDLE" - }, - "chain_addresses": { - "1": "0x808507121b80c02388fad14726482e061b8da827" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/pendle.png", - "canonical_exchange": "Binance" - }, - { - "name": "Lido DAO Token", - "ticker": "LDO", - "address": "0xb6447ee182e04d987cfc29a96270da7865550058", - "decimals": 18, - "supported_exchanges": { - "Binance": "LDO", - "Coinbase": "LDO", - "Kraken": "LDO", - "Okx": "LDO" - }, - "chain_addresses": { - "1": "0x5A98FcBEA516Cf06857215779Fd812CA3beF1B32" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/ldo.png", - "canonical_exchange": "Binance" - }, - { - "name": "ChainLink Token", - "ticker": "LINK", - "address": "0x50348f82e1ec4f76979f8b98f2729370a3971b1f", - "decimals": 18, - "supported_exchanges": { - "Binance": "LINK", - "Coinbase": "LINK", - "Kraken": "LINK", - "Okx": "LINK" - }, - "chain_addresses": { - "1": "0x514910771AF9Ca656af840dff83E8264EcF986CA" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/link.png", - "canonical_exchange": "Binance" - }, - { - "name": "Curve DAO Token", - "ticker": "CRV", - "address": "0x017dc958eb7171de1127829bd12a9939778ea8dd", - "decimals": 18, - "supported_exchanges": { - "Binance": "CRV", - "Coinbase": "CRV", - "Kraken": "CRV", - "Okx": "CRV" - }, - "chain_addresses": { - "1": "0xD533a949740bb3306d119CC777fa900bA034cd52" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/crv.png", - "canonical_exchange": "Binance" - }, - { - "name": "Uniswap", - "ticker": "UNI", - "address": "0x61f23c9d60e04509c9d732d395951027cb44995d", - "decimals": 18, - "supported_exchanges": { - "Binance": "UNI", - "Coinbase": "UNI", - "Kraken": "UNI", - "Okx": "UNI" - }, - "chain_addresses": { - "1": "0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/uni.png", - "canonical_exchange": "Binance" - }, - { - "name": "LayerZero", - "ticker": "ZRO", - "address": "0x3953496267860cf93ba2675c23f1e4c278f58767", - "decimals": 18, - "supported_exchanges": { - "Binance": "ZRO", - "Coinbase": "ZRO", - "Kraken": "ZRO", - "Okx": "ZRO" - }, - "chain_addresses": { - "1": "0x6985884C4392D348587B19cb9eAAf157F13271cd" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/zro.png", - "canonical_exchange": "Binance" - }, - { - "name": "Livepeer Token", - "ticker": "LPT", - "address": "0x410c082fd0e7b49d68b021215720166c296dde98", - "decimals": 18, - "supported_exchanges": { - "Binance": "LPT", - "Coinbase": "LPT", - "Kraken": "LPT", - "Okx": "LPT" - }, - "chain_addresses": { - "1": "0x58b6A8A3302369DAEc383334672404Ee733aB239" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/lpt.png", - "canonical_exchange": "Binance" - }, - { - "name": "Graph Token", - "ticker": "GRT", - "address": "0x5267cf9eadf73c4b1a21dc2a0f6115c504b53373", - "decimals": 18, - "supported_exchanges": { - "Binance": "GRT", - "Coinbase": "GRT", - "Kraken": "GRT", - "Okx": "GRT" - }, - "chain_addresses": { - "1": "0xc944E90C64B2c07662A292be6244BDf05Cda44a7" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/grt.png", - "canonical_exchange": "Binance" - }, - { - "name": "Compound", - "ticker": "COMP", - "address": "0x8c7ab63b908b7575fba683c5ac6d6a1056ed2e79", - "decimals": 18, - "supported_exchanges": { - "Binance": "COMP", - "Coinbase": "COMP", - "Kraken": "COMP", - "Okx": "COMP" - }, - "chain_addresses": { - "1": "0xc00e94Cb662C3520282E6f5717214004A7f26888" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/comp.png", - "canonical_exchange": "Binance" - }, - { - "name": "Aave Token", - "ticker": "AAVE", - "address": "0x5d0aa5cfed1b4ad46c6a5226ec7a6b534e972766", - "decimals": 18, - "supported_exchanges": { - "Binance": "AAVE", - "Coinbase": "AAVE", - "Kraken": "AAVE", - "Okx": "AAVE" - }, - "chain_addresses": { - "1": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/aave.png", - "canonical_exchange": "Binance" - }, - { - "name": "Xai", - "ticker": "XAI", - "address": "0x4c42b54a35889e05b74f7507c7b4fc1e991315fa", - "decimals": 18, - "supported_exchanges": { - "Binance": "XAI" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/xai.png", - "canonical_exchange": "Binance" - }, - { - "name": "Radiant", - "ticker": "RDNT", - "address": "0xd54c59fbcfef1efc66bc04dc1ca7a05b94aa6d41", - "decimals": 18, - "supported_exchanges": { - "Binance": "RDNT", - "Okx": "RDNT" - }, - "chain_addresses": { - "1": "0x137dDB47Ee24EaA998a535Ab00378d6BFa84F893" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/rdnt.png", - "canonical_exchange": "Binance" - }, - { - "name": "Ether.fi", - "ticker": "ETHFI", - "address": "0x5fcaeddd67bf47e638d6b8688f6f5f89654af28d", - "decimals": 18, - "supported_exchanges": { - "Binance": "ETHFI", - "Okx": "ETHFI" - }, - "chain_addresses": { - "1": "0xFe0c30065B384F05761f15d0CC899D4F9F9Cc0eB" - }, - "logo_url": "https://raw.githubusercontent.com/renegade-fi/token-mappings/refs/heads/main/token-logos/ethfi.png", - "canonical_exchange": "Binance" - } - ] -} diff --git a/examples/token/sync-initialization/tsconfig.json b/examples/token/sync-initialization/tsconfig.json deleted file mode 100644 index 7f285754..00000000 --- a/examples/token/sync-initialization/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "target": "ESNext", - "useDefineForClassFields": true, - "module": "ESNext", - "lib": ["ESNext", "DOM"], - "moduleResolution": "Node", - "strict": true, - "resolveJsonModule": true, - "isolatedModules": true, - "esModuleInterop": true, - "noEmit": true, - "noUnusedLocals": true, - "noUnusedParameters": true, - "noImplicitReturns": true, - "skipLibCheck": true - }, - "include": ["src"] -} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..fda0a57a --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1440 @@ +{ + "name": "typescript-sdk", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "@biomejs/biome": "2.3.6", + "@changesets/cli": "^2.27.1", + "@types/node": "^20.12.7", + "typescript": "^5.5.4" + } + }, + "node_modules/@babel/runtime": { + "version": "7.25.4", + "dev": true, + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@biomejs/biome": { + "version": "2.3.6", + "dev": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "2.3.6", + "@biomejs/cli-darwin-x64": "2.3.6", + "@biomejs/cli-linux-arm64": "2.3.6", + "@biomejs/cli-linux-arm64-musl": "2.3.6", + "@biomejs/cli-linux-x64": "2.3.6", + "@biomejs/cli-linux-x64-musl": "2.3.6", + "@biomejs/cli-win32-arm64": "2.3.6", + "@biomejs/cli-win32-x64": "2.3.6" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.3.6.tgz", + "integrity": "sha512-P4JWE5d8UayBxYe197QJwyW4ZHp0B+zvRIGCusOm1WbxmlhpAQA1zEqQuunHgSIzvyEEp4TVxiKGXNFZPg7r9Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.3.6.tgz", + "integrity": "sha512-I4rTebj+F/L9K93IU7yTFs8nQ6EhaCOivxduRha4w4WEZK80yoZ8OAdR1F33m4yJ/NfUuTUbP/Wjs+vKjlCoWA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.3.6.tgz", + "integrity": "sha512-JjYy83eVBnvuINZiqyFO7xx72v8Srh4hsgaacSBCjC22DwM6+ZvnX1/fj8/SBiLuUOfZ8YhU2pfq2Dzakeyg1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.3.6.tgz", + "integrity": "sha512-oK1NpIXIixbJ/4Tcx40cwiieqah6rRUtMGOHDeK2ToT7yUFVEvXUGRKqH0O4hqZ9tW8TcXNZKfgRH6xrsjVtGg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "2.3.6", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "2.3.6", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.3.6.tgz", + "integrity": "sha512-YM7hLHpwjdt8R7+O2zS1Vo2cKgqEeptiXB1tWW1rgjN5LlpZovBVKtg7zfwfRrFx3i08aNZThYpTcowpTlczug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.3.6.tgz", + "integrity": "sha512-psgNEYgMAobY5h+QHRBVR9xvg2KocFuBKm6axZWB/aD12NWhQjiVFQUjV6wMXhlH4iT0Q9c3yK5JFRiDC/rzHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@changesets/apply-release-plan": { + "version": "7.0.4", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/config": "^3.0.2", + "@changesets/get-version-range-type": "^0.4.0", + "@changesets/git": "^3.0.0", + "@changesets/should-skip-package": "^0.1.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "detect-indent": "^6.0.0", + "fs-extra": "^7.0.1", + "lodash.startcase": "^4.4.0", + "outdent": "^0.5.0", + "prettier": "^2.7.1", + "resolve-from": "^5.0.0", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/assemble-release-plan": { + "version": "6.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/should-skip-package": "^0.1.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/changelog-git": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.0.0" + } + }, + "node_modules/@changesets/cli": { + "version": "2.27.7", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/apply-release-plan": "^7.0.4", + "@changesets/assemble-release-plan": "^6.0.3", + "@changesets/changelog-git": "^0.2.0", + "@changesets/config": "^3.0.2", + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/get-release-plan": "^4.0.3", + "@changesets/git": "^3.0.0", + "@changesets/logger": "^0.1.0", + "@changesets/pre": "^2.0.0", + "@changesets/read": "^0.6.0", + "@changesets/should-skip-package": "^0.1.0", + "@changesets/types": "^6.0.0", + "@changesets/write": "^0.3.1", + "@manypkg/get-packages": "^1.1.3", + "@types/semver": "^7.5.0", + "ansi-colors": "^4.1.3", + "chalk": "^2.1.0", + "ci-info": "^3.7.0", + "enquirer": "^2.3.0", + "external-editor": "^3.1.0", + "fs-extra": "^7.0.1", + "human-id": "^1.0.2", + "mri": "^1.2.0", + "outdent": "^0.5.0", + "p-limit": "^2.2.0", + "preferred-pm": "^3.0.0", + "resolve-from": "^5.0.0", + "semver": "^7.5.3", + "spawndamnit": "^2.0.0", + "term-size": "^2.1.0" + }, + "bin": { + "changeset": "bin.js" + } + }, + "node_modules/@changesets/config": { + "version": "3.0.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/errors": "^0.2.0", + "@changesets/get-dependents-graph": "^2.1.1", + "@changesets/logger": "^0.1.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "fs-extra": "^7.0.1", + "micromatch": "^4.0.2" + } + }, + "node_modules/@changesets/errors": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "extendable-error": "^0.1.5" + } + }, + "node_modules/@changesets/get-dependents-graph": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "chalk": "^2.1.0", + "fs-extra": "^7.0.1", + "semver": "^7.5.3" + } + }, + "node_modules/@changesets/get-release-plan": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/assemble-release-plan": "^6.0.3", + "@changesets/config": "^3.0.2", + "@changesets/pre": "^2.0.0", + "@changesets/read": "^0.6.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3" + } + }, + "node_modules/@changesets/get-version-range-type": { + "version": "0.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@changesets/git": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/errors": "^0.2.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "is-subdir": "^1.1.1", + "micromatch": "^4.0.2", + "spawndamnit": "^2.0.0" + } + }, + "node_modules/@changesets/logger": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^2.1.0" + } + }, + "node_modules/@changesets/parse": { + "version": "0.4.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@changesets/types": "^6.0.0", + "js-yaml": "^3.13.1" + } + }, + "node_modules/@changesets/pre": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/errors": "^0.2.0", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3", + "fs-extra": "^7.0.1" + } + }, + "node_modules/@changesets/read": { + "version": "0.6.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/git": "^3.0.0", + "@changesets/logger": "^0.1.0", + "@changesets/parse": "^0.4.0", + "@changesets/types": "^6.0.0", + "chalk": "^2.1.0", + "fs-extra": "^7.0.1", + "p-filter": "^2.1.0" + } + }, + "node_modules/@changesets/should-skip-package": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/types": "^6.0.0", + "@manypkg/get-packages": "^1.1.3" + } + }, + "node_modules/@changesets/types": { + "version": "6.0.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@changesets/write": { + "version": "0.3.1", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.20.1", + "@changesets/types": "^6.0.0", + "fs-extra": "^7.0.1", + "human-id": "^1.0.2", + "prettier": "^2.7.1" + } + }, + "node_modules/@manypkg/find-root": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.5.5", + "@types/node": "^12.7.1", + "find-up": "^4.1.0", + "fs-extra": "^8.1.0" + } + }, + "node_modules/@manypkg/find-root/node_modules/@types/node": { + "version": "12.20.55", + "dev": true, + "license": "MIT" + }, + "node_modules/@manypkg/find-root/node_modules/fs-extra": { + "version": "8.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@manypkg/get-packages": { + "version": "1.1.3", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.5.5", + "@changesets/types": "^4.0.1", + "@manypkg/find-root": "^1.1.0", + "fs-extra": "^8.1.0", + "globby": "^11.0.0", + "read-yaml-file": "^1.1.0" + } + }, + "node_modules/@manypkg/get-packages/node_modules/@changesets/types": { + "version": "4.1.0", + "dev": true, + "license": "MIT" + }, + "node_modules/@manypkg/get-packages/node_modules/fs-extra": { + "version": "8.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/node": { + "version": "20.16.1", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.19.2" + } + }, + "node_modules/@types/semver": { + "version": "7.5.8", + "dev": true, + "license": "MIT" + }, + "node_modules/ansi-colors": { + "version": "4.1.3", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/argparse": { + "version": "1.0.10", + "dev": true, + "license": "MIT", + "dependencies": { + "sprintf-js": "~1.0.2" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/better-path-resolve": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "is-windows": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "dev": true, + "license": "MIT" + }, + "node_modules/ci-info": { + "version": "3.9.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "dev": true, + "license": "MIT" + }, + "node_modules/cross-spawn": { + "version": "5.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "node_modules/detect-indent": { + "version": "6.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/enquirer": { + "version": "2.4.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-colors": "^4.1.1", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "dev": true, + "license": "BSD-2-Clause", + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/extendable-error": { + "version": "0.1.7", + "dev": true, + "license": "MIT" + }, + "node_modules/external-editor": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/fast-glob": { + "version": "3.3.2", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fastq": { + "version": "1.17.1", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up/node_modules/locate-path": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-up/node_modules/p-locate": { + "version": "4.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-yarn-workspace-root2": { + "version": "1.2.16", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "micromatch": "^4.0.2", + "pkg-dir": "^4.2.0" + } + }, + "node_modules/fs-extra": { + "version": "7.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + }, + "engines": { + "node": ">=6 <7 || >=8" + } + }, + "node_modules/glob-parent": { + "version": "5.1.2", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/globby": { + "version": "11.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.11", + "dev": true, + "license": "ISC" + }, + "node_modules/has-flag": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/human-id": { + "version": "1.0.2", + "dev": true, + "license": "MIT" + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "dev": true, + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/ignore": { + "version": "5.3.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-subdir": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "better-path-resolve": "1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/is-windows": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "dev": true, + "license": "ISC" + }, + "node_modules/js-yaml": { + "version": "3.14.1", + "dev": true, + "license": "MIT", + "dependencies": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsonfile": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/load-yaml-file": { + "version": "0.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.5", + "js-yaml": "^3.13.0", + "pify": "^4.0.1", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash.startcase": { + "version": "4.4.0", + "dev": true, + "license": "MIT" + }, + "node_modules/lru-cache": { + "version": "4.1.5", + "dev": true, + "license": "ISC", + "dependencies": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/mri": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/outdent": { + "version": "0.5.0", + "dev": true, + "license": "MIT" + }, + "node_modules/p-filter": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-map": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-map": { + "version": "2.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-type": { + "version": "4.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-dir": { + "version": "4.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/preferred-pm": { + "version": "3.1.4", + "dev": true, + "license": "MIT", + "dependencies": { + "find-up": "^5.0.0", + "find-yarn-workspace-root2": "1.2.16", + "path-exists": "^4.0.0", + "which-pm": "^2.2.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/preferred-pm/node_modules/find-up": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/preferred-pm/node_modules/locate-path": { + "version": "6.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/preferred-pm/node_modules/p-limit": { + "version": "3.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/preferred-pm/node_modules/p-locate": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/prettier": { + "version": "2.8.8", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/pseudomap": { + "version": "1.0.2", + "dev": true, + "license": "ISC" + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/read-yaml-file": { + "version": "1.1.0", + "dev": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.1.5", + "js-yaml": "^3.6.1", + "pify": "^4.0.1", + "strip-bom": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "dev": true, + "license": "MIT" + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.6.3", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/shebang-command": { + "version": "1.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shebang-regex": { + "version": "1.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/signal-exit": { + "version": "3.0.7", + "dev": true, + "license": "ISC" + }, + "node_modules/slash": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/spawndamnit": { + "version": "2.0.0", + "dev": true, + "license": "MIT", + "dependencies": { + "cross-spawn": "^5.1.0", + "signal-exit": "^3.0.2" + } + }, + "node_modules/sprintf-js": { + "version": "1.0.3", + "dev": true, + "license": "BSD-3-Clause" + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/term-size": { + "version": "2.2.1", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/tmp": { + "version": "0.0.33", + "dev": true, + "license": "MIT", + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/typescript": { + "version": "5.5.4", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "6.19.8", + "dev": true, + "license": "MIT" + }, + "node_modules/universalify": { + "version": "0.1.2", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4.0.0" + } + }, + "node_modules/which": { + "version": "1.3.1", + "dev": true, + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } + }, + "node_modules/which-pm": { + "version": "2.2.0", + "dev": true, + "license": "MIT", + "dependencies": { + "load-yaml-file": "^0.2.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8.15" + } + }, + "node_modules/yallist": { + "version": "2.1.2", + "dev": true, + "license": "ISC" + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + } + } +} diff --git a/package.json b/package.json index 932612fb..052467d3 100644 --- a/package.json +++ b/package.json @@ -1,14 +1,14 @@ { "private": true, "devDependencies": { - "@biomejs/biome": "^2.3.6", + "@biomejs/biome": "2.3.6", "@changesets/cli": "^2.27.1", "@types/node": "^20.12.7", "typescript": "^5.5.4" }, "scripts": { "build": "pnpm run --r --filter \"./packages/**\" build", - "build:wasm": "cd wasm && ./build.sh && ./build.sh --node", + "build:wasm": "cd wasm && ./build.sh", "changeset:prepublish": "./bin/check-deps.sh && ./bin/update-version.sh && pnpm build:wasm && pnpm build", "changeset:publish": "pnpm changeset:prepublish && changeset publish", "changeset:version": "changeset version", diff --git a/packages/direct-match/package.json b/packages/direct-match/package.json index 3b2899b3..4c84894c 100644 --- a/packages/direct-match/package.json +++ b/packages/direct-match/package.json @@ -1,5 +1,5 @@ { - "name": "@renegade-fi/renegade-sdk", + "name": "@renegade-fi/direct-match", "version": "2.0.1", "description": "A TypeScript client for interacting with the Renegade direct matching API", "repository": { @@ -12,7 +12,8 @@ "!dist/**/*.tsbuildinfo", "src/**/*.ts", "!src/**/*.test.ts", - "!src/**/*.test-d.ts" + "!src/**/*.test-d.ts", + "renegade-sdk-wasm/**" ], "sideEffects": false, "type": "module", @@ -24,18 +25,26 @@ "types": "./dist/types/index.d.ts", "default": "./dist/index.js" }, - "./package.json": "./package.json" + "./package.json": "./package.json", + "./renegade-sdk-wasm": { + "types": "./renegade-sdk-wasm/index.d.ts", + "default": "./renegade-sdk-wasm/index.js" + } }, "scripts": { "build": "pnpm run clean && pnpm run build:esm+types", "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", "clean": "rm -rf dist tsconfig.tsbuildinfo", - "typecheck": "tsc --noEmit" + "typecheck": "tsc --noEmit", + "test": "vitest run --no-file-parallelism" }, "dependencies": { + "@renegade-fi/http-client": "workspace:^", + "viem": "^2.23.15" }, "keywords": [], "author": "", "devDependencies": { + "vitest": "^3.0.0" } } diff --git a/packages/direct-match/renegade-sdk-wasm/index.d.ts b/packages/direct-match/renegade-sdk-wasm/index.d.ts new file mode 100644 index 00000000..09a6cdef --- /dev/null +++ b/packages/direct-match/renegade-sdk-wasm/index.d.ts @@ -0,0 +1,15 @@ +/* tslint:disable */ +/* eslint-disable */ + +/** + * Derive a Schnorr public key from 64 extended signature bytes. + * + * Steps (matching the Rust SDK): + * 1. Interpret bytes as big-endian integer, reduce mod Baby JubJub Fr + * 2. Compute public key: scalar * G (generator point) + * 3. Serialize as uncompressed affine (arkworks canonical format, little-endian) + * 4. Return hex string with 0x prefix + */ +export function derive_schnorr_public_key(extended_sig_bytes: Uint8Array): string; + +export function init(): void; diff --git a/packages/direct-match/renegade-sdk-wasm/index.js b/packages/direct-match/renegade-sdk-wasm/index.js new file mode 100644 index 00000000..95351f64 --- /dev/null +++ b/packages/direct-match/renegade-sdk-wasm/index.js @@ -0,0 +1,182 @@ +/* @ts-self-types="./index.d.ts" */ + +/** + * Derive a Schnorr public key from 64 extended signature bytes. + * + * Steps (matching the Rust SDK): + * 1. Interpret bytes as big-endian integer, reduce mod Baby JubJub Fr + * 2. Compute public key: scalar * G (generator point) + * 3. Serialize as uncompressed affine (arkworks canonical format, little-endian) + * 4. Return hex string with 0x prefix + * @param {Uint8Array} extended_sig_bytes + * @returns {string} + */ +function derive_schnorr_public_key(extended_sig_bytes) { + let deferred3_0; + let deferred3_1; + try { + const ptr0 = passArray8ToWasm0(extended_sig_bytes, wasm.__wbindgen_malloc); + const len0 = WASM_VECTOR_LEN; + const ret = wasm.derive_schnorr_public_key(ptr0, len0); + var ptr2 = ret[0]; + var len2 = ret[1]; + if (ret[3]) { + ptr2 = 0; len2 = 0; + throw takeFromExternrefTable0(ret[2]); + } + deferred3_0 = ptr2; + deferred3_1 = len2; + return getStringFromWasm0(ptr2, len2); + } finally { + wasm.__wbindgen_free(deferred3_0, deferred3_1, 1); + } +} +exports.derive_schnorr_public_key = derive_schnorr_public_key; + +function init() { + wasm.init(); +} +exports.init = init; + +function __wbg_get_imports() { + const import0 = { + __proto__: null, + __wbg_Error_2e59b1b37a9a34c3: function(arg0, arg1) { + const ret = Error(getStringFromWasm0(arg0, arg1)); + return ret; + }, + __wbg_error_a6fa202b58aa1cd3: function(arg0, arg1) { + let deferred0_0; + let deferred0_1; + try { + deferred0_0 = arg0; + deferred0_1 = arg1; + console.error(getStringFromWasm0(arg0, arg1)); + } finally { + wasm.__wbindgen_free(deferred0_0, deferred0_1, 1); + } + }, + __wbg_new_227d7c05414eb861: function() { + const ret = new Error(); + return ret; + }, + __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) { + const ret = arg1.stack; + const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc); + const len1 = WASM_VECTOR_LEN; + getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); + getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); + }, + __wbindgen_init_externref_table: function() { + const table = wasm.__wbindgen_externrefs; + const offset = table.grow(4); + table.set(0, undefined); + table.set(offset + 0, undefined); + table.set(offset + 1, null); + table.set(offset + 2, true); + table.set(offset + 3, false); + }, + }; + return { + __proto__: null, + "./index_bg.js": import0, + }; +} + +let cachedDataViewMemory0 = null; +function getDataViewMemory0() { + if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { + cachedDataViewMemory0 = new DataView(wasm.memory.buffer); + } + return cachedDataViewMemory0; +} + +function getStringFromWasm0(ptr, len) { + ptr = ptr >>> 0; + return decodeText(ptr, len); +} + +let cachedUint8ArrayMemory0 = null; +function getUint8ArrayMemory0() { + if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { + cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); + } + return cachedUint8ArrayMemory0; +} + +function passArray8ToWasm0(arg, malloc) { + const ptr = malloc(arg.length * 1, 1) >>> 0; + getUint8ArrayMemory0().set(arg, ptr / 1); + WASM_VECTOR_LEN = arg.length; + return ptr; +} + +function passStringToWasm0(arg, malloc, realloc) { + if (realloc === undefined) { + const buf = cachedTextEncoder.encode(arg); + const ptr = malloc(buf.length, 1) >>> 0; + getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf); + WASM_VECTOR_LEN = buf.length; + return ptr; + } + + let len = arg.length; + let ptr = malloc(len, 1) >>> 0; + + const mem = getUint8ArrayMemory0(); + + let offset = 0; + + for (; offset < len; offset++) { + const code = arg.charCodeAt(offset); + if (code > 0x7F) break; + mem[ptr + offset] = code; + } + if (offset !== len) { + if (offset !== 0) { + arg = arg.slice(offset); + } + ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0; + const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len); + const ret = cachedTextEncoder.encodeInto(arg, view); + + offset += ret.written; + ptr = realloc(ptr, len, offset, 1) >>> 0; + } + + WASM_VECTOR_LEN = offset; + return ptr; +} + +function takeFromExternrefTable0(idx) { + const value = wasm.__wbindgen_externrefs.get(idx); + wasm.__externref_table_dealloc(idx); + return value; +} + +let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }); +cachedTextDecoder.decode(); +function decodeText(ptr, len) { + return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); +} + +const cachedTextEncoder = new TextEncoder(); + +if (!('encodeInto' in cachedTextEncoder)) { + cachedTextEncoder.encodeInto = function (arg, view) { + const buf = cachedTextEncoder.encode(arg); + view.set(buf); + return { + read: arg.length, + written: buf.length + }; + }; +} + +let WASM_VECTOR_LEN = 0; + +const wasmPath = `${__dirname}/index_bg.wasm`; +const wasmBytes = require('fs').readFileSync(wasmPath); +const wasmModule = new WebAssembly.Module(wasmBytes); +let wasm = new WebAssembly.Instance(wasmModule, __wbg_get_imports()).exports; +wasm.__wbindgen_start(); diff --git a/packages/direct-match/renegade-sdk-wasm/index_bg.wasm b/packages/direct-match/renegade-sdk-wasm/index_bg.wasm new file mode 100644 index 0000000000000000000000000000000000000000..bfaf52ab3d493f7d6f4fb04528b4ef2038a0fe38 GIT binary patch literal 46531 zcmeIb3!If_b?^V)_HFhIvmt~)hJ<%-V*(+-a2+6q%sUArhzZfeBwk@)1~M}+12Y4G zO2Uv!iy949TdDPeHC4Ps(ON}K>$Hs#&xuMu^^(&@MH?&U)6`@7_kA zH(x~=ij?hn8za5dvUu_Ivs~+EfQ$j&2E2_~Rdv1HeRtZ@Qzfe%{Jo!Pn!li@zpH!C zhD}@N_YTe6u;I>4TQ{s892^+ju&8_KicJeQEpF>v(YbiZ=EYv)_{tZ$%KhDUZdkOa zt*dQw>(V6)mvnDhzHFh_G`?!u@6d4P=DrP!H??-HXj`&r)0V{xyO%84;!Qed>8MXifAEnVK(xo~sWVlNn9d6s|xgRR~D8+!VChBtKY8SWnJAMD<;VYqYCwr(#M z?i$VnK@j?0kdOR)A@IB)@EU?ba}atV^bdlp%Do^gMNyOsqHGw1;bf1wi6{?A7QDdA zH%!TfUgSklNPAj_p&w*v?}b4`)ts;Y(OriB1-YmY?C|H#9q>l-8OENREijMC$jGQy z%zeTyWVd&39~j&lcr&`X2YYsRZy4HqNB_X!;D#N$Hf`(KyrHjqulKS@7u}sM z*xl{Dc5+?L_RekF1~z-wO{vQp>~@(iJ-;rqMwubspRr*gp*D1-Z5Eg6+Aw2-!`_}k ztM4U#@$&OFwXeT@vn8^^((HtxbM}in~HaCt2Do)f8e(3y9aMdE}47h zD{pP|vkhN-I2eA*B|(0_e|OM6_FwEJKl9f|?K~fU?hWgr_QY#0k|_38{AAD0awd85 zbEDquz^mj}H$};;axU@WOkX*q&QG6vE_VY>Gs&f~pX7IMt$2OA6MrW~{%~Kis<)gg z#h-FVV6{dl`~1Adpr}`x&!CpSyN{l8$*k*IhRc!4L%@uK*+B#xm28|@ z+vLSO`gjl5^B&MPTM3&yDu=O8hfz`Wr&2*RgE&eq+MPr@8M#ymu4_?lOW7maXNWjx z@`{aqaf}wp6Dg`eQZf=G&xAszxVEK|Ny6O~Z#P5>n~rdn?%_9IklD$>ytW*EIQY7)Q&3#yE<@WkDXi!TFRM>xQO$>^B89DtoKR@a`B-G)DtR zcCa?W(0QriK?Yu?+6$;pFXw~~sFP@{cxwPPNT!00(Zy?Va5Yuwuk3uqk3B(0SAx!m zh{@Dm{wejwUQ0O&+vBL5jeU?L+p}zq=~G5hz5CUUy<(hA=#6J?byHTL%noMOun|eT zIJiz=#W^t0TTa7IjlHIzu|PAWAb*qJm@mc#nioTrEL<7qmIc$*W2xfP&;Vv|wV0kx zy-!V7Ff}b`RLdF#K^9(#!?gk*CI${(f*3|@^om~5cmUk*j71~u;R&O01q_%+7x#~6biU<~0to-zD$49{w-4WH?) zXAO%1m#aZC2@>3;Xft_}|RrZ0b%F}=hTH)^DO1M*tQ281jJRkx~ECnIKWB!q$* zvb?dh;xNTCjI+J!e+*A1+OHw%O+b`Y3Zl6&M58!oh)SkaXM`Dt*OkM}+43!e${3otgWuXpwgs3oYb%j>93=QDs|5sUfG~{q$3aH# zQ;U)vMNnOhEUAg5ig$xLr_=R2os6l97GDA<6)nD7{3d{$1PI1N3)S*Klu|B8Nk)@i zXg*%F1fV=lv;J8m(*n)0w#Yi(7ED#%hJ%f>waqyx!kf6H%Gta*&L(Fh zu$?##OEcIc>UcUxSY5``(HKv&zZp-5$uoYHsl#$0rnamaS8F4zZc19dhLM)<*xZP# zZEwT4(lyl3b#LX#ljNBsQT9_xi0n$}Su1&3iBoBbp0#Q}RpNA7qGzqzvr3#vOZ2Q&yYD!O zXVMZqYtJuMR zLOCiqTA%o|63S7@vHHX#N+?Gq$LkZ1Dxn;ejMgU}S3)@|IZ>bZh7!tA$;tY}lS(K@ zB~K~wM4HgER`RqGr_vHVYt??L#Obs|&sw!-l{k}@=vk|FAB>bdla}aNtM-6OM)*hI z=vk}w4kZqzC3@DXy<3SxX^Eb-Y7Z%KI4#k$R_$X-97#*`tX2E85=YY#J!{n-QQ}xy zqGzqzqe>i4OZ2Q&dt8apv_#KZwQneKA}!IgR!u9`Eu)k5btFa*3A6ib)k}8ORG*+X znT=kSJfr#}BO_XkQW}wW+P$K6gKS-_??yISx3%y(AS8J`#dm!umt#SEWjTdaPU|izFR7zETLg>{{DZkS~}fez9mW$zk~KM2b$c zN!%yhB@Z2dJYomMDhU%1hzyiDfmbdd_)ERX3Dz*lHc$&qQpW|}&ndA~H8!rREqvO{ z>~-QYks1fVK?c(a`-`0=j@C5gc!W|s?nXt94CM&8YPy;_q?y~!AP(DEzJ5FN6Q5$K zXu;Ta#w^%&2JhFlGtcR0mPP+nCCv#;*)mdwO#j4as@hnll$y$xNAVsW)H>P#wADN~b5>Xa(Fb#hv71_3HJ6O1-cr6G1t zIRWw77v9p?DgMSPOH_O1p`cYSga#clKt+giDD8<2#xOz zdWnp5n9@r)IZRa7$e@3qmS{V^u3DiWQ_)!oPDQFh3YeK2aCkWR@gJBlv5Ir>)B zZwmbVQ}2EeE0yINTml7PNJgI%dKGv@k4dF@JKpr znVQx*WVPP>tB&;8MFXRXd52W`HRjUAvT z9iXTDO0xhS4Jr+K9t`$XGW#kyy+4Dz(DRI63HQa}Ef4S8SIH~m5S7Al=tUFJJHvR{ z_&ghXl%b-Dm>ofx&&E@&!ZE8b9;uU7e!i6-vGVZ<9dQViDuooG5h?-Os9!OlPavY= z24JojUMB$=J^^-rU!@V_CV%V0N}k62iJOJmzDkoa&QKAL*qrdNY{a}FT_wm9Qurx4 zSw|3~-jTBilAlPB5%4Lb1UcjN#`%c^Ic60cK~7nP@dP<#<&GdHt$aK|jyZx%uS`n` z(rWbB;il|~Aa00@w^qq<3V<=#=7jD0DwE^JxXDrDupbxWMruKgDJnh^ifoxUdy7%) znSeQKa@1;6`7x;3BnrCrC&V#1*M5@9M`&-h~i@gp( zjA}aO!qap889DN-9piePwiYK`~j{A<*qOYSL^l2KS??Jpb@g&#Y=(kbi%f$uP ze2@6nmD&P5L~C1+$3@+ON-7QeSP_7-+_7rw*wQVvg%Y)toeB|JHqi#OCf$G@L-q-@ z7l$of)*}#3K;S094~P!HJI27bSsw+!D9*!wgHm~VYEVPBv zQ^-6MVuu>jDRp~w_%ZNLV}l!Ki>S?x|5WvaP=IfhZ4$wgC}21@*z_?_GHqdr!AxAJ zrQBFR%uGjuM_JFH+la~4SwmYm9i{BV$49-=RZ@E6Qr%*|%Tc+|@v{#+`UaO=FaPcOj-OTEG^ek|p>DN+u;bs}`J?x~>#^_r z@4X$rsJ>Ar^XitkVIM$gAH;WXiC6sN|ImK*9RK_CPyO;thqkK&mwR!EBS$&$C;7=h*!Zoc_$)jvjY=+9?DTJKu!u>cgXtz47B;d;6zat*8Hl z?WzvDXd-rJ?^fdxJA1R5fYaH#)p&gVU$|S<(IY>R9%pY>GA)y z&8m)=XEE1Vd)0Vap0!m?Am#YIs-BGhwO5&J{;$32H|pQ+( zeLMFyb*3>0_czO|8V##vl}QGSOJ`Y`f#ob16QMY5RFIGBteRxH<>k^m$#M*M+eSut z&!z7t?LBY#BfMv;eV_|w(mIlR`PkJtW%YAbf6S`Ob<{2OOdXx9o@}^G$N2Rvi!IYJ zVNqkDWjgBDG6#s%L(@1II6LK7P$_iyzn!Yjr_du!)59jC5*Aq|&UM^%@4h%=THmh+ zO9t3Puw-+c1(po0iExeCRc0_83Z3S9JaG1sOrHh-jSC%DAG}Y>XErVZlfy#R)+DF3 z3T~{eY*hhlPEo_Cq6Cu)jH>A5e=U_|K21bN7Smbi$V{4uPSq-!g0hJ{q_I&;3vr{- zakA3bDh+1kI1FX&nzky_P;(MDI8@EB#DHpyCshp~GoVoRr6-!XDFbPeLt0&9AZ6o{ zQ%X^OO-aTMq68}_6X#zT0kC)`;*XIt5&g4JKZ?7}47^(m?d!qPY&|!jBcZc;uzPcL z*pGsAMgU^_nIQsZxpDK|5Kq>8PnLQO6>(@3WICt~_DrhM(>L?$a?Lb1E7B2Iwz<(Y z=jcjLM(?9O5Yo#LXy|NtEmVk|+6!1yMOjuNc18~XpgJark^T;=O$J7kiY;mEr&@cM zh}2SZZOz_dPRuTwttv6|gYs?GuWL=_a+S1F!d#hkkq(`e-XA1rM%XL4_&jKwGb_T` z*{1?$P(Kks5#e5Gsv}}PZZ>PH!lKAIq%_R!;4hoKiWwG+mKQ`;>2z$N)K)CI!H+XI z_O}=;9UN(vn&w!n`P9m5g3K5St9MBX{*9BojuFpNGp$bcCiokZFANxZhHL1}MoQ=?*cybiC;*9py&r@SkD&%E!o ztkb@-6pT~Lddjlscr5El%TiQCt=4hN(z$gq!g+z>dunB0vvD}NEhTcde)K)j`WAu? z@beDx@RK6pE~J9t*}+|Dqohu2Rw*)Wo^Rzj4Nv3XCT83+2u5c|9 zjkQD(&gf4c!9~xJ0bvV*?)=^5Jj5*r0p|+IEDNpEDGT|uv>1g<67|i-iOhEG?IgU8 znydhV(RvlWf!9xm7fe%MIY@|#vxBUB@@Ma4oOvE6=h)Tjh+t3~fX-iMp&z_MRyaSI z)SGxKJrQ!m`-V45oU{ju@o_sP!j8`})xUsCIQ z3jq{$ayvN@jMj2sGsY~BidhtLz{FEgD}?T-rgJ;Jt_Y)9mZufWvrX)T6$@kBLpl1*Q(>|IMpmBzJ**83|bB}jC#!oF!heV ze^gZaydHH_D}?8!8pon_R4d#-Xkk#J+Bf_v)!y+(FPv(~EK%(nem&K^MCXd?W=$nO zMmK;bb{3+E>d%ENTT$;Elso-_vnltC&2^Cc&ky{2DTg1rN;x{Qg-*uKCQ#3^z0@uA zX|_gd3w?$q>lgY(mQ%mbXIf7ELT|C0`h|WW_|`4-X)k=CUwrO`K5cBF&tikXoQlH* zzIUbPB@N;;&&A`6_~jru;1^eVO=JZtJp@@2YoGjb&M(^57<2fRuQae+M@A+4yy|Wl zTi%GT7+-IJKdF+pfVMykLzt2T1q=sbVQ)f=5~qpT-b#U(U_1EDTjZH7JdVh(0Io0Y ze<>?hGoe*S)Fxp8HWe9qLPJTOHCg2rD{H;hhIiM7Q{%o$#@ZB+nFQj(c=XAt%X8qL zUEP#PMx}ped9e8v1x#b&v9OBTWtx&Rxt$do&H%F$Y{I1!z?|F7Ld@mhQu_9Xj#sO^~QScW6hIa-~;BDAj zn;%qpn;~Q|{WYSUu&ef#3u+Mi44E%y1Qt71fiSaRzty%0CV1DovB|rT92xA%Mgl98 z2$k58CZgUV+hf?LP9;^UOhEt09y|ek7F;hTZ6xr7%^&@|5B))c(JN;iL&MHQz=u0& zJ}K~gm^fd~YN_Pep+*%7cgjwhq(_mo)qX!6K=&=NLy>N7&lYuJXkz;wqp!8UpW0km)dLm{fQ55 zBfgdw+cd8wdqw0afvVWTr1e_75sKLht`A(36o(OMg9jo<6~{a-rh1GrVhu-|3bDp@ z)PXjRAwg4=sw0vG_n?5)YC}UJei#;}9iz$PDNUe+x`tAoBcRatSm6~TP8lVnfGlRs z6pQc55&qF&;UCho$#a1o=ADe{eN|_jo5>>>PVflI(-%(k2+BtnPH+jzM~9(*%Eu|7 zNMbBoxg*HJ4R}^)#;*rNuDywX96A>u^7l;yL>@OrJ>t8wWt?^Ji}S_GiG|ARToR{= zx`}hnmB2x?fr^)grpGwskE3c7$*%|X6r)W9Rj$0VXx6Scm+@Xy=ib{`fkiDAgpV$q ze^`!{Z1o`e3G+ibIL!wqKc$X+Q#|lIv3a`kLW;*8^|<4OV}X-yA`>;OwaBG!|ejkjcHtHo=gbl+RkRo)SZOyM?DMgIC7=e z^J)+QCSAeMI=@fjOQr)G5ST;HHO0F_xofIGd}A)>(HRM(seV7}XC^pt7*R%%wza(b zW(BPY86KkDwZwj};>cr)`;3h3e0*c8?VCQ}q6i5}t$sFD10)Y3LKGkrz6h7fJHnS1DFkPA zf~be;E>2Ytt9rF^4O|zrn1XAepDEN98=6K3TI{98KB|VCX9h?FAo#qVr|&2Yq{M|> zPlX675R|DnL2ZnV%4G_ED?91loH$8(z_Nr z++VHrf#V{Z9RAd(m&{L2@F=~?f!U zjvCIdRx#}Hoj83hl)VgjU|Ef2DkVEB5w9YkU{zQrW7~I@qCYw{3J^Xc@-40!`r_TI zMoMcS#|w}hj95N&R63tszxtn52M&vj2AkSqk{_o!96`xiz|2%&fyW?-;+b|0aJ_Eq z8hqnGVo)`9Vaa0<)tW&eEqF~iw3;F2b|1dz>la&6X)M0S2f+#;7xBHQJ%rR!YH3yd zrlwf^Vur48e$2W-@%G3cn^NOA_XZ(gvx}EE+PIo0^Ln993SW|HMJJSZ8imvD1eLy8i3-T^?)LIXj+{K zzKjJu2xx4oneZ`4#%2P(tj+|YAi{KXA5iSq3M+mp@*DSS9{b8on#TwqgQ#0Zu@qh4 zRC>>{wd@Z>L|m*M8SDtQ35;>EJb2l}z7MAs3>XJ|S&C3Yc$@D8t4g0n^WbZ8O%>gc zke@nf;J5+cghXmj$$6r0AJ*YF4P>!RsE%x{udcDMlhpuWFMCEYEV3$QQhn+$6R5OA%rIekBCJErUKEJHa5Xblr3V~02`7IK0Jzqlab`CauE;=VsltwH>IHI<3KVY852rizYgs} z`Q9^_m<jFYJmUe0oj3*yJRI*6s}c9_%R7XhK?I7N z=i0_Ei@D8p7|izYLeLT1K)-yMg98Y+y3vFtkOR~?-(cW4TEOOuxzE|oPJNe4l0_F# zXcLLAC&{ZIuL9{KD##bjEmV@Dl2vRD6(PRBkK`gjc}rq7!u^zHqsbPp^mS?qCCFlP-MT#2-D zCRm>PlEp)|f_wnrzF1X<9k5oW&b0;=<+4DP!tY@G%^5u%6_dHxL6ss!!&u+LLK^@Hl&(>gJ1Xk7b>lZQDxP>|3bML z(;T$eOi2KGbcIGnGtGfPo#tTLnCVsHv@!NxqiP-G6VWss%rfl_EyNTi>ucP1PUq;W zO1xt6(GX4Cd2{hXB^-_gkVLD)L)N(O?7%?lL_KTEKrwm;TN=`f+?2U=M#vd3qEnj| zab<3g;IO|p`L1fq)0gi}qSA%Q50pmuB$?8Ml4ykrGds`ASE4~SMyyH2Ir!J%)=k0S zT*&Qcf-5<2gys&U>fpv+DjQK5l&%9z69g&}cdozW8x9^pU(x!kMCPaiZ-1UQHdgYt z@3YRVl<`=t9O=;N3IDe{_^q`F) zG-L^zb&yWHNdx25+FcyFhJ#H)M?z>q%C<{^5VGm*Kkja!`rCilZbgZha215RMyR`< zLv)Kh3tnLBigo6|6NT0 zxRQEMx^#;&?fxme#+K8hzF1JD)hhBhb410kPMH$emLWnN5mMjg1scK(RGo^hTY5bc zZHs_e)##@4mo=Rr1fwHW`R?Re_||dH29j=4|#ZOQ>2J=nB*z4P_2d+cu&5kou~jw%RWHQQ?kt| zKJ}%T!5{lUv@TYdO<3lb#13%6q#(Z^8Acj1Z-~e^ z))vV!JkR^id)g7f+V@$54k_ZB8sea@G}*+&CGw8koirp5A!ti&Uh%Y~s@oewh;~{o zwwr_Y=cp>6R(K_yeJ3qOUlrFdn-351Sc5tiDl6NHgcjqbq#a-EoQ&LQc70TU?$49}K!gFQPX&%>&^H-iz~ zoq2(~Gf(O~?uYcsy9y1t#z^5`==6%3;MhOhlJgo!TKNtX6MhIQ$#21D;uYGO zifFu9MSx9j0s_Soq8(gH0BXiGxE#Qv@kHAB=Xr7;xTRjF+@SV&$+uwh?HLmFZqI-!;#73IZOC;6fg#vgBGiQ-+B0}e$FHt8 zLxPRrMrD>%AMmv&vwb4o!%~y>1`!x18~9eM=3P}BLpk;1_JxF8Q#dqU#734^j@?{A z!n{s8v<4O$NG{N+MQj}og8bb+xZsIiDIX+fYiK=p#|@(iS8~$-oKQQG?i^ru)CZUX zNlz<6m1RGxi}K!A32uFu{Z$S01uftI1A8=fmQALP>ZqdAyRhzypu0Hvwd(@L4rlij z#n~bWa8<(e^P{L^e}^)|TUvCIqU#U}cX2RT3DVDEl~<}{?_vD@kD%SGAyi4zJ|x^sQ)Thy zlV?88#&M0r?o8;!W4d-drWF4M4<=Z2lWQ|+K^Y(m$spjEJM0Y zj+36_Hg}!iC&%j3M{9}FI`(f|{&lvP4gkpZlgTpCkntEoPRm8$X!a2}%%hnqf+#>k z60aVn)6xwwtmkUmAsQ>+w$sp>u{UrLa;D?MNHpN#s0 z04UD)lg8azFx6J7j?yAk!|KDOvRc(Fmz=6KvodiBWvY@(+q;^6GG%wN!-f#4V%c}v zkN{qi3J2X^!X;?Kjz8@rT}RV8X_n>#h2=e@#pIFpatbLz{uzH?v zECB!2?o)HN>T`Zxfhgu9^2mKe4#up}+VOiDKjG3^D6n;{T%TCL)-GKoe=l)Nq3-eRxuPPQti*`eQ{uvYw1xx%>8@H{j;_#i2`cxjoiQm^WR*#ktow2!2D z9sfkTO(mtnN8J_&5A@&rg!%2!1a+wUKkVmOP?g9o)A(!@1Q^<2t$mN?pm+nj_P9YCjQw(P+ zO61gWlD3L~6oow0ev|sVrSu2q>`x@BSEboDA&jZ!aHW)U`hie&dU;s<7r!bx&fn(NO#e zN`S~MeUz12Gm{Rsl{g`hc|k&g!~9f8ocaG7&dhRE%WB0$L-CSl!l_SEvPm^cTTZSZ zyu=(DanK>f3okiH!8}5HG0F968**}=-t-Sm zQd{bfOVI(%{6tB*aHg6P$va#Hc2#*gSb`unbuw_l=qtU8c)-~+dB`2ZBf~a?`30OO zJvTXlC;;87bds?(Q!{g1aVL-RPw84nExlV*!$)M=J6}7-9zMp0t=))!UmF5US^4@b zzI>#+*=g1pk6Nuzfyjp6r}N*r2XsWh3e&3<&5{(k3=0`3m5fmF%y-FF*xK<=pMUr> zU%meuKl^*{e$CJFj%V)qgFpMdA3ye`&+WhezMHTxBk+a_*3Mdd{=eP(m!JH{k^g>k z+Ta5pdhU~7`00lpnsNVq9o{S0Q`ihR21z)Yau>Qe7|H?+GO$62439Z7P@Dgv-qN+w zorp6Nx2Bw7+&ELZrSX}Ud_gFFiGNDhmN>*Iq5H?VOW`Xa3}e37FNrwJ8ir%5{#jDG zTJ#d)C}KuC5gg~x67tDvWpwO}QWsFG=j6-Qz35(AriMVRwZh(9+5+R=XS%9iS}br0 zhrC3-hvbY}wiz7BDZL+kCqORY%rRv*q&K<=Czy^=-N!8YM2>YKql!tI&ctBW|Ecf$ zscEW(ZZxUe{6z`CsBQj+?bzlI+%>fUtHV!59|VxCa6$)tm4=&qt@#sgBNOeaj26b& zrZ?mv0J5NNDEp|hZYYZ&92=^`Prr9H!{-miln#MyYZR+R#Ad_w*+PPLBmjyUtXXp@ zqEc8T#crYHv$rv$)WN05(_D&DP<;F`ngvccU@y&P*&e!Z-JE)4SwOuLAc!}_i6+Rj zgg5zq4qvEDC=cJ5(5;$2b%u`>aLYM{PikyQez|7YK5AB~b_KdCV6K zZfDXusCU(;TXg_(4NBAMDhWc0I!IPfTl`4KhFmf} zjtPD5!GfSLIS^Q|J!el%6;c+>&d#HCqMC3t;Re_b+TN+evXcmf1?Wsis`#y`0N>dt zw5UzfyK8$KCZc#qg6kZ6oJmr*#Z(2Xe7{qF%^t^+aegVcF|o%@)gC8%ZsHzyj@`)k z`zgQPuL*K6AhOK<07c>%6Uvdu_6V6cglB4G$jLOZwP5aYjB7r9tmkcoj3hoDIP$M<6Bef62VvekoJLF-A73DSYk7XWLJN#UvfA97x#W!8V%|c`ZD(#iw_EvO1J( zbYN<&Fq_r2LK`hTTPmCUNGm0S@WK@t z?n`j;Eqpu9%8tWXK$+FNZy$zD-ng!|8vQz3%iImDQd@l*ImYv$zH1kG)EpA5vJw!W z6|=%zJyjgL4COAlE=sO1G#T?*r1k2YA#zLfakg(NhOML^U3k>(#i{B^{<7F~V(lcQ z^C5VW-!bcn{mKMpHM=UCt7*8)1g52nT{XMR*Lrh|k$y@6L$UR1VHp2N|7NlqtvO4C z2@Tq{BDl%kPU<9B?IcnQ%_}WM61pjTmru>H|B^>OV|o!A(4;U5*>5bz91&GzN`7NL zK!y`jRf%sds~Z;~ljJ0J<1w=~; z2|!~WY(kAZm^<^qf|JwiPDy7o&C#Vzhbtvd-#bbxCJ}7}>Zxx-$v&X3C`=g1tc_A} z!yJyXG03kIBrJ6%|FYh71kgj3NzBb}2ypJyfvm)bGhC3W~ODHN7o zBd)aF84aSTl92@GO^0b%2DZ~OgF+qJ(uertMn2W4dWCJD6KxtbYobPIf}3w2kULPt z$f0PRP}(o4Qu5h*Mzv8vj6lSA;oZ3orZdu5=cVLBqU~6BkNTcg2=E4SXn~C`836hl zngVBUnCj(VW_dY}pqSLnSgS$oRL!xRQu3gn7E3}kpmtsP+R8*97PIThXS&9BrJO2z zsPj_tV|Aq^?YdGAye)TTlzY1t8V7eL)5}5F&Zv8^1nv7oK#;27M5w(*w@~z)ud`*v zEznaO-Hy8=@r&2NW+sUA538#$4rK0&r-Ia>Xn_;TV{Y;32ox8c&OoG{<8HmhNQr}- zqEL;A!MK?xwLs)gqdK*qtC|2H3C)HzrkJQ}bPj0+?Guno&(P0>n8hvC;f1UQv8w|9 zaMb=f>SzZQX^bwqo`fC4KM1kObgli4tAD#J<)m1=y0)?%_cDDmAqh+@)*>|(e55;| zcVH)govc8*3eB}!T;ke0Ne6-$#g59sIs9ylZ@ceHT^*<-8|K&wka9tZ=Ne~c~Au8CwSy%?tU9MV?P zEjtvkU(;Z@@gAI-yqkl9^d18qbv(drXzAw3VT40Dciyof50z|F)7cI+`S z(b(t20d>_#0I5o`wphAJ9(WkyT9?(sO^^`JQKzi4H6pfY78;S@^SqBSHB^LA(A_>LIRgqcgCwW1=8AOxS`S7dag)awl_ntrYT(5ZPT3kRO8xrEApa@sQ=f^8_&_U`HJw=!;e9k@`xYZIucXNZXLN zC1^)V^Jmx;Lxhq*U;*ty$yyu(1k@lU%Z)lhBXZbMl8E`ZQ4i!tUzxoYHc~&1>+}|$i}NdiEOthUsjl2@l})LDVt$OW>jXs0W3_0z#;%<4%(LxF-=-ZR6jq2md{)>~8mwS@X&IQRq?Jt@BuDjEz4V<5 zYhoE}kiw;sAnifPp?dxWQqYQn4o{R>)rHeFcC&I*CU!&WXE2}!5^Y85lUZF3A05jK% zU1M9`k+IjqwO17$Qka(RJGDONV7nl{;R?$+j&4!SIb}Iq6gBMu{0#;U~%YkCm9Qj8N<=VnCVlW55nQU+A zQa8g*en(hdRg71C$i4u<33`K;|8;iYwn||SwnM{}lAsmmkYE;B%9A5-B7zM7-u)yjT?>_jhzbNeb+xAAbzj^rxftXtdnRj!GXcr~tv ztK-Bz-A=fQFRgZzCpT>Jmm1pRYdDck;%ltRHNeH!H>F{r7OxtARk^`%_4C|SUSC(o z%)l&|&UsZicyN#3syH#w1=BfiE2kRw_+5iP<|vUpY%AQt=45L!%I>Gt4%=7q)wxP^ zrJ+wQ%cIg*%hfH5njn@@Wl}X)=xdQ24P(B*DlMY?6zll-p;7r?-CBEsjAQi~+zOi< ztj#k9WYQXIqdR806_>ZRhpASX(ltJ%#&o6l7nd`^P)esg{B}EA!&CPu5Chew>cV8mcT1>uIz@^nUt5!&dyGtixoT zNwd=SN6306&4M?mCBmIxL2yN65Cf_$yHjZu(gy|l2oO>4XjthO_m@BFnWQw2if0g@ zt0w+&i&K_4{*N%6w7mL1zJN?1k5SI}l{I#&<37jw2ZOjn`6EGP)xLO@@%3*2l?eThFF;d=?Vi66=@O3a;tpm+7&i ze1jgXQ<_+tRq=H~PpLbEDZX2##4y!m8EeK+<+6r+&3cbs)o<+^>23YF_jghcU;@ePRQYa!yxc)BrPs^QjXjCiepa$|Kk#<DVaBrvp zlS}yy_HYJN_%BhUa&u6LB7$>7Yb~70)!fQ!o*5m%W2IcpUAg5|=@un@K%rVrVrJ2B z4`6rJ0=7^ntmI^tZq9WzZhif9Lp@2G=Ly@YZmHt>tZl1LqywDFo->NeHdnURQ+$Si zz{aYwJ&ndyMCd zYOcWx><2jvi>nxgaTQRbh6!RE;CZkvJ4&y4W+4wB{Y^(yR z2-;!VV{>hk(%GZ1^rLtTqcL30jfIq)2F|G}m({v&K!2{xu8q;a606Lq4TQvSOry1a z5b7+A)yEX|u`G^L5T~e*wzynN(#P_+QcbFlgOCLCHm+)s++>s%qw%M2#+A|*jS3es z&SZ^qc@5Ud8fR_|*2#kPiW;m)xfIsKFMILDCWGW&sVa28iN7_=vS~~aWVSD^4Gd>6 zlPhW?!&#(P)`m97ZEa~iU6$e##XX z3J$TD;)~PVFkX?qW#g6gHBU#zc--a0a$QtIcX18fC1<0HD1G7VB|#*S8N~}~u*|Q) zGOr#M+$LHCx>xEFT3m>D&BYhg7W(wKy3l9DXD#%jSrfjeiK231_+UnFaZLb~YXYcp zwg5UP0b3QO^#ZmkbRDZZ0h@^>>IqU#Vdo4XedEsEdVI7r@RJncS+o!ZUbrxn82I-H z!xt`KE~V!&IXET)&nf+u#;QIh^2Vgy^9Z^ZE|fL5V=`_`yq!z3rAiM{$}DiyDxA9` zzP#0_WBA3wWL2sZd(tFkDu0u({soF7ozR3hurg2U40ri-y-SCv_| z>GV~PW9*k5K5Du4O*zLD|4^OtME)~*W@;JitYlQ9(osO1{SQ+BTCO)4#lu^xjAJ1= zUY~(aAvso`akQE^Bw>9jO9yYO>);78j@M_PL?y@SGmcghCj`Mc-ClA))ggQ|Ku0x| zLLjphdZjzu{p4sxP*n-lnCG1#f;0`RM*%6VGB>R9s@iR7zLY_fsFG>1t`%P0w1%`S zO_{V8zqE4HUAfBimIw;f4wW{ZX_x4z8W}XQVtRFzN;938S_KBe(V#kjHaP=9FRRRn z%E7@&Hi^`!h`#2=;CQq;q8kRpOI!IYzJ9U~+uYVo_94qSYqAfD)XbG3hZm<7WmZ4#>FT&{M4VW4BjUlT8}a11Mm!PN-}X+_uzp~)e#;pf9F#4m4ghf? zt?Ec&NSfEH3Z!_LI(1|fxeRR3u9EI(z$I46qn~gyoqQvGL6aboU-Qoi621JU^&k+d zZY@V0xd^$ln(erpvzDCbu0sdf~M}smxT`iQlfLDFgb`2Kg)phovBFa{eMU>r2 z@oM|$_Lhe$?KlGJE(TS8`z`wC)h#V?a#vmCSUIVy7q7ajd`;aL@zr;guO1sCUVWF2 z1p-;}r{H4Q`8ptxztGM^F!oXEov9@r1q*}#cLkWyCC-%456MBDF0JJ1ZJZeM z_S%1n7ILRQ94^w2you@QPv+&yFyDBV^9i;T4dYh4<2=^*9JM~mC5*Z^+3vqI9y*GF zo!T}`i2$xn$%(Kwc6$=iFES$NV{+}{WsV;0N!Xd^2b{kc8p#jdKI$cJfIV&Kv=-Jolk<2j&>z`bS_fz$~ReL`AwH{Gy}yK#fB2tJ(sb>d2&6XCqqjPsxc3nXkr?R!@rZ^5EB1R`Ug@t>LjMa{rMDnaHq}b zys;C#DCYb))kYB2432aHWyKVTQvx}!nH|r3{seuTb%2>oelRi$V2N`%h3tYhh$kr7 z^K^Y09}vNQT%N{z$c0$~kdt4-PS=lRw8ep{ZmyhuC*M?LbW8ZiNTi$i^%A5n`JG9Q z+rs(097)YlK9`y4C9oGgmDa{tHuS_d zGU!1j5$jwbay@^yB||iU{90OF8F$^MaeX>%Ixx0lPa@`Qxr^~ni$g^esHt7Mq(dq( zp^lv`-hhcWCdE?aY5ejy{Nmykh+0T|F;x@i+ZjXOMS+z=AmQ-QR=UDIOwde(K;KE2 zpUysXXmrd*Gz@KhPQn#9(R6up5GtI^p83;u z9nc=-p@16TRXomR7B)mxmW#M-4>vICVPR>)4i;k~is#dzyTI6IAxu?V58>N0###&0 zy872B_9ngTK>;gv`Gan@G$N$ISU!C=r=f?(^jVO{pX32c4FQVNjdVf}wCb^&1!7Pq zdG|3C<-m^diQ%m!iq-N5YFX63ua+pztWw8FWKfS$WCop!9{NX+q$QqLoJ@)6G0b&l zE_{=^7EW~houhn%P*2xpH$4sm=ttTy1AH%fl2-4e_(BMtERv4eJs8g`-j{Xp)cTep z1Fu-bt>SMLaHfC{+}T9PCL@9VyhPYePuc1p#6b9=o^#`;q9D1Tk|iq^SD-H61~n$E zX$H-%tK?dcsrMcMZsL7fY;8N1boB`|EOVuv8tEDaZVM;{NHqbxUNN@ZjL%RZFtMCs z3KZb$LPjm@ce!O%IoN&8Wm$1usOjwF?FUA|kFUNQQ(Ht!dtm>;+U~3D)f)5$3vWSq zfNW4jw#DR`)~;gVxuBCUPG`E{Lqemz!m~g8LhMB-nuO3qQuZuhg_s=jXTcxU0o$rd zV?nXAlOIXEjlnJm2=fpnp*yq>k+AMBO$2TW$a3=-#|jch`nwWfm26OaE(a0Au_u`= z@k}lt2z>MS49s&>3EGo|GbWf?Is zyz1%s$ar3u>e)JktaVGUkxV3>8Ir}4SXqVoCtqr)WmwCI475YlfztX8?>th;gc!j| zRyS?1sCbR8o{7_=A_>n55>Stf#5rq4F;a*C#bBj8rLTgd>~njrRJ_%;l!0+8fApz1 ziO=G+#^xf?xS)G7cdTd^c~SC!G&N+LN zb&VV7ObQK6!Q4;YiuI99hYqe+iOSH4nnYfQQm4V{{?vT>?mnw?`BvwuVnHBE8!BeK zQdC-4EPi-d)`Lw(z2cuWukYX79ryGP4R`A0j?STY$6)vFo`GFM+xEtry1V=19Roc> z1O44y{N@e!Y*+1`;hxTIJ-^jC+%wQ0Z|~e2_YVwHIo{DdxMg5)dv{kn*u8nz;84%* z?rnR6);*)%q)pvhd-~&-Torfscg3?uBfXBI+uwNyLkw-}+1%5=HQqStZv?7Mdxtej zSNEQHbXwdq6c6kgjt92Hn+A6Ecahq1u8NncqTuL^H{a1Y=qh&(?!7YZ8CDTE_H=c} zqxpEY`X7o%vvbC}8ueG||K2o#QXL$k3=R*)ox|~HQ@jZnfZZj%6ufbOt&E57=#IC6 z55tX4u@=g4m?+PiGT7O_wL7+ss~A?Q=(#coX!Ph7aCEkH_zoJDT%m}U66OUpE3RFz zKJFeI92i_lC!>M>-PW^d5V|br+_r6C^Mawl%?q|{AD%xrkV0-t1uAT++H+K$h z9au2Plno72Q*~_A`I`qjA>I6*fq4s8ELpL6%ks_3HZ9$>bZOg`1)YO^^R{f6*E)a6 z{6*GcQ_t|we?qsL2Vm9>cXV%q*(UTqxNB&5*Nz3l0|VP&0VaGwf6vxChPUmVx2Sc| z(s>IP&g0)b%a?6fwq)L}{=WW!JNxHt>*?RMXWrKST??Sg0`;J$FxI;=jaZup2D>fS z_+vrOaQC2aJF6H{F6iI2eLUX(iExcgA~VGjst0OlxXVD^(b?a#xi2mJKbzz`JBPN< z+XOFc?e1r)7tLR|u+7Hk-UCJY2fMe7$NWFaNZp(37-{=JSNFD|1;cm3jon=vy1VY| z9PAoe(79zxPk;CSo$9S?V|Gi;g86$kFO={1;***U!@^X#7ZjGh1t1huIP9N;NbHncL%{AC;p>}oe7+TP^ zZM#)VS<{fH=KY_~gCx(uw(bokPdC`A+Hl9fKp&$mobQ$az-pXJHxKOCyJ5@V!1fJ> z%gT6YVAmk~irZaMsXlvj?wq)5fUQW|*7nZf&3D9I-9y7Y{cdBOP}!g3@xOn{mb|Sz ze~%y9iB3xRH2)XRJ-2@5lHdQ>oUd+t-|y{ycG>(jd-n`{pnuDP@8#b07k4&Hdi$ln zJM)SiZ~x}r!tdR<`)B=5_RTNal7A+6^ewlpf8>Gl z{ihF1zyJ8&<#){cyNAB>j*o=V-WL^vl6Na3#{8!6yCo`l13YK@o_86~;kO=p-$mO$ z_@gK1?Ed~Yzp(4uKl(}k?024ge8=JMJ-DK9d*n4zN56<)6TeCPn)%ofH$(At^x>8G zeQ106a~CW$(6sl`TmhF+Ge?(BDar&Ch2m7{-j4{qD5rpVjw&h2qm zPnV|8^ZvyzdDH3tO@TvibLWoE%{{|=G%OmdIv!i=6dQJEC9e}rGTj$mxV423RIz<;uNDD9J&2A`p zGkC6J2e^jqabP>!3KT)VxN%^3jnuQ7x(B!S3=N?eUfbQ@)7^E=Kz~1@k$y$@mR&>R zGlsf{$I6pU1B1wSI!g1pyOOT1!L|Lb9O~8!1*S4+>)SAAv4)L}9kR^S;78=}wNbg#|YxuT7cJNns4-TyDXWts!wS$4z zL!iM|_B-lycdZ`S($H}8aOdW}l@0uF91C9v4O;lY!lzO1i(j8r<>Aiw+Mb~u+fa#r zBUA0F4Yh5r_iEg`d+6~cMaMm>MN@Bwm-FWNz8~dmh`SL(|KcF@ zi%Msx;7<*vWqsAA@4TN28-k1Z6wk*~SMX=kJ-vn*E=L?fa z*ZbT|ANqdYf4Lvz8uOd{pis=M4O-~W_uD46anR0Hw|PG(7W{eiw=1alyTd3b_}TF9003xn>M_V?8v?&|e$Y5IYHf(Z zOAC$Mp%P@5Q$(}O@_Y~+4*e!Sr{Tijv3Ae@tFjlq#oriv*`C0Q{DwHVDe%BE@@E7Y z|DC~wQ=0rs^D~ORe?`~|ZUE_D;$H*p1AGK|e}TUk0t7(@%r6h}{*OgC-}AjvspQeq z5B%TDcp-R3v%|>$W5!4_UT{NpO>trL27g)e9B^$27t(Lezbd>WYeXvyLwOO`BMvTRA)lI2TQENxx7 zaOt9@iFI};$b=ksYi7|*ZTX7MO`E&Ax3umV%Sk$}xpwuME8;5}X3uUgg|)Nrd$xuYK%9|`sXV)&b_?#)ZBp&9=Reo8qd4<7x8@WR~whT z_qij>e(9In{D#i9OPb2dKRW6CD;7*Iul(1G%j?>gy#MBlJHLO+ncmJ-XR0{cZVn@6`KW_35)HC(xBOV5M9 zJ9%Kk7k~WEuio^z&;Rt<=Wf2`U4J-#!DX{w`JN;1|G+~ZI{NVEA9*xeY&`#>l~=ER z`3FDr_*akQW?Wc#@v5u8_oJu(`MEDW7R4`m@ujmDFJF26OJ8==&9A)m_E*35^&2;L zZ|NJ_bJzYiJ@k=J92-6P@lW&*eEB=yef#SxZ^(qvyl_kCFPJ}a&qd+F=9$qYg^M$D zGuK9wE+6?w_LAt5Xm)-{@y2jT+_ctb`?8TU7o!%(~x~Re;lq9W{R)M2N!L+`1*Xq$Om6vSzT<%Hl4RJ z+mM|)^NQ$#k*mJm3k_>lw_KmUxoK^#;nw`^l}QcRH4PVq*R5>}Co%8}`o1D+ z82R~(+?C-)uk@Q2HQoD%TXq#k9(~ixHaFeZTAJ4I;2&o0x$a$`Tlw3M-LoQhdGy-s zr44HuW@pYjaBStsW3S09xnf7BV zQ&`BA9^5$c%kaRbvllc^ZoaNC{F0HMHw@)>oWJI`rZ!G(ysa=}BOhOWQPUMsAs0-_j=byM{}E0Oo5GR5%{E4Ub7Qm| z!@0q{;(Wg~S{N+yKOB4{`e^>&f?s5Q6+TyZc+cK9 zzvYiwZ@c}?4;-5Lok`8>UiOP;=P$VWwXfUogZtj{*0=rchd=rGFMR2-ul%>~KJ~-r zyvUYB+sZ4iTKm%1-S<`sKmGYHJoewd_VuTJ$Zgf>g1J&F=Jj3O_r2{8-}9BPeZ6V& zoRwFuUVGbXUcaHM`z>$#FfG3HmG3?E!!u2jSFi2r9=Y#RkNo);zxnMmKe_k*H$U{j zKmX#FzWnvS{k!WA|Jhd```Xvn-njm@SG|728{hiiCqMJqFaE`2U;g&wX&1cawLkw~ zzj|(D`_AuvZ_=#(fteR=xa;nZf8x8}yWtCuOuOLXS!=GlalIDJ-TVLaOW*kBlV^VN zv%#SUhj(2%f5C@7@!2na`Rm{Q-n+c^cOGtiaMstJyK()iUz5u>mo8iIV5IZiOfC6!V9za{4#u1Zdze_K`htHLb)*es@&YnnuaSPm?B(Qydt_V zTMS1&M$yZrj{G$LlCU{kg`zVzbI)^=r{@<;o)=aom77N%i0*mUwBq>(-;r6s_8d%_ zUKsiF%5dYzw=O(T%8Y!!@GtKT+X@F>J9XrEe&jn-UlKNCm*>~y8?(d3i^Eq(uPTh( zJAG!uw8G1xkvC;O`cUHq(Zcsf2mbcbTw^A4&!5DXXDN6~H1g+ROW54>BKGSSv-fCk zUdFGQZs2_`zxneq0j}xB0_k*0J3d;}+&kHq_#b;b*3oZK?Z}Iccib z%9U3Cn=n#0@O&#j?Ss|y1H8u*(ygSoV;HTHimXoZf*E+yyEyjt@>zjZtKa<U@g2OL$h(KS|S%VvN6@{Fn2S&09_1%=(7WgTCA@Vx?LG;>>i_xL zb1G47-?`@;?LSL1(z0s$jcHo2i(YEioIYi33l`-IMfIzv@=Lwsd#mo$4OS&TZbl%bd^iwr(5P)VXbF?s@(AebDN6 z;GUYdWykOU-s!o;O}n=B&D-9+ePD3!-270_*8X|8kLEVxs_!1er^K1w-W}aTa~rnr L+BV!{2EhLV+cMqA literal 0 HcmV?d00001 diff --git a/packages/direct-match/renegade-sdk-wasm/index_bg.wasm.d.ts b/packages/direct-match/renegade-sdk-wasm/index_bg.wasm.d.ts new file mode 100644 index 00000000..e8414e7b --- /dev/null +++ b/packages/direct-match/renegade-sdk-wasm/index_bg.wasm.d.ts @@ -0,0 +1,11 @@ +/* tslint:disable */ +/* eslint-disable */ +export const memory: WebAssembly.Memory; +export const derive_schnorr_public_key: (a: number, b: number) => [number, number, number, number]; +export const init: () => void; +export const __wbindgen_free: (a: number, b: number, c: number) => void; +export const __wbindgen_malloc: (a: number, b: number) => number; +export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; +export const __wbindgen_externrefs: WebAssembly.Table; +export const __externref_table_dealloc: (a: number) => void; +export const __wbindgen_start: () => void; diff --git a/packages/direct-match/renegade-sdk-wasm/package.json b/packages/direct-match/renegade-sdk-wasm/package.json new file mode 100644 index 00000000..abc13f1f --- /dev/null +++ b/packages/direct-match/renegade-sdk-wasm/package.json @@ -0,0 +1,11 @@ +{ + "name": "renegade-sdk-wasm", + "version": "0.1.0", + "files": [ + "index_bg.wasm", + "index.js", + "index.d.ts" + ], + "main": "index.js", + "types": "index.d.ts" +} \ No newline at end of file diff --git a/packages/direct-match/src/client.ts b/packages/direct-match/src/client.ts index cbce6c7a..a1149179 100644 --- a/packages/direct-match/src/client.ts +++ b/packages/direct-match/src/client.ts @@ -1,32 +1,534 @@ -// Constants for v2 relayer server URLs -const ARBITRUM_SEPOLIA_RELAYER_BASE_URL = "https://arbitrum-sepolia.v2.relayer.renegade.fi"; -const ARBITRUM_ONE_BASERELAYER__URL = "https://arbitrum-one.v2.relayer.renegade.fi"; -const BASE_SEPOLIA_BASERELAYER__URL = "https://base-sepolia.v2.relayer.renegade.fi"; -const BASE_MAINNET_BASERELAYER__URL = "https://base-mainnet.v2.relayer.renegade.fi"; +import { RelayerHttpClient } from "@renegade-fi/http-client"; +import { encodeAbiParameters, type Hex, keccak256, toBytes } from "viem"; +import type { PrivateKeyAccount } from "viem/accounts"; + +import { AccountSecrets } from "./secrets.js"; +import type { + ApiAccount, + ApiBalance, + ApiOrder, + ApiOrderCore, + ApiPublicIntentPermit, + CancelOrderRequest, + CancelOrderResponse, + CreateAccountRequest, + CreateOrderInPoolRequest, + CreateOrderRequest, + CreateOrderResponse, + GetAccountResponse, + GetBalanceByMintResponse, + GetBalancesResponse, + GetOrderByIdResponse, + GetOrdersResponse, + OrderAuth, + PlaceOrderParams, + SignatureWithNonce, + SyncAccountRequest, + SyncAccountResponse, + UpdateOrderParams, + UpdateOrderResponse, +} from "./types.js"; +import { toBase64NoPad } from "./utils.js"; -// The Arbitrum one chain ID +// Chain IDs const ARBITRUM_ONE_CHAIN_ID = 42161; -// The Arbitrum Sepolia chain ID const ARBITRUM_SEPOLIA_CHAIN_ID = 421614; -// The Base mainnet chain ID const BASE_MAINNET_CHAIN_ID = 8453; -// The Base Sepolia chain ID const BASE_SEPOLIA_CHAIN_ID = 84532; -// The Ethereum Sepolia chain ID -const ETHEREUM_SEPOLIA_CHAIN_ID = 11155111; -import { type HttpResponse, RelayerHttpClient } from "@renegade-fi/http-client"; +// Relayer server URLs +const ARBITRUM_SEPOLIA_RELAYER_BASE_URL = "https://arbitrum-sepolia.v2.relayer.renegade.fi"; +const ARBITRUM_ONE_RELAYER_BASE_URL = "https://arbitrum-one.v2.relayer.renegade.fi"; +const BASE_SEPOLIA_RELAYER_BASE_URL = "https://base-sepolia.v2.relayer.renegade.fi"; +const BASE_MAINNET_RELAYER_BASE_URL = "https://base-mainnet.v2.relayer.renegade.fi"; + +// Executor addresses per chain (from rust-sdk config.rs) +const EXECUTOR_ADDRESSES: Record = { + [ARBITRUM_ONE_CHAIN_ID]: "0x336A6b8AE5589d40ba4391020649E268E8323CA1", + [ARBITRUM_SEPOLIA_CHAIN_ID]: "0x9094314D60e3eF5fC73df548A3dD7b1Cd9798729", + [BASE_MAINNET_CHAIN_ID]: "0x1b5A1833d8566FACb138aa6BF1cd040f572B1D56", + [BASE_SEPOLIA_CHAIN_ID]: "0x5E2ca57B7F09Cf3DAca07c67CC65e1BfbDf346b0", +}; + +// Cancel domain separator, matching the contract's CANCEL_DOMAIN +const CANCEL_DOMAIN = new TextEncoder().encode("cancel"); + +// ABI type definition for PublicIntentPermit (reused across sign and cancel) +const PERMIT_ABI = [ + { + type: "tuple", + components: [ + { + type: "tuple", + name: "intent", + components: [ + { type: "address", name: "inToken" }, + { type: "address", name: "outToken" }, + { type: "address", name: "owner" }, + { + type: "tuple", + name: "minPrice", + components: [{ type: "uint256", name: "repr" }], + }, + { type: "uint256", name: "amountIn" }, + ], + }, + { type: "address", name: "executor" }, + ], + }, +] as const; /** * Client for interacting with the Renegade direct match API. */ export class DirectMatchClient { + readonly account: PrivateKeyAccount; + readonly secrets: AccountSecrets; + readonly httpClient: RelayerHttpClient; + readonly chainId: number; + readonly executorAddress: string; + + private constructor( + baseUrl: string, + account: PrivateKeyAccount, + secrets: AccountSecrets, + chainId: number, + ) { + this.account = account; + this.secrets = secrets; + this.httpClient = new RelayerHttpClient(baseUrl, secrets.authHmacKeyBase64()); + this.chainId = chainId; + this.executorAddress = EXECUTOR_ADDRESSES[chainId]!; + } + + // --------------------- + // | Factory Methods | + // --------------------- + + private static async create( + baseUrl: string, + account: PrivateKeyAccount, + chainId: number, + ): Promise { + const secrets = await AccountSecrets.create(account, chainId); + return new DirectMatchClient(baseUrl, account, secrets, chainId); + } + + static async newArbitrumSepoliaClient(account: PrivateKeyAccount): Promise { + return DirectMatchClient.create( + ARBITRUM_SEPOLIA_RELAYER_BASE_URL, + account, + ARBITRUM_SEPOLIA_CHAIN_ID, + ); + } + + static async newArbitrumOneClient(account: PrivateKeyAccount): Promise { + return DirectMatchClient.create( + ARBITRUM_ONE_RELAYER_BASE_URL, + account, + ARBITRUM_ONE_CHAIN_ID, + ); + } + + static async newBaseSepoliaClient(account: PrivateKeyAccount): Promise { + return DirectMatchClient.create( + BASE_SEPOLIA_RELAYER_BASE_URL, + account, + BASE_SEPOLIA_CHAIN_ID, + ); + } + + static async newBaseMainnetClient(account: PrivateKeyAccount): Promise { + return DirectMatchClient.create( + BASE_MAINNET_RELAYER_BASE_URL, + account, + BASE_MAINNET_CHAIN_ID, + ); + } + + // --------------------- + // | Account Actions | + // --------------------- + + /** + * Create a new account on the relayer. + * + * Sends the derived account secrets so the relayer can manage + * the account's orders and balances. + */ + async createAccount(): Promise { + const request: CreateAccountRequest = { + account_id: this.secrets.accountId, + address: this.account.address, + master_view_seed: this.secrets.masterViewSeed, + auth_hmac_key: this.secrets.authHmacKeyBase64(), + schnorr_public_key: this.secrets.schnorrPublicKey, + }; + + const response = await this.httpClient.post("/v2/account", request); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `createAccount failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + } + + /** + * Look up this client's account by its ID. + * + * Returns the account's orders and balances. + * Throws if the account does not exist. + */ + async getAccount(): Promise { + const path = `/v2/account/${this.secrets.accountId}`; + const response = await this.httpClient.get(path); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `getAccount failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + return response.data.account; + } + /** - * Initialize a new DirectMatchClient. + * Sync the account with on-chain state. * - * @param baseUrl The base URL of the relayer server API + * Triggers the relayer to re-scan on-chain balances for this account. + * Needed for Ring 0 so the matching engine knows EOA token balances. */ - constructor(baseUrl: string) { - this.httpClient = new RelayerHttpClient(baseUrl); + async syncAccount(): Promise { + const request: SyncAccountRequest = { + account_id: this.secrets.accountId, + master_view_seed: this.secrets.masterViewSeedHex(), + auth_hmac_key: this.secrets.authHmacKeyBase64(), + schnorr_public_key: this.secrets.schnorrPublicKey, + }; + + const path = `/v2/account/${this.secrets.accountId}/sync`; + const response = await this.httpClient.post(path, request); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `syncAccount failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + } + + // ----------------------- + // | Balance Actions | + // ----------------------- + + /** + * Fetch all balances in the account. + */ + async getBalances(): Promise { + const path = `/v2/account/${this.secrets.accountId}/balances`; + const response = await this.httpClient.get(path); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `getBalances failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + return response.data.balances; + } + + /** + * Fetch a single balance by token mint address. + */ + async getBalanceByMint(mint: string): Promise { + const path = `/v2/account/${this.secrets.accountId}/balances/${mint}`; + const response = await this.httpClient.get(path); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `getBalanceByMint failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + return response.data.balance; + } + + // --------------------- + // | Order Actions | + // --------------------- + + /** + * Place a Ring 0 (public) order. + * + * Builds the order, signs a PublicIntentPermit, and POSTs to the relayer. + */ + async placeOrder(params: PlaceOrderParams): Promise { + const order = this.buildOrderCore(params); + const auth = await this.buildPublicOrderAuth(order); + + const request: CreateOrderRequest = { + order, + auth, + precompute_cancellation_proof: false, + }; + + const path = `/v2/account/${this.secrets.accountId}/orders`; + const response = await this.httpClient.post(path, request); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `placeOrder failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + } + + /** + * Place a Ring 0 (public) order in a specific matching pool. + * + * Uses the admin endpoint, which requires an admin HMAC key. + */ + async placeOrderInPool( + params: PlaceOrderParams, + matchingPool: string, + adminKey: string, + ): Promise { + const order = this.buildOrderCore(params); + const auth = await this.buildPublicOrderAuth(order); + + const request: CreateOrderInPoolRequest = { + order, + auth, + matching_pool: matchingPool, + }; + + const adminClient = new RelayerHttpClient(this.httpClient.getBaseUrl(), adminKey); + const path = `/v2/relayer-admin/account/${this.secrets.accountId}/orders/create-order-in-pool`; + const response = await adminClient.post(path, request); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `placeOrderInPool failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + } + + /** + * Fetch all orders in the account with pagination. + */ + async getOrders(includeHistoric: boolean): Promise { + const allOrders: ApiOrder[] = []; + let pageToken: number | undefined; + + do { + let query = `include_historic_orders=${includeHistoric}`; + if (pageToken !== undefined) { + query += `&page_token=${pageToken}`; + } + const path = `/v2/account/${this.secrets.accountId}/orders?${query}`; + const response = await this.httpClient.get(path); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `getOrders failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + allOrders.push(...response.data.orders); + pageToken = response.data.next_page_token; + } while (pageToken !== undefined); + + return allOrders; + } + + /** + * Fetch a single order by ID. + */ + async getOrder(orderId: string): Promise { + const { order } = await this.getOrderWithAuth(orderId); + return order; + } + + /** + * Update an existing order's min_fill_size or allow_external_matches. + * + * Fetches the current order, applies the updates, and POSTs the modified order. + */ + async updateOrder(params: UpdateOrderParams): Promise { + const { order: current } = await this.getOrderWithAuth(params.orderId); + const updated = { ...current.order }; + + if (params.minFillSize !== undefined) { + updated.min_fill_size = params.minFillSize.toString(); + } + if (params.allowExternalMatches !== undefined) { + updated.allow_external_matches = params.allowExternalMatches; + } + + const path = `/v2/account/${this.secrets.accountId}/orders/${params.orderId}/update`; + const response = await this.httpClient.post(path, { order: updated }); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `updateOrder failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + return response.data.order; + } + + /** + * Cancel a Ring 0 (public) order by ID. + * + * Fetches the order's auth, computes the cancel nullifier, signs it, + * and POSTs the cancellation request. + */ + async cancelOrder(orderId: string): Promise { + // Fetch order with its auth (needed to compute nullifier) + const { auth } = await this.getOrderWithAuth(orderId); + if (!auth.public_order) { + throw new Error(`cancelOrder: order ${orderId} is not a Ring 0 (public) order`); + } + const { permit, intent_signature } = auth.public_order; + + // ABI-encode the permit and compute its hash + const abiEncoded = encodePermit(permit); + const intentHash = toBytes(keccak256(abiEncoded)); + + // Compute nullifier: keccak256(intentHash || originalNonce_be_32) + const originalNonceBytes = bigIntToBytes32(BigInt(intent_signature.nonce)); + const nullifierInput = new Uint8Array(32 + 32); + nullifierInput.set(intentHash, 0); + nullifierInput.set(originalNonceBytes, 32); + const nullifier = toBytes(keccak256(nullifierInput)); + + // Build cancel payload: "cancel" || nullifier + const cancelPayload = new Uint8Array(CANCEL_DOMAIN.length + 32); + cancelPayload.set(CANCEL_DOMAIN, 0); + cancelPayload.set(nullifier, CANCEL_DOMAIN.length); + + // Sign the cancel payload + const cancelSignature = await this.signWithNonce(cancelPayload); + + const request: CancelOrderRequest = { cancel_signature: cancelSignature }; + const path = `/v2/account/${this.secrets.accountId}/orders/${orderId}/cancel`; + const response = await this.httpClient.post(path, request); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `cancelOrder failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + } + + // --------------------- + // | Private Helpers | + // --------------------- + + /** Fetch an order with its auth from the relayer */ + private async getOrderWithAuth(orderId: string): Promise { + const path = `/v2/account/${this.secrets.accountId}/orders/${orderId}`; + const response = await this.httpClient.get(path); + if (response.status < 200 || response.status >= 300) { + throw new Error( + `getOrder failed (${response.status}): ${JSON.stringify(response.data)}`, + ); + } + return response.data; + } + + private buildOrderCore(params: PlaceOrderParams): ApiOrderCore { + const minPrice = params.minOutputAmount + ? ceilDiv(params.minOutputAmount, params.inputAmount).toString() + : "0"; + + return { + id: crypto.randomUUID(), + intent: { + in_token: params.inputMint, + out_token: params.outputMint, + owner: this.account.address, + min_price: minPrice, + amount_in: params.inputAmount.toString(), + }, + min_fill_size: (params.minFillSize ?? 0n).toString(), + order_type: "public_order", + allow_external_matches: params.allowExternalMatches ?? true, + }; + } + + /** Build OrderAuth for a Ring 0 (public) order */ + private async buildPublicOrderAuth(order: ApiOrderCore): Promise { + const permit: ApiPublicIntentPermit = { + intent: order.intent, + executor: this.executorAddress, + }; + + const abiEncoded = encodePermit(permit); + const intentSignature = await this.signWithNonce(toBytes(abiEncoded)); + + return { + public_order: { + permit, + intent_signature: intentSignature, + }, + }; + } + + /** + * Sign a payload using the Renegade SignatureWithNonce scheme. + * + * Computes: sign(keccak256(keccak256(payload) || nonce || chainId)) + */ + private async signWithNonce(payload: Uint8Array): Promise { + const payloadDigest = toBytes(keccak256(payload)); + + const nonceBytes = crypto.getRandomValues(new Uint8Array(32)); + const nonceBigInt = bytesToBigInt(nonceBytes); + + const chainIdBytes = bigIntToBytes32(BigInt(this.chainId)); + + const message = new Uint8Array(32 + 32 + 32); + message.set(payloadDigest, 0); + message.set(nonceBytes, 32); + message.set(chainIdBytes, 64); + const finalDigest = keccak256(message); + + const sig: Hex = await this.account.sign({ hash: finalDigest }); + const sigBytes = toBytes(sig); + + return { + nonce: nonceBigInt.toString(), + signature: toBase64NoPad(sigBytes), + }; + } +} + +// ----------- +// | Helpers | +// ----------- + +/** ABI-encode a PublicIntentPermit struct */ +function encodePermit(permit: ApiPublicIntentPermit): Hex { + return encodeAbiParameters(PERMIT_ABI, [ + { + intent: { + inToken: permit.intent.in_token as Hex, + outToken: permit.intent.out_token as Hex, + owner: permit.intent.owner as Hex, + minPrice: { repr: BigInt(permit.intent.min_price) }, + amountIn: BigInt(permit.intent.amount_in), + }, + executor: permit.executor as Hex, + }, + ]); +} + +/** Ceiling division for bigints */ +function ceilDiv(a: bigint, b: bigint): bigint { + return (a + b - 1n) / b; +} + +/** Convert big-endian bytes to bigint */ +function bytesToBigInt(bytes: Uint8Array): bigint { + let value = 0n; + for (const byte of bytes) { + value = (value << 8n) | BigInt(byte); + } + return value; +} + +/** Convert bigint to big-endian 32 bytes */ +function bigIntToBytes32(n: bigint): Uint8Array { + const bytes = new Uint8Array(32); + let v = n; + for (let i = 31; i >= 0; i--) { + bytes[i] = Number(v & 0xffn); + v >>= 8n; } + return bytes; } diff --git a/packages/direct-match/src/index.ts b/packages/direct-match/src/index.ts index 2fa8def3..51a0203a 100644 --- a/packages/direct-match/src/index.ts +++ b/packages/direct-match/src/index.ts @@ -1,4 +1,32 @@ -/** - * A TypeScript client for interacting with the Renegade direct match API. - */ - +export { DirectMatchClient } from "./client.js"; +export { AccountSecrets } from "./secrets.js"; +export type { + ApiAccount, + ApiBalance, + ApiIntent, + ApiOrder, + ApiOrderCore, + ApiPartialOrderFill, + ApiPublicIntentPermit, + CancelOrderRequest, + CancelOrderResponse, + CreateAccountRequest, + CreateOrderInPoolRequest, + CreateOrderRequest, + CreateOrderResponse, + GetAccountResponse, + GetBalanceByMintResponse, + GetBalancesResponse, + GetOrderByIdResponse, + GetOrdersResponse, + OrderAuth, + OrderState, + OrderType, + PlaceOrderParams, + SignatureWithNonce, + SyncAccountRequest, + SyncAccountResponse, + UpdateOrderParams, + UpdateOrderRequest, + UpdateOrderResponse, +} from "./types.js"; diff --git a/packages/direct-match/src/secrets.ts b/packages/direct-match/src/secrets.ts new file mode 100644 index 00000000..92f11aac --- /dev/null +++ b/packages/direct-match/src/secrets.ts @@ -0,0 +1,178 @@ +// Account secrets derivation, ported from rust-sdk/src/renegade_wallet_client/utils.rs +// +// Derives deterministic account credentials from an Ethereum private key and chain ID. +// The derivation signs structured messages with the key and hashes the results. + +import { type Hex, keccak256, toBytes } from "viem"; +import type { PrivateKeyAccount } from "viem/accounts"; +import { derive_schnorr_public_key } from "../renegade-sdk-wasm/index.js"; +import { toBase64 } from "./utils.js"; + +// Message prefixes matching the Rust SDK constants +const ACCOUNT_ID_PREFIX = toBytes("account id"); +const AUTH_HMAC_KEY_PREFIX = toBytes("auth hmac key"); +const MASTER_VIEW_SEED_PREFIX = toBytes("master view seed"); +const SCHNORR_KEY_PREFIX = toBytes("schnorr key"); + +const ACCOUNT_ID_BYTES = 16; + +// BN254 scalar field modulus (Fr), used for master_view_seed reduction +const BN254_SCALAR_MODULUS = + 21888242871839275222246405745257275088548364400416034343698204186575808495617n; + +/** + * Secrets derived from an Ethereum private key, used to authenticate + * account actions against the relayer API. + */ +export class AccountSecrets { + /** UUID identifying the account (first 16 bytes of a derived hash) */ + readonly accountId: string; + /** 32-byte HMAC key for authenticating API requests */ + readonly authHmacKey: Uint8Array; + /** BN254 scalar field element (decimal string), used for account state sync */ + readonly masterViewSeed: string; + /** Schnorr public key as hex string (0x-prefixed, uncompressed Baby JubJub point) */ + readonly schnorrPublicKey: string; + + private constructor( + accountId: string, + authHmacKey: Uint8Array, + masterViewSeed: string, + schnorrPublicKey: string, + ) { + this.accountId = accountId; + this.authHmacKey = authHmacKey; + this.masterViewSeed = masterViewSeed; + this.schnorrPublicKey = schnorrPublicKey; + } + + /** + * Derive account secrets from a viem PrivateKeyAccount and chain ID. + * + * This mirrors the Rust SDK's `AccountSecrets::new()`: + * 1. Build message = prefix_bytes ++ chain_id as 8 big-endian bytes + * 2. keccak256(message) → digest + * 3. ECDSA sign the raw digest (no EIP-191 prefix) + * 4. keccak256(signature) → 32 dispersed bytes + * 5. Interpret those bytes per secret type + */ + static async create(account: PrivateKeyAccount, chainId: number): Promise { + const accountId = await deriveAccountId(account, chainId); + const authHmacKey = await deriveAuthHmacKey(account, chainId); + const masterViewSeed = await deriveMasterViewSeed(account, chainId); + const schnorrPublicKey = await deriveSchnorrPublicKey(account, chainId); + return new AccountSecrets(accountId, authHmacKey, masterViewSeed, schnorrPublicKey); + } + + /** Master view seed as a hex string (0x-prefixed) for sync requests */ + masterViewSeedHex(): string { + return `0x${BigInt(this.masterViewSeed).toString(16)}`; + } + + /** Base64-encode the HMAC key (with padding, matching Rust's STANDARD) */ + authHmacKeyBase64(): string { + return toBase64(this.authHmacKey); + } +} + +// ----------- +// | Helpers | +// ----------- + +/** Build the message bytes: prefix ++ chain_id as 8 big-endian bytes */ +function buildMessage(prefix: Uint8Array, chainId: number): Uint8Array { + const chainIdBytes = new Uint8Array(8); + const view = new DataView(chainIdBytes.buffer); + // Write chain ID as big-endian uint64 + view.setBigUint64(0, BigInt(chainId)); + const msg = new Uint8Array(prefix.length + 8); + msg.set(prefix, 0); + msg.set(chainIdBytes, prefix.length); + return msg; +} + +/** + * Sign a message and return the keccak256-dispersed 32-byte result. + * + * Steps (matching Rust `get_sig_bytes`): + * 1. keccak256(message) → digest + * 2. account.sign({ hash: digest }) → ECDSA signature (raw hash signing, no EIP-191) + * 3. keccak256(signature_bytes) → 32 dispersed bytes + */ +async function getSigBytes(msg: Uint8Array, account: PrivateKeyAccount): Promise { + const digest = keccak256(msg); + const sig: Hex = await account.sign({ hash: digest }); + return toBytes(keccak256(sig)); +} + +/** + * Sign a message and return 64 extended bytes for secure field reduction. + * + * Steps (matching Rust `get_extended_sig_bytes`): + * 1. getSigBytes(msg) → 32 bytes + * 2. Extend: original 32 bytes ++ keccak256(original 32 bytes) + * + * The 64-byte result ensures uniform sampling when reduced mod a ~254-bit field. + */ +async function getExtendedSigBytes( + msg: Uint8Array, + account: PrivateKeyAccount, +): Promise { + const sigBytes = await getSigBytes(msg, account); + const topBytes = toBytes(keccak256(sigBytes)); + const extended = new Uint8Array(64); + extended.set(sigBytes, 0); + extended.set(topBytes, 32); + return extended; +} + +/** + * Derive the master view seed as a BN254 scalar (decimal string). + * + * Interprets 64 extended sig bytes as a big-endian integer and reduces mod + * the BN254 scalar field modulus, matching Rust's `Scalar::from_be_bytes_mod_order`. + */ +async function deriveMasterViewSeed(account: PrivateKeyAccount, chainId: number): Promise { + const msg = buildMessage(MASTER_VIEW_SEED_PREFIX, chainId); + const extended = await getExtendedSigBytes(msg, account); + // Interpret as big-endian unsigned integer + let value = 0n; + for (const byte of extended) { + value = (value << 8n) | BigInt(byte); + } + return (value % BN254_SCALAR_MODULUS).toString(); +} + +/** Derive the account UUID from the first 16 bytes of the sig hash */ +async function deriveAccountId(account: PrivateKeyAccount, chainId: number): Promise { + const msg = buildMessage(ACCOUNT_ID_PREFIX, chainId); + const bytes = await getSigBytes(msg, account); + return formatUuid(bytes.slice(0, ACCOUNT_ID_BYTES)); +} + +/** Derive the 32-byte HMAC key for API authentication */ +async function deriveAuthHmacKey(account: PrivateKeyAccount, chainId: number): Promise { + const msg = buildMessage(AUTH_HMAC_KEY_PREFIX, chainId); + return getSigBytes(msg, account); +} + +/** + * Derive the Schnorr public key as a hex string. + * + * Computes extended sig bytes for the "schnorr key" prefix, then delegates + * to the WASM module for Baby JubJub scalar multiplication and serialization. + */ +async function deriveSchnorrPublicKey( + account: PrivateKeyAccount, + chainId: number, +): Promise { + const msg = buildMessage(SCHNORR_KEY_PREFIX, chainId); + const extended = await getExtendedSigBytes(msg, account); + return derive_schnorr_public_key(extended); +} + +/** Format 16 bytes as a UUID string (8-4-4-4-12) */ +function formatUuid(bytes: Uint8Array): string { + const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join(""); + return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`; +} diff --git a/packages/direct-match/src/types.ts b/packages/direct-match/src/types.ts new file mode 100644 index 00000000..3f3da4cf --- /dev/null +++ b/packages/direct-match/src/types.ts @@ -0,0 +1,207 @@ +// API response types for the Renegade direct match API +// Only ring0-relevant fields are fully typed; rings 1-3 fields are noted as TODOs + +/** Request body for POST /v2/account */ +export interface CreateAccountRequest { + account_id: string; + address: string; + master_view_seed: string; + auth_hmac_key: string; + schnorr_public_key: string; +} + +/** Request body for POST /v2/account/:account_id/orders */ +export interface CreateOrderRequest { + order: ApiOrderCore; + auth: OrderAuth; + precompute_cancellation_proof: boolean; +} + +/** Request body for POST /v2/relayer-admin/account/:account_id/orders/create-order-in-pool */ +export interface CreateOrderInPoolRequest { + order: ApiOrderCore; + auth: OrderAuth; + matching_pool: string; +} + +/** Response for POST /v2/account/:account_id/orders */ +export interface CreateOrderResponse { + task_id: string; + completed: boolean; +} + +/** Order authorization — Ring 0 only, other rings are TODO */ +export interface OrderAuth { + public_order: { + permit: ApiPublicIntentPermit; + intent_signature: SignatureWithNonce; + }; + // TODO: natively_settled_private_order — ring 1 + // TODO: renegade_settled_order — rings 2-3 +} + +/** A public intent permit for a Ring 0 order */ +export interface ApiPublicIntentPermit { + intent: ApiIntent; + executor: string; +} + +/** An ECDSA signature with a nonce for replay protection */ +export interface SignatureWithNonce { + nonce: string; // U256 as decimal string + signature: string; // base64-encoded 65 bytes (r || s || v) +} + +/** Parameters for placing a Ring 0 (public) order */ +export interface PlaceOrderParams { + inputMint: string; + outputMint: string; + inputAmount: bigint; + minOutputAmount?: bigint; + minFillSize?: bigint; + allowExternalMatches?: boolean; +} + +/** Response for GET /v2/account/:account_id/orders */ +export interface GetOrdersResponse { + orders: ApiOrder[]; + next_page_token?: number; +} + +/** Response for GET /v2/account/:account_id/orders/:order_id */ +export interface GetOrderByIdResponse { + order: ApiOrder; + auth: OrderAuth; +} + +/** Request body for POST /v2/account/:account_id/orders/:order_id/update */ +export interface UpdateOrderRequest { + order: ApiOrderCore; +} + +/** Response for POST /v2/account/:account_id/orders/:order_id/update */ +export interface UpdateOrderResponse { + order: ApiOrder; +} + +/** Parameters for updating an existing order */ +export interface UpdateOrderParams { + orderId: string; + minFillSize?: bigint; + allowExternalMatches?: boolean; +} + +/** Request body for POST /v2/account/:account_id/orders/:order_id/cancel */ +export interface CancelOrderRequest { + cancel_signature: SignatureWithNonce; +} + +/** Response for POST /v2/account/:account_id/orders/:order_id/cancel */ +export interface CancelOrderResponse { + task_id: string; + completed: boolean; +} + +/** The response wrapper for GET /v2/account/:account_id */ +export interface GetAccountResponse { + account: ApiAccount; +} + +/** An account managed by the relayer */ +export interface ApiAccount { + id: string; + orders: ApiOrder[]; + balances: ApiBalance[]; +} + +/** A full order with metadata */ +export interface ApiOrder { + id: string; + order: ApiOrderCore; + state: OrderState; + fills: ApiPartialOrderFill[]; + created: number; + // TODO: recovery_stream — rings 1-3 (PoseidonCSPRNG state) + // TODO: share_stream — rings 1-3 (PoseidonCSPRNG state) + // TODO: public_shares — rings 1-3 (order secret shares) + [key: string]: unknown; +} + +/** Core order data */ +export interface ApiOrderCore { + id: string; + intent: ApiIntent; + min_fill_size: string; + order_type: OrderType; + allow_external_matches: boolean; +} + +/** The intent of an order */ +export interface ApiIntent { + in_token: string; + out_token: string; + owner: string; + min_price: string; + amount_in: string; +} + +/** Order type corresponding to privacy rings */ +export type OrderType = + | "public_order" // ring 0 + | "natively_settled_private_order" // ring 1 + | "renegade_settled_public_fill_order" // ring 2 + | "renegade_settled_private_fill_order"; // ring 3 + +/** The state of an order */ +export type OrderState = "created" | "matching" | "settling_match" | "filled" | "cancelled"; + +/** A partial fill of an order */ +export interface ApiPartialOrderFill { + amount: string; + price: { price: string; timestamp: number }; + fees: { relayer_fee: string; protocol_fee: string }; + tx_hash: string; +} + +// --- Balance types --- + +/** Response for GET /v2/account/:account_id/balances */ +export interface GetBalancesResponse { + balances: ApiBalance[]; +} + +/** Response for GET /v2/account/:account_id/balances/:mint */ +export interface GetBalanceByMintResponse { + balance: ApiBalance; +} + +// --- Sync types --- + +/** Request body for POST /v2/account/:account_id/sync */ +export interface SyncAccountRequest { + account_id: string; + master_view_seed: string; + auth_hmac_key: string; + schnorr_public_key: string; +} + +/** Response for POST /v2/account/:account_id/sync */ +export interface SyncAccountResponse { + task_id: string; + completed: boolean; +} + +/** A balance in an account */ +export interface ApiBalance { + mint: string; + owner: string; + amount: string; + relayer_fee_balance: string; + protocol_fee_balance: string; + relayer_fee_recipient: string; + // TODO: authority — rings 1-3 (Schnorr public key) + // TODO: recovery_stream — rings 1-3 (PoseidonCSPRNG state) + // TODO: share_stream — rings 1-3 (PoseidonCSPRNG state) + // TODO: public_shares — rings 1-3 (balance secret shares) + [key: string]: unknown; +} diff --git a/packages/direct-match/src/types/index.ts b/packages/direct-match/src/types/index.ts deleted file mode 100644 index 49290139..00000000 --- a/packages/direct-match/src/types/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * Type definitions for the Renegade Darkpool direct match API. - */ - diff --git a/packages/direct-match/src/utils.ts b/packages/direct-match/src/utils.ts new file mode 100644 index 00000000..8ac87120 --- /dev/null +++ b/packages/direct-match/src/utils.ts @@ -0,0 +1,9 @@ +/** Base64-encode without padding (matches Rust's STANDARD_NO_PAD) */ +export function toBase64NoPad(bytes: Uint8Array): string { + return Buffer.from(bytes).toString("base64").replace(/=+$/, ""); +} + +/** Base64-encode with padding (matches Rust's STANDARD) */ +export function toBase64(bytes: Uint8Array): string { + return Buffer.from(bytes).toString("base64"); +} diff --git a/packages/direct-match/test/accountId.test.ts b/packages/direct-match/test/accountId.test.ts new file mode 100644 index 00000000..6833e976 --- /dev/null +++ b/packages/direct-match/test/accountId.test.ts @@ -0,0 +1,31 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { type Hex, toHex } from "viem"; +import { privateKeyToAccount } from "viem/accounts"; +import { describe, expect, it } from "vitest"; +import { AccountSecrets } from "../src/secrets.js"; + +const testData = JSON.parse( + readFileSync(resolve(__dirname, "../test_data/test_data.json"), "utf-8"), +) as { + chainId: number; + accounts: { privateKey: string; accountId: string; authHmacKey: string }[]; +}; + +describe("secrets derivation", () => { + for (const entry of testData.accounts) { + const label = `key ${entry.privateKey.slice(0, 10)}...`; + + it(`accountId matches golden data for ${label}`, async () => { + const account = privateKeyToAccount(entry.privateKey as Hex); + const secrets = await AccountSecrets.create(account, testData.chainId); + expect(secrets.accountId).toBe(entry.accountId); + }); + + it(`authHmacKey matches golden data for ${label}`, async () => { + const account = privateKeyToAccount(entry.privateKey as Hex); + const secrets = await AccountSecrets.create(account, testData.chainId); + expect(toHex(secrets.authHmacKey).slice(2)).toBe(entry.authHmacKey); + }); + } +}); diff --git a/packages/direct-match/test/cancelOrder.test.ts b/packages/direct-match/test/cancelOrder.test.ts new file mode 100644 index 00000000..d9daa599 --- /dev/null +++ b/packages/direct-match/test/cancelOrder.test.ts @@ -0,0 +1,36 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount, USDC, WETH } from "./helpers.js"; + +describe("cancelOrder", () => { + it( + "cancels a placed order so it no longer appears in active orders", + { timeout: 30_000 }, + async () => { + const client = await createClient(); + await ensureAccount(client); + + await client.placeOrder({ + inputMint: USDC, + outputMint: WETH, + inputAmount: 100_000n, + }); + + const before = await client.getOrders(false); + expect(before.length).toBeGreaterThan(0); + const orderId = before[0]!.id; + + await client.cancelOrder(orderId); + + const after = await client.getOrders(false); + expect(after.find((o) => o.id === orderId)).toBeUndefined(); + }, + ); + + it("fails when cancelling a nonexistent order", { timeout: 15_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + const fakeOrderId = "00000000-0000-0000-0000-000000000000"; + await expect(client.cancelOrder(fakeOrderId)).rejects.toThrow(); + }); +}); diff --git a/packages/direct-match/test/createAndGetAccount.test.ts b/packages/direct-match/test/createAndGetAccount.test.ts new file mode 100644 index 00000000..7ff2d11a --- /dev/null +++ b/packages/direct-match/test/createAndGetAccount.test.ts @@ -0,0 +1,27 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount } from "./helpers.js"; + +describe("createAccount and getAccount", () => { + it("creates an account if absent and fetches it", { timeout: 30_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + const account = await client.getAccount(); + expect(account.id).toBe(client.secrets.accountId); + expect(Array.isArray(account.orders)).toBe(true); + expect(Array.isArray(account.balances)).toBe(true); + }); + + it("throws on getAccount for a nonexistent account ID", { timeout: 15_000 }, async () => { + // Use a throwaway key that has never had an account created + const { privateKeyToAccount } = await import("viem/accounts"); + const { generatePrivateKey } = await import("viem/accounts"); + const { DirectMatchClient } = await import("../src/client.js"); + + const throwawayKey = generatePrivateKey(); + const account = privateKeyToAccount(throwawayKey); + const client = await DirectMatchClient.newBaseSepoliaClient(account); + + await expect(client.getAccount()).rejects.toThrow("getAccount failed"); + }); +}); diff --git a/packages/direct-match/test/getBalanceByMint.test.ts b/packages/direct-match/test/getBalanceByMint.test.ts new file mode 100644 index 00000000..1c8fc234 --- /dev/null +++ b/packages/direct-match/test/getBalanceByMint.test.ts @@ -0,0 +1,17 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount, USDC } from "./helpers.js"; + +describe("getBalanceByMint", () => { + it("fetches a balance by token mint or throws if not found", { timeout: 15_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + try { + const balance = await client.getBalanceByMint(USDC); + expect(balance.mint.toLowerCase()).toBe(USDC.toLowerCase()); + } catch (e) { + // The relayer returns 404 if no balance exists for this mint + expect(String(e)).toContain("getBalanceByMint failed"); + } + }); +}); diff --git a/packages/direct-match/test/getBalances.test.ts b/packages/direct-match/test/getBalances.test.ts new file mode 100644 index 00000000..72bf4559 --- /dev/null +++ b/packages/direct-match/test/getBalances.test.ts @@ -0,0 +1,12 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount } from "./helpers.js"; + +describe("getBalances", () => { + it("fetches account balances", { timeout: 15_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + const balances = await client.getBalances(); + expect(Array.isArray(balances)).toBe(true); + }); +}); diff --git a/packages/direct-match/test/getOrderAndPlaceOrder.test.ts b/packages/direct-match/test/getOrderAndPlaceOrder.test.ts new file mode 100644 index 00000000..8923e8bc --- /dev/null +++ b/packages/direct-match/test/getOrderAndPlaceOrder.test.ts @@ -0,0 +1,34 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount, USDC, WETH } from "./helpers.js"; + +describe("placeOrder and getOrder", () => { + it("places an order and fetches it by ID", { timeout: 30_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + await client.placeOrder({ + inputMint: USDC, + outputMint: WETH, + inputAmount: 100_000n, + }); + + // Find the placed order via getOrders + const orders = await client.getOrders(false); + expect(orders.length).toBeGreaterThan(0); + + const placed = orders.find( + (o) => + o.order.intent.in_token.toLowerCase() === USDC.toLowerCase() && + o.order.intent.out_token.toLowerCase() === WETH.toLowerCase(), + ); + expect(placed).toBeDefined(); + + // Fetch the same order by ID + const order = await client.getOrder(placed!.id); + expect(order.id).toBe(placed!.id); + expect(order.state).toBe("created"); + + // Clean up + await client.cancelOrder(placed!.id); + }); +}); diff --git a/packages/direct-match/test/getOrders.test.ts b/packages/direct-match/test/getOrders.test.ts new file mode 100644 index 00000000..cf58acff --- /dev/null +++ b/packages/direct-match/test/getOrders.test.ts @@ -0,0 +1,46 @@ +import { describe, expect, it } from "vitest"; +import { createClient, ensureAccount, USDC, WETH } from "./helpers.js"; + +describe("getOrders", () => { + it("returns placed orders", { timeout: 30_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + await client.placeOrder({ + inputMint: USDC, + outputMint: WETH, + inputAmount: 100_000n, + }); + + const orders = await client.getOrders(false); + const found = orders.find( + (o) => o.order.intent.in_token.toLowerCase() === USDC.toLowerCase(), + ); + expect(found).toBeDefined(); + + // Clean up + await client.cancelOrder(found!.id); + }); + + it("cancelled orders do not appear in non-historic results", { timeout: 30_000 }, async () => { + const client = await createClient(); + await ensureAccount(client); + + await client.placeOrder({ + inputMint: USDC, + outputMint: WETH, + inputAmount: 100_000n, + }); + + const orders = await client.getOrders(false); + const found = orders.find( + (o) => o.order.intent.in_token.toLowerCase() === USDC.toLowerCase(), + ); + expect(found).toBeDefined(); + + await client.cancelOrder(found!.id); + + const after = await client.getOrders(false); + expect(after.find((o) => o.id === found!.id)).toBeUndefined(); + }); +}); diff --git a/packages/direct-match/test/helpers.ts b/packages/direct-match/test/helpers.ts new file mode 100644 index 00000000..d647d25c --- /dev/null +++ b/packages/direct-match/test/helpers.ts @@ -0,0 +1,226 @@ +import { execSync } from "node:child_process"; +import { + type Address, + createPublicClient, + createWalletClient, + erc20Abi, + type Hex, + http, + maxUint48, + maxUint160, +} from "viem"; +import { type PrivateKeyAccount, privateKeyToAccount } from "viem/accounts"; +import { baseSepolia } from "viem/chains"; +import { DirectMatchClient } from "../src/client.js"; +import type { ApiOrder } from "../src/types.js"; + +// Permit2 canonical address (same on all chains) +const PERMIT2 = "0x000000000022D473030F116dDEE9F6B43aC78BA3" as Address; +// Darkpool address on Base Sepolia +const DARKPOOL = "0xDE9BfD62B2187d4c14FBcC7D869920d34e4DB3Da" as Address; + +const permit2Abi = [ + { + type: "function", + name: "allowance", + inputs: [ + { name: "user", type: "address" }, + { name: "token", type: "address" }, + { name: "spender", type: "address" }, + ], + outputs: [ + { name: "amount", type: "uint160" }, + { name: "expiration", type: "uint48" }, + { name: "nonce", type: "uint48" }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "approve", + inputs: [ + { name: "token", type: "address" }, + { name: "spender", type: "address" }, + { name: "amount", type: "uint160" }, + { name: "expiration", type: "uint48" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, +] as const; + +// Base Sepolia test token addresses +export const USDC = "0xD9961Bb4Cb27192f8dAd20a662be081f546b0E74"; +export const WETH = "0x31a5552AF53C35097Fdb20FFf294c56dc66FA04c"; + +// AWS Secrets Manager paths for Base Sepolia v2 +const AWS_REGION = "us-east-2"; +const AWS_QUOTERS_API_KEY_SECRET = "/base/sepolia/v2/quoters-api-key"; +const AWS_ADMIN_API_KEY_SECRET = "/base/sepolia/v2/admin-api-key"; + +/** + * Fetch a secret from AWS Secrets Manager via the CLI. + * Requires the AWS CLI to be installed and authenticated. + */ +function fetchAwsSecret(secretId: string): string { + try { + const result = execSync( + `aws secretsmanager get-secret-value --secret-id ${secretId} --region ${AWS_REGION} --query SecretString --output text`, + { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }, + ); + return result.trim(); + } catch { + throw new Error( + `Failed to fetch AWS secret ${secretId}. Ensure the AWS CLI is installed and authenticated (aws sso login).`, + ); + } +} + +/** Get the quoters API key from env var or AWS Secrets Manager */ +export function getQuotersApiKey(): string { + if (process.env.QUOTERS_API_KEY) return process.env.QUOTERS_API_KEY; + return fetchAwsSecret(AWS_QUOTERS_API_KEY_SECRET); +} + +/** Get the relayer admin key from env var or AWS Secrets Manager */ +export function getRelayerAdminKey(): string { + if (process.env.RELAYER_ADMIN_KEY) return process.env.RELAYER_ADMIN_KEY; + return fetchAwsSecret(AWS_ADMIN_API_KEY_SECRET); +} + +export function getPrivateKey(): Hex { + const key = process.env.PRIVATE_KEY; + if (!key) throw new Error("PRIVATE_KEY env var required"); + return key as Hex; +} + +export async function createClient(): Promise { + const account = privateKeyToAccount(getPrivateKey()); + return DirectMatchClient.newBaseSepoliaClient(account); +} + +export async function ensureAccount(client: DirectMatchClient): Promise { + try { + await client.getAccount(); + } catch { + await client.createAccount(); + } +} + +const baseSepoliaPublicClient = createPublicClient({ chain: baseSepolia, transport: http() }); + +/** + * Ensure ERC20 and Permit2 allowances are set for a token. + * Two-step approval: ERC20→Permit2, then Permit2→Darkpool. + */ +export async function ensureAllowances( + account: PrivateKeyAccount, + token: Address, + amount: bigint, +): Promise { + const pub = baseSepoliaPublicClient; + const wallet = createWalletClient({ account, chain: baseSepolia, transport: http() }); + const owner = account.address; + + // Step 1: ERC20 approval for Permit2 + const erc20Allowance = await pub.readContract({ + address: token, + abi: erc20Abi, + functionName: "allowance", + args: [owner, PERMIT2], + }); + if (erc20Allowance < amount) { + const hash = await wallet.writeContract({ + address: token, + abi: erc20Abi, + functionName: "approve", + args: [PERMIT2, amount], + }); + await pub.waitForTransactionReceipt({ hash, confirmations: 1 }); + console.log(` ERC20 approval for Permit2 confirmed: ${hash}`); + } + + // Step 2: Permit2 allowance for Darkpool + const [permit2Amount, permit2Expiration] = await pub.readContract({ + address: PERMIT2, + abi: permit2Abi, + functionName: "allowance", + args: [owner, token, DARKPOOL], + }); + const now = BigInt(Math.floor(Date.now() / 1000)); + if (permit2Amount < amount || permit2Expiration < now) { + const hash = await wallet.writeContract({ + address: PERMIT2, + abi: permit2Abi, + functionName: "approve", + args: [token, DARKPOOL, maxUint160, maxUint48], + }); + await pub.waitForTransactionReceipt({ hash, confirmations: 1 }); + console.log(` Permit2 allowance for Darkpool confirmed: ${hash}`); + } +} + +export function sleep(ms: number): Promise { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +/** + * Poll with exponential backoff until an order leaves the active list, + * has fills, or an on-chain balance change is detected. + * + * Pass `balanceCheck` to detect settlement via ERC20 balance change + * (useful when the relayer doesn't report fills for Ring 0 orders). + */ +export async function waitForOrderFill( + client: DirectMatchClient, + orderId: string, + balanceCheck?: { token: Address; owner: Address; balanceBefore: bigint }, + maxAttempts = 6, + initialDelayMs = 2_000, +): Promise { + let delayMs = initialDelayMs; + + for (let attempt = 1; attempt <= maxAttempts; attempt++) { + console.log(` Poll ${attempt}/${maxAttempts} (${delayMs / 1000}s)...`); + await sleep(delayMs); + + // Check on-chain balance change (most reliable for Ring 0) + if (balanceCheck) { + const currentBalance = await baseSepoliaPublicClient.readContract({ + address: balanceCheck.token, + abi: erc20Abi, + functionName: "balanceOf", + args: [balanceCheck.owner], + }); + if (currentBalance !== balanceCheck.balanceBefore) { + console.log( + ` Balance changed: ${balanceCheck.balanceBefore} → ${currentBalance}`, + ); + // Return the order from whichever endpoint has it + const active = await client.getOrders(false); + const order = active.find((o) => o.id === orderId); + if (order) return order; + const historic = await client.getOrders(true); + return historic.find((o) => o.id === orderId) ?? null; + } + } + + const active = await client.getOrders(false); + const stillActive = active.find((o) => o.id === orderId); + + if (!stillActive) { + const historic = await client.getOrders(true); + return historic.find((o) => o.id === orderId) ?? null; + } + + if (stillActive.fills.length > 0) { + console.log(` Partially filled (${stillActive.fills.length} fill(s))`); + return stillActive; + } + + console.log(` Still active (state: ${stillActive.state})`); + delayMs = Math.min(delayMs * 2, 60_000); + } + + return null; // Timed out +} diff --git a/packages/direct-match/test/matchQuoterOrders.test.ts b/packages/direct-match/test/matchQuoterOrders.test.ts new file mode 100644 index 00000000..14bc7945 --- /dev/null +++ b/packages/direct-match/test/matchQuoterOrders.test.ts @@ -0,0 +1,186 @@ +import { type Address, createPublicClient, erc20Abi, formatUnits, http } from "viem"; +import { baseSepolia } from "viem/chains"; +import { describe, expect, it } from "vitest"; +import { + createClient, + ensureAccount, + ensureAllowances, + getQuotersApiKey, + getRelayerAdminKey, + sleep, + USDC, + WETH, + waitForOrderFill, +} from "./helpers.js"; + +const publicClient = createPublicClient({ chain: baseSepolia, transport: http() }); +const USDC_AMOUNT = 100_000_000n; // 100 USDC (6 decimals) + +if (!process.env.PRIVATE_KEY) { + console.error("PRIVATE_KEY env var required"); + process.exit(1); +} + +const QUOTERS_URL = "https://base-sepolia.v2.quoters.renegade.fi:3000"; + +/** Fetch the quoters /view and find a WETH matching pool with active orders */ +async function findWethMatchingPool(apiKey: string): Promise { + const resp = await fetch(`${QUOTERS_URL}/view`, { + headers: { "x-api-key": apiKey }, + }); + if (!resp.ok) { + throw new Error(`Quoters /view failed (${resp.status}): ${await resp.text()}`); + } + const view = (await resp.json()) as Record; + const quoters = view.quoters as Record[] }>; + + for (const [key, quoter] of Object.entries(quoters)) { + if (!key.toLowerCase().includes("weth")) continue; + if (quoter.orders && quoter.orders.length > 0) { + const order = quoter.orders[0]!; + for (const parentKey of [ + "match_options", + "matching_options", + "external_match_options", + "", + ]) { + const parent = parentKey + ? (order[parentKey] as Record | undefined) + : order; + if (!parent) continue; + for (const field of ["matching_pool", "matchingPool", "matching-pool"]) { + if (field in parent) { + return String(parent[field]); + } + } + } + } + } + + throw new Error("No active WETH quoter orders found"); +} + +describe("match against quoter orders", () => { + console.log("NOTE: WETH quoters must be funded and rebalanced before running this test."); + console.log(" Use the quoters API to rebalance, and fund EOAs if allocation is 0.\n"); + it( + "places a USDC→WETH order in the quoter's pool and waits for fill", + { timeout: 180_000 }, + async () => { + const quotersApiKey = getQuotersApiKey(); + const adminKey = getRelayerAdminKey(); + + // 1. Set up client and account + const client = await createClient(); + await ensureAccount(client); + console.log(`Account: ${client.account.address}`); + + // 2. Cancel stale orders from previous runs + const stale = await client.getOrders(false); + for (const order of stale) { + try { + console.log(`Cancelling stale order ${order.id}`); + await client.cancelOrder(order.id); + } catch (e) { + console.log( + `Skipping order ${order.id}: ${e instanceof Error ? e.message : e}`, + ); + } + } + + // 3. Find a WETH matching pool with active quoter orders + const matchingPool = await findWethMatchingPool(quotersApiKey); + console.log(`Using matching pool: ${matchingPool}`); + + // 4. Check USDC balance + const usdcBalance = await publicClient.readContract({ + address: USDC as Address, + abi: erc20Abi, + functionName: "balanceOf", + args: [client.account.address], + }); + console.log(`USDC balance: ${formatUnits(usdcBalance, 6)}`); + expect(usdcBalance).toBeGreaterThanOrEqual(USDC_AMOUNT); + + // 5. Snapshot WETH balance before (to detect settlement on-chain) + const wethBefore = await publicClient.readContract({ + address: WETH as Address, + abi: erc20Abi, + functionName: "balanceOf", + args: [client.account.address], + }); + console.log(`WETH balance before: ${formatUnits(wethBefore, 18)}`); + + // 6. Ensure Permit2 allowances FIRST (on-chain state must be ready + // before sync queries it) + console.log("Ensuring Permit2 allowances for USDC..."); + await ensureAllowances(client.account, USDC as Address, USDC_AMOUNT); + + // 6. Place the order + const beforeOrders = new Set((await client.getOrders(false)).map((o) => o.id)); + console.log("Placing USDC→WETH order..."); + await client.placeOrderInPool( + { + inputMint: USDC, + outputMint: WETH, + inputAmount: USDC_AMOUNT, + }, + matchingPool, + adminKey, + ); + + const afterOrders = await client.getOrders(false); + const placed = afterOrders.find((o) => !beforeOrders.has(o.id)); + expect(placed).toBeDefined(); + console.log(`Placed order: ${placed!.id}`); + + // 7. Repeatedly sync until the relayer indexes a non-zero USDC balance. + // The sync queries the indexer for active orders, then fetches + // on-chain EOA balances. The indexer needs time to pick up our order. + // The sync queries the indexer for active orders, fetches on-chain + // EOA balances, and triggers the matching engine via success hook. + // We retry because the indexer may take time to index our order. + let synced = false; + for (let attempt = 1; attempt <= 10; attempt++) { + console.log(`Sync attempt ${attempt}/10...`); + await sleep(3_000); + await client.syncAccount(); + + // Check via getAccount (returns all balances including EOA) + const acct = await client.getAccount(); + const usdcBal = acct.balances.find( + (b) => b.mint.toLowerCase() === USDC.toLowerCase(), + ); + console.log(` USDC balance (getAccount): ${usdcBal?.amount ?? "not found"}`); + console.log(` Orders: ${acct.orders.length}`); + + if (usdcBal && usdcBal.amount !== "0") { + synced = true; + break; + } + } + console.log( + `Sync result: ${synced ? "balance indexed" : "balance still 0 after retries"}`, + ); + + // 9. Poll with exponential backoff — detect fill via WETH balance change + await waitForOrderFill(client, placed!.id, { + token: WETH as Address, + owner: client.account.address, + balanceBefore: wethBefore, + }); + + // 10. Verify fill + const wethAfter = await publicClient.readContract({ + address: WETH as Address, + abi: erc20Abi, + functionName: "balanceOf", + args: [client.account.address], + }); + const wethReceived = wethAfter - wethBefore; + console.log(`WETH received: ${formatUnits(wethReceived, 18)}`); + + expect(wethReceived).toBeGreaterThan(0n); + }, + ); +}); diff --git a/packages/direct-match/test/matchSelfOrders.test.ts b/packages/direct-match/test/matchSelfOrders.test.ts new file mode 100644 index 00000000..18fe712d --- /dev/null +++ b/packages/direct-match/test/matchSelfOrders.test.ts @@ -0,0 +1,99 @@ +import { type Address, createPublicClient, erc20Abi, formatUnits, http } from "viem"; +import { privateKeyToAccount } from "viem/accounts"; +import { baseSepolia } from "viem/chains"; +import { describe, expect, it } from "vitest"; +import { DirectMatchClient } from "../src/client.js"; +import { ensureAccount, ensureAllowances, sleep, USDC, WETH } from "./helpers.js"; + +const PRIVATE_KEY = process.env.PRIVATE_KEY; +const PRIVATE_KEY_2 = process.env.PRIVATE_KEY_2; + +if (!PRIVATE_KEY) { + console.error("PRIVATE_KEY env var required"); + process.exit(1); +} +if (!PRIVATE_KEY_2) { + console.error("PRIVATE_KEY_2 env var required"); + process.exit(1); +} + +const publicClient = createPublicClient({ chain: baseSepolia, transport: http() }); + +const USDC_AMOUNT = 2_000_000n; // 2 USDC (6 decimals) +const WETH_AMOUNT = 1_000_000_000_000_000n; // 0.001 WETH (18 decimals) + +async function getErc20Balance(token: Address, owner: Address): Promise { + return publicClient.readContract({ + address: token, + abi: erc20Abi, + functionName: "balanceOf", + args: [owner], + }); +} + +describe("match self orders", () => { + it( + "places opposing orders from two accounts and verifies settlement", + { timeout: 120_000 }, + async () => { + const accountA = privateKeyToAccount(PRIVATE_KEY as Hex); + const accountB = privateKeyToAccount(PRIVATE_KEY_2 as Hex); + + const clientA = await DirectMatchClient.newBaseSepoliaClient(accountA); + const clientB = await DirectMatchClient.newBaseSepoliaClient(accountB); + + await ensureAccount(clientA); + await ensureAccount(clientB); + + // 1. Ensure Permit2 allowances + await ensureAllowances(accountA, USDC as Address, USDC_AMOUNT); + await ensureAllowances(accountB, WETH as Address, WETH_AMOUNT); + + // 2. Snapshot output token balances + const wethBeforeA = await getErc20Balance(WETH as Address, accountA.address); + const usdcBeforeB = await getErc20Balance(USDC as Address, accountB.address); + + // 3. Place both orders concurrently + const [resultA, resultB] = await Promise.allSettled([ + clientA.placeOrder({ inputMint: USDC, outputMint: WETH, inputAmount: USDC_AMOUNT }), + clientB.placeOrder({ inputMint: WETH, outputMint: USDC, inputAmount: WETH_AMOUNT }), + ]); + console.log(`Orders: A=${resultA.status}, B=${resultB.status}`); + + // 4. Poll for on-chain balance change + let matched = false; + for (let attempt = 1; attempt <= 10; attempt++) { + await sleep(2_000); + + const wethNowA = await getErc20Balance(WETH as Address, accountA.address); + const usdcNowB = await getErc20Balance(USDC as Address, accountB.address); + + if (wethNowA > wethBeforeA || usdcNowB > usdcBeforeB) { + console.log(`Match settled after ${attempt * 2}s`); + console.log(` A received ${formatUnits(wethNowA - wethBeforeA, 18)} WETH`); + console.log(` B received ${formatUnits(usdcNowB - usdcBeforeB, 6)} USDC`); + matched = true; + break; + } + } + + // 5. Clean up remaining orders + for (const o of await clientA.getOrders(false)) { + try { + await clientA.cancelOrder(o.id); + } catch { + /* skip */ + } + } + for (const o of await clientB.getOrders(false)) { + try { + await clientB.cancelOrder(o.id); + } catch { + /* skip */ + } + } + + expect(matched).toBe(true); + }, + ); +}); diff --git a/packages/direct-match/test/updateOrder.test.ts b/packages/direct-match/test/updateOrder.test.ts new file mode 100644 index 00000000..b3c3f891 --- /dev/null +++ b/packages/direct-match/test/updateOrder.test.ts @@ -0,0 +1,7 @@ +import { describe, it } from "vitest"; + +// TODO: updateOrder is not yet implemented in the relayer (returns "not implemented") +describe("updateOrder", () => { + it.todo("updates min_fill_size on an existing order"); + it.todo("toggles allow_external_matches on an existing order"); +}); diff --git a/packages/direct-match/test_data/test_data.json b/packages/direct-match/test_data/test_data.json new file mode 100644 index 00000000..48b1396a --- /dev/null +++ b/packages/direct-match/test_data/test_data.json @@ -0,0 +1,85 @@ +{ + "chainId": 42161, + "accounts": [ + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000001", + "accountId": "a2751b2b-f835-5062-6d25-cff06332529e", + "authHmacKey": "bdd3db7a79c8fa69d3130e41a93c49a305255a446881451bff6f272276979af8" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000002", + "accountId": "4c31a16c-74f3-9ab3-7c1f-3bfde92ec72c", + "authHmacKey": "e91f451b3b3352b9ea5709279cbb4b9ead13d8ab4124ef594e3e223b50d1c654" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000003", + "accountId": "4fa3047c-9c53-e848-e544-7525500e6e31", + "authHmacKey": "f989f14e4ede8e7ab31401c58e0cd4571909f051272ffe52058997e9e94f5e7d" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000004", + "accountId": "38f52dea-a6d7-9933-eb06-900c9fad6deb", + "authHmacKey": "41438f88994b557e09a90868e25f153e48c2a5fae2471bbe805e8c22a49e7d92" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000005", + "accountId": "c531ae06-b219-a3c4-19e0-e778a547704f", + "authHmacKey": "b2927df447f9e1523b3377ad715d69c4ee25361e87f634975756038fe76da98f" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000006", + "accountId": "b4325f70-fb9c-45b9-bfdd-f62b43f27f14", + "authHmacKey": "a52a51f4d386f0d3101c95b0ee1e390aa16c603b29238d3e7c99985ed8a7bc81" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000007", + "accountId": "9175fc58-fd60-c501-0018-172d656b8ad1", + "authHmacKey": "b0fb98fc861df07a47177a7fd7b3fb0b286cf9fefa33179ddb2d740b285d3f70" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000008", + "accountId": "6f8b1865-b177-96cb-596e-5ccd6c4f5e44", + "authHmacKey": "28bf3c95ce588d7c3e8f8fb36ffb9eaf3652de77fc9ccdc001c3acba1e3fe8b9" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000009", + "accountId": "b99d5358-7249-75b4-dcf2-b7bab0ebe321", + "authHmacKey": "5c0746af2f1c14654e15991f7c6e42c5272391f3ea4a79f2dba7e20bc654ce7e" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000a", + "accountId": "a4bedccc-562e-b360-8d0b-f1d74a119875", + "authHmacKey": "531a823f79740bf647232727993ed7549dc8968fd99bb6a70c0630ab92a19263" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000b", + "accountId": "207c5b65-22c2-a3a4-2720-d7a30be9c964", + "authHmacKey": "eddb103041c5ed4e4486e48286528c27bdcdd2dadbed7d6ca7295166bec63bae" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000c", + "accountId": "e06b31dc-a452-f7de-ee59-70aca334c9e7", + "authHmacKey": "b910137640ea4c15aa59274bd61b78ef11281d02fdd17e2e8a3f444ec4eb3e3e" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000d", + "accountId": "a0faf48e-df97-87ef-984f-710526e0626c", + "authHmacKey": "803f552d91a7098901fd7d542b30b28c75af3b3e8e1ae872c2bd73a63fc30b6d" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000e", + "accountId": "3b317b94-1482-d494-f624-0f6747ece3eb", + "authHmacKey": "0310611af23400cd2aea38f2823aa9e1e257933ae73c58b3c94886a836b998f8" + }, + { + "privateKey": "0x000000000000000000000000000000000000000000000000000000000000000f", + "accountId": "901557e9-88b3-d0aa-14bc-f88e83d8209c", + "authHmacKey": "c7ba2d8ffe8a4840ac45cce8eed84362d74368e3237da20614628818f3357e3f" + }, + { + "privateKey": "0x0000000000000000000000000000000000000000000000000000000000000010", + "accountId": "bbddf2ed-37e3-717a-bd2b-70e5ece43ed5", + "authHmacKey": "c524d8ab600fc38eac6fd0eb6d3a3e0572570332c64e2f1b124c0aefa4f61588" + } + ] +} diff --git a/packages/external-match/package.json b/packages/external-match/package.json index d2f90b1f..473f609d 100644 --- a/packages/external-match/package.json +++ b/packages/external-match/package.json @@ -1,5 +1,5 @@ { - "name": "@renegade-fi/renegade-sdk", + "name": "@renegade-fi/external-match", "version": "2.0.1", "description": "A TypeScript client for interacting with the Renegade external matching API", "repository": { diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.ts index aef1fb54..c02f9af9 100644 --- a/packages/http-client/src/index.ts +++ b/packages/http-client/src/index.ts @@ -60,6 +60,10 @@ export class RelayerHttpClient { }; } + public getBaseUrl(): string { + return this.baseUrl; + } + /** * Make a GET request with custom headers. * diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md deleted file mode 100644 index 1b272327..00000000 --- a/packages/node/CHANGELOG.md +++ /dev/null @@ -1,1037 +0,0 @@ -# @renegade-fi/node - -## 1.0.0 - -### Major Changes - -- v1 release - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@1.0.0 - -## 0.6.18 - -### Patch Changes - -- external-match: client: Add direct malleable match method -- Updated dependencies - - @renegade-fi/core@0.9.13 - -## 0.6.17 - -### Patch Changes - -- Assume fees paid in withdrawal API -- Updated dependencies - - @renegade-fi/core@0.9.12 - -## 0.6.16 - -### Patch Changes - -- chore: pin safe versions -- Updated dependencies - - @renegade-fi/core@0.9.11 - -## 0.6.15 - -### Patch Changes - -- core, node: use logger interface -- Updated dependencies - - @renegade-fi/core@0.9.10 - -## 0.6.14 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.9 - -## 0.6.13 - -### Patch Changes - -- add getWalletNullifier action -- Updated dependencies - - @renegade-fi/core@0.9.8 - -## 0.6.12 - -### Patch Changes - -- node: clients: renegade: base: Make createOrderWebsocket fields public - -## 0.6.11 - -### Patch Changes - -- node: external match client: add base constructors - -## 0.6.10 - -### Patch Changes - -- node: renegade client: add get order history and base mainnet constructors - -## 0.6.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.7 - -## 0.6.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.6 - -## 0.6.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.5 - -## 0.6.6 - -### Patch Changes - -- core, node: add get supported tokens route -- Updated dependencies - - @renegade-fi/core@0.9.4 - -## 0.6.5 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.3 - -## 0.6.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.2 - -## 0.6.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.1 - -## 0.6.2 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.0 - -## 0.6.1 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.8.1 - -## 0.6.0 - -### Minor Changes - -- add Base-specific withdrawal logic & client - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.8.0 - -## 0.5.24 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.10 - -## 0.5.23 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.9 - -## 0.5.22 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.8 - -## 0.5.21 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.7 - -## 0.5.20 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.6 - -## 0.5.19 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.5 - -## 0.5.18 - -### Patch Changes - -- core, node price-reporter: update env namespace, add overrides' -- Updated dependencies - - @renegade-fi/core@0.7.4 - -## 0.5.17 - -### Patch Changes - -- core, node: filter defaults when fetching wallet, catch error in prefetch -- Updated dependencies - - @renegade-fi/core@0.7.3 - -## 0.5.16 - -### Patch Changes - -- wasm, core: make update order path compatible with external keychains -- Updated dependencies - - @renegade-fi/core@0.7.2 - -## 0.5.15 - -### Patch Changes - -- Add triggerRelayerSnapshot action -- Updated dependencies - - @renegade-fi/core@0.7.1 - -## 0.5.14 - -### Patch Changes - -- node, token, price-reporter: misc adjustments - -## 0.5.13 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.0 - -## 0.5.12 - -### Patch Changes - -- core: add malleable matches -- Updated dependencies - - @renegade-fi/core@0.6.8 - -## 0.5.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.7 - -## 0.5.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.6 - -## 0.5.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.5 - -## 0.5.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.4 - -## 0.5.7 - -### Patch Changes - -- react: temp disable unsubscribing ws topics -- Updated dependencies - - @renegade-fi/core@0.6.3 - -## 0.5.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.2 - -## 0.5.5 - -### Patch Changes - -- Use disable_gas_sponsorship request parameter -- Updated dependencies - - @renegade-fi/core@0.6.1 - -## 0.5.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.0 - -## 0.5.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.5.2 - -## 0.5.2 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.5.1 - -## 0.5.1 - -### Patch Changes - -- node: Add order websocket - -## 0.5.0 - -### Minor Changes - -- node: chore - -## 0.4.21 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.5.0 - -## 0.4.20 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.19 - -## 0.4.19 - -### Patch Changes - -- node: Use simulate + write contract pattern for approval tx - -## 0.4.18 - -### Patch Changes - -- core, node: Accept key config in execute transfer actions -- Updated dependencies - - @renegade-fi/core@0.4.18 - -## 0.4.17 - -### Patch Changes - -- Return raw POST data if JSON cannot be parsed -- Updated dependencies - - @renegade-fi/core@0.4.17 - -## 0.4.16 - -### Patch Changes - -- include query string in auth path -- Updated dependencies - - @renegade-fi/core@0.4.16 - -## 0.4.15 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.15 - -## 0.4.14 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.14 - -## 0.4.13 - -### Patch Changes - -- implement external key management -- Updated dependencies - - @renegade-fi/core@0.4.13 - -## 0.4.12 - -### Patch Changes - -- Added support for order updates between quote and assemble calls -- Updated dependencies - - @renegade-fi/core@0.4.12 - -## 0.4.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.11 - -## 0.4.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.10 - -## 0.4.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.9 - -## 0.4.8 - -### Patch Changes - -- export default quote & load token mapping method -- Updated dependencies - - @renegade-fi/core@0.4.8 - -## 0.4.6 - -### Patch Changes - -- Use consistent naming in `getExternalMatchQuote` -- Updated dependencies - - @renegade-fi/core@0.4.6 - -## 0.4.5 - -### Patch Changes - -- Add quote/assemble actions for external match client -- Updated dependencies - - @renegade-fi/core@0.4.5 - -## 0.4.4 - -### Patch Changes - -- core: add fee details to external match bundle response -- Updated dependencies - - @renegade-fi/core@0.4.4 - -## 0.4.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.3 - -## 0.4.2 - -### Patch Changes - -- wasm, core, react, node: add action to request external match bundles -- Updated dependencies - - @renegade-fi/core@0.4.2 - -## 0.4.1 - -### Patch Changes - -- react: revert es module interop -- Updated dependencies - - @renegade-fi/core@0.4.1 - -## 0.4.0 - -### Minor Changes - -- wasm: include public blinder in create-wallet - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.0 - -## 0.3.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.8 - -## 0.3.10 - -### Patch Changes - -- core: tidy up -- Updated dependencies - - @renegade-fi/core@0.3.7 - -## 0.3.9 - -### Patch Changes - -- wasm, core, react: update to api auth v2 -- Updated dependencies - - @renegade-fi/core@0.3.6 - -## 0.3.8 - -### Patch Changes - -- wasm: init console_error_panic_hook to log panics to dev console - -## 0.3.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.5 - -## 0.3.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.4 - -## 0.3.5 - -### Patch Changes - -- node: export actions from entry module - -## 0.3.4 - -### Patch Changes - -- core: set default min fill size when creating an order -- Updated dependencies - - @renegade-fi/core@0.3.3 - -## 0.3.3 - -### Patch Changes - -- wasm: add serde default trait to min_fill_size - -## 0.3.2 - -### Patch Changes - -- wasm, core: add min fill amount -- Updated dependencies - - @renegade-fi/core@0.3.2 - -## 0.3.1 - -### Patch Changes - -- chore: update metadata -- Updated dependencies - - @renegade-fi/core@0.3.1 - -## 0.3.0 - -### Minor Changes - -- wasm, core: implement worst case price - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.0 - -## 0.2.2 - -### Patch Changes - -- wasm: fix keychain padding issue - -## 0.2.1 - -### Patch Changes - -- wasm: modify fixed point precision' - -## 0.2.0 - -### Minor Changes - -- meta: ensure cookie storage rename -- ensure storage rename - -### Patch Changes - -- Updated dependencies -- Updated dependencies - - @renegade-fi/core@0.2.0 - -## 0.1.0 - -### Minor Changes - -- core: new storage key - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.1.0 - -## 0.0.56 - -### Patch Changes - -- core, react: reset sk_root in create-wallet and lookup-wallet - -## 0.0.55 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.53 - -## 0.0.54 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.52 - -## 0.0.53 - -### Patch Changes - -- pre-mainnet release -- Updated dependencies - - @renegade-fi/core@0.0.51 - -## 0.0.52 - -### Patch Changes - -- wasm, core, react, node: implement keychain rotation -- Updated dependencies - - @renegade-fi/core@0.0.50 - -## 0.0.51 - -### Patch Changes - -- wasm, core: update wallet parameterization -- Updated dependencies - - @renegade-fi/core@0.0.49 - -## 0.0.50 - -### Patch Changes - -- order mutation & timestamped prices -- Updated dependencies - - @renegade-fi/core@0.0.48 - -## 0.0.49 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.47 - -## 0.0.48 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.46 - -## 0.0.47 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.45 - -## 0.0.46 - -### Patch Changes - -- set viem as config option and export cookie storage module -- Updated dependencies - - @renegade-fi/core@0.0.44 - -## 0.0.45 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.43 - -## 0.0.44 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.42 - -## 0.0.43 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.41 - -## 0.0.42 - -### Patch Changes - -- node: fix index import - -## 0.0.41 - -### Patch Changes - -- node: export core actions and constants - -## 0.0.40 - -### Patch Changes - -- core: downstream API changes for orders / tasks -- Updated dependencies - - @renegade-fi/core@0.0.40 - -## 0.0.39 - -### Patch Changes - -- core: react, remove `seed` parameter, fix connect / reconnect logic -- Updated dependencies - - @renegade-fi/core@0.0.39 - -## 0.0.38 - -### Patch Changes - -- core, react: add ping query, fix lookup wallet log -- Updated dependencies - - @renegade-fi/core@0.0.38 - -## 0.0.37 - -### Patch Changes - -- core: increase lookup wallet timeout -- Updated dependencies - - @renegade-fi/core@0.0.37 - -## 0.0.36 - -### Patch Changes - -- core: add refresh wallet action -- Updated dependencies - - @renegade-fi/core@0.0.36 - -## 0.0.35 - -### Patch Changes - -- use proxied exports -- Updated dependencies - - @renegade-fi/core@0.0.35 - -## 0.0.34 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.34 - -## 0.0.33 - -### Patch Changes - -- add back of queue queries, remove placeholder block explorer url -- Updated dependencies - - @renegade-fi/core@0.0.33 - -## 0.0.32 - -### Patch Changes - -- react: prevent orderbook refetching -- Updated dependencies - - @renegade-fi/core@0.0.32 - -## 0.0.31 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.31 - -## 0.0.30 - -### Patch Changes - -- set token mapping using env var -- Updated dependencies - - @renegade-fi/core@0.0.30 - -## 0.0.29 - -### Patch Changes - -- use core connect function in all packages -- Updated dependencies - - @renegade-fi/core@0.0.29 - -## 0.0.28 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.28 - -## 0.0.27 - -### Patch Changes - -- add function to wait for wallet indexing completion -- Updated dependencies - - @renegade-fi/core@0.0.27 - -## 0.0.26 - -### Patch Changes - -- prevent deposit if MAX_BALANCES would be exceeded -- Updated dependencies - - @renegade-fi/core@0.0.26 - -## 0.0.25 - -### Patch Changes - -- core, react: fix bigint parsing error -- Updated dependencies - - @renegade-fi/core@0.0.25 - -## 0.0.24 - -### Patch Changes - -- adjust decimal count in formatAmount fn -- Updated dependencies - - @renegade-fi/core@0.0.24 - -## 0.0.23 - -### Patch Changes - -- core: error if order would result in too many balances -- Updated dependencies - - @renegade-fi/core@0.0.23 - -## 0.0.22 - -### Patch Changes - -- use env variable for network detection -- Updated dependencies - - @renegade-fi/core@0.0.22 - -## 0.0.21 - -### Patch Changes - -- wasm: implement fix for signature generation -- Updated dependencies - - @renegade-fi/core@0.0.21 - -## 0.0.20 - -### Patch Changes - -- wasm: implement fix for signature generation -- Updated dependencies - - @renegade-fi/core@0.0.20 - -## 0.0.19 - -### Patch Changes - -- Add function to reinitialize store if user does not want persistence -- Updated dependencies - - @renegade-fi/core@0.0.19 - -## 0.0.18 - -### Patch Changes - -- Parse all numerical values as bigint -- Updated dependencies - - @renegade-fi/core@0.0.18 - -## 0.0.17 - -### Patch Changes - -- Move node specific connect logic -- Updated dependencies - - @renegade-fi/core@0.0.17 - -## 0.0.16 - -### Patch Changes - -- Add /v0 suffix -- Updated dependencies - - @renegade-fi/core@0.0.16 - -## 0.0.15 - -### Patch Changes - -- Allow for insecure transport to be set in config -- Updated dependencies - - @renegade-fi/core@0.0.15 - -## 0.0.14 - -### Patch Changes - -- Handle lookup/create wallet errors gracefully -- Updated dependencies - - @renegade-fi/core@0.0.14 - -## 0.0.13 - -### Patch Changes - -- Init node package -- Updated dependencies - - @renegade-fi/core@0.0.13 - -## 0.0.12 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.12 - -## 0.0.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.11 - -## 0.0.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.10 - -## 0.0.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.9 - -## 0.0.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.8 - -## 0.0.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.7 - -## 0.0.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.6 - -## 0.0.5 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.5 - -## 0.0.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.4 - -## 0.0.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.3 - -## 0.0.2 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.2 - -## 0.0.1 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.1 diff --git a/packages/node/README.md b/packages/node/README.md deleted file mode 100644 index f5394c8d..00000000 --- a/packages/node/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# @renegade-fi/node - -Node.js library for Renegade - -## Installation - -```bash -pnpm add @renegade-fi/node -``` - -## Documentation - -For documentation and guides, visit [the docs](https://docs.renegade.fi/technical-reference/typescript-sdk). \ No newline at end of file diff --git a/packages/node/package.json b/packages/node/package.json deleted file mode 100644 index eee327cc..00000000 --- a/packages/node/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@renegade-fi/node", - "description": "Node.js library for Renegade", - "version": "1.0.0", - "repository": { - "type": "git", - "url": "https://github.com/renegade-fi/typescript-sdk.git", - "directory": "packages/node" - }, - "scripts": { - "build": "pnpm run clean && pnpm run build:wasm && pnpm run build:esm+types", - "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", - "clean": "rm -rf dist tsconfig.tsbuildinfo", - "typecheck": "tsc --noEmit" - }, - "files": [ - "dist/**", - "!dist/**/*.tsbuildinfo", - "renegade-utils/*", - "src/**/*.ts", - "!src/**/*.test.ts", - "!src/**/*.test-d.ts" - ], - "sideEffects": false, - "type": "module", - "main": "./dist/exports/index.js", - "types": "./dist/types/exports/index.d.ts", - "typings": "./dist/types/exports/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/exports/index.d.ts", - "default": "./dist/exports/index.js" - }, - "./actions": { - "types": "./dist/types/exports/actions.d.ts", - "default": "./dist/exports/actions.js" - }, - "./renegade-utils": { - "types": "./renegade-utils/index.d.ts", - "default": "./renegade-utils/index.js" - }, - "./package.json": "./package.json" - }, - "typesVersions": { - "*": { - "actions": [ - "./dist/types/exports/actions.d.ts" - ] - } - }, - "dependencies": { - "@renegade-fi/core": "workspace:*", - "tiny-invariant": "^1.3.3" - }, - "peerDependencies": { - "viem": "2.x" - }, - "keywords": [ - "cryptography", - "zero-knowledge", - "darkpool", - "eth", - "ethereum", - "dapps", - "web3" - ] -} diff --git a/packages/node/src/actions/executeDeposit.ts b/packages/node/src/actions/executeDeposit.ts deleted file mode 100644 index b1c7c348..00000000 --- a/packages/node/src/actions/executeDeposit.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - type DepositReturnType, - deposit, - getBackOfQueueWallet, - getPkRootScalars, - type RenegadeConfig, - waitForTaskCompletionWs, -} from "@renegade-fi/core"; -import invariant from "tiny-invariant"; -import { type Address, erc20Abi, type WalletClient, zeroAddress } from "viem"; -import { signPermit2 } from "../utils/permit2.js"; - -export type ExecuteDepositParameters = { - mint: Address; - amount: bigint; - permit2Address: Address; - walletClient: WalletClient; - awaitTask?: boolean; - newPublicKey?: string; -}; - -export async function executeDeposit( - config: RenegadeConfig, - parameters: ExecuteDepositParameters, -): DepositReturnType { - const { mint, amount, permit2Address, walletClient, awaitTask, newPublicKey } = parameters; - invariant(config.viemClient, "Viem client is required"); - const chainId = config.viemClient.chain?.id; - - if (mint === zeroAddress || mint === "0x") { - throw new Error("Invalid mint address"); - } - if (amount === BigInt(0)) { - throw new Error("Amount must be greater than zero"); - } - if (!chainId) { - throw new Error("Invalid chainId"); - } - if (!walletClient.account) { - throw new Error("Invalid wallet client"); - } - - const keychainNonce = (await getBackOfQueueWallet(config)).key_chain.nonce; - const pkRoot = getPkRootScalars(config, { - nonce: keychainNonce, - }); - - // Check Permit2 Allowance - const permit2Allowance = await config.viemClient.readContract({ - address: mint, - abi: erc20Abi, - functionName: "allowance", - args: [walletClient.account.address, permit2Address], - }); - - // If not enough allowance, approve max amount - if (permit2Allowance < amount) { - const nonce = await config.viemClient.getTransactionCount({ - address: walletClient.account.address, - }); - const { request } = await config.viemClient.simulateContract({ - account: walletClient.account, - address: mint, - abi: erc20Abi, - functionName: "approve", - args: [permit2Address, amount], - nonce, - }); - const hash = await walletClient.writeContract(request); - await config.viemClient - .waitForTransactionReceipt({ - hash, - confirmations: 1, - timeout: 5_000, - }) - .catch(() => { - // Attempt deposit even if receipt not found - }); - } - - // Sign Permit2 - const { nonce, deadline, signature } = await signPermit2({ - amount, - chainId, - spender: config.darkPoolAddress, - permit2Address, - tokenAddress: mint, - walletClient, - pkRoot, - }); - - // Deposit - const { taskId } = await deposit(config, { - fromAddr: walletClient.account.address, - mint, - amount, - permitNonce: nonce, - permitDeadline: deadline, - permit: signature, - newPublicKey, - }); - - if (awaitTask) { - await waitForTaskCompletionWs(config, { - id: taskId, - timeout: 30_000, - }); - } - - return { taskId }; -} diff --git a/packages/node/src/actions/executeWithdrawal.ts b/packages/node/src/actions/executeWithdrawal.ts deleted file mode 100644 index 272fe5d0..00000000 --- a/packages/node/src/actions/executeWithdrawal.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { - getWalletId, - type RenegadeConfig, - type WithdrawParameters, - type WithdrawReturnType, - waitForTaskCompletionWs, - withdraw, -} from "@renegade-fi/core"; - -export type ExecuteWithdrawalParameters = WithdrawParameters & { - awaitTask?: boolean; -}; - -export async function executeWithdrawal( - config: RenegadeConfig, - parameters: ExecuteWithdrawalParameters, -): WithdrawReturnType { - const walletId = getWalletId(config); - const logger = config.getLogger("node:actions:executeWithdrawal"); - - logger.debug("Initiating withdrawal", { - walletId, - mint: parameters.mint, - amount: parameters.amount, - }); - const { taskId } = await withdraw(config, parameters); - - if (parameters.awaitTask) { - await waitForTaskCompletionWs(config, { id: taskId }); - logger.debug("Withdrawal completed", { walletId, taskId }); - } - - return { taskId }; -} diff --git a/packages/node/src/actions/generateWalletSecrets.ts b/packages/node/src/actions/generateWalletSecrets.ts deleted file mode 100644 index 27ec5dfa..00000000 --- a/packages/node/src/actions/generateWalletSecrets.ts +++ /dev/null @@ -1,30 +0,0 @@ -import type { SignMessageReturnType } from "viem"; -import { generate_wallet_secrets } from "../../renegade-utils/index.js"; - -/** - * Interface representing the cryptographic secrets generated for a wallet - */ -export interface GeneratedSecrets { - /** Unique identifier for the wallet in UUID format */ - wallet_id: string; - - /** Cryptographic seed for the wallet's blinder CSPRNG */ - blinder_seed: `0x${string}`; - - /** Cryptographic seed for the wallet's share CSPRNG */ - share_seed: `0x${string}`; - - /** Encryption key for authenticating API requests */ - symmetric_key: `0x${string}`; - - /** Secret key used for matching operations */ - sk_match: `0x${string}`; -} - -export async function generateWalletSecrets( - signMessage: (message: string) => Promise, -): Promise { - const secrets = await generate_wallet_secrets(signMessage); - const parsedSecrets = JSON.parse(secrets) as GeneratedSecrets; - return parsedSecrets; -} diff --git a/packages/node/src/clients/relayer/index.ts b/packages/node/src/clients/relayer/index.ts deleted file mode 100644 index 26b2c643..00000000 --- a/packages/node/src/clients/relayer/index.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { - type Config, - createConfig, - getSDKConfig, - type Logger, - type SDKConfig, -} from "@renegade-fi/core"; -import type { - AssignOrderParameters, - CreateMatchingPoolParameters, - DestroyMatchingPoolParameters, - GetOpenOrdersParameters, - GetOrderMatchingPoolParameters, - GetOrderMetadataParameters, - GetWalletMatchableOrderIdsParameters, -} from "@renegade-fi/core/actions"; -import { - assignOrder, - createMatchingPool, - destroyMatchingPool, - getOpenOrders, - getOrderMatchingPool, - getOrderMetadata, - getWalletMatchableOrderIds, - triggerRelayerSnapshot, -} from "@renegade-fi/core/actions"; -import * as rustUtils from "../../../renegade-utils/index.js"; - -/** - * The client for interacting with the Renegade relayer's admin API with an API key. - */ -export class AdminRelayerClient { - readonly config: Config; - readonly configv2: SDKConfig; - - /** - * @internal - */ - private constructor(params: { - apiKey: string; - chainId: number; - overrides?: Partial; - logger?: Logger; - }) { - const defaultConfig = getSDKConfig(params.chainId); - const configv2 = params.overrides - ? { ...defaultConfig, ...params.overrides } - : defaultConfig; - this.configv2 = configv2; - - this.config = createConfig({ - adminKey: params.apiKey, - darkPoolAddress: configv2.darkpoolAddress, - priceReporterUrl: configv2.priceReporterUrl, - relayerUrl: configv2.relayerUrl, - chainId: configv2.id, - utils: rustUtils, - logging: params.logger - ? { logger: params.logger, namespace: "node:clients:relayer" } - : undefined, - }); - } - - /** - * Create a new AdminRelayerClient - * - * @param params.apiKey your API key - * @param params.chainId the chain ID - * @param params.overrides any SDKConfig field can be passed directly as an override - */ - static new({ - apiKey, - chainId, - overrides, - logger, - }: { - apiKey: string; - chainId: number; - overrides?: Partial; - logger?: Logger; - }) { - return new AdminRelayerClient({ apiKey, chainId, overrides, logger }); - } - - /** - * Assign an order to a matching pool - * - * @param params.orderId the order ID - * @param params.matchingPool name of the matching pool - */ - async assignOrder(params: AssignOrderParameters) { - return assignOrder(this.config, params); - } - - /** - * Create a matching pool - * - * @param params.matchingPool name of the matching pool - */ - async createMatchingPool(params: CreateMatchingPoolParameters) { - return createMatchingPool(this.config, params); - } - - /** - * Destroy a matching pool - * - * @param params.matchingPool name of the matching pool - */ - async destroyMatchingPool(params: DestroyMatchingPoolParameters) { - return destroyMatchingPool(this.config, params); - } - - /** - * Get open orders managed by the relayer - */ - async getOpenOrders(params: GetOpenOrdersParameters) { - return getOpenOrders(this.config, params); - } - - /** - * Get the matching pool for an order - */ - async getOrderMatchingPool(params: GetOrderMatchingPoolParameters) { - return getOrderMatchingPool(this.config, params); - } - - /** - * Get the metadata for an order - */ - async getOrderMetadata(params: GetOrderMetadataParameters) { - return getOrderMetadata(this.config, params); - } - - /** - * Get the matchable order IDs for a wallet - */ - async getWalletMatchableOrderIds(params: GetWalletMatchableOrderIdsParameters) { - return getWalletMatchableOrderIds(this.config, params); - } - - /** - * Trigger a relayer raft snapshot - */ - async triggerSnapshot() { - return triggerRelayerSnapshot(this.config); - } - - /** - * Get the config - * - * TODO: Remove once we migrate to the SDK config - */ - public getConfig() { - return this.config; - } -} diff --git a/packages/node/src/clients/renegade/admin.ts b/packages/node/src/clients/renegade/admin.ts deleted file mode 100644 index 663eaae3..00000000 --- a/packages/node/src/clients/renegade/admin.ts +++ /dev/null @@ -1,90 +0,0 @@ -import type { Logger, SDKConfig } from "@renegade-fi/core"; -import { createConfig } from "@renegade-fi/core"; -import { - type CreateOrderInMatchingPoolParameters, - createOrderInMatchingPool, -} from "@renegade-fi/core/actions"; -import * as rustUtils from "../../../renegade-utils/index.js"; -import { RenegadeClient } from "./base.js"; -import type { ConstructorParams } from "./types.js"; - -/** - * The client for interacting with the Renegade relayer's admin API, with a keychain. - */ -export class AdminRenegadeClient extends RenegadeClient { - private readonly apiKey: string; - - /** - * @internal - */ - private constructor(params: ConstructorParams & { apiKey: string; logger?: Logger }) { - const { apiKey, ...renegadeParams } = params; - super(renegadeParams); - this.apiKey = apiKey; - } - - /** - * Create an admin client for any chain by seed. - * - * @param params.chainId the chain ID (e.g. CHAIN_IDS.ArbitrumMainnet) - * @param params.seed your 0x… seed - * @param params.apiKey your admin API key - * @param params.overrides optional overrides for SDK config values - */ - static override new({ - chainId, - seed, - apiKey, - overrides, - logger, - }: { - chainId: number; - seed: `0x${string}`; - apiKey: string; - overrides?: Partial; - logger?: Logger; - }): AdminRenegadeClient { - return new AdminRenegadeClient({ chainId, mode: "seed", seed, apiKey, overrides, logger }); - } - - /** - * @see AdminRelayerClient.new - */ - static override newWithExternalKeychain: never; - /** - * @see AdminRelayerClient.new - */ - static override newArbitrumOneClient: never; - /** - * @see AdminRelayerClient.new - */ - static override newArbitrumOneClientWithKeychain: never; - /** - * @see AdminRelayerClient.new - */ - static override newArbitrumSepoliaClient: never; - /** - * @see AdminRelayerClient.new - */ - static override newArbitrumSepoliaClientWithKeychain: never; - - /** - * Create an order in a matching pool - * - * @param params.matchingPool – the matching pool address - */ - async createOrderInMatchingPool(params: CreateOrderInMatchingPoolParameters) { - const config = createConfig({ - darkPoolAddress: this.configv2.darkpoolAddress, - priceReporterUrl: this.configv2.priceReporterUrl, - relayerUrl: this.configv2.relayerUrl, - chainId: this.configv2.id, - utils: rustUtils, - logging: { logger: this.getConfig().getLogger() }, - // Inject the admin key - adminKey: this.apiKey, - }); - config.setState((s) => ({ ...s, seed: this.seed })); - return createOrderInMatchingPool(config, params); - } -} diff --git a/packages/node/src/clients/renegade/base.ts b/packages/node/src/clients/renegade/base.ts deleted file mode 100644 index e9ef31e4..00000000 --- a/packages/node/src/clients/renegade/base.ts +++ /dev/null @@ -1,481 +0,0 @@ -import type { - CancelOrderParameters, - CreateOrderParameters, - DepositParameters, - GetBackOfQueueWalletParameters, - GetOrderHistoryParameters, - GetWalletFromRelayerParameters, - OrderMetadata, - RenegadeConfig, - SDKConfig, - UpdateOrderParameters, - WithdrawParameters, -} from "@renegade-fi/core"; -import { - createConfig, - createExternalKeyConfig, - getOrderHistory, - getSDKConfig, - getTaskQueue, - getWalletId, - type Logger, - updateOrder, -} from "@renegade-fi/core"; -import { - cancelOrder, - createOrder, - createWallet, - deposit, - getBackOfQueueWallet, - getTaskQueuePaused, - getWalletFromRelayer, - getWalletNullifier, - lookupWallet, - payFees, - refreshWallet, - withdraw, -} from "@renegade-fi/core/actions"; -import { CHAIN_IDS, ROOT_KEY_MESSAGE_PREFIX } from "@renegade-fi/core/constants"; -import type { PublicClient } from "viem"; -import * as rustUtils from "../../../renegade-utils/index.js"; -import { type ExecuteDepositParameters, executeDeposit } from "../../actions/executeDeposit.js"; -import { - type ExecuteWithdrawalParameters, - executeWithdrawal, -} from "../../actions/executeWithdrawal.js"; -import { - type GeneratedSecrets, - generateWalletSecrets, -} from "../../actions/generateWalletSecrets.js"; -import { createOrderWebSocket } from "../../services/orderWebSocket.js"; -import type { ConstructorParams } from "./types.js"; - -/** - * The client for interacting with the Renegade relayer with a keychain. - */ -export class RenegadeClient { - readonly config: RenegadeConfig; - readonly configv2: SDKConfig; - readonly seed?: `0x${string}`; - readonly walletSecrets?: GeneratedSecrets; - - /** - * @internal - */ - protected constructor(params: ConstructorParams & { logger?: Logger }) { - const defaultConfig = getSDKConfig(params.chainId); - const configv2 = params.overrides - ? { ...defaultConfig, ...params.overrides } - : defaultConfig; - this.configv2 = configv2; - - if (params.mode === "seed") { - this.seed = params.seed; - this.config = createConfig({ - darkPoolAddress: configv2.darkpoolAddress, - priceReporterUrl: configv2.priceReporterUrl, - relayerUrl: configv2.relayerUrl, - chainId: configv2.id, - utils: rustUtils, - logging: params.logger - ? { logger: params.logger, namespace: "node:clients:renegade" } - : undefined, - }); - this.config.setState((s) => ({ ...s, seed: params.seed })); - } else { - this.walletSecrets = params.walletSecrets; - this.config = createExternalKeyConfig({ - chainId: configv2.id, - darkPoolAddress: configv2.darkpoolAddress, - relayerUrl: `https://${configv2.relayerUrl}:3000`, - utils: rustUtils, - websocketUrl: configv2.websocketUrl, - signMessage: params.signMessage, - symmetricKey: params.walletSecrets.symmetric_key, - walletId: params.walletSecrets.wallet_id, - publicKey: params.publicKey, - logging: params.logger - ? { logger: params.logger, namespace: "node:clients:renegade" } - : undefined, - }); - } - } - - /** - * Create a client for any chain by seed. - * - * @param params.chainId the chain ID (e.g. CHAIN_IDS.ArbitrumMainnet) - * @param params.seed your 0x… seed - * @param params.overrides any SDKConfig field can be passed directly as an override - */ - static new({ - chainId, - seed, - overrides, - logger, - }: { - chainId: number; - seed: `0x${string}`; - overrides?: Partial; - logger?: Logger; - }): RenegadeClient { - return new RenegadeClient({ chainId, mode: "seed", seed, overrides, logger }); - } - - /** - * Create a client for any chain with an external keychain. - * - * @param params.chainId the chain ID - * @param params.walletSecrets symmetric key + wallet ID - * @param params.signMessage callback to sign auth messages - * @param params.publicKey your public key - */ - static newWithExternalKeychain({ - chainId, - walletSecrets, - signMessage, - publicKey, - logger, - }: { - chainId: number; - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; - logger?: Logger; - }): RenegadeClient { - return new RenegadeClient({ - chainId, - mode: "keychain", - walletSecrets, - signMessage, - publicKey, - logger, - }); - } - - /** - * Arbitrum One client via seed. - * - * @param params.seed your 0x… seed - */ - static newArbitrumOneClient({ seed, logger }: { seed: `0x${string}`; logger?: Logger }) { - return RenegadeClient.new({ - chainId: CHAIN_IDS.ArbitrumOne, - seed, - logger, - }); - } - - /** - * Arbitrum Mainnet client with external keychain. - * - * @param params.walletSecrets symmetric key + wallet ID - * @param params.signMessage callback to sign auth messages - * @param params.publicKey your public key - */ - static newArbitrumOneClientWithKeychain({ - walletSecrets, - signMessage, - publicKey, - logger, - }: { - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; - logger?: Logger; - }) { - return RenegadeClient.newWithExternalKeychain({ - chainId: CHAIN_IDS.ArbitrumOne, - walletSecrets, - signMessage, - publicKey, - logger, - }); - } - - /** - * Arbitrum Sepolia client via seed. - * - * @param params.seed your 0x… seed - */ - static newArbitrumSepoliaClient({ seed, logger }: { seed: `0x${string}`; logger?: Logger }) { - return RenegadeClient.new({ - chainId: CHAIN_IDS.ArbitrumSepolia, - seed, - logger, - }); - } - - /** - * Arbitrum Sepolia client with external keychain. - * - * @param params.walletSecrets symmetric key + wallet ID - * @param params.signMessage callback to sign auth messages - * @param params.publicKey your public key - */ - static newArbitrumSepoliaClientWithKeychain({ - walletSecrets, - signMessage, - publicKey, - logger, - }: { - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; - logger?: Logger; - }) { - return RenegadeClient.newWithExternalKeychain({ - chainId: CHAIN_IDS.ArbitrumSepolia, - walletSecrets, - signMessage, - publicKey, - logger, - }); - } - - /** - * Base Sepolia client via seed. - * - * @param params.seed your 0x… seed - */ - static newBaseMainnetClient({ seed, logger }: { seed: `0x${string}`; logger?: Logger }) { - return RenegadeClient.new({ chainId: CHAIN_IDS.BaseMainnet, seed, logger }); - } - - /** - * Base Sepolia client with external keychain. - * - * @param params.walletSecrets symmetric key + wallet ID - * @param params.signMessage callback to sign auth messages - * @param params.publicKey your public key - */ - static newBaseMainnetClientWithKeychain({ - walletSecrets, - signMessage, - publicKey, - logger, - }: { - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; - logger?: Logger; - }) { - return RenegadeClient.newWithExternalKeychain({ - chainId: CHAIN_IDS.BaseMainnet, - walletSecrets, - signMessage, - publicKey, - logger, - }); - } - - /** - * Base Sepolia client via seed. - * - * @param params.seed your 0x… seed - */ - static newBaseSepoliaClient({ seed, logger }: { seed: `0x${string}`; logger?: Logger }) { - return RenegadeClient.new({ chainId: CHAIN_IDS.BaseSepolia, seed, logger }); - } - - /** - * Base Sepolia client with external keychain. - * - * @param params.walletSecrets symmetric key + wallet ID - * @param params.signMessage callback to sign auth messages - * @param params.publicKey your public key - */ - static newBaseSepoliaClientWithKeychain({ - walletSecrets, - signMessage, - publicKey, - logger, - }: { - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; - logger?: Logger; - }) { - return RenegadeClient.newWithExternalKeychain({ - chainId: CHAIN_IDS.BaseSepolia, - walletSecrets, - signMessage, - publicKey, - logger, - }); - } - - // -- Wallet Operations -- // - - async getWallet( - params: GetWalletFromRelayerParameters = { - filterDefaults: true, - }, - ) { - return getWalletFromRelayer(this.getConfig(), params); - } - - async getBackOfQueueWallet( - params: GetBackOfQueueWalletParameters = { - filterDefaults: true, - }, - ) { - return getBackOfQueueWallet(this.getConfig(), params); - } - - async lookupWallet() { - if (this.walletSecrets) { - return lookupWallet(this.getConfig(), { - blinderSeed: this.walletSecrets.blinder_seed, - shareSeed: this.walletSecrets.share_seed, - skMatch: this.walletSecrets.sk_match, - }); - } - return lookupWallet(this.getConfig()); - } - - async refreshWallet() { - return refreshWallet(this.getConfig()); - } - - async createWallet() { - if (this.walletSecrets) { - return createWallet(this.getConfig(), { - blinderSeed: this.walletSecrets.blinder_seed, - shareSeed: this.walletSecrets.share_seed, - skMatch: this.walletSecrets.sk_match, - }); - } - return createWallet(this.getConfig()); - } - - getWalletId() { - return getWalletId(this.getConfig()); - } - - async getWalletNullifier() { - return getWalletNullifier(this.getConfig()); - } - - async getOrderHistory(parameters: GetOrderHistoryParameters = {}) { - return getOrderHistory(this.getConfig(), parameters); - } - - // -- Balance Operations -- // - - async deposit(parameters: DepositParameters) { - return deposit(this.getConfig(), parameters); - } - - async executeDeposit( - parameters: Omit & { - publicClient: PublicClient; - }, - ) { - let config: RenegadeConfig; - if (this.config.renegadeKeyType === "internal") { - config = createConfig({ - darkPoolAddress: this.configv2.darkpoolAddress, - priceReporterUrl: this.configv2.priceReporterUrl, - relayerUrl: this.configv2.relayerUrl, - chainId: this.configv2.id, - utils: rustUtils, - viemClient: parameters.publicClient, - logging: { logger: this.config.getLogger() }, - }); - config.setState((s) => ({ ...s, seed: this.seed })); - } else { - config = createExternalKeyConfig({ - chainId: this.configv2.id, - darkPoolAddress: this.configv2.darkpoolAddress, - relayerUrl: `https://${this.configv2.relayerUrl}:3000`, - utils: rustUtils, - websocketUrl: this.configv2.websocketUrl, - signMessage: this.config.signMessage, - symmetricKey: this.config.symmetricKey, - walletId: this.config.walletId, - publicKey: this.config.publicKey, - viemClient: parameters.publicClient, - logging: { logger: this.config.getLogger() }, - }); - } - return executeDeposit(config, { - ...parameters, - permit2Address: this.configv2.permit2Address, - }); - } - - async withdraw(parameters: WithdrawParameters) { - return withdraw(this.getConfig(), parameters); - } - - async executeWithdraw(parameters: ExecuteWithdrawalParameters) { - return executeWithdrawal(this.getConfig(), parameters); - } - - async payFees() { - return payFees(this.getConfig()); - } - - // -- Order Operations -- // - - async placeOrder(parameters: CreateOrderParameters) { - return createOrder(this.getConfig(), parameters); - } - - async updateOrder(parameters: UpdateOrderParameters) { - return updateOrder(this.getConfig(), parameters); - } - - async cancelOrder(parameters: CancelOrderParameters) { - return cancelOrder(this.getConfig(), parameters); - } - - async createOrderWebSocket(onUpdate: (order: OrderMetadata) => void) { - return createOrderWebSocket({ - config: this.getConfig(), - onUpdate, - }); - } - - // -- Task Operations -- // - - async getTaskQueue() { - return getTaskQueue(this.getConfig()); - } - - async getTaskQueuePaused() { - return getTaskQueuePaused(this.getConfig()); - } - - // --- Keychain Generation --- // - - /** - * Generate the message from which the seed can be derived. - * - * @param chainId - the chain ID - * @returns the message to sign - */ - static generateSeedMessage(chainId: number) { - return `${ROOT_KEY_MESSAGE_PREFIX} ${chainId}`; - } - - /** - * Generate an externally managed keychain for a Renegade wallet. - * - * @param sign - the callback to sign messages - * @returns the keychain - */ - static async generateKeychain({ sign }: { sign: (message: string) => Promise<`0x${string}`> }) { - return generateWalletSecrets(sign); - } - - // -- Private -- // - - /** - * @internal - */ - public getConfig() { - return this.config; - } -} diff --git a/packages/node/src/clients/renegade/index.ts b/packages/node/src/clients/renegade/index.ts deleted file mode 100644 index e92aa324..00000000 --- a/packages/node/src/clients/renegade/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AdminRenegadeClient } from "./admin.js"; -export { RenegadeClient } from "./base.js"; diff --git a/packages/node/src/clients/renegade/types.ts b/packages/node/src/clients/renegade/types.ts deleted file mode 100644 index f069f547..00000000 --- a/packages/node/src/clients/renegade/types.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Logger, SDKConfig } from "@renegade-fi/core"; -import type { GeneratedSecrets } from "../../actions/generateWalletSecrets.js"; - -type CommonParams = { - chainId: number; - overrides?: Partial; - logger?: Logger; -}; - -type SeedParams = CommonParams & { - mode: "seed"; - seed: `0x${string}`; -}; - -type KeychainParams = CommonParams & { - mode: "keychain"; - walletSecrets: GeneratedSecrets; - signMessage: (message: string) => Promise<`0x${string}`>; - publicKey: `0x${string}`; -}; - -export type ConstructorParams = SeedParams | KeychainParams; diff --git a/packages/node/src/exports/actions.ts b/packages/node/src/exports/actions.ts deleted file mode 100644 index fe51d44b..00000000 --- a/packages/node/src/exports/actions.ts +++ /dev/null @@ -1,8 +0,0 @@ -export { - type ExecuteDepositParameters, - executeDeposit, -} from "../actions/executeDeposit.js"; -export { - type ExecuteWithdrawalParameters, - executeWithdrawal, -} from "../actions/executeWithdrawal.js"; diff --git a/packages/node/src/exports/index.ts b/packages/node/src/exports/index.ts deleted file mode 100644 index 4986f393..00000000 --- a/packages/node/src/exports/index.ts +++ /dev/null @@ -1,72 +0,0 @@ -export * from "@renegade-fi/core"; -export * from "@renegade-fi/core/actions"; -export * from "@renegade-fi/core/constants"; - -import { - createConfig as core_createConfig, - createExternalKeyConfig as core_createExternalKeyConfig, -} from "@renegade-fi/core"; - -import * as RustUtils from "../../renegade-utils/index.js"; - -function createConfig( - ...args: Parameters -): ReturnType { - const config = core_createConfig({ - ...args[0], - utils: RustUtils, - }); - return config; -} - -function createExternalKeyConfig( - ...args: Parameters -): ReturnType { - const config = core_createExternalKeyConfig({ - ...args[0], - utils: RustUtils, - }); - return config; -} - -export { createConfig, createExternalKeyConfig }; - -//////////////////////////////////////////////////////////////////////////////// -// Clients -//////////////////////////////////////////////////////////////////////////////// - -export { AdminRelayerClient } from "../clients/relayer/index.js"; -export { - AdminRenegadeClient, - RenegadeClient, -} from "../clients/renegade/index.js"; - -//////////////////////////////////////////////////////////////////////////////// -// Actions -//////////////////////////////////////////////////////////////////////////////// - -export { - type ExecuteDepositParameters, - executeDeposit, -} from "../actions/executeDeposit.js"; -export { - type ExecuteWithdrawalParameters, - executeWithdrawal, -} from "../actions/executeWithdrawal.js"; -export { - type GeneratedSecrets, - generateWalletSecrets, -} from "../actions/generateWalletSecrets.js"; - -export { createOrderWebSocket } from "../services/orderWebSocket.js"; - -//////////////////////////////////////////////////////////////////////////////// -// @renegade-fi/core -//////////////////////////////////////////////////////////////////////////////// - -export { - // WebSocket - AuthType, - RelayerWebsocket, - type RelayerWebsocketParams, -} from "@renegade-fi/core"; diff --git a/packages/node/src/services/orderWebSocket.ts b/packages/node/src/services/orderWebSocket.ts deleted file mode 100644 index 7b8381f7..00000000 --- a/packages/node/src/services/orderWebSocket.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { - AuthType, - getWalletId, - type OrderMetadata, - RelayerWebsocket, - type RenegadeConfig, - WS_WALLET_ORDERS_ROUTE, -} from "@renegade-fi/core"; - -interface OrderWebSocketOptions { - config: RenegadeConfig; - onUpdate: (order: OrderMetadata) => void; -} - -export function createOrderWebSocket(options: OrderWebSocketOptions) { - return new OrderWebSocketImpl(options); -} - -class OrderWebSocketImpl { - config: RenegadeConfig; - ws: RelayerWebsocket | null = null; - callback: (order: OrderMetadata) => void; - walletId: string; - - constructor(options: OrderWebSocketOptions) { - this.config = options.config; - this.callback = options.onUpdate; - this.walletId = getWalletId(this.config); - } - - connect() { - if (this.ws) return; - - this.ws = new RelayerWebsocket({ - config: this.config, - topic: WS_WALLET_ORDERS_ROUTE(this.walletId), - authType: AuthType.Wallet, - onmessage: (event) => this.handleMessage(event), - oncloseCallback: () => this.handleClose(), - onerrorCallback: () => this.handleError(), - }); - - this.ws.connect(); - } - - disconnect() { - this.ws?.close(); - this.ws = null; - } - - handleMessage(event: MessageEvent) { - try { - const message = JSON.parse(event.data, (key, value) => { - if (typeof value === "number" && key !== "price") { - return BigInt(value); - } - return value; - }); - - if ( - message.topic === WS_WALLET_ORDERS_ROUTE(this.walletId) && - message.event?.type === "OrderMetadataUpdated" && - message.event?.order - ) { - this.callback(message.event.order); - } - } catch (error) { - const logger = this.config.getLogger("node:services:orderWebSocket"); - const msg = error instanceof Error ? error.message : String(error); - logger.error(`Error processing WebSocket message: ${msg}`, { - walletId: this.walletId, - }); - } - } - - handleClose() { - const logger = this.config.getLogger("node:services:orderWebSocket"); - logger.debug("WebSocket connection closed", { walletId: this.walletId }); - this.ws = null; - } - - handleError() { - const logger = this.config.getLogger("node:services:orderWebSocket"); - logger.error("WebSocket connection error", { walletId: this.walletId }); - this.ws = null; - } -} diff --git a/packages/node/src/utils/permit2.ts b/packages/node/src/utils/permit2.ts deleted file mode 100644 index 837bbdfd..00000000 --- a/packages/node/src/utils/permit2.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { hashTypedData, type TypedDataDomain, verifyTypedData, type WalletClient } from "viem"; -import { publicKeyToAddress, recoverPublicKey } from "viem/utils"; - -export function millisecondsToSeconds(milliseconds: number): number { - return Math.floor(milliseconds / 1000); -} - -const TOKEN_PERMISSIONS = [ - { name: "token", type: "address" }, - { name: "amount", type: "uint256" }, -]; - -const DEPOSIT_WITNESS = [{ name: "pkRoot", type: "uint256[4]" }]; - -const PERMIT_WITNESS_TRANSFER_FROM_TYPES = { - PermitWitnessTransferFrom: [ - { name: "permitted", type: "TokenPermissions" }, - { name: "spender", type: "address" }, - { name: "nonce", type: "uint256" }, - { name: "deadline", type: "uint256" }, - { name: "witness", type: "DepositWitness" }, - ], - TokenPermissions: TOKEN_PERMISSIONS, - DepositWitness: DEPOSIT_WITNESS, -}; - -/** - * Signs a permit allowing a specified spender to transfer a specified amount of tokens from the signer's account. - * This function constructs a domain and message for the permit, signs it using the wallet client, and verifies the signature. - * It also ensures the public key recovered from the signature matches the wallet's public key. - * @param {bigint} amount - The decimal-adjusted amount of tokens to permit the spender to transfer. - * @param {number} chainId - The chain ID of the network. - * @param {string} spender - The address of the spender who is permitted to transfer the tokens. - * @param {string} permit2Address - The address of the deployed Permit2 contract. - * @param {string} tokenAddress - The address of the token to be transferred. - * @param {WalletClient} walletClient - The wallet client used to sign the permit. - * - * @returns {Promise<{signature: string, nonce: bigint, deadline: bigint}>} An object containing the signature, nonce, and deadline of the permit. - * - * @throws {Error} Throws an error if the wallet client's account address is not found, the signature is invalid, or the recovered public key does not match the wallet's public key. - */ -export async function signPermit2({ - amount, - chainId, - spender, - permit2Address, - tokenAddress, - walletClient, - pkRoot, -}: { - amount: bigint; - chainId: number; - spender: `0x${string}`; - permit2Address: `0x${string}`; - tokenAddress: `0x${string}`; - walletClient: WalletClient; - pkRoot: bigint[]; -}) { - if (!walletClient.account) throw new Error("Account not found on wallet client"); - - // Construct Domain - const domain: TypedDataDomain = { - name: "Permit2", - chainId, - verifyingContract: permit2Address as `0x${string}`, - }; - - // Construct Message - const message = { - permitted: { - token: tokenAddress, - amount, - }, - spender, - nonce: BigInt(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)), - deadline: BigInt(millisecondsToSeconds(Date.now() + 1000 * 60 * 30)), - witness: { pkRoot }, - } as const; - - // Generate signature - const signature = await walletClient.signTypedData({ - account: walletClient.account, - domain, - types: PERMIT_WITNESS_TRANSFER_FROM_TYPES, - primaryType: "PermitWitnessTransferFrom", - message, - }); - - // Verify signature - const valid = await verifyTypedData({ - address: walletClient.account.address, - domain, - types: PERMIT_WITNESS_TRANSFER_FROM_TYPES, - primaryType: "PermitWitnessTransferFrom", - message, - signature, - }); - if (!valid) throw new Error("Invalid signature"); - - // Ensure correct public key is recovered - const hash = hashTypedData({ - domain, - types: PERMIT_WITNESS_TRANSFER_FROM_TYPES, - primaryType: "PermitWitnessTransferFrom", - message, - }); - const recoveredPubKey = publicKeyToAddress( - await recoverPublicKey({ - hash, - signature, - }), - ); - if (recoveredPubKey !== walletClient.account.address) - throw new Error("Recovered public key does not match wallet public key"); - - return { signature, nonce: message.nonce, deadline: message.deadline }; -} diff --git a/packages/node/tsconfig.json b/packages/node/tsconfig.json deleted file mode 100644 index 684c8dd6..00000000 --- a/packages/node/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "include": ["src/**/*.ts", "test/**/*.ts", "wagmi.config.ts"], - "exclude": [] -} diff --git a/packages/react/CHANGELOG.md b/packages/react/CHANGELOG.md deleted file mode 100644 index 140f6ed2..00000000 --- a/packages/react/CHANGELOG.md +++ /dev/null @@ -1,1030 +0,0 @@ -# @renegade-fi/react - -## 1.0.0 - -### Major Changes - -- v1 release - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@1.0.0 - -## 0.6.28 - -### Patch Changes - -- external-match: client: Add direct malleable match method -- Updated dependencies - - @renegade-fi/core@0.9.13 - -## 0.6.27 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.12 - -## 0.6.26 - -### Patch Changes - -- chore: pin safe versions -- Updated dependencies - - @renegade-fi/core@0.9.11 - -## 0.6.25 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.10 - -## 0.6.24 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.9 - -## 0.6.23 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.8 - -## 0.6.22 - -### Patch Changes - -- export chainIdFromEnvAndName - -## 0.6.21 - -### Patch Changes - -- feat: base -- Updated dependencies - - @renegade-fi/core@0.9.7 - -## 0.6.20 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.6 - -## 0.6.19 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.5 - -## 0.6.18 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.4 - -## 0.6.17 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.3 - -## 0.6.16 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.2 - -## 0.6.15 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.1 - -## 0.6.14 - -### Patch Changes - -- react: export getSDKConfig - -## 0.6.13 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.0 - -## 0.6.12 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.8.1 - -## 0.6.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.8.0 - -## 0.6.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.10 - -## 0.6.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.9 - -## 0.6.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.8 - -## 0.6.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.7 - -## 0.6.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.6 - -## 0.6.5 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.5 - -## 0.6.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.4 - -## 0.6.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.3 - -## 0.6.2 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.2 - -## 0.6.1 - -### Patch Changes - -- Add triggerRelayerSnapshot action -- Updated dependencies - - @renegade-fi/core@0.7.1 - -## 0.6.0 - -### Minor Changes - -- workspace: move `Token`, `PriceReporterClient` into packages - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.7.0 - -## 0.5.11 - -### Patch Changes - -- core: add malleable matches -- Updated dependencies - - @renegade-fi/core@0.6.8 - -## 0.5.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.7 - -## 0.5.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.6 - -## 0.5.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.5 - -## 0.5.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.4 - -## 0.5.6 - -### Patch Changes - -- react: temp disable unsubscribing ws topics -- Updated dependencies - - @renegade-fi/core@0.6.3 - -## 0.5.5 - -### Patch Changes - -- core, react: fix WASM initialization status flag -- Updated dependencies - - @renegade-fi/core@0.6.2 - -## 0.5.4 - -### Patch Changes - -- Use disable_gas_sponsorship request parameter -- Updated dependencies - - @renegade-fi/core@0.6.1 - -## 0.5.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.6.0 - -## 0.5.2 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.5.2 - -## 0.5.1 - -### Patch Changes - -- core: define and handle ws errors -- Updated dependencies - - @renegade-fi/core@0.5.1 - -## 0.5.0 - -### Minor Changes - -- core: Use HSE in order history and task history actions - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.5.0 - -## 0.4.20 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.19 - -## 0.4.19 - -### Patch Changes - -- core, node: Accept key config in execute transfer actions -- Updated dependencies - - @renegade-fi/core@0.4.18 - -## 0.4.18 - -### Patch Changes - -- Return raw POST data if JSON cannot be parsed -- Updated dependencies - - @renegade-fi/core@0.4.17 - -## 0.4.17 - -### Patch Changes - -- include query string in auth path -- Updated dependencies - - @renegade-fi/core@0.4.16 - -## 0.4.16 - -### Patch Changes - -- expose history length params & useQuery util -- Updated dependencies - - @renegade-fi/core@0.4.15 - -## 0.4.15 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.14 - -## 0.4.14 - -### Patch Changes - -- implement external key management -- Updated dependencies - - @renegade-fi/core@0.4.13 - -## 0.4.13 - -### Patch Changes - -- Added support for order updates between quote and assemble calls -- Updated dependencies - - @renegade-fi/core@0.4.12 - -## 0.4.12 - -### Patch Changes - -- use getDefaultQuoteToken method instead of DEFAULT_QUOTES constant -- Updated dependencies - - @renegade-fi/core@0.4.11 - -## 0.4.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.10 - -## 0.4.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.9 - -## 0.4.9 - -### Patch Changes - -- export default quote & load token mapping method -- Updated dependencies - - @renegade-fi/core@0.4.8 - -## 0.4.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.6 - -## 0.4.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.5 - -## 0.4.5 - -### Patch Changes - -- core: add fee details to external match bundle response -- Updated dependencies - - @renegade-fi/core@0.4.4 - -## 0.4.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.3 - -## 0.4.3 - -### Patch Changes - -- react: fix ws import - -## 0.4.2 - -### Patch Changes - -- wasm, core, react, node: add action to request external match bundles -- Updated dependencies - - @renegade-fi/core@0.4.2 - -## 0.4.1 - -### Patch Changes - -- react: revert es module interop -- Updated dependencies - - @renegade-fi/core@0.4.1 - -## 0.4.0 - -### Minor Changes - -- wasm: include public blinder in create-wallet - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.4.0 - -## 0.3.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.8 - -## 0.3.9 - -### Patch Changes - -- core: tidy up -- Updated dependencies - - @renegade-fi/core@0.3.7 - -## 0.3.8 - -### Patch Changes - -- wasm, core, react: update to api auth v2 -- Updated dependencies - - @renegade-fi/core@0.3.6 - -## 0.3.7 - -### Patch Changes - -- wasm: init console_error_panic_hook to log panics to dev console - -## 0.3.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.5 - -## 0.3.5 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.4 - -## 0.3.4 - -### Patch Changes - -- core: set default min fill size when creating an order -- Updated dependencies - - @renegade-fi/core@0.3.3 - -## 0.3.3 - -### Patch Changes - -- wasm: add serde default trait to min_fill_size - -## 0.3.2 - -### Patch Changes - -- wasm, core: add min fill amount -- Updated dependencies - - @renegade-fi/core@0.3.2 - -## 0.3.1 - -### Patch Changes - -- chore: update metadata -- Updated dependencies - - @renegade-fi/core@0.3.1 - -## 0.3.0 - -### Minor Changes - -- wasm, core: implement worst case price - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.3.0 - -## 0.2.2 - -### Patch Changes - -- wasm: fix keychain padding issue - -## 0.2.1 - -### Patch Changes - -- wasm: modify fixed point precision' - -## 0.2.0 - -### Minor Changes - -- meta: ensure cookie storage rename -- ensure storage rename - -### Patch Changes - -- Updated dependencies -- Updated dependencies - - @renegade-fi/core@0.2.0 - -## 0.1.0 - -### Minor Changes - -- core: new storage key - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.1.0 - -## 0.0.57 - -### Patch Changes - -- core, react: reset sk_root in create-wallet and lookup-wallet - -## 0.0.56 - -### Patch Changes - -- core, react: scrub console logs -- Updated dependencies - - @renegade-fi/core@0.0.53 - -## 0.0.55 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.52 - -## 0.0.54 - -### Patch Changes - -- pre-mainnet release -- Updated dependencies - - @renegade-fi/core@0.0.51 - -## 0.0.53 - -### Patch Changes - -- wasm, core, react, node: implement keychain rotation -- Updated dependencies - - @renegade-fi/core@0.0.50 - -## 0.0.52 - -### Patch Changes - -- wasm, core: update wallet parameterization -- Updated dependencies - - @renegade-fi/core@0.0.49 - -## 0.0.51 - -### Patch Changes - -- order mutation & timestamped prices -- Updated dependencies - - @renegade-fi/core@0.0.48 - -## 0.0.50 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.47 - -## 0.0.49 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.46 - -## 0.0.48 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.45 - -## 0.0.47 - -### Patch Changes - -- react: use `0x{string}` as balance / fee map index type - -## 0.0.46 - -### Patch Changes - -- react: refactor useBalances useOrders useFees to return Map - -## 0.0.45 - -### Patch Changes - -- set viem as config option and export cookie storage module -- Updated dependencies - - @renegade-fi/core@0.0.44 - -## 0.0.44 - -### Patch Changes - -- core, react: delay setting init flag until after rehydration -- Updated dependencies - - @renegade-fi/core@0.0.43 - -## 0.0.43 - -### Patch Changes - -- core: Add Arbitrum Sepolia -- Updated dependencies - - @renegade-fi/core@0.0.42 - -## 0.0.42 - -### Patch Changes - -- core, react: changes for quoter dashboard -- Updated dependencies - - @renegade-fi/core@0.0.41 - -## 0.0.41 - -### Patch Changes - -- core: downstream API changes for orders / tasks -- Updated dependencies - - @renegade-fi/core@0.0.40 - -## 0.0.40 - -### Patch Changes - -- core: react, remove `seed` parameter, fix connect / reconnect logic -- Updated dependencies - - @renegade-fi/core@0.0.39 - -## 0.0.39 - -### Patch Changes - -- core, react: add ping query, fix lookup wallet log -- Updated dependencies - - @renegade-fi/core@0.0.38 - -## 0.0.38 - -### Patch Changes - -- core: increase lookup wallet timeout -- Updated dependencies - - @renegade-fi/core@0.0.37 - -## 0.0.37 - -### Patch Changes - -- core: add refresh wallet action -- Updated dependencies - - @renegade-fi/core@0.0.36 - -## 0.0.36 - -### Patch Changes - -- use proxied exports -- Updated dependencies - - @renegade-fi/core@0.0.35 - -## 0.0.35 - -### Patch Changes - -- export constants - -## 0.0.34 - -### Patch Changes - -- export hooks -- Updated dependencies - - @renegade-fi/core@0.0.34 - -## 0.0.33 - -### Patch Changes - -- add back of queue queries, remove placeholder block explorer url -- Updated dependencies - - @renegade-fi/core@0.0.33 - -## 0.0.32 - -### Patch Changes - -- react: prevent orderbook refetching -- Updated dependencies - - @renegade-fi/core@0.0.32 - -## 0.0.31 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.31 - -## 0.0.30 - -### Patch Changes - -- set token mapping using env var -- Updated dependencies - - @renegade-fi/core@0.0.30 - -## 0.0.29 - -### Patch Changes - -- use core connect function in all packages -- Updated dependencies - - @renegade-fi/core@0.0.29 - -## 0.0.28 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.0.28 - -## 0.0.27 - -### Patch Changes - -- add function to wait for wallet indexing completion -- Updated dependencies - - @renegade-fi/core@0.0.27 - -## 0.0.26 - -### Patch Changes - -- prevent deposit if MAX_BALANCES would be exceeded -- Updated dependencies - - @renegade-fi/core@0.0.26 - -## 0.0.25 - -### Patch Changes - -- core, react: fix bigint parsing error -- Updated dependencies - - @renegade-fi/core@0.0.25 - -## 0.0.24 - -### Patch Changes - -- adjust decimal count in formatAmount fn -- Updated dependencies - - @renegade-fi/core@0.0.24 - -## 0.0.23 - -### Patch Changes - -- core: error if order would result in too many balances -- Updated dependencies - - @renegade-fi/core@0.0.23 - -## 0.0.22 - -### Patch Changes - -- use env variable for network detection -- Updated dependencies - - @renegade-fi/core@0.0.22 - -## 0.0.21 - -### Patch Changes - -- wasm: implement fix for signature generation -- Updated dependencies - - @renegade-fi/core@0.0.21 - -## 0.0.20 - -### Patch Changes - -- wasm: implement fix for signature generation -- Updated dependencies - - @renegade-fi/core@0.0.20 - -## 0.0.19 - -### Patch Changes - -- Add function to reinitialize store if user does not want persistence -- Updated dependencies - - @renegade-fi/core@0.0.19 - -## 0.0.18 - -### Patch Changes - -- Parse all numerical values as bigint -- Updated dependencies - - @renegade-fi/core@0.0.18 - -## 0.0.17 - -### Patch Changes - -- Move node specific connect logic -- Updated dependencies - - @renegade-fi/core@0.0.17 - -## 0.0.16 - -### Patch Changes - -- Add /v0 suffix -- Updated dependencies - - @renegade-fi/core@0.0.16 - -## 0.0.15 - -### Patch Changes - -- Allow for insecure transport to be set in config -- Updated dependencies - - @renegade-fi/core@0.0.15 - -## 0.0.14 - -### Patch Changes - -- Handle lookup/create wallet errors gracefully -- Updated dependencies - - @renegade-fi/core@0.0.14 - -## 0.0.13 - -### Patch Changes - -- Init node package -- Updated dependencies - - @renegade-fi/core@0.0.13 - -## 0.0.12 - -### Patch Changes - -- remove /dist from vc -- Updated dependencies - - @renegade-fi/core@0.0.12 - -## 0.0.11 - -### Patch Changes - -- Queue withdraw after pay fees -- Updated dependencies - - @renegade-fi/core@0.0.11 - -## 0.0.10 - -### Patch Changes - -- Prevent orderbook jitter -- Updated dependencies - - @renegade-fi/core@0.0.10 - -## 0.0.9 - -### Patch Changes - -- Add Biome -- Updated dependencies - - @renegade-fi/core@0.0.9 - -## 0.0.8 - -### Patch Changes - -- Fix useBalances filter -- Updated dependencies - - @renegade-fi/core@0.0.8 - -## 0.0.7 - -### Patch Changes - -- Add missing Task types -- Updated dependencies - - @renegade-fi/core@0.0.7 - -## 0.0.6 - -### Patch Changes - -- Add task history hooks -- Updated dependencies - - @renegade-fi/core@0.0.6 - -## 0.0.5 - -### Patch Changes - -- add fees action and hook -- Updated dependencies - - @renegade-fi/core@0.0.5 - -## 0.0.4 - -### Patch Changes - -- add back of queue route -- Updated dependencies - - @renegade-fi/core@0.0.4 - -## 0.0.3 - -### Patch Changes - -- add rpc url as config parameter -- Updated dependencies - - @renegade-fi/core@0.0.3 - -## 0.0.2 - -### Patch Changes - -- add darkpool contract addr as config parameter -- Updated dependencies - - @renegade-fi/core@0.0.2 - -## 0.0.1 - -### Patch Changes - -- Initialize -- Updated dependencies - - @renegade-fi/core@0.0.1 diff --git a/packages/react/README.md b/packages/react/README.md deleted file mode 100644 index f47a050b..00000000 --- a/packages/react/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# @renegade-fi/react - -React library for Renegade - -## Installation - -```bash -pnpm add @renegade-fi/react -``` - -## Documentation - -For documentation and guides, visit [the docs](https://docs.renegade.fi/technical-reference/typescript-sdk). \ No newline at end of file diff --git a/packages/react/package.json b/packages/react/package.json deleted file mode 100644 index f8554bea..00000000 --- a/packages/react/package.json +++ /dev/null @@ -1,87 +0,0 @@ -{ - "name": "@renegade-fi/react", - "description": "React library for Renegade", - "version": "1.0.0", - "repository": { - "type": "git", - "url": "https://github.com/renegade-fi/typescript-sdk.git", - "directory": "packages/react" - }, - "scripts": { - "build": "pnpm run clean && pnpm run build:esm+types", - "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", - "clean": "rm -rf dist tsconfig.tsbuildinfo", - "typecheck": "tsc --noEmit" - }, - "files": [ - "dist/**", - "!dist/**/*.tsbuildinfo", - "renegade-utils/*", - "src/**/*.ts", - "!src/**/*.test.ts", - "!src/**/*.test-d.ts" - ], - "sideEffects": false, - "type": "module", - "main": "./dist/exports/index.js", - "types": "./dist/types/exports/index.d.ts", - "typings": "./dist/types/exports/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/exports/index.d.ts", - "default": "./dist/exports/index.js" - }, - "./actions": { - "types": "./dist/types/exports/actions.d.ts", - "default": "./dist/exports/actions.js" - }, - "./constants": { - "types": "./dist/types/exports/constants.d.ts", - "default": "./dist/exports/constants.js" - }, - "./query": { - "types": "./dist/types/exports/query.d.ts", - "default": "./dist/exports/query.js" - } - }, - "typesVersions": { - "*": { - "actions": [ - "./dist/types/exports/actions.d.ts" - ], - "constants": [ - "./dist/types/exports/constants.d.ts" - ], - "query": [ - "./dist/types/exports/query.d.ts" - ] - } - }, - "peerDependencies": { - "@tanstack/react-query": ">=5.0.0", - "react": ">=18" - }, - "dependencies": { - "@renegade-fi/core": "workspace:*", - "json-bigint": "^1.0.0", - "react-use-websocket": "^4.8.1", - "tiny-invariant": "^1.3.3" - }, - "devDependencies": { - "@tanstack/react-query": ">=5.0.0", - "@types/json-bigint": "^1.0.4", - "@types/react": ">=18", - "@types/react-dom": ">=18", - "react": ">=18", - "react-dom": ">=18" - }, - "keywords": [ - "cryptography", - "zero-knowledge", - "darkpool", - "eth", - "ethereum", - "dapps", - "web3" - ] -} \ No newline at end of file diff --git a/packages/react/src/context.ts b/packages/react/src/context.ts deleted file mode 100644 index 7af043e7..00000000 --- a/packages/react/src/context.ts +++ /dev/null @@ -1,24 +0,0 @@ -"use client"; - -import type { Config, State } from "@renegade-fi/core"; -import { createContext, createElement } from "react"; -import { Hydrate } from "./hydrate.js"; - -export const RenegadeContext = createContext(undefined); - -export type RenegadeProviderProps = { - config: Config | undefined; - initialState?: State | undefined; - reconnectOnMount?: boolean | undefined; -}; - -export function RenegadeProvider(parameters: React.PropsWithChildren) { - const { children, config } = parameters; - - const props = { value: config }; - return createElement( - Hydrate, - parameters, - createElement(RenegadeContext.Provider, props, children), - ); -} diff --git a/packages/react/src/errors/base.ts b/packages/react/src/errors/base.ts deleted file mode 100644 index 06c86907..00000000 --- a/packages/react/src/errors/base.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError as CoreError } from "@renegade-fi/core"; - -import { getVersion } from "../utils/getVersion.js"; - -export type BaseErrorType = BaseError & { name: "RenegadeError" }; -export class BaseError extends CoreError { - override name = "RenegadeError"; - override get version() { - return getVersion(); - } -} diff --git a/packages/react/src/errors/context.ts b/packages/react/src/errors/context.ts deleted file mode 100644 index 7f3f513d..00000000 --- a/packages/react/src/errors/context.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { BaseError } from "./base.js"; - -export type RenegadeProviderNotFoundErrorType = RenegadeProviderNotFoundError & { - name: "RenegadeProviderNotFoundError"; -}; -export class RenegadeProviderNotFoundError extends BaseError { - override name = "RenegadeProviderNotFoundError"; - constructor() { - super("`useConfig` must be used within `RenegadeProvider`."); - } -} diff --git a/packages/react/src/exports/actions.ts b/packages/react/src/exports/actions.ts deleted file mode 100644 index 00f9a8dc..00000000 --- a/packages/react/src/exports/actions.ts +++ /dev/null @@ -1,5 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// @renegade-fi/core/actions -//////////////////////////////////////////////////////////////////////////////// - -export * from "@renegade-fi/core/actions"; diff --git a/packages/react/src/exports/constants.ts b/packages/react/src/exports/constants.ts deleted file mode 100644 index 8ebd4976..00000000 --- a/packages/react/src/exports/constants.ts +++ /dev/null @@ -1,5 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// @renegade-fi/core/constants -//////////////////////////////////////////////////////////////////////////////// - -export * from "@renegade-fi/core/constants"; diff --git a/packages/react/src/exports/index.ts b/packages/react/src/exports/index.ts deleted file mode 100644 index 41e4558e..00000000 --- a/packages/react/src/exports/index.ts +++ /dev/null @@ -1,231 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// createConfig -//////////////////////////////////////////////////////////////////////////////// -import { createConfig as core_createConfig } from "@renegade-fi/core"; - -import * as RustUtils from "../../renegade-utils/index.js"; - -export { default as RustUtils } from "../../renegade-utils/index.js"; - -function createConfig( - ...args: Parameters -): ReturnType { - const config = core_createConfig({ - ...args[0], - utils: RustUtils, - }); - return config; -} - -export { createConfig }; - -//////////////////////////////////////////////////////////////////////////////// -// Context -//////////////////////////////////////////////////////////////////////////////// - -export { - RenegadeContext, - RenegadeProvider, - type RenegadeProviderProps, -} from "../context.js"; - -//////////////////////////////////////////////////////////////////////////////// -// Hooks -//////////////////////////////////////////////////////////////////////////////// - -export { - type UseBackOfQueueBalancesParameters, - type UseBackOfQueueBalancesReturnType, - useBackOfQueueBalances, -} from "../hooks/useBackOfQueueBalances.js"; -export { - type UseBackOfQueueOrdersParameters, - type UseBackOfQueueOrdersReturnType, - useBackOfQueueOrders, -} from "../hooks/useBackOfQueueOrders.js"; - -export { - type UseBackOfQueueWalletParameters, - type UseBackOfQueueWalletReturnType, - useBackOfQueueWallet, -} from "../hooks/useBackOfQueueWallet.js"; - -export { - type UseBalancesParameters, - type UseBalancesReturnType, - useBalances, -} from "../hooks/useBalances.js"; -export { - type UseCancelOrderParameters, - type UseCancelOrderReturnType, - useCancelOrder, -} from "../hooks/useCancelOrder.js"; -export { - type UseConfigParameters, - type UseConfigReturnType, - useConfig, -} from "../hooks/useConfig.js"; -export { - type UseConnectParameters, - type UseConnectReturnType, - useConnect, -} from "../hooks/useConnect.js"; -export { - type UseCreateOrderParameters, - type UseCreateOrderReturnType, - useCreateOrder, -} from "../hooks/useCreateOrder.js"; - -export { - type UseDepositParameters, - type UseDepositReturnType, - useDeposit, -} from "../hooks/useDeposit.js"; - -export { - type UseFeesParameters, - type UseFeesReturnType, - useFees, -} from "../hooks/useFees.js"; -export { - type UseNetworkOrdersParameters, - type UseNetworkOrdersReturnType, - useNetworkOrders, -} from "../hooks/useNetworkOrders.js"; -export { - type UseOpenOrdersParameters, - type UseOpenOrdersReturnType, - useOpenOrders, -} from "../hooks/useOpenOrders.js"; -export { - type UseOrderBookWebSocketParameters, - type UseOrderBookWebSocketReturnType, - useOrderBookWebSocket, -} from "../hooks/useOrderBookWebSocket.js"; -export { - type UseOrderHistoryParameters, - type UseOrderHistoryReturnType, - useOrderHistory, -} from "../hooks/useOrderHistory.js"; -export { - type UseOrderHistoryWebSocketParameters, - useOrderHistoryWebSocket, -} from "../hooks/useOrderHistoryWebSocket.js"; - -export { - type UseOrderMetadataParameters, - type UseOrderMetadataReturnType, - useOrderMetadata, -} from "../hooks/useOrderMetadata.js"; -export { - type UseOrdersParameters, - type UseOrdersReturnType, - useOrders, -} from "../hooks/useOrders.js"; -export { - type UsePayFeesParameters, - type UsePayFeesReturnType, - usePayFees, -} from "../hooks/usePayFees.js"; -export { - type UsePingParameters, - type UsePingReturnType, - usePing, -} from "../hooks/usePing.js"; -export { - type UsePkRootParameters, - type UsePkRootScalarsReturnType, - usePkRootScalars, -} from "../hooks/usePkRootScalars.js"; - -export { - type UseStatusParameters, - type UseStatusReturnType, - useStatus, -} from "../hooks/useStatus.js"; - -export { - type UseTaskHistoryParameters, - type UseTaskHistoryReturnType, - useTaskHistory, -} from "../hooks/useTaskHistory.js"; - -export { - type UseTaskHistoryWebSocketParameters, - useTaskHistoryWebSocket, -} from "../hooks/useTaskHistoryWebSocket.js"; -export { useWallet } from "../hooks/useWallet.js"; -export { - type UseWalletIdParameters, - type UseWalletIdReturnType, - useWalletId, -} from "../hooks/useWalletId.js"; -export { - type UseWalletParameters, - useWalletWebsocket, -} from "../hooks/useWalletWebSocket.js"; - -export { - type UseWithdrawParameters, - type UseWithdrawReturnType, - useWithdraw, -} from "../hooks/useWithdraw.js"; - -export { useWasmInitialized } from "../wasm.js"; - -//////////////////////////////////////////////////////////////////////////////// -// Utils -//////////////////////////////////////////////////////////////////////////////// - -export { useQuery } from "../utils/query.js"; - -export { createSignedWebSocketRequest } from "../utils/websocket.js"; - -//////////////////////////////////////////////////////////////////////////////// -// @renegade/core -//////////////////////////////////////////////////////////////////////////////// - -// Types -export type { - Balance, - Config, - CreateConfigParameters, - Exchange, - NetworkOrder, - Order, - OrderMetadata, - PartialOrderFill, - Task, - TaskInfo, - TaskState, -} from "@renegade-fi/core"; - -export { - // WebSocket - AuthType, - // Errors - ConfigRequiredError, - // createStorage - type CreateStorageParameters, - chainIdFromEnvAndName, - chainIdToEnv, - // Utils - cookieStorage, - cookieToInitialState, - createStorage, - deepEqual, - // Config - getSDKConfig, - isSupportedChainId, - noopStorage, - // Types - OrderState, - parseCookie, - RelayerWebsocket, - type RelayerWebsocketParams, - type Storage, - type StorageItemMap, - stringifyForWasm, - TaskType, - UpdateType, -} from "@renegade-fi/core"; diff --git a/packages/react/src/exports/query.ts b/packages/react/src/exports/query.ts deleted file mode 100644 index c161b0d9..00000000 --- a/packages/react/src/exports/query.ts +++ /dev/null @@ -1,5 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// @renegade-fi/core/query -//////////////////////////////////////////////////////////////////////////////// - -export * from "@renegade-fi/core/query"; diff --git a/packages/react/src/hooks/useBackOfQueueBalances.ts b/packages/react/src/hooks/useBackOfQueueBalances.ts deleted file mode 100644 index 91e7592e..00000000 --- a/packages/react/src/hooks/useBackOfQueueBalances.ts +++ /dev/null @@ -1,23 +0,0 @@ -"use client"; - -import type { Balance, Config } from "@renegade-fi/core"; -import { useBackOfQueueWallet } from "./useBackOfQueueWallet.js"; - -export type UseBackOfQueueBalancesParameters = { - config?: Config; - filter?: boolean; -}; - -export type UseBackOfQueueBalancesReturnType = Balance[]; - -export function useBackOfQueueBalances( - parameters: UseBackOfQueueBalancesParameters = {}, -): UseBackOfQueueBalancesReturnType { - const { filter = true } = parameters; - const { data: wallet } = useBackOfQueueWallet(); - if (!wallet) return []; - if (filter) { - return wallet.balances.filter((balance) => balance.mint !== "0x0" && balance.amount); - } - return wallet.balances; -} diff --git a/packages/react/src/hooks/useBackOfQueueOrders.ts b/packages/react/src/hooks/useBackOfQueueOrders.ts deleted file mode 100644 index a710e66c..00000000 --- a/packages/react/src/hooks/useBackOfQueueOrders.ts +++ /dev/null @@ -1,23 +0,0 @@ -"use client"; - -import type { Config, Order } from "@renegade-fi/core"; -import { useBackOfQueueWallet } from "./useBackOfQueueWallet.js"; - -export type UseBackOfQueueOrdersParameters = { - config?: Config; - filter?: boolean; -}; - -export type UseBackOfQueueOrdersReturnType = Order[]; - -export function useBackOfQueueOrders( - parameters: UseBackOfQueueOrdersParameters = {}, -): UseBackOfQueueOrdersReturnType { - const { filter = true } = parameters; - const { data: wallet } = useBackOfQueueWallet(); - if (!wallet) return []; - if (filter) { - return wallet.orders.filter((order) => order.amount > 0); - } - return wallet.orders; -} diff --git a/packages/react/src/hooks/useBackOfQueueWallet.ts b/packages/react/src/hooks/useBackOfQueueWallet.ts deleted file mode 100644 index ee98c92a..00000000 --- a/packages/react/src/hooks/useBackOfQueueWallet.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { Evaluate, GetBackOfQueueWalletErrorType } from "@renegade-fi/core"; -import { - type GetBackOfQueueWalletData, - type GetBackOfQueueWalletOptions, - type GetBackOfQueueWalletQueryFnData, - type GetBackOfQueueWalletQueryKey, - getBackOfQueueWalletQueryOptions, -} from "@renegade-fi/core/query"; -import { useQueryClient } from "@tanstack/react-query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; -import { useStatus } from "./useStatus.js"; -import { useWalletWebsocket } from "./useWalletWebSocket.js"; - -export type UseBackOfQueueWalletParameters = Evaluate< - GetBackOfQueueWalletOptions & - ConfigParameter & - QueryParameter< - GetBackOfQueueWalletQueryFnData, - GetBackOfQueueWalletErrorType, - selectData, - GetBackOfQueueWalletQueryKey - > ->; - -export type UseBackOfQueueWalletReturnType = - UseQueryReturnType; - -export function useBackOfQueueWallet( - parameters: UseBackOfQueueWalletParameters = {}, -): UseBackOfQueueWalletReturnType { - const { filterDefaults, query = {} } = parameters; - - const config = useConfig(parameters); - const status = useStatus(parameters); - const queryClient = useQueryClient(); - - const options = getBackOfQueueWalletQueryOptions(config, { - ...parameters, - filterDefaults, - }); - const enabled = Boolean( - status === "in relayer" && config?.state.seed && (query.enabled ?? true), - ); - - useWalletWebsocket({ - enabled, - onUpdate: (wallet) => { - if (wallet && queryClient && options.queryKey) { - queryClient.setQueryData(options.queryKey, wallet); - } - }, - }); - - return useQuery({ ...query, ...options, enabled }); -} diff --git a/packages/react/src/hooks/useBalances.ts b/packages/react/src/hooks/useBalances.ts deleted file mode 100644 index 8033a32c..00000000 --- a/packages/react/src/hooks/useBalances.ts +++ /dev/null @@ -1,22 +0,0 @@ -"use client"; - -import type { Balance, Config } from "@renegade-fi/core"; -import { useWallet } from "./useWallet.js"; - -export type UseBalancesParameters = { - config?: Config; - filter?: boolean; -}; - -export type UseBalancesReturnType = Map<`0x${string}`, Balance>; - -export function useBalances(parameters: UseBalancesParameters = {}): UseBalancesReturnType { - const { filter = true } = parameters; - const { data: wallet } = useWallet(); - if (!wallet?.balances) return new Map(); - let balances = wallet.balances; - if (filter) { - balances = balances.filter((balance) => balance.mint !== "0x0" && balance.amount); - } - return new Map(balances.map((balance) => [balance.mint, balance])); -} diff --git a/packages/react/src/hooks/useCancelOrder.ts b/packages/react/src/hooks/useCancelOrder.ts deleted file mode 100644 index a6816170..00000000 --- a/packages/react/src/hooks/useCancelOrder.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { CancelOrderRequestErrorType, Evaluate } from "@renegade-fi/core"; -import { - type CancelOrderRequestData, - type CancelOrderRequestMutate, - type CancelOrderRequestMutateAsync, - type CancelOrderRequestVariables, - cancelOrderRequestMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseCancelOrderParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters< - CancelOrderRequestData, - CancelOrderRequestErrorType, - CancelOrderRequestVariables, - context - > - | undefined; - } ->; - -export type UseCancelOrderReturnType = Evaluate< - UseMutationReturnType< - CancelOrderRequestData, - CancelOrderRequestErrorType, - CancelOrderRequestVariables, - context - > & { - cancelOrder: CancelOrderRequestMutate; - cancelOrderAsync: CancelOrderRequestMutateAsync; - } ->; - -export function useCancelOrder( - parameters: UseCancelOrderParameters = {}, -): UseCancelOrderReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = cancelOrderRequestMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - cancelOrder: mutate, - cancelOrderAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hooks/useConfig.ts b/packages/react/src/hooks/useConfig.ts deleted file mode 100644 index dc85cf9e..00000000 --- a/packages/react/src/hooks/useConfig.ts +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import type { Config } from "@renegade-fi/core"; -import { useContext } from "react"; - -import { RenegadeContext } from "../context.js"; -import type { ConfigParameter } from "../types/properties.js"; - -export type UseConfigParameters = ConfigParameter; - -export type UseConfigReturnType = config | undefined; - -export function useConfig( - parameters: UseConfigParameters = {}, -): UseConfigReturnType { - // biome-ignore lint/correctness/useHookAtTopLevel: from wagmi - const config = parameters.config ?? useContext(RenegadeContext); - return config as UseConfigReturnType; -} diff --git a/packages/react/src/hooks/useConnect.ts b/packages/react/src/hooks/useConnect.ts deleted file mode 100644 index 5c65658d..00000000 --- a/packages/react/src/hooks/useConnect.ts +++ /dev/null @@ -1,49 +0,0 @@ -"use client"; - -import type { ConnectErrorType, Evaluate } from "@renegade-fi/core"; -import { - type ConnectData, - type ConnectMutate, - type ConnectMutateAsync, - type ConnectVariables, - connectMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseConnectParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters - | undefined; - } ->; - -export type UseConnectReturnType = Evaluate< - UseMutationReturnType & { - connect: ConnectMutate; - connectAsync: ConnectMutateAsync; - } ->; - -export function useConnect( - parameters: UseConnectParameters = {}, -): UseConnectReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = connectMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - connect: mutate, - connectAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hooks/useCreateOrder.ts b/packages/react/src/hooks/useCreateOrder.ts deleted file mode 100644 index 59d5d912..00000000 --- a/packages/react/src/hooks/useCreateOrder.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { CreateOrderRequestErrorType, Evaluate } from "@renegade-fi/core"; -import { - type CreateOrderRequestData, - type CreateOrderRequestMutate, - type CreateOrderRequestMutateAsync, - type CreateOrderRequestVariables, - createOrderRequestMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseCreateOrderParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters< - CreateOrderRequestData, - CreateOrderRequestErrorType, - CreateOrderRequestVariables, - context - > - | undefined; - } ->; - -export type UseCreateOrderReturnType = Evaluate< - UseMutationReturnType< - CreateOrderRequestData, - CreateOrderRequestErrorType, - CreateOrderRequestVariables, - context - > & { - createOrder: CreateOrderRequestMutate; - createOrderAsync: CreateOrderRequestMutateAsync; - } ->; - -export function useCreateOrder( - parameters: UseCreateOrderParameters = {}, -): UseCreateOrderReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = createOrderRequestMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - createOrder: mutate, - createOrderAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hooks/useDeposit.ts b/packages/react/src/hooks/useDeposit.ts deleted file mode 100644 index 9b40f51d..00000000 --- a/packages/react/src/hooks/useDeposit.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { DepositRequestErrorType, Evaluate } from "@renegade-fi/core"; -import { - type DepositRequestData, - type DepositRequestMutate, - type DepositRequestMutateAsync, - type DepositRequestVariables, - depositRequestMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseDepositParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters< - DepositRequestData, - DepositRequestErrorType, - DepositRequestVariables, - context - > - | undefined; - } ->; - -export type UseDepositReturnType = Evaluate< - UseMutationReturnType< - DepositRequestData, - DepositRequestErrorType, - DepositRequestVariables, - context - > & { - deposit: DepositRequestMutate; - depositAsync: DepositRequestMutateAsync; - } ->; - -export function useDeposit( - parameters: UseDepositParameters = {}, -): UseDepositReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = depositRequestMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - deposit: mutate, - depositAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hooks/useFees.ts b/packages/react/src/hooks/useFees.ts deleted file mode 100644 index 98f497cc..00000000 --- a/packages/react/src/hooks/useFees.ts +++ /dev/null @@ -1,24 +0,0 @@ -"use client"; - -import type { Balance, Config } from "@renegade-fi/core"; -import { useWallet } from "./useWallet.js"; - -export type UseFeesParameters = { - config?: Config; - filter?: boolean; -}; - -export type UseFeesReturnType = Map<`0x${string}`, Balance>; - -export function useFees(parameters: UseFeesParameters = {}): UseFeesReturnType { - const { filter = true } = parameters; - const { data: wallet } = useWallet(); - if (!wallet?.balances) return new Map(); - let balances = wallet.balances; - if (filter) { - balances = balances.filter( - (balance) => balance.protocol_fee_balance || balance.relayer_fee_balance, - ); - } - return new Map(balances.map((balance) => [balance.mint, balance])); -} diff --git a/packages/react/src/hooks/useIsIndexed.ts b/packages/react/src/hooks/useIsIndexed.ts deleted file mode 100644 index 355a9c8c..00000000 --- a/packages/react/src/hooks/useIsIndexed.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { getWalletFromRelayer } from "@renegade-fi/core"; -import { useQuery } from "@tanstack/react-query"; -import { useWasmInitialized } from "../wasm.js"; -import { useConfig } from "./useConfig.js"; -import { useWalletId } from "./useWalletId.js"; - -/** - * Checks if the wallet is indexed in the relayer. - * This is necessary to subscribe to topics once a wallet is indexed. - * The query runs every 2 seconds until the wallet is indexed, or 30 times (1 minute) if the wallet is not indexed. - * This is fine because in most cases the wallet is indexed in << 1 minute. - * If after 1 minute the wallet is not indexed, there is a higher level issue that should be addressed. - */ -export function useIsIndexed() { - const config = useConfig(); - const walletId = useWalletId(); - const isWasmInitialized = useWasmInitialized(); - - return useQuery({ - queryKey: ["wallet", "is-indexed", walletId], - queryFn: async () => { - if (!walletId || !isWasmInitialized || !config) throw new Error("Invalid state"); - return getWalletFromRelayer(config).then((wallet) => !!wallet.id); - }, - refetchInterval: (query) => { - return query.state.data === true ? false : 2000; - }, - staleTime: Number.POSITIVE_INFINITY, - enabled: !!walletId && !!isWasmInitialized && !!config, - retry: 30, - }); -} diff --git a/packages/react/src/hooks/useNetworkOrders.ts b/packages/react/src/hooks/useNetworkOrders.ts deleted file mode 100644 index 5f34a51c..00000000 --- a/packages/react/src/hooks/useNetworkOrders.ts +++ /dev/null @@ -1,71 +0,0 @@ -"use client"; - -import type { Evaluate, GetNetworkOrdersErrorType, NetworkOrder } from "@renegade-fi/core"; -import { - type GetNetworkOrdersData, - type GetNetworkOrdersOptions, - type GetNetworkOrdersQueryFnData, - type GetNetworkOrdersQueryKey, - getNetworkOrdersQueryOptions, -} from "@renegade-fi/core/query"; -import { useQueryClient } from "@tanstack/react-query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; -import { useOrderBookWebSocket } from "./useOrderBookWebSocket.js"; - -export type UseNetworkOrdersParameters = Evaluate< - GetNetworkOrdersOptions & - ConfigParameter & - QueryParameter< - GetNetworkOrdersQueryFnData, - GetNetworkOrdersErrorType, - selectData, - GetNetworkOrdersQueryKey - > ->; - -export type UseNetworkOrdersReturnType = UseQueryReturnType< - selectData, - GetNetworkOrdersErrorType ->; - -export function useNetworkOrders( - parameters: UseNetworkOrdersParameters = {}, -): UseNetworkOrdersReturnType { - const { query = {} } = parameters; - - const config = useConfig(parameters); - const queryClient = useQueryClient(); - - const options = getNetworkOrdersQueryOptions(config, { - ...parameters, - }); - const enabled = Boolean(query.enabled ?? true); - - useOrderBookWebSocket({ - enabled, - onUpdate: (incoming: NetworkOrder) => { - if (queryClient && options.queryKey) { - const existingMap = - queryClient.getQueryData(options.queryKey) || new Map(); - const existingTask = existingMap.get(incoming.id); - - if (!existingTask || incoming.state !== existingTask.state) { - const newMap = new Map(existingMap); - newMap.set(incoming.id, incoming); - queryClient.setQueryData(options.queryKey, newMap); - } - } - }, - }); - - // Disable refetch to prevent flickering in multinode cluster (orderbook is not part of consensus) - return useQuery({ - ...query, - ...options, - enabled, - refetchInterval: false, - refetchOnWindowFocus: false, - }); -} diff --git a/packages/react/src/hooks/useOpenOrders.ts b/packages/react/src/hooks/useOpenOrders.ts deleted file mode 100644 index 2e5e60a9..00000000 --- a/packages/react/src/hooks/useOpenOrders.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { Evaluate } from "@renegade-fi/core"; -import type { GetOpenOrdersErrorType } from "@renegade-fi/core/actions"; -import { - type GetOpenOrdersData, - type GetOpenOrdersOptions, - type GetOpenOrdersQueryFnData, - type GetOpenOrdersQueryKey, - getOpenOrdersQueryOptions, -} from "@renegade-fi/core/query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseOpenOrdersParameters = Evaluate< - GetOpenOrdersOptions & - ConfigParameter & - QueryParameter< - GetOpenOrdersQueryFnData, - GetOpenOrdersErrorType, - selectData, - GetOpenOrdersQueryKey - > ->; - -export type UseOpenOrdersReturnType = UseQueryReturnType< - selectData, - GetOpenOrdersErrorType ->; - -export function useOpenOrders( - parameters: UseOpenOrdersParameters = {}, -): UseOpenOrdersReturnType { - const { query = {} } = parameters; - - const config = useConfig(parameters); - - const options = getOpenOrdersQueryOptions(config, { - ...parameters, - }); - const enabled = Boolean(query.enabled ?? true); - - return useQuery({ - ...query, - ...options, - enabled, - }); -} diff --git a/packages/react/src/hooks/useOrderBookWebSocket.ts b/packages/react/src/hooks/useOrderBookWebSocket.ts deleted file mode 100644 index 4984c572..00000000 --- a/packages/react/src/hooks/useOrderBookWebSocket.ts +++ /dev/null @@ -1,57 +0,0 @@ -"use client"; - -import { type Config, type NetworkOrder, ORDER_BOOK_ROUTE, parseBigJSON } from "@renegade-fi/core"; -import { useEffect } from "react"; -import { ReadyState } from "react-use-websocket"; -import { useWebSocket } from "react-use-websocket/dist/lib/use-websocket.js"; -import { useConfig } from "./useConfig.js"; - -export type UseOrderBookWebSocketParameters = { - config?: Config; - onUpdate?: (order: NetworkOrder) => void; - enabled?: boolean; -}; - -export type UseOrderBookWebSocketReturnType = NetworkOrder | undefined; - -export function useOrderBookWebSocket(parameters: UseOrderBookWebSocketParameters = {}) { - const config = useConfig(parameters); - const { enabled = true, onUpdate } = parameters; - - const { readyState, sendJsonMessage } = useWebSocket( - config?.getWebsocketBaseUrl() ?? "", - { - filter: () => false, - onMessage: (event) => { - try { - const messageData = parseBigJSON(event.data); - if ( - messageData.topic === ORDER_BOOK_ROUTE && - (messageData.event?.type === "NewOrder" || - messageData.event?.type === "OrderStateChange") && - messageData.event?.order - ) { - onUpdate?.(messageData.event.order); - } - } catch (_) {} - }, - share: true, - shouldReconnect: () => true, - }, - enabled && !!config?.getWebsocketBaseUrl(), - ); - - useEffect(() => { - if (enabled && readyState !== ReadyState.OPEN) return; - - const body = { - method: "subscribe", - topic: ORDER_BOOK_ROUTE, - }; - const message = { - body, - headers: {}, - }; - sendJsonMessage(message); - }, [enabled, readyState, sendJsonMessage]); -} diff --git a/packages/react/src/hooks/useOrderHistory.ts b/packages/react/src/hooks/useOrderHistory.ts deleted file mode 100644 index 3b64cae7..00000000 --- a/packages/react/src/hooks/useOrderHistory.ts +++ /dev/null @@ -1,66 +0,0 @@ -"use client"; - -import type { Evaluate, GetOrderHistoryErrorType, OrderMetadata } from "@renegade-fi/core"; -import { - type GetOrderHistoryData, - type GetOrderHistoryOptions, - type GetOrderHistoryQueryFnData, - type GetOrderHistoryQueryKey, - getOrderHistoryQueryOptions, -} from "@renegade-fi/core/query"; -import { useQueryClient } from "@tanstack/react-query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; -import { useOrderHistoryWebSocket } from "./useOrderHistoryWebSocket.js"; -import { useStatus } from "./useStatus.js"; - -export type UseOrderHistoryParameters = Evaluate< - GetOrderHistoryOptions & - ConfigParameter & - QueryParameter< - GetOrderHistoryQueryFnData, - GetOrderHistoryErrorType, - selectData, - GetOrderHistoryQueryKey - > ->; - -export type UseOrderHistoryReturnType = UseQueryReturnType< - selectData, - GetOrderHistoryErrorType ->; - -export function useOrderHistory( - parameters: UseOrderHistoryParameters = {}, -): UseOrderHistoryReturnType { - const { query = {} } = parameters; - - const config = useConfig(parameters); - const status = useStatus(parameters); - const queryClient = useQueryClient(); - - const options = getOrderHistoryQueryOptions(config, { - ...parameters, - }); - const enabled = Boolean(status === "in relayer" && (query.enabled ?? true)); - - useOrderHistoryWebSocket({ - enabled, - onUpdate: (incoming: OrderMetadata) => { - if (queryClient && options.queryKey) { - const existingMap = - queryClient.getQueryData(options.queryKey) || new Map(); - const existingOrder = existingMap.get(incoming.id); - - if (!existingOrder || incoming.state !== existingOrder.state) { - const newMap = new Map(existingMap); - newMap.set(incoming.id, incoming); - queryClient.setQueryData(options.queryKey, newMap); - } - } - }, - }); - - return useQuery({ ...query, ...options, enabled }); -} diff --git a/packages/react/src/hooks/useOrderHistoryWebSocket.ts b/packages/react/src/hooks/useOrderHistoryWebSocket.ts deleted file mode 100644 index 95699fbc..00000000 --- a/packages/react/src/hooks/useOrderHistoryWebSocket.ts +++ /dev/null @@ -1,86 +0,0 @@ -"use client"; - -import { - type Config, - getSymmetricKey, - type OrderMetadata, - WS_WALLET_ORDERS_ROUTE, -} from "@renegade-fi/core"; -import { useEffect } from "react"; -import { ReadyState } from "react-use-websocket"; -import { useWebSocket } from "react-use-websocket/dist/lib/use-websocket.js"; -import { createSignedWebSocketRequest } from "../utils/websocket.js"; -import { useWasmInitialized } from "../wasm.js"; -import { useConfig } from "./useConfig.js"; -import { useIsIndexed } from "./useIsIndexed.js"; -import { useWalletId } from "./useWalletId.js"; - -export type UseOrderHistoryWebSocketParameters = { - config?: Config; - onUpdate?: (order: OrderMetadata) => void; - enabled?: boolean; -}; - -export function useOrderHistoryWebSocket(parameters: UseOrderHistoryWebSocketParameters = {}) { - const isWasmInitialized = useWasmInitialized(); - const config = useConfig(parameters); - const walletId = useWalletId(); - - const { enabled = true, onUpdate } = parameters; - - const { readyState, sendJsonMessage } = useWebSocket( - config?.getWebsocketBaseUrl() ?? "", - { - filter: () => false, - onMessage(event) { - try { - const messageData = JSON.parse(event.data, (key, value) => { - if (typeof value === "number" && key !== "price") { - return BigInt(value); - } - return value; - }); - if ( - walletId && - messageData.topic === WS_WALLET_ORDERS_ROUTE(walletId) && - messageData.event?.type === "OrderMetadataUpdated" && - messageData.event?.order - ) - onUpdate?.(messageData.event.order); - } catch (_) {} - }, - share: true, - shouldReconnect: () => true, - }, - enabled && !!config?.getWebsocketBaseUrl(), - ); - - const { data: isIndexed } = useIsIndexed(); - // Subscribe to wallet updates with auth headers - useEffect(() => { - // Capture the current (old) wallet id in a local variable - const currentWalletId = walletId; - - if ( - !enabled || - !currentWalletId || - readyState !== ReadyState.OPEN || - !isWasmInitialized || - !config || - !config.state.seed || - !isIndexed - ) - return; - - // Subscribe to wallet's order updates - const body = { - method: "subscribe" as const, - topic: WS_WALLET_ORDERS_ROUTE(currentWalletId), - } as const; - - const symmetricKey = getSymmetricKey(config); - const message = createSignedWebSocketRequest(config, symmetricKey, body); - - sendJsonMessage(message); - }, [enabled, walletId, readyState, isWasmInitialized, sendJsonMessage, config, isIndexed]); -} diff --git a/packages/react/src/hooks/useOrderMetadata.ts b/packages/react/src/hooks/useOrderMetadata.ts deleted file mode 100644 index c4fc68f2..00000000 --- a/packages/react/src/hooks/useOrderMetadata.ts +++ /dev/null @@ -1,47 +0,0 @@ -import type { Evaluate } from "@renegade-fi/core"; -import type { GetOrderMetadataErrorType } from "@renegade-fi/core/actions"; -import { - type GetOrderMetadataData, - type GetOrderMetadataOptions, - type GetOrderMetadataQueryFnData, - type GetOrderMetadataQueryKey, - getOrderMetadataQueryOptions, -} from "@renegade-fi/core/query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseOrderMetadataParameters = Evaluate< - GetOrderMetadataOptions & - ConfigParameter & - QueryParameter< - GetOrderMetadataQueryFnData, - GetOrderMetadataErrorType, - selectData, - GetOrderMetadataQueryKey - > ->; - -export type UseOrderMetadataReturnType = UseQueryReturnType< - selectData, - GetOrderMetadataErrorType ->; - -export function useOrderMetadata( - parameters: UseOrderMetadataParameters, -): UseOrderMetadataReturnType { - const { query } = parameters; - - const config = useConfig(parameters); - - const options = getOrderMetadataQueryOptions(config, { - ...parameters, - }); - const enabled = Boolean(query?.enabled ?? true); - - return useQuery({ - ...query, - ...options, - enabled, - }); -} diff --git a/packages/react/src/hooks/useOrders.ts b/packages/react/src/hooks/useOrders.ts deleted file mode 100644 index 04f0a975..00000000 --- a/packages/react/src/hooks/useOrders.ts +++ /dev/null @@ -1,22 +0,0 @@ -"use client"; - -import type { Config, Order } from "@renegade-fi/core"; -import { useWallet } from "./useWallet.js"; - -export type UseOrdersParameters = { - config?: Config; - filter?: boolean; -}; - -export type UseOrdersReturnType = Map; - -export function useOrders(parameters: UseOrdersParameters = {}): UseOrdersReturnType { - const { filter = true } = parameters; - const { data: wallet } = useWallet(); - if (!wallet?.orders) return new Map(); - let orders = wallet.orders; - if (filter) { - orders = orders.filter((order) => order.amount > 0); - } - return new Map(orders.map((order) => [order.id, order])); -} diff --git a/packages/react/src/hooks/usePayFees.ts b/packages/react/src/hooks/usePayFees.ts deleted file mode 100644 index fabc800f..00000000 --- a/packages/react/src/hooks/usePayFees.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { Evaluate, PayFeesErrorType } from "@renegade-fi/core"; -import { - type PayFeesRequestData, - type PayFeesRequestMutate, - type PayFeesRequestMutateAsync, - type PayFeesRequestVariables, - payFeesRequestMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UsePayFeesParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters< - PayFeesRequestData, - PayFeesErrorType, - PayFeesRequestVariables, - context - > - | undefined; - } ->; - -export type UsePayFeesReturnType = Evaluate< - UseMutationReturnType< - PayFeesRequestData, - PayFeesErrorType, - PayFeesRequestVariables, - context - > & { - payFees: PayFeesRequestMutate; - payFeesAsync: PayFeesRequestMutateAsync; - } ->; - -export function usePayFees( - parameters: UsePayFeesParameters = {}, -): UsePayFeesReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = payFeesRequestMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - payFees: mutate, - payFeesAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hooks/usePing.ts b/packages/react/src/hooks/usePing.ts deleted file mode 100644 index d9c549d3..00000000 --- a/packages/react/src/hooks/usePing.ts +++ /dev/null @@ -1,37 +0,0 @@ -"use client"; - -import type { Evaluate } from "@renegade-fi/core"; -import type { GetPingErrorType } from "@renegade-fi/core/actions"; -import { - type GetPingData, - type GetPingOptions, - type GetPingQueryFnData, - type GetPingQueryKey, - getPingQueryOptions, -} from "@renegade-fi/core/query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UsePingParameters = Evaluate< - GetPingOptions & - ConfigParameter & - QueryParameter ->; - -export type UsePingReturnType = UseQueryReturnType< - selectData, - GetPingErrorType ->; - -export function usePing( - parameters: UsePingParameters = {}, -): UsePingReturnType { - const { query = {} } = parameters; - - const config = useConfig(parameters); - const options = getPingQueryOptions(config); - const enabled = Boolean(query.enabled ?? true); - - return useQuery({ ...query, ...options, enabled }); -} diff --git a/packages/react/src/hooks/usePkRootScalars.ts b/packages/react/src/hooks/usePkRootScalars.ts deleted file mode 100644 index a080b6b4..00000000 --- a/packages/react/src/hooks/usePkRootScalars.ts +++ /dev/null @@ -1,20 +0,0 @@ -"use client"; - -import { ConfigRequiredError, type GetPkRootScalarsReturnType } from "@renegade-fi/core"; -import { getPkRootScalars } from "@renegade-fi/core/actions"; -import React from "react"; -import type { ConfigParameter } from "../types/properties.js"; -import { useConfig } from "./useConfig.js"; - -export type UsePkRootParameters = ConfigParameter; - -export type UsePkRootScalarsReturnType = GetPkRootScalarsReturnType; - -export function usePkRootScalars(parameters: UsePkRootParameters = {}): UsePkRootScalarsReturnType { - const config = useConfig(parameters); - const pkRootScalars = React.useMemo(() => { - if (!config) throw new ConfigRequiredError("getPkRootScalars"); - return getPkRootScalars(config); - }, [config]); - return pkRootScalars; -} diff --git a/packages/react/src/hooks/useStatus.ts b/packages/react/src/hooks/useStatus.ts deleted file mode 100644 index 6339557a..00000000 --- a/packages/react/src/hooks/useStatus.ts +++ /dev/null @@ -1,30 +0,0 @@ -"use client"; - -import { type Config, watchStatus } from "@renegade-fi/core"; -import { useEffect, useState } from "react"; -import { useConfig } from "./useConfig.js"; - -export type UseStatusParameters = { - config?: Config; -}; - -export type UseStatusReturnType = Config["state"]["status"]; - -export function useStatus(parameters: UseStatusParameters = {}): UseStatusReturnType { - const config = useConfig(parameters); - const [status, setStatus] = useState(config?.state.status); - - useEffect(() => { - if (!config) return; - const unsubscribe = watchStatus(config, { - onChange: (status) => { - setStatus(status); - }, - }); - return () => { - unsubscribe(); - }; - }, [config]); - - return status; -} diff --git a/packages/react/src/hooks/useTaskHistory.ts b/packages/react/src/hooks/useTaskHistory.ts deleted file mode 100644 index 1d5a8e30..00000000 --- a/packages/react/src/hooks/useTaskHistory.ts +++ /dev/null @@ -1,66 +0,0 @@ -"use client"; - -import type { Evaluate, GetTaskHistoryErrorType, Task } from "@renegade-fi/core"; -import { - type GetTaskHistoryData, - type GetTaskHistoryOptions, - type GetTaskHistoryQueryFnData, - type GetTaskHistoryQueryKey, - getTaskHistoryQueryOptions, -} from "@renegade-fi/core/query"; -import { useQueryClient } from "@tanstack/react-query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; -import { useStatus } from "./useStatus.js"; -import { useTaskHistoryWebSocket } from "./useTaskHistoryWebSocket.js"; - -export type UseTaskHistoryParameters = Evaluate< - GetTaskHistoryOptions & - ConfigParameter & - QueryParameter< - GetTaskHistoryQueryFnData, - GetTaskHistoryErrorType, - selectData, - GetTaskHistoryQueryKey - > ->; - -export type UseTaskHistoryReturnType = UseQueryReturnType< - selectData, - GetTaskHistoryErrorType ->; - -export function useTaskHistory( - parameters: UseTaskHistoryParameters = {}, -): UseTaskHistoryReturnType { - const { query = {} } = parameters; - - const config = useConfig(parameters); - const status = useStatus(parameters); - const queryClient = useQueryClient(); - - const options = getTaskHistoryQueryOptions(config, { - ...parameters, - }); - const enabled = Boolean(status === "in relayer" && (query.enabled ?? true)); - - useTaskHistoryWebSocket({ - enabled, - onUpdate: (incoming: Task) => { - if (queryClient && options.queryKey) { - const existingMap = - queryClient.getQueryData(options.queryKey) || new Map(); - const existingTask = existingMap.get(incoming.id); - - if (!existingTask || incoming.state !== existingTask.state) { - const newMap = new Map(existingMap); - newMap.set(incoming.id, incoming); - queryClient.setQueryData(options.queryKey, newMap); - } - } - }, - }); - - return useQuery({ ...query, ...options, enabled }); -} diff --git a/packages/react/src/hooks/useTaskHistoryWebSocket.ts b/packages/react/src/hooks/useTaskHistoryWebSocket.ts deleted file mode 100644 index 3bc1e1f4..00000000 --- a/packages/react/src/hooks/useTaskHistoryWebSocket.ts +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; - -import { - type Config, - getSymmetricKey, - parseBigJSON, - type Task, - WS_TASK_HISTORY_ROUTE, -} from "@renegade-fi/core"; -import { useEffect } from "react"; -import { ReadyState } from "react-use-websocket"; -import { useWebSocket } from "react-use-websocket/dist/lib/use-websocket.js"; -import { createSignedWebSocketRequest } from "../utils/websocket.js"; -import { useWasmInitialized } from "../wasm.js"; -import { useConfig } from "./useConfig.js"; -import { useIsIndexed } from "./useIsIndexed.js"; -import { useWalletId } from "./useWalletId.js"; - -export type UseTaskHistoryWebSocketParameters = { - config?: Config; - onUpdate?: (task: Task) => void; - enabled?: boolean; -}; - -export function useTaskHistoryWebSocket(parameters: UseTaskHistoryWebSocketParameters = {}) { - const isWasmInitialized = useWasmInitialized(); - const config = useConfig(parameters); - const walletId = useWalletId(); - - const { enabled = true, onUpdate } = parameters; - - const { readyState, sendJsonMessage } = useWebSocket( - config?.getWebsocketBaseUrl() ?? "", - { - filter: () => false, - onMessage(event) { - try { - const messageData = parseBigJSON(event.data); - if ( - walletId && - messageData.topic === WS_TASK_HISTORY_ROUTE(walletId) && - messageData.event?.type === "TaskHistoryUpdate" && - messageData.event?.task - ) - onUpdate?.(messageData.event.task); - } catch (_) {} - }, - share: true, - shouldReconnect: () => Boolean(enabled && walletId), - }, - enabled && !!config?.getWebsocketBaseUrl(), - ); - - const { data: isIndexed } = useIsIndexed(); - - useEffect(() => { - // Capture the current (old) wallet id in a local variable - const currentWalletId = walletId; - - if ( - !enabled || - !currentWalletId || - readyState !== ReadyState.OPEN || - !isWasmInitialized || - !config || - !config.state.seed || - !isIndexed - ) - return; - - const body = { - method: "subscribe", - topic: WS_TASK_HISTORY_ROUTE(currentWalletId), - } as const; - - const symmetricKey = getSymmetricKey(config); - const subscriptionMessage = createSignedWebSocketRequest(config, symmetricKey, body); - - sendJsonMessage(subscriptionMessage); - }, [enabled, walletId, readyState, isWasmInitialized, sendJsonMessage, config, isIndexed]); -} diff --git a/packages/react/src/hooks/useWallet.ts b/packages/react/src/hooks/useWallet.ts deleted file mode 100644 index aa6f55e4..00000000 --- a/packages/react/src/hooks/useWallet.ts +++ /dev/null @@ -1,56 +0,0 @@ -"use client"; - -import type { Evaluate, GetWalletErrorType } from "@renegade-fi/core"; -import { - type GetWalletData, - type GetWalletOptions, - type GetWalletQueryFnData, - type GetWalletQueryKey, - getWalletQueryOptions, -} from "@renegade-fi/core/query"; -import { useQueryClient } from "@tanstack/react-query"; -import type { ConfigParameter, QueryParameter } from "../types/properties.js"; -import { type UseQueryReturnType, useQuery } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; -import { useStatus } from "./useStatus.js"; -import { useWalletWebsocket } from "./useWalletWebSocket.js"; - -export type UseWalletParameters = Evaluate< - GetWalletOptions & - ConfigParameter & - QueryParameter ->; - -export type UseWalletReturnType = UseQueryReturnType< - selectData, - GetWalletErrorType ->; - -export function useWallet( - parameters: UseWalletParameters = {}, -): UseWalletReturnType { - const { filterDefaults, query = {} } = parameters; - - const config = useConfig(parameters); - const status = useStatus(parameters); - const queryClient = useQueryClient(); - - const options = getWalletQueryOptions(config, { - ...parameters, - filterDefaults, - }); - const enabled = Boolean( - status === "in relayer" && config?.state.seed && (query.enabled ?? true), - ); - - useWalletWebsocket({ - enabled, - onUpdate: (wallet) => { - if (wallet && queryClient && options.queryKey) { - queryClient.setQueryData(options.queryKey, wallet); - } - }, - }); - - return useQuery({ ...query, ...options, enabled }); -} diff --git a/packages/react/src/hooks/useWalletBalances.ts b/packages/react/src/hooks/useWalletBalances.ts deleted file mode 100644 index d22c110b..00000000 --- a/packages/react/src/hooks/useWalletBalances.ts +++ /dev/null @@ -1,18 +0,0 @@ -"use client"; - -import type { Balance, Config } from "@renegade-fi/core"; -import { useWallet } from "./useWallet.js"; - -export type UseBalancesParameters = { - config?: Config; - filterDefaults?: boolean; -}; - -export type UseBalancesReturnType = Balance[]; - -export function useBalances(parameters: UseBalancesParameters = {}): UseBalancesReturnType { - const { filterDefaults = true } = parameters; - const { data } = useWallet({ filterDefaults }); - if (!data) return []; - return data.balances; -} diff --git a/packages/react/src/hooks/useWalletId.ts b/packages/react/src/hooks/useWalletId.ts deleted file mode 100644 index 2bcfe76c..00000000 --- a/packages/react/src/hooks/useWalletId.ts +++ /dev/null @@ -1,30 +0,0 @@ -"use client"; - -import type { Config } from "@renegade-fi/core"; -import { useEffect, useState } from "react"; -import { useConfig } from "./useConfig.js"; - -export type UseWalletIdParameters = { - config?: Config; -}; - -export type UseWalletIdReturnType = string | undefined; - -export function useWalletId(parameters: UseWalletIdParameters = {}): UseWalletIdReturnType { - const config = useConfig(parameters); - const [walletId, setWalletId] = useState(config?.state.id); - - useEffect(() => { - if (!config) return; - setWalletId(config.state.id); - const unsubscribe = config.subscribe( - (state) => state.id, - (s) => setWalletId(s), - ); - return () => { - unsubscribe(); - }; - }, [config]); - - return walletId; -} diff --git a/packages/react/src/hooks/useWalletOrders.ts b/packages/react/src/hooks/useWalletOrders.ts deleted file mode 100644 index 8646e2e1..00000000 --- a/packages/react/src/hooks/useWalletOrders.ts +++ /dev/null @@ -1,18 +0,0 @@ -"use client"; - -import type { Config, Order } from "@renegade-fi/core"; -import { useWallet } from "./useWallet.js"; - -export type UseOrdersParameters = { - config?: Config; - filterDefaults?: boolean; -}; - -export type UseOrdersReturnType = Order[]; - -export function useOrders(parameters: UseOrdersParameters = {}): UseOrdersReturnType { - const { filterDefaults = true } = parameters; - const { data } = useWallet({ filterDefaults }); - if (!data) return []; - return data.orders; -} diff --git a/packages/react/src/hooks/useWalletWebSocket.ts b/packages/react/src/hooks/useWalletWebSocket.ts deleted file mode 100644 index ee18d1e1..00000000 --- a/packages/react/src/hooks/useWalletWebSocket.ts +++ /dev/null @@ -1,81 +0,0 @@ -"use client"; - -import { - type Config, - getSymmetricKey, - parseBigJSON, - WALLET_ROUTE, - type Wallet, -} from "@renegade-fi/core"; -import { useEffect } from "react"; -import { ReadyState } from "react-use-websocket"; -import { useWebSocket } from "react-use-websocket/dist/lib/use-websocket.js"; -import { createSignedWebSocketRequest } from "../utils/websocket.js"; -import { useWasmInitialized } from "../wasm.js"; -import { useConfig } from "./useConfig.js"; -import { useIsIndexed } from "./useIsIndexed.js"; -import { useWalletId } from "./useWalletId.js"; - -export type UseWalletParameters = { - config?: Config; - onUpdate?: (wallet: Wallet) => void; - enabled?: boolean; -}; - -export function useWalletWebsocket(parameters: UseWalletParameters = {}) { - const isWasmInitialized = useWasmInitialized(); - const config = useConfig(parameters); - const walletId = useWalletId(); - const { enabled = true, onUpdate } = parameters; - - const { readyState, sendJsonMessage } = useWebSocket( - config?.getWebsocketBaseUrl() ?? "", - { - filter: () => false, - onMessage: (event) => { - try { - const messageData = parseBigJSON(event.data); - if ( - walletId && - messageData.topic === WALLET_ROUTE(walletId) && - messageData.event?.type === "WalletUpdate" && - messageData.event?.wallet - ) - onUpdate?.(messageData.event.wallet); - } catch (_) {} - }, - share: true, - shouldReconnect: () => true, - }, - enabled && !!config?.getWebsocketBaseUrl(), - ); - - const { data: isIndexed } = useIsIndexed(); - // Subscribe to wallet updates with auth headers - useEffect(() => { - // Capture the current (old) wallet id in a local variable - const currentWalletId = walletId; - - if ( - !enabled || - !currentWalletId || - readyState !== ReadyState.OPEN || - !isWasmInitialized || - !config || - !config.state.seed || - !isIndexed - ) - return; - - // Subscribe to wallet updates - const body = { - method: "subscribe", - topic: WALLET_ROUTE(currentWalletId), - } as const; - - const symmetricKey = getSymmetricKey(config); - const subscriptionMessage = createSignedWebSocketRequest(config, symmetricKey, body); - - sendJsonMessage(subscriptionMessage); - }, [enabled, walletId, readyState, isWasmInitialized, sendJsonMessage, config, isIndexed]); -} diff --git a/packages/react/src/hooks/useWithdraw.ts b/packages/react/src/hooks/useWithdraw.ts deleted file mode 100644 index 46cade32..00000000 --- a/packages/react/src/hooks/useWithdraw.ts +++ /dev/null @@ -1,59 +0,0 @@ -"use client"; - -import type { Evaluate, WithdrawRequestErrorType } from "@renegade-fi/core"; -import { - type WithdrawRequestData, - type WithdrawRequestMutate, - type WithdrawRequestMutateAsync, - type WithdrawRequestVariables, - withdrawRequestMutationOptions, -} from "@renegade-fi/core/query"; -import { useMutation } from "@tanstack/react-query"; -import type { ConfigParameter } from "../types/properties.js"; -import type { UseMutationParameters, UseMutationReturnType } from "../utils/query.js"; -import { useConfig } from "./useConfig.js"; - -export type UseWithdrawParameters = Evaluate< - ConfigParameter & { - mutation?: - | UseMutationParameters< - WithdrawRequestData, - WithdrawRequestErrorType, - WithdrawRequestVariables, - context - > - | undefined; - } ->; - -export type UseWithdrawReturnType = Evaluate< - UseMutationReturnType< - WithdrawRequestData, - WithdrawRequestErrorType, - WithdrawRequestVariables, - context - > & { - withdraw: WithdrawRequestMutate; - withdrawAsync: WithdrawRequestMutateAsync; - } ->; - -export function useWithdraw( - parameters: UseWithdrawParameters = {}, -): UseWithdrawReturnType { - const { mutation } = parameters; - - const config = useConfig(parameters); - - const mutationOptions = withdrawRequestMutationOptions(config); - const { mutate, mutateAsync, ...result } = useMutation({ - ...mutation, - ...mutationOptions, - }); - - return { - ...result, - withdraw: mutate, - withdrawAsync: mutateAsync, - }; -} diff --git a/packages/react/src/hydrate.ts b/packages/react/src/hydrate.ts deleted file mode 100644 index 50a8ff33..00000000 --- a/packages/react/src/hydrate.ts +++ /dev/null @@ -1,66 +0,0 @@ -"use client"; - -import type { Config } from "@renegade-fi/core"; -import { hydrate, type State } from "@renegade-fi/core"; -import { createElement, type ReactElement, useEffect, useRef, useState } from "react"; -import * as RustUtils from "../renegade-utils/index.js"; -import { WasmContext } from "./wasm.js"; - -export type HydrateProps = { - config: Config | undefined; - initialState?: State | undefined; - reconnectOnMount?: boolean | undefined; -}; - -export function Hydrate(parameters: React.PropsWithChildren) { - const { children, config, initialState, reconnectOnMount = true } = parameters; - const [isInitialized, setIsInitialized] = useState(false); - - const { onMount } = hydrate(config, { - initialState, - reconnectOnMount, - }); - - // Hydrate for non-SSR - if (config && !config._internal.ssr) onMount(); - - useEffect(() => { - RustUtils.default() - .then(() => { - setIsInitialized(true); - console.log("Backup effect initialized WASM"); - }) - .catch((error: unknown) => { - console.error("❌ Failed to initialize Rust utils", error); - }); - }, []); - - // Hydrate for SSR - const active = useRef(true); - // biome-ignore lint/correctness/useExhaustiveDependencies: we only want to initialize once on mount - useEffect(() => { - if (!config) return; - config.utils - .default() - .then(() => { - console.log("🚀 ~ WASM initialized"); - setIsInitialized(true); - if (!active.current) return; - if (!config._internal.ssr) return; - // Rehydrate after WASM is initialized to prevent race condition - onMount(); - }) - .catch((error: unknown) => { - console.error("❌ Failed to initialize Rust utils", error); - }); - return () => { - active.current = false; - }; - }, []); - - return createElement( - WasmContext.Provider, - { value: { isInitialized } }, - children as ReactElement, - ); -} diff --git a/packages/react/src/types/properties.ts b/packages/react/src/types/properties.ts deleted file mode 100644 index d0a3f701..00000000 --- a/packages/react/src/types/properties.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { Config, Omit } from "@renegade-fi/core"; -import type { DefaultError, QueryKey } from "@tanstack/react-query"; - -import type { UseInfiniteQueryParameters, UseQueryParameters } from "../utils/query.js"; - -export type EnabledParameter = { - enabled?: boolean | undefined; -}; - -export type ConfigParameter = { - config?: Config | config | undefined; -}; - -export type QueryParameter< - queryFnData = unknown, - error = DefaultError, - data = queryFnData, - queryKey extends QueryKey = QueryKey, -> = { - query?: - | Omit< - UseQueryParameters, - "queryFn" | "queryHash" | "queryKey" | "queryKeyHashFn" | "throwOnError" - > - | undefined; -}; - -export type InfiniteQueryParameter< - queryFnData = unknown, - error = DefaultError, - data = queryFnData, - queryData = queryFnData, - queryKey extends QueryKey = QueryKey, - pageParam = unknown, -> = { - query: Omit< - UseInfiniteQueryParameters, - "queryFn" | "queryHash" | "queryKey" | "queryKeyHashFn" | "throwOnError" - >; -}; diff --git a/packages/react/src/utils/getVersion.ts b/packages/react/src/utils/getVersion.ts deleted file mode 100644 index 9a48f1a2..00000000 --- a/packages/react/src/utils/getVersion.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { version } from "../version.js"; - -export const getVersion = () => `renegade-fi@${version}`; diff --git a/packages/react/src/utils/query.ts b/packages/react/src/utils/query.ts deleted file mode 100644 index 31261821..00000000 --- a/packages/react/src/utils/query.ts +++ /dev/null @@ -1,118 +0,0 @@ -import type { Evaluate, ExactPartial, Omit, UnionStrictOmit } from "@renegade-fi/core"; -import { hashFn } from "@renegade-fi/core/query"; -import { - type DefaultError, - type QueryKey, - useInfiniteQuery as tanstack_useInfiniteQuery, - useQuery as tanstack_useQuery, - type UseInfiniteQueryOptions, - type UseInfiniteQueryResult, - type UseMutationOptions, - type UseMutationResult, - type UseQueryOptions, - type UseQueryResult, - useMutation, -} from "@tanstack/react-query"; - -export type UseMutationParameters< - data = unknown, - error = Error, - variables = void, - context = unknown, -> = Evaluate< - Omit< - UseMutationOptions, context>, - "mutationFn" | "mutationKey" | "throwOnError" - > ->; - -export type UseMutationReturnType< - data = unknown, - error = Error, - variables = void, - context = unknown, -> = Evaluate< - UnionStrictOmit, "mutate" | "mutateAsync"> ->; - -export { useMutation }; - -//////////////////////////////////////////////////////////////////////////////// - -export type UseQueryParameters< - queryFnData = unknown, - error = DefaultError, - data = queryFnData, - queryKey extends QueryKey = QueryKey, -> = Evaluate< - ExactPartial, "initialData">> & { - // Fix `initialData` type - initialData?: - | UseQueryOptions["initialData"] - | undefined; - } ->; - -export type UseQueryReturnType = Evaluate< - UseQueryResult & { - queryKey: QueryKey; - } ->; - -// Adding some basic customization. -// Ideally we don't have this function, but `import('@tanstack/react-query').useQuery` currently has some quirks where it is super hard to -// pass down the inferred `initialData` type because of it's discriminated overload in the on `useQuery`. -export function useQuery( - parameters: UseQueryParameters & { - queryKey: QueryKey; - }, -): UseQueryReturnType { - const result = tanstack_useQuery({ - ...(parameters as any), - queryKeyHashFn: hashFn, // for bigint support - }) as UseQueryReturnType; - result.queryKey = parameters.queryKey; - return result; -} - -//////////////////////////////////////////////////////////////////////////////// - -export type UseInfiniteQueryParameters< - queryFnData = unknown, - error = DefaultError, - data = queryFnData, - queryData = queryFnData, - queryKey extends QueryKey = QueryKey, - pageParam = unknown, -> = Evaluate< - Omit< - UseInfiniteQueryOptions, - "initialData" - > & { - // Fix `initialData` type - initialData?: - | UseInfiniteQueryOptions["initialData"] - | undefined; - } ->; - -export type UseInfiniteQueryReturnType< - data = unknown, - error = DefaultError, -> = UseInfiniteQueryResult & { - queryKey: QueryKey; -}; - -// Adding some basic customization. -export function useInfiniteQuery( - parameters: UseInfiniteQueryParameters & { - queryKey: QueryKey; - }, -): UseInfiniteQueryReturnType { - const result = tanstack_useInfiniteQuery({ - ...(parameters as any), - queryKeyHashFn: hashFn, // for bigint support - }) as UseInfiniteQueryReturnType; - result.queryKey = parameters.queryKey; - return result; -} diff --git a/packages/react/src/utils/websocket.ts b/packages/react/src/utils/websocket.ts deleted file mode 100644 index 1e4b98eb..00000000 --- a/packages/react/src/utils/websocket.ts +++ /dev/null @@ -1,21 +0,0 @@ -import type { Config, SubscriptionBody, UnsubscriptionBody } from "@renegade-fi/core"; -import { addExpiringAuthToHeaders, SIG_EXPIRATION_BUFFER_MS } from "@renegade-fi/core"; - -export function createSignedWebSocketRequest( - config: Config, - key: `0x${string}`, - body: SubscriptionBody | UnsubscriptionBody, -) { - const headers = addExpiringAuthToHeaders( - config, - body.topic, - {}, - JSON.stringify(body), - key, - SIG_EXPIRATION_BUFFER_MS, - ); - return { - headers, - body, - }; -} diff --git a/packages/react/src/version.ts b/packages/react/src/version.ts deleted file mode 100644 index dbeaefe3..00000000 --- a/packages/react/src/version.ts +++ /dev/null @@ -1 +0,0 @@ -export const version = "0.0.1"; diff --git a/packages/react/src/wasm.ts b/packages/react/src/wasm.ts deleted file mode 100644 index 719365ea..00000000 --- a/packages/react/src/wasm.ts +++ /dev/null @@ -1,19 +0,0 @@ -"use client"; - -import { createContext, useContext } from "react"; - -type WasmContextValue = { - isInitialized: boolean; -}; - -export const WasmContext = createContext(undefined); - -export function useWasmInitialized() { - const context = useContext(WasmContext); - - if (!context) { - throw new Error("useWasmInitialized must be used within a "); - } - - return context.isInitialized; -} diff --git a/packages/react/tsconfig.build.json b/packages/react/tsconfig.build.json deleted file mode 100644 index 0eee00d7..00000000 --- a/packages/react/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src/**/*.ts"], - "exclude": ["src/**/*.test.ts", "src/**/*.test-d.ts"], - "compilerOptions": { - "sourceMap": true - } -} diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json deleted file mode 100644 index c0779d22..00000000 --- a/packages/react/tsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "compilerOptions": { - "jsx": "preserve" - }, - "include": ["src/**/*.ts", "src/**/*.tsx", "test/**/*.ts", "test/**/*.tsx"], - "exclude": [] -} diff --git a/packages/types/package.json b/packages/renegade-sdk/package.json similarity index 65% rename from packages/types/package.json rename to packages/renegade-sdk/package.json index 6891d4d7..b89fa54b 100644 --- a/packages/types/package.json +++ b/packages/renegade-sdk/package.json @@ -1,11 +1,11 @@ { - "name": "@renegade-fi/types", - "version": "1.0.0", - "description": "Types for the Renegade SDK", + "name": "@renegade-fi/renegade-sdk", + "version": "2.0.0", + "description": "A TypeScript SDK for interacting with the Renegade protocol", "repository": { "type": "git", "url": "https://github.com/renegade-fi/typescript-sdk.git", - "directory": "packages/types" + "directory": "packages/renegade-sdk" }, "files": [ "dist/**", @@ -16,9 +16,9 @@ ], "sideEffects": false, "type": "module", - "main": "./dist/esm/exports/index.js", - "types": "./dist/types/exports/index.d.ts", - "typings": "./dist/types/exports/index.d.ts", + "main": "./dist/index.js", + "types": "./dist/types/index.d.ts", + "typings": "./dist/types/index.d.ts", "exports": { ".": { "types": "./dist/types/index.d.ts", @@ -32,12 +32,10 @@ "clean": "rm -rf dist tsconfig.tsbuildinfo", "typecheck": "tsc --noEmit" }, - "keywords": [], - "author": "", - "devDependencies": { - "zod": "^4" + "dependencies": { + "@renegade-fi/external-match": "workspace:^", + "@renegade-fi/direct-match": "workspace:^" }, - "peerDependencies": { - "zod": "^4" - } -} \ No newline at end of file + "keywords": [], + "author": "" +} diff --git a/packages/renegade-sdk/src/index.ts b/packages/renegade-sdk/src/index.ts new file mode 100644 index 00000000..33ab3377 --- /dev/null +++ b/packages/renegade-sdk/src/index.ts @@ -0,0 +1,2 @@ +export * from "@renegade-fi/direct-match"; +export * from "@renegade-fi/external-match"; diff --git a/packages/node/tsconfig.build.json b/packages/renegade-sdk/tsconfig.build.json similarity index 100% rename from packages/node/tsconfig.build.json rename to packages/renegade-sdk/tsconfig.build.json diff --git a/packages/token-nextjs/CHANGELOG.md b/packages/token-nextjs/CHANGELOG.md deleted file mode 100644 index 3c026ae5..00000000 --- a/packages/token-nextjs/CHANGELOG.md +++ /dev/null @@ -1,183 +0,0 @@ -# @renegade-fi/token-nextjs - -## 1.0.0 - -### Major Changes - -- v1 release - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@1.0.0 - - @renegade-fi/token@1.0.0 - -## 0.1.18 - -### Patch Changes - -- external-match: client: Add direct malleable match method -- Updated dependencies - - @renegade-fi/core@0.9.13 - - @renegade-fi/token@0.0.32 - -## 0.1.17 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.12 - - @renegade-fi/token@0.0.31 - -## 0.1.16 - -### Patch Changes - -- chore: pin safe versions -- Updated dependencies - - @renegade-fi/core@0.9.11 - - @renegade-fi/token@0.0.30 - -## 0.1.15 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.10 - - @renegade-fi/token@0.0.29 - -## 0.1.14 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.9 - - @renegade-fi/token@0.0.28 - -## 0.1.13 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.8 - - @renegade-fi/token@0.0.27 - -## 0.1.12 - -### Patch Changes - -- token-next-js: remove spammy log - -## 0.1.11 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.7 - - @renegade-fi/token@0.0.26 - -## 0.1.10 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.6 - - @renegade-fi/token@0.0.25 - -## 0.1.9 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.5 - - @renegade-fi/token@0.0.24 - -## 0.1.8 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/token@0.0.23 - -## 0.1.7 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.4 - - @renegade-fi/token@0.0.22 - -## 0.1.6 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/token@0.0.21 - -## 0.1.5 - -### Patch Changes - -- set sideEffects:true in token-nextjs - -## 0.1.4 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.3 - - @renegade-fi/token@0.0.20 - -## 0.1.3 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/token@0.0.19 - -## 0.1.2 - -### Patch Changes - -- proper env var access in token-nextjs -- Updated dependencies - - @renegade-fi/core@0.9.2 - - @renegade-fi/token@0.0.18 - -## 0.1.1 - -### Patch Changes - -- Updated dependencies - - @renegade-fi/token@0.0.17 - - @renegade-fi/core@0.9.1 - -## 0.1.0 - -### Minor Changes - -- multi-chain-aware NextJS token - -### Patch Changes - -- Updated dependencies - - @renegade-fi/core@0.9.0 - - @renegade-fi/token@0.0.16 - -## 0.0.4 - -### Patch Changes - -- @renegade-fi/token@0.0.15 - -## 0.0.3 - -### Patch Changes - -- @renegade-fi/token@0.0.14 - -## 0.0.2 - -### Patch Changes - -- init diff --git a/packages/token-nextjs/README.md b/packages/token-nextjs/README.md deleted file mode 100644 index b9a96774..00000000 --- a/packages/token-nextjs/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# @renegade-fi/token - -Token remapping for Renegade, preconfigured for Next.js. - -## Installation - -```bash -pnpm add @renegade-fi/token -``` - -## Documentation - -Set the `NEXT_PUBLIC_TOKEN_MAPPING` environment variable to the token remap. \ No newline at end of file diff --git a/packages/token-nextjs/package.json b/packages/token-nextjs/package.json deleted file mode 100644 index e13a2867..00000000 --- a/packages/token-nextjs/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "@renegade-fi/token-nextjs", - "version": "1.0.0", - "description": "Token remapping for Renegade, preconfigured for Next.js", - "files": [ - "dist/**", - "!dist/**/*.tsbuildinfo", - "src/**/*.ts", - "!src/**/*.test.ts", - "!src/**/*.test-d.ts" - ], - "sideEffects": true, - "type": "module", - "main": "./dist/index.js", - "types": "./dist/types/index.d.ts", - "typings": "./dist/types/index.d.ts", - "exports": { - ".": { - "types": "./dist/types/index.d.ts", - "default": "./dist/index.js" - }, - "./package.json": "./package.json" - }, - "scripts": { - "build": "pnpm run clean && pnpm run build:esm+types", - "build:esm+types": "tsc --project tsconfig.build.json --outDir ./dist --declaration --declarationMap --declarationDir ./dist/types", - "clean": "rm -rf dist tsconfig.tsbuildinfo", - "typecheck": "tsc --noEmit" - }, - "keywords": [], - "author": "", - "dependencies": { - "@renegade-fi/core": "workspace:^", - "@renegade-fi/token": "workspace:^" - } -} \ No newline at end of file diff --git a/packages/token-nextjs/src/index.ts b/packages/token-nextjs/src/index.ts deleted file mode 100644 index 5077a354..00000000 --- a/packages/token-nextjs/src/index.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { - chainIdFromEnvAndName, - ENV_AGNOSTIC_CHAINS, - ENVIRONMENT, - isSupportedEnvironment, -} from "@renegade-fi/core"; -import { Token as CoreTokenAliased } from "@renegade-fi/token"; - -// Re-export all named exports from the core package. -export * from "@renegade-fi/token"; - -// Initialization Logic using the aliased CoreTokenAliased -const PACKAGE_NAME = "@renegade-fi/token-nextjs"; - -(() => { - const environment = typeof window === "undefined" ? "SERVER" : "CLIENT"; - const logPrefix = `[${PACKAGE_NAME} on ${environment}]`; - - if ( - !process.env.NEXT_PUBLIC_CHAIN_ENVIRONMENT || - !isSupportedEnvironment(process.env.NEXT_PUBLIC_CHAIN_ENVIRONMENT) - ) { - console.error( - `${logPrefix} NEXT_PUBLIC_CHAIN_ENVIRONMENT is unset or invalid, token mapping is unset.`, - "Expected to be one of:", - Object.values(ENVIRONMENT).join(", "), - ); - return; - } - - const chainEnvironment = process.env.NEXT_PUBLIC_CHAIN_ENVIRONMENT; - const envAgnosticChains = Object.values(ENV_AGNOSTIC_CHAINS); - - for (const chain of envAgnosticChains) { - let tokenMappingJson: string | undefined; - let envVarName: string | undefined; - - switch (chain) { - case ENV_AGNOSTIC_CHAINS.Arbitrum: - tokenMappingJson = process.env.NEXT_PUBLIC_ARBITRUM_TOKEN_MAPPING; - envVarName = "NEXT_PUBLIC_ARBITRUM_TOKEN_MAPPING"; - break; - case ENV_AGNOSTIC_CHAINS.Base: - tokenMappingJson = process.env.NEXT_PUBLIC_BASE_TOKEN_MAPPING; - envVarName = "NEXT_PUBLIC_BASE_TOKEN_MAPPING"; - break; - } - - if ( - !( - tokenMappingJson && - typeof tokenMappingJson === "string" && - tokenMappingJson.trim() !== "" - ) - ) { - console.warn( - `${logPrefix} ${envVarName} is not set or is empty. Token mapping not initialized from this env var.`, - "Token operations will rely on default behavior (e.g., UNKNOWN token or errors if not handled by core Token class).", - ); - continue; - } - - try { - const chainId = chainIdFromEnvAndName(chainEnvironment, chain); - - // Initialize the imported and aliased CoreTokenAliased - CoreTokenAliased.addRemapFromString(chainId, tokenMappingJson); - - // Check if any tokens were actually loaded after parsing - if (!CoreTokenAliased.getAllTokensOnChain(chainId).length) { - console.warn( - `${logPrefix} Token mapping from ${envVarName} was processed but resulted in zero tokens. Check the JSON content.`, - ); - } - } catch (error) { - console.error( - `${logPrefix} Failed to parse token mapping from ${envVarName}. Token operations may fail or use defaults.`, - error, - ); - } - } -})(); - -// Export initialized version of Token, which is the initialized CoreTokenAliased. -export const Token = CoreTokenAliased; diff --git a/packages/token-nextjs/tsconfig.build.json b/packages/token-nextjs/tsconfig.build.json deleted file mode 100644 index 0eee00d7..00000000 --- a/packages/token-nextjs/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src/**/*.ts"], - "exclude": ["src/**/*.test.ts", "src/**/*.test-d.ts"], - "compilerOptions": { - "sourceMap": true - } -} diff --git a/packages/token-nextjs/tsconfig.json b/packages/token-nextjs/tsconfig.json deleted file mode 100644 index dd44724d..00000000 --- a/packages/token-nextjs/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "include": ["src/**/*.ts", "test/**/*.ts"], - "exclude": [] -} diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md deleted file mode 100644 index c31f9851..00000000 --- a/packages/types/CHANGELOG.md +++ /dev/null @@ -1,43 +0,0 @@ -# @renegade-fi/types - -## 1.0.0 - -### Major Changes - -- v1 release - -## 0.0.7 - -### Patch Changes - -- external-match: client: Add direct malleable match method - -## 0.0.6 - -### Patch Changes - -- chore: pin safe versions - -## 0.0.5 - -### Patch Changes - -- types: add ws types' - -## 0.0.4 - -### Patch Changes - -- types: export ws types - -## 0.0.3 - -### Patch Changes - -- types: add ws message schema' - -## 0.0.2 - -### Patch Changes - -- types: initial publish diff --git a/packages/types/README.md b/packages/types/README.md deleted file mode 100644 index f0f36af6..00000000 --- a/packages/types/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# @renegade-fi/price-reporter - -TypeScript types for the Renegade SDK - -## Installation - -```bash -pnpm add @renegade-fi/types -``` - -## Documentation - -For documentation and guides, visit [the docs](https://docs.renegade.fi/technical-reference/typescript-sdk). \ No newline at end of file diff --git a/packages/types/renegade-fi-types-0.0.1.tgz b/packages/types/renegade-fi-types-0.0.1.tgz deleted file mode 100644 index fcea0f4fe8c362b2dbdb3eaad1ccbaee40b67c8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2921 zcmV-v3zqaBiwFP!00002|Lt9SZ`(K$&)@zOJaw^1bAHIL1ZQ`Pqtt8~baUM{Ef#3e zYZ-~QnMk6Rr1L8B-4CQ>Suej*$8K^YipHXbgN>xrj<|LnkS3jbyH-!%6% z{DiHiQ3G=b(W9cC(}LzllVAh5y?a|F_g_Ty`Y%_x8Xi>Vjx4fB|K| zysm`|56Crk0dif2ImaCAH6{*%Ljx|r?Q48}Di{fd;5Tqv7uXLyB=8?ZV1~Ti&xUzz zRKabXE1KQsU!Kp?xtK zw^sps;KK+5PFxJ=0EiI=K4KSG00f5Q5(hxdFhDq=oRujEM_&JN~Kz`8AbxTvXv7goDm6zQHw%&Bp9kZ znejXEyok(3frHgWiX#X@MjQ-~M}r}_B4VU?5yZ!U2ylfs;K&a>>=qgOKzz&v@~PGj|FDrR^CRymy#)V=Fg~ZC2T3PS)D;X z9S5S6*HmB2MU&~ydmJ*%aUi(j`3!Lk#7&q?jSwfjBZ1?MlinfDu>c_=tSYZ%T@h2& zsP!s9feT#1up=cfYeLQF-``^@@K>LxJ|-xNIwyIYaZ947H^oAfc|{o)UmaO0nFA9G zT3tq(J_)|c!T!q0EuKk*Jda*|#n%F}0C`{40Anu6&nWdU3UU+a1PkOM5%~vc6rvb| zRS;6n$(eTpMuZE>h=aTta-38)OP<6n_FAccUJBSzw(O~58!?7%cFSjET!jfFcOOR-UnGmsROBC-^aCq(^qdM1sDz~CxWsY zqX(kqRlaOZ)-WU@CRN#E=E>ZV5Fzh18bcyR>4^D!55Z`NFS zTiyK72Bbotb8OI5&AwCXxX z?N0fX^duOrQX;;S9rAkSatvtQaP^G zh^v_tgg#*7065Y#f?t0HNsglFVebDk4WeoB)U6&c1b0BK7BVWW9T421!GH|wic)a} zYBf3*uLuKCCqb>|V#h-)^2{<X>W|A;IK+XA1Bc+8sBftf^nW|qnnR4)@`WmQ z`Z0gG=l=+7nP)qRxgT|A7Onp^&Ak2Zwp(3o|2Ja)r-r>*zlj3H$MXZqf4vbKZ1ux68*1J z;6H`%wBPR^LTDxr5r^lm%88|>=&K~@4-jmVcCHhD3 zs8HlD2>aF|GMYn)7q;Y?SrO{|M7_M zzc$lvUs};^g;fQ1^-B>_3qm?In4^s0&*=&2D&+NqQVi3}HxRx_)t*%hMbBahMU-nm z@sR6?(pBo0>bCkN{eqI_vyMux`N;jqGmsGVkCpPAcCmzJsuU&lwUy#`KD7<)hLz>@ z^$)XJrlDuBdTXUR7W-i~v`2P=-wH>uKuhVX7@FpTW zw@Rm~%2U7Mu1wkysctM5MKe7>$_clj9a`E8NZJ4Qhw#@e3 z+e~@}GDm*Y;li3cqQeAcm5MyhbE*zOs1udtCwnTDXV1WKzyg5>`S$JG8RDag zIuL)?4=}@lgLB7(p4avI-!l9E9~l2lv#|fa)9vW}KO0H+jsLU8?cqB8 zT=-uf@R!7Yw}Ah4YhTCz*$)2K9RE-2iAVbWZ;e{u9`?U|pwItn`>)f+@L#fxdsEN< zX1iOA|Ec5u{RH^e@c6&N|Js4Sto<*E|I^a;|MB?$8b(h7|JiNa8^eEz{cr8-_@CPT z>$H{U|Kk4thsA%ZTX_H1Ine(9X3`qte@7w5a3K!3jI8;Ix*xKUz+ZebuYdU-Mf1G- z_HuqeO}*N%LHrl?|39q#@0!K<|DA3}`~Ta<|NX;xXEi|*$~aa8hr!r?5yk7X#y35n zLVWktwT$xJi-UdlD|avN8}7S|fhbaNo&$Rl{Wl2%9&s{>1l~&p1)uPkiVNP$#|e*U zqEO+zBxZP&n}iMTr9+5k`gy+~;@R$&N6e19{#Hd)evu0&{)xJ_ihb<y;E!u5FKQF`AOj&2*pfBSIt`!AgpEnzRJR*C^*k&WMmyK~0n>{BaUaoTIsonXicUkp2TLsTk z!|5rI1d#tkT_|J7zbMxLOV5Lax@1*-vZ_v*p;tOa Tbka$u$D95Kw0$qb0Ez$r&q(37 diff --git a/packages/types/src/common/index.ts b/packages/types/src/common/index.ts deleted file mode 100644 index 20cdc26e..00000000 --- a/packages/types/src/common/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./schema.js"; diff --git a/packages/types/src/common/schema.ts b/packages/types/src/common/schema.ts deleted file mode 100644 index be09a3d1..00000000 --- a/packages/types/src/common/schema.ts +++ /dev/null @@ -1,4 +0,0 @@ -import z from "zod/v4"; - -/** Zod schema for 0x-prefixed addresses */ -export const zHexString = z.templateLiteral(["0x", z.string()]); diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts deleted file mode 100644 index 77c6f963..00000000 --- a/packages/types/src/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export * from "./common/index.js"; -export * from "./order/index.js"; -export * from "./ws/index.js"; diff --git a/packages/types/src/order/index.ts b/packages/types/src/order/index.ts deleted file mode 100644 index 20cdc26e..00000000 --- a/packages/types/src/order/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./schema.js"; diff --git a/packages/types/src/order/schema.ts b/packages/types/src/order/schema.ts deleted file mode 100644 index 4a6c6ad3..00000000 --- a/packages/types/src/order/schema.ts +++ /dev/null @@ -1,66 +0,0 @@ -import z from "zod/v4"; -import { zHexString } from "../common/index.js"; - -/** - * The side of the market a given order is on - */ -export const OrderSideSchema = z.enum(["Buy", "Sell"]); - -/** - * The state of an order in the wallet - */ -export const OrderStateSchema = z.enum([ - "Created", - "Matching", - "SettlingMatch", - "Filled", - "Cancelled", -]); - -/** - * A price along with the time it was sampled - */ -export const TimestampedPriceSchema = z.object({ - price: z.coerce.number(), - timestamp: z.coerce.bigint(), -}); - -/** - * A partial fill of an order, recording the information parameterizing a match - */ -export const PartialOrderFillSchema = z.object({ - amount: z.coerce.bigint(), - price: TimestampedPriceSchema, -}); - -/** - * Represents the base type of an open order, including the asset pair, the - * amount, price, and direction - */ -export const OrderSchema = z.object({ - quote_mint: zHexString, - base_mint: zHexString, - side: OrderSideSchema, - worst_case_price: z.string(), - amount: z.coerce.bigint(), - min_fill_size: z.coerce.bigint(), - allow_external_matches: z.boolean(), -}); - -/** - * Metadata for an order in a wallet, possibly historical - */ -export const OrderMetadataSchema = z.object({ - id: z.string(), - state: OrderStateSchema, - fills: z.array(PartialOrderFillSchema), - created: z.coerce.bigint(), - data: OrderSchema, -}); - -export type OrderSide = z.infer; -export type OrderState = z.infer; -export type TimestampedPrice = z.infer; -export type PartialOrderFill = z.infer; -export type OrderMetadata = z.infer; -export type Order = z.infer; diff --git a/packages/types/src/ws/index.ts b/packages/types/src/ws/index.ts deleted file mode 100644 index 133bde02..00000000 --- a/packages/types/src/ws/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import z from "zod/v4"; -import { type OrderMetadataWsMessage, OrderMetadataWsMessageSchema } from "./order.js"; -import { type SubscriptionsAck, SubscriptionsAckSchema } from "./subscriptions.js"; - -export const RenegadeWsMessageSchema = z.union([ - SubscriptionsAckSchema, - OrderMetadataWsMessageSchema, -]); -export type RenegadeWsMessage = SubscriptionsAck | OrderMetadataWsMessage; - -export { type OrderMetadataWsMessage, OrderMetadataWsMessageSchema } from "./order.js"; -export { type SubscriptionsAck, SubscriptionsAckSchema } from "./subscriptions.js"; diff --git a/packages/types/src/ws/order.ts b/packages/types/src/ws/order.ts deleted file mode 100644 index 752e73f3..00000000 --- a/packages/types/src/ws/order.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { z } from "zod"; -import { OrderMetadataSchema } from "../order/schema.js"; - -export const OrderMetadataWsMessageSchema = z.object({ - topic: z.string(), - event: z.object({ - type: z.literal("OrderMetadataUpdated"), - order: OrderMetadataSchema, - }), -}); -export type OrderMetadataWsMessage = z.infer; diff --git a/packages/types/src/ws/subscriptions.ts b/packages/types/src/ws/subscriptions.ts deleted file mode 100644 index 3002c47b..00000000 --- a/packages/types/src/ws/subscriptions.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { z } from "zod"; -export const SubscriptionsAckSchema = z.object({ - subscriptions: z.array(z.string()), -}); -export type SubscriptionsAck = z.infer; diff --git a/packages/types/tsconfig.build.json b/packages/types/tsconfig.build.json deleted file mode 100644 index 0eee00d7..00000000 --- a/packages/types/tsconfig.build.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "../../tsconfig.base.json", - "include": ["src/**/*.ts"], - "exclude": ["src/**/*.test.ts", "src/**/*.test-d.ts"], - "compilerOptions": { - "sourceMap": true - } -} diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json deleted file mode 100644 index dd44724d..00000000 --- a/packages/types/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "./tsconfig.build.json", - "include": ["src/**/*.ts", "test/**/*.ts"], - "exclude": [] -} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7d1dbf82..b952d580 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,7 +18,7 @@ importers: .: devDependencies: '@biomejs/biome': - specifier: ^2.3.6 + specifier: 2.3.6 version: 2.3.6 '@changesets/cli': specifier: ^2.27.1 @@ -30,593 +30,6 @@ importers: specifier: ^5.5.4 version: 5.5.4 - examples/external-keychain/cancel-order: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/create-wallet: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/deposit: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/get-back-of-queue-wallet: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/get-order-history: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/get-wallet: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/lookup-wallet: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/pay-fees: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/place-order: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-keychain/withdraw: - dependencies: - '@noble/secp256k1': - specifier: '2' - version: 2.3.0 - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-match/base-sepolia: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/basic: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/direct-malleable-match: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.39.0(typescript@5.9.3)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.6 - typescript: - specifier: ^5 - version: 5.9.3 - - examples/external-match/direct-match: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.39.0(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/exact-output: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.46.2(typescript@5.9.3)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.6 - typescript: - specifier: ^5 - version: 5.9.3 - - examples/external-match/exchange-metadata: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.39.3(typescript@5.9.3)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.6 - typescript: - specifier: ^5 - version: 5.9.3 - - examples/external-match/in-kind-gas-sponsorship: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/malleable: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/external-match/native-gas-sponshorship: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/order-book-depth: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/order-book-depth-all-pairs: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.39.3(typescript@5.9.3)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.6 - typescript: - specifier: ^5 - version: 5.9.3 - - examples/external-match/supported-tokens: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/external-match/token-prices: - dependencies: - '@renegade-fi/renegade-sdk': - specifier: workspace:* - version: link:../../../packages/external-match - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4 - version: 4.20.5 - typescript: - specifier: ^5 - version: 5.5.4 - - examples/relayer/cancel-order: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/create-wallet: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/deposit: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/get-back-of-queue-wallet: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/get-order-history: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/get-wallet: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/lookup-wallet: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/pay-fees: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/place-order: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/relayer/withdraw: - dependencies: - '@renegade-fi/node': - specifier: latest - version: 0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/token/async-initialization: - dependencies: - '@renegade-fi/token': - specifier: latest - version: 0.0.32(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - - examples/token/sync-initialization: - dependencies: - '@renegade-fi/token': - specifier: latest - version: 0.0.32(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - viem: - specifier: latest - version: 2.37.4(typescript@5.5.4)(zod@4.0.5) - devDependencies: - tsx: - specifier: ^4.20.3 - version: 4.20.5 - typescript: - specifier: ^5.0.3 - version: 5.5.4 - packages/core: dependencies: axios: @@ -648,7 +61,18 @@ importers: specifier: ^1.0.4 version: 1.0.4 - packages/direct-match: {} + packages/direct-match: + dependencies: + '@renegade-fi/http-client': + specifier: workspace:^ + version: link:../http-client + viem: + specifier: ^2.23.15 + version: 2.47.6(typescript@5.9.3)(zod@4.0.5) + devDependencies: + vitest: + specifier: ^3.0.0 + version: 3.2.4(@types/node@20.16.1)(tsx@4.20.6) packages/external-match: dependencies: @@ -682,18 +106,6 @@ importers: specifier: ^1.0.4 version: 1.0.4 - packages/node: - dependencies: - '@renegade-fi/core': - specifier: workspace:* - version: link:../core - tiny-invariant: - specifier: ^1.3.3 - version: 1.3.3 - viem: - specifier: 2.x - version: 2.20.0(typescript@5.9.3)(zod@3.23.8) - packages/price-reporter: dependencies: '@renegade-fi/core': @@ -709,60 +121,20 @@ importers: specifier: ^8.2.0 version: 8.2.0 - packages/react: + packages/renegade-sdk: dependencies: - '@renegade-fi/core': - specifier: workspace:* - version: link:../core - json-bigint: - specifier: ^1.0.0 - version: 1.0.0 - react-use-websocket: - specifier: ^4.8.1 - version: 4.8.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - tiny-invariant: - specifier: ^1.3.3 - version: 1.3.3 - devDependencies: - '@tanstack/react-query': - specifier: '>=5.0.0' - version: 5.52.1(react@18.3.1) - '@types/json-bigint': - specifier: ^1.0.4 - version: 1.0.4 - '@types/react': - specifier: '>=18' - version: 18.3.4 - '@types/react-dom': - specifier: '>=18' - version: 18.3.0 - react: - specifier: '>=18' - version: 18.3.1 - react-dom: - specifier: '>=18' - version: 18.3.1(react@18.3.1) - - packages/token: - dependencies: - '@renegade-fi/core': + '@renegade-fi/direct-match': specifier: workspace:^ - version: link:../core + version: link:../direct-match + '@renegade-fi/external-match': + specifier: workspace:^ + version: link:../external-match - packages/token-nextjs: + packages/token: dependencies: '@renegade-fi/core': specifier: workspace:^ version: link:../core - '@renegade-fi/token': - specifier: workspace:^ - version: link:../token - - packages/types: - devDependencies: - zod: - specifier: ^4 - version: 4.0.5 packages: @@ -890,156 +262,315 @@ packages: cpu: [ppc64] os: [aix] + '@esbuild/aix-ppc64@0.27.4': + resolution: {integrity: sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [aix] + '@esbuild/android-arm64@0.25.9': resolution: {integrity: sha512-IDrddSmpSv51ftWslJMvl3Q2ZT98fUSL2/rlUXuVqRXHCs5EUF1/f+jbjF5+NG9UffUDMCiTyh8iec7u8RlTLg==} engines: {node: '>=18'} cpu: [arm64] os: [android] + '@esbuild/android-arm64@0.27.4': + resolution: {integrity: sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [android] + '@esbuild/android-arm@0.25.9': resolution: {integrity: sha512-5WNI1DaMtxQ7t7B6xa572XMXpHAaI/9Hnhk8lcxF4zVN4xstUgTlvuGDorBguKEnZO70qwEcLpfifMLoxiPqHQ==} engines: {node: '>=18'} cpu: [arm] os: [android] + '@esbuild/android-arm@0.27.4': + resolution: {integrity: sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==} + engines: {node: '>=18'} + cpu: [arm] + os: [android] + '@esbuild/android-x64@0.25.9': resolution: {integrity: sha512-I853iMZ1hWZdNllhVZKm34f4wErd4lMyeV7BLzEExGEIZYsOzqDWDf+y082izYUE8gtJnYHdeDpN/6tUdwvfiw==} engines: {node: '>=18'} cpu: [x64] os: [android] + '@esbuild/android-x64@0.27.4': + resolution: {integrity: sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==} + engines: {node: '>=18'} + cpu: [x64] + os: [android] + '@esbuild/darwin-arm64@0.25.9': resolution: {integrity: sha512-XIpIDMAjOELi/9PB30vEbVMs3GV1v2zkkPnuyRRURbhqjyzIINwj+nbQATh4H9GxUgH1kFsEyQMxwiLFKUS6Rg==} engines: {node: '>=18'} cpu: [arm64] os: [darwin] + '@esbuild/darwin-arm64@0.27.4': + resolution: {integrity: sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==} + engines: {node: '>=18'} + cpu: [arm64] + os: [darwin] + '@esbuild/darwin-x64@0.25.9': resolution: {integrity: sha512-jhHfBzjYTA1IQu8VyrjCX4ApJDnH+ez+IYVEoJHeqJm9VhG9Dh2BYaJritkYK3vMaXrf7Ogr/0MQ8/MeIefsPQ==} engines: {node: '>=18'} cpu: [x64] os: [darwin] + '@esbuild/darwin-x64@0.27.4': + resolution: {integrity: sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==} + engines: {node: '>=18'} + cpu: [x64] + os: [darwin] + '@esbuild/freebsd-arm64@0.25.9': resolution: {integrity: sha512-z93DmbnY6fX9+KdD4Ue/H6sYs+bhFQJNCPZsi4XWJoYblUqT06MQUdBCpcSfuiN72AbqeBFu5LVQTjfXDE2A6Q==} engines: {node: '>=18'} cpu: [arm64] os: [freebsd] + '@esbuild/freebsd-arm64@0.27.4': + resolution: {integrity: sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==} + engines: {node: '>=18'} + cpu: [arm64] + os: [freebsd] + '@esbuild/freebsd-x64@0.25.9': resolution: {integrity: sha512-mrKX6H/vOyo5v71YfXWJxLVxgy1kyt1MQaD8wZJgJfG4gq4DpQGpgTB74e5yBeQdyMTbgxp0YtNj7NuHN0PoZg==} engines: {node: '>=18'} cpu: [x64] os: [freebsd] + '@esbuild/freebsd-x64@0.27.4': + resolution: {integrity: sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [freebsd] + '@esbuild/linux-arm64@0.25.9': resolution: {integrity: sha512-BlB7bIcLT3G26urh5Dmse7fiLmLXnRlopw4s8DalgZ8ef79Jj4aUcYbk90g8iCa2467HX8SAIidbL7gsqXHdRw==} engines: {node: '>=18'} cpu: [arm64] os: [linux] + '@esbuild/linux-arm64@0.27.4': + resolution: {integrity: sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==} + engines: {node: '>=18'} + cpu: [arm64] + os: [linux] + '@esbuild/linux-arm@0.25.9': resolution: {integrity: sha512-HBU2Xv78SMgaydBmdor38lg8YDnFKSARg1Q6AT0/y2ezUAKiZvc211RDFHlEZRFNRVhcMamiToo7bDx3VEOYQw==} engines: {node: '>=18'} cpu: [arm] os: [linux] + '@esbuild/linux-arm@0.27.4': + resolution: {integrity: sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==} + engines: {node: '>=18'} + cpu: [arm] + os: [linux] + '@esbuild/linux-ia32@0.25.9': resolution: {integrity: sha512-e7S3MOJPZGp2QW6AK6+Ly81rC7oOSerQ+P8L0ta4FhVi+/j/v2yZzx5CqqDaWjtPFfYz21Vi1S0auHrap3Ma3A==} engines: {node: '>=18'} cpu: [ia32] os: [linux] + '@esbuild/linux-ia32@0.27.4': + resolution: {integrity: sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==} + engines: {node: '>=18'} + cpu: [ia32] + os: [linux] + '@esbuild/linux-loong64@0.25.9': resolution: {integrity: sha512-Sbe10Bnn0oUAB2AalYztvGcK+o6YFFA/9829PhOCUS9vkJElXGdphz0A3DbMdP8gmKkqPmPcMJmJOrI3VYB1JQ==} engines: {node: '>=18'} cpu: [loong64] os: [linux] + '@esbuild/linux-loong64@0.27.4': + resolution: {integrity: sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==} + engines: {node: '>=18'} + cpu: [loong64] + os: [linux] + '@esbuild/linux-mips64el@0.25.9': resolution: {integrity: sha512-YcM5br0mVyZw2jcQeLIkhWtKPeVfAerES5PvOzaDxVtIyZ2NUBZKNLjC5z3/fUlDgT6w89VsxP2qzNipOaaDyA==} engines: {node: '>=18'} cpu: [mips64el] os: [linux] + '@esbuild/linux-mips64el@0.27.4': + resolution: {integrity: sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==} + engines: {node: '>=18'} + cpu: [mips64el] + os: [linux] + '@esbuild/linux-ppc64@0.25.9': resolution: {integrity: sha512-++0HQvasdo20JytyDpFvQtNrEsAgNG2CY1CLMwGXfFTKGBGQT3bOeLSYE2l1fYdvML5KUuwn9Z8L1EWe2tzs1w==} engines: {node: '>=18'} cpu: [ppc64] os: [linux] + '@esbuild/linux-ppc64@0.27.4': + resolution: {integrity: sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==} + engines: {node: '>=18'} + cpu: [ppc64] + os: [linux] + '@esbuild/linux-riscv64@0.25.9': resolution: {integrity: sha512-uNIBa279Y3fkjV+2cUjx36xkx7eSjb8IvnL01eXUKXez/CBHNRw5ekCGMPM0BcmqBxBcdgUWuUXmVWwm4CH9kg==} engines: {node: '>=18'} cpu: [riscv64] os: [linux] + '@esbuild/linux-riscv64@0.27.4': + resolution: {integrity: sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==} + engines: {node: '>=18'} + cpu: [riscv64] + os: [linux] + '@esbuild/linux-s390x@0.25.9': resolution: {integrity: sha512-Mfiphvp3MjC/lctb+7D287Xw1DGzqJPb/J2aHHcHxflUo+8tmN/6d4k6I2yFR7BVo5/g7x2Monq4+Yew0EHRIA==} engines: {node: '>=18'} cpu: [s390x] os: [linux] + '@esbuild/linux-s390x@0.27.4': + resolution: {integrity: sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==} + engines: {node: '>=18'} + cpu: [s390x] + os: [linux] + '@esbuild/linux-x64@0.25.9': resolution: {integrity: sha512-iSwByxzRe48YVkmpbgoxVzn76BXjlYFXC7NvLYq+b+kDjyyk30J0JY47DIn8z1MO3K0oSl9fZoRmZPQI4Hklzg==} engines: {node: '>=18'} cpu: [x64] os: [linux] + '@esbuild/linux-x64@0.27.4': + resolution: {integrity: sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==} + engines: {node: '>=18'} + cpu: [x64] + os: [linux] + '@esbuild/netbsd-arm64@0.25.9': resolution: {integrity: sha512-9jNJl6FqaUG+COdQMjSCGW4QiMHH88xWbvZ+kRVblZsWrkXlABuGdFJ1E9L7HK+T0Yqd4akKNa/lO0+jDxQD4Q==} engines: {node: '>=18'} cpu: [arm64] os: [netbsd] + '@esbuild/netbsd-arm64@0.27.4': + resolution: {integrity: sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==} + engines: {node: '>=18'} + cpu: [arm64] + os: [netbsd] + '@esbuild/netbsd-x64@0.25.9': resolution: {integrity: sha512-RLLdkflmqRG8KanPGOU7Rpg829ZHu8nFy5Pqdi9U01VYtG9Y0zOG6Vr2z4/S+/3zIyOxiK6cCeYNWOFR9QP87g==} engines: {node: '>=18'} cpu: [x64] os: [netbsd] + '@esbuild/netbsd-x64@0.27.4': + resolution: {integrity: sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==} + engines: {node: '>=18'} + cpu: [x64] + os: [netbsd] + '@esbuild/openbsd-arm64@0.25.9': resolution: {integrity: sha512-YaFBlPGeDasft5IIM+CQAhJAqS3St3nJzDEgsgFixcfZeyGPCd6eJBWzke5piZuZ7CtL656eOSYKk4Ls2C0FRQ==} engines: {node: '>=18'} cpu: [arm64] os: [openbsd] + '@esbuild/openbsd-arm64@0.27.4': + resolution: {integrity: sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openbsd] + '@esbuild/openbsd-x64@0.25.9': resolution: {integrity: sha512-1MkgTCuvMGWuqVtAvkpkXFmtL8XhWy+j4jaSO2wxfJtilVCi0ZE37b8uOdMItIHz4I6z1bWWtEX4CJwcKYLcuA==} engines: {node: '>=18'} cpu: [x64] os: [openbsd] + '@esbuild/openbsd-x64@0.27.4': + resolution: {integrity: sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==} + engines: {node: '>=18'} + cpu: [x64] + os: [openbsd] + '@esbuild/openharmony-arm64@0.25.9': resolution: {integrity: sha512-4Xd0xNiMVXKh6Fa7HEJQbrpP3m3DDn43jKxMjxLLRjWnRsfxjORYJlXPO4JNcXtOyfajXorRKY9NkOpTHptErg==} engines: {node: '>=18'} cpu: [arm64] os: [openharmony] + '@esbuild/openharmony-arm64@0.27.4': + resolution: {integrity: sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [openharmony] + '@esbuild/sunos-x64@0.25.9': resolution: {integrity: sha512-WjH4s6hzo00nNezhp3wFIAfmGZ8U7KtrJNlFMRKxiI9mxEK1scOMAaa9i4crUtu+tBr+0IN6JCuAcSBJZfnphw==} engines: {node: '>=18'} cpu: [x64] os: [sunos] + '@esbuild/sunos-x64@0.27.4': + resolution: {integrity: sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==} + engines: {node: '>=18'} + cpu: [x64] + os: [sunos] + '@esbuild/win32-arm64@0.25.9': resolution: {integrity: sha512-mGFrVJHmZiRqmP8xFOc6b84/7xa5y5YvR1x8djzXpJBSv/UsNK6aqec+6JDjConTgvvQefdGhFDAs2DLAds6gQ==} engines: {node: '>=18'} cpu: [arm64] os: [win32] + '@esbuild/win32-arm64@0.27.4': + resolution: {integrity: sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==} + engines: {node: '>=18'} + cpu: [arm64] + os: [win32] + '@esbuild/win32-ia32@0.25.9': resolution: {integrity: sha512-b33gLVU2k11nVx1OhX3C8QQP6UHQK4ZtN56oFWvVXvz2VkDoe6fbG8TOgHFxEvqeqohmRnIHe5A1+HADk4OQww==} engines: {node: '>=18'} cpu: [ia32] os: [win32] + '@esbuild/win32-ia32@0.27.4': + resolution: {integrity: sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==} + engines: {node: '>=18'} + cpu: [ia32] + os: [win32] + '@esbuild/win32-x64@0.25.9': resolution: {integrity: sha512-PPOl1mi6lpLNQxnGoyAfschAodRFYXJ+9fs6WHXz7CSWKbOqiMZsubC+BQsVKuul+3vKLuwTHsS2c2y9EoKwxQ==} engines: {node: '>=18'} cpu: [x64] os: [win32] + '@esbuild/win32-x64@0.27.4': + resolution: {integrity: sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==} + engines: {node: '>=18'} + cpu: [x64] + os: [win32] + + '@jridgewell/sourcemap-codec@1.5.5': + resolution: {integrity: sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==} + '@manypkg/find-root@1.1.0': resolution: {integrity: sha512-mki5uBvhHzO8kYYix/WRy2WX8S3B5wdVSc9D6KcU5lQNglP2yt58/VfLuAK49glRXChosY8ap2oJ1qgma3GUVA==} @@ -1069,9 +600,6 @@ packages: resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} - '@noble/secp256k1@2.3.0': - resolution: {integrity: sha512-0TQed2gcBbIrh7Ccyw+y/uZQvbJwm7Ao4scBUxqpBCcsOlZG0O4KGfjtNAy/li4W8n1xt3dxrwJ0beZ2h2G6Kw==} - '@nodelib/fs.scandir@2.1.5': resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -1084,28 +612,136 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} - '@renegade-fi/core@0.9.13': - resolution: {integrity: sha512-2cSI2WQTqDSjl95iYXo5aJvE8DL7KzlAGmCpDhlFFxanYDE3FNdiUCrrB6BgXTKWDByfPK/fbQ/TAYV5LHiH5Q==} - peerDependencies: - '@tanstack/query-core': '>=5.0.0' - viem: 2.x - peerDependenciesMeta: - '@tanstack/query-core': - optional: true + '@rollup/rollup-android-arm-eabi@4.60.1': + resolution: {integrity: sha512-d6FinEBLdIiK+1uACUttJKfgZREXrF0Qc2SmLII7W2AD8FfiZ9Wjd+rD/iRuf5s5dWrr1GgwXCvPqOuDquOowA==} + cpu: [arm] + os: [android] - '@renegade-fi/node@0.6.18': - resolution: {integrity: sha512-PWCxzigA7IPXyZuIkd76oX8Yw1fG0U/DZG50+wku7TNHske2Fs1yLErPF+c7UJjpaJgWnPqI34PhxxVYEXdpJg==} - peerDependencies: - viem: 2.x + '@rollup/rollup-android-arm64@4.60.1': + resolution: {integrity: sha512-YjG/EwIDvvYI1YvYbHvDz/BYHtkY4ygUIXHnTdLhG+hKIQFBiosfWiACWortsKPKU/+dUwQQCKQM3qrDe8c9BA==} + cpu: [arm64] + os: [android] + + '@rollup/rollup-darwin-arm64@4.60.1': + resolution: {integrity: sha512-mjCpF7GmkRtSJwon+Rq1N8+pI+8l7w5g9Z3vWj4T7abguC4Czwi3Yu/pFaLvA3TTeMVjnu3ctigusqWUfjZzvw==} + cpu: [arm64] + os: [darwin] + + '@rollup/rollup-darwin-x64@4.60.1': + resolution: {integrity: sha512-haZ7hJ1JT4e9hqkoT9R/19XW2QKqjfJVv+i5AGg57S+nLk9lQnJ1F/eZloRO3o9Scy9CM3wQ9l+dkXtcBgN5Ew==} + cpu: [x64] + os: [darwin] + + '@rollup/rollup-freebsd-arm64@4.60.1': + resolution: {integrity: sha512-czw90wpQq3ZsAVBlinZjAYTKduOjTywlG7fEeWKUA7oCmpA8xdTkxZZlwNJKWqILlq0wehoZcJYfBvOyhPTQ6w==} + cpu: [arm64] + os: [freebsd] + + '@rollup/rollup-freebsd-x64@4.60.1': + resolution: {integrity: sha512-KVB2rqsxTHuBtfOeySEyzEOB7ltlB/ux38iu2rBQzkjbwRVlkhAGIEDiiYnO2kFOkJp+Z7pUXKyrRRFuFUKt+g==} + cpu: [x64] + os: [freebsd] + + '@rollup/rollup-linux-arm-gnueabihf@4.60.1': + resolution: {integrity: sha512-L+34Qqil+v5uC0zEubW7uByo78WOCIrBvci69E7sFASRl0X7b/MB6Cqd1lky/CtcSVTydWa2WZwFuWexjS5o6g==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm-musleabihf@4.60.1': + resolution: {integrity: sha512-n83O8rt4v34hgFzlkb1ycniJh7IR5RCIqt6mz1VRJD6pmhRi0CXdmfnLu9dIUS6buzh60IvACM842Ffb3xd6Gg==} + cpu: [arm] + os: [linux] + + '@rollup/rollup-linux-arm64-gnu@4.60.1': + resolution: {integrity: sha512-Nql7sTeAzhTAja3QXeAI48+/+GjBJ+QmAH13snn0AJSNL50JsDqotyudHyMbO2RbJkskbMbFJfIJKWA6R1LCJQ==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-arm64-musl@4.60.1': + resolution: {integrity: sha512-+pUymDhd0ys9GcKZPPWlFiZ67sTWV5UU6zOJat02M1+PiuSGDziyRuI/pPue3hoUwm2uGfxdL+trT6Z9rxnlMA==} + cpu: [arm64] + os: [linux] + + '@rollup/rollup-linux-loong64-gnu@4.60.1': + resolution: {integrity: sha512-VSvgvQeIcsEvY4bKDHEDWcpW4Yw7BtlKG1GUT4FzBUlEKQK0rWHYBqQt6Fm2taXS+1bXvJT6kICu5ZwqKCnvlQ==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-loong64-musl@4.60.1': + resolution: {integrity: sha512-4LqhUomJqwe641gsPp6xLfhqWMbQV04KtPp7/dIp0nzPxAkNY1AbwL5W0MQpcalLYk07vaW9Kp1PBhdpZYYcEw==} + cpu: [loong64] + os: [linux] + + '@rollup/rollup-linux-ppc64-gnu@4.60.1': + resolution: {integrity: sha512-tLQQ9aPvkBxOc/EUT6j3pyeMD6Hb8QF2BTBnCQWP/uu1lhc9AIrIjKnLYMEroIz/JvtGYgI9dF3AxHZNaEH0rw==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-ppc64-musl@4.60.1': + resolution: {integrity: sha512-RMxFhJwc9fSXP6PqmAz4cbv3kAyvD1etJFjTx4ONqFP9DkTkXsAMU4v3Vyc5BgzC+anz7nS/9tp4obsKfqkDHg==} + cpu: [ppc64] + os: [linux] + + '@rollup/rollup-linux-riscv64-gnu@4.60.1': + resolution: {integrity: sha512-QKgFl+Yc1eEk6MmOBfRHYF6lTxiiiV3/z/BRrbSiW2I7AFTXoBFvdMEyglohPj//2mZS4hDOqeB0H1ACh3sBbg==} + cpu: [riscv64] + os: [linux] - '@renegade-fi/token@0.0.32': - resolution: {integrity: sha512-ck1MEze8sSHFry82pUKTsgMuoqgSIx5ue0PxN0gdYIH/cLORz+1XLzr7k4WJXdITvazl0CBf/3+uGXJ/eAyT2w==} + '@rollup/rollup-linux-riscv64-musl@4.60.1': + resolution: {integrity: sha512-RAjXjP/8c6ZtzatZcA1RaQr6O1TRhzC+adn8YZDnChliZHviqIjmvFwHcxi4JKPSDAt6Uhf/7vqcBzQJy0PDJg==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.60.1': + resolution: {integrity: sha512-wcuocpaOlaL1COBYiA89O6yfjlp3RwKDeTIA0hM7OpmhR1Bjo9j31G1uQVpDlTvwxGn2nQs65fBFL5UFd76FcQ==} + cpu: [s390x] + os: [linux] '@rollup/rollup-linux-x64-gnu@4.35.0': resolution: {integrity: sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==} cpu: [x64] os: [linux] + '@rollup/rollup-linux-x64-gnu@4.60.1': + resolution: {integrity: sha512-77PpsFQUCOiZR9+LQEFg9GClyfkNXj1MP6wRnzYs0EeWbPcHs02AXu4xuUbM1zhwn3wqaizle3AEYg5aeoohhg==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-linux-x64-musl@4.60.1': + resolution: {integrity: sha512-5cIATbk5vynAjqqmyBjlciMJl1+R/CwX9oLk/EyiFXDWd95KpHdrOJT//rnUl4cUcskrd0jCCw3wpZnhIHdD9w==} + cpu: [x64] + os: [linux] + + '@rollup/rollup-openbsd-x64@4.60.1': + resolution: {integrity: sha512-cl0w09WsCi17mcmWqqglez9Gk8isgeWvoUZ3WiJFYSR3zjBQc2J5/ihSjpl+VLjPqjQ/1hJRcqBfLjssREQILw==} + cpu: [x64] + os: [openbsd] + + '@rollup/rollup-openharmony-arm64@4.60.1': + resolution: {integrity: sha512-4Cv23ZrONRbNtbZa37mLSueXUCtN7MXccChtKpUnQNgF010rjrjfHx3QxkS2PI7LqGT5xXyYs1a7LbzAwT0iCA==} + cpu: [arm64] + os: [openharmony] + + '@rollup/rollup-win32-arm64-msvc@4.60.1': + resolution: {integrity: sha512-i1okWYkA4FJICtr7KpYzFpRTHgy5jdDbZiWfvny21iIKky5YExiDXP+zbXzm3dUcFpkEeYNHgQ5fuG236JPq0g==} + cpu: [arm64] + os: [win32] + + '@rollup/rollup-win32-ia32-msvc@4.60.1': + resolution: {integrity: sha512-u09m3CuwLzShA0EYKMNiFgcjjzwqtUMLmuCJLeZWjjOYA3IT2Di09KaxGBTP9xVztWyIWjVdsB2E9goMjZvTQg==} + cpu: [ia32] + os: [win32] + + '@rollup/rollup-win32-x64-gnu@4.60.1': + resolution: {integrity: sha512-k+600V9Zl1CM7eZxJgMyTUzmrmhB/0XZnF4pRypKAlAgxmedUA+1v9R+XOFv56W4SlHEzfeMtzujLJD22Uz5zg==} + cpu: [x64] + os: [win32] + + '@rollup/rollup-win32-x64-msvc@4.60.1': + resolution: {integrity: sha512-lWMnixq/QzxyhTV6NjQJ4SFo1J6PvOX8vUx5Wb4bBPsEb+8xZ89Bz6kOXpfXj9ak9AHTQVQzlgzBEc1SyM27xQ==} + cpu: [x64] + os: [win32] + '@scure/base@1.1.7': resolution: {integrity: sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==} @@ -1127,10 +763,14 @@ packages: '@tanstack/query-core@5.52.0': resolution: {integrity: sha512-U1DOEgltjUwalN6uWYTewSnA14b+tE7lSylOiASKCAO61ENJeCq9VVD/TXHA6O5u9+6v5+UgGYBSccTKDoyMqw==} - '@tanstack/react-query@5.52.1': - resolution: {integrity: sha512-soyn4dNIUZ8US8NaPVXv06gkZFHaZnPfKWPDjRJjFRW3Y7WZ0jx72eT6zhw3VQlkMPysmXye8l35ewPHspKgbQ==} - peerDependencies: - react: ^18 || ^19 + '@types/chai@5.2.3': + resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} + + '@types/deep-eql@4.0.2': + resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} + + '@types/estree@1.0.8': + resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} '@types/json-bigint@1.0.4': resolution: {integrity: sha512-ydHooXLbOmxBbubnA7Eh+RpBzuaIiQjh8WGJYQB50JFGFrdxW7JzVlyEV7fAXw0T2sqJ1ysTneJbiyNLqZRAag==} @@ -1144,28 +784,43 @@ packages: '@types/prop-types@15.7.12': resolution: {integrity: sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==} - '@types/react-dom@18.3.0': - resolution: {integrity: sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==} - '@types/react@18.3.4': resolution: {integrity: sha512-J7W30FTdfCxDDjmfRM+/JqLHBIyl7xUIp9kwK637FGmY7+mkSFSe6L4jpZzhj5QMfLssSDP4/i75AKkrdC7/Jw==} '@types/semver@7.5.8': resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} - abitype@1.0.5: - resolution: {integrity: sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==} + '@vitest/expect@3.2.4': + resolution: {integrity: sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==} + + '@vitest/mocker@3.2.4': + resolution: {integrity: sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==} peerDependencies: - typescript: '>=5.0.4' - zod: ^3 >=3.22.0 + msw: ^2.4.9 + vite: ^5.0.0 || ^6.0.0 || ^7.0.0-0 peerDependenciesMeta: - typescript: + msw: optional: true - zod: + vite: optional: true - abitype@1.0.8: - resolution: {integrity: sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==} + '@vitest/pretty-format@3.2.4': + resolution: {integrity: sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==} + + '@vitest/runner@3.2.4': + resolution: {integrity: sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==} + + '@vitest/snapshot@3.2.4': + resolution: {integrity: sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==} + + '@vitest/spy@3.2.4': + resolution: {integrity: sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==} + + '@vitest/utils@3.2.4': + resolution: {integrity: sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==} + + abitype@1.0.5: + resolution: {integrity: sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.22.0 @@ -1175,11 +830,11 @@ packages: zod: optional: true - abitype@1.1.0: - resolution: {integrity: sha512-6Vh4HcRxNMLA0puzPjM5GBgT4aAcFGKZzSgAXvuZ27shJP6NEpielTuqbBmZILR5/xd0PizkBGy5hReKz9jl5A==} + abitype@1.0.8: + resolution: {integrity: sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==} peerDependencies: typescript: '>=5.0.4' - zod: ^3.22.0 || ^4.0.0 + zod: ^3 >=3.22.0 peerDependenciesMeta: typescript: optional: true @@ -1216,6 +871,10 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + assertion-error@2.0.1: + resolution: {integrity: sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==} + engines: {node: '>=12'} + asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} @@ -1233,6 +892,14 @@ packages: resolution: {integrity: sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==} engines: {node: '>=8'} + cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + + chai@5.3.3: + resolution: {integrity: sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==} + engines: {node: '>=18'} + chalk@2.4.2: resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==} engines: {node: '>=4'} @@ -1240,6 +907,10 @@ packages: chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} + check-error@2.1.3: + resolution: {integrity: sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==} + engines: {node: '>= 16'} + ci-info@3.9.0: resolution: {integrity: sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==} engines: {node: '>=8'} @@ -1260,6 +931,19 @@ packages: csstype@3.1.3: resolution: {integrity: sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==} + debug@4.4.3: + resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + + deep-eql@5.0.2: + resolution: {integrity: sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==} + engines: {node: '>=6'} + delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} @@ -1276,11 +960,19 @@ packages: resolution: {integrity: sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==} engines: {node: '>=8.6'} + es-module-lexer@1.7.0: + resolution: {integrity: sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==} + esbuild@0.25.9: resolution: {integrity: sha512-CRbODhYyQx3qp7ZEwzxOk4JBqmD/seJrzPa/cGjY1VtIn5E09Oi9/dB4JwctnfZ8Q8iT7rioVv5k/FNT/uf54g==} engines: {node: '>=18'} hasBin: true + esbuild@0.27.4: + resolution: {integrity: sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==} + engines: {node: '>=18'} + hasBin: true + escape-string-regexp@1.0.5: resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==} engines: {node: '>=0.8.0'} @@ -1290,9 +982,16 @@ packages: engines: {node: '>=4'} hasBin: true + estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + eventemitter3@5.0.1: resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + expect-type@1.3.0: + resolution: {integrity: sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==} + engines: {node: '>=12.0.0'} + extendable-error@0.1.7: resolution: {integrity: sha512-UOiS2in6/Q0FK0R0q6UY9vYpQ21mr/Qn1KOnte7vsACuNJf514WvCCUHSRCPcgjPT2bAhNIJdlE6bVap1GKmeg==} @@ -1307,6 +1006,15 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} + fdir@6.5.0: + resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} + engines: {node: '>=12.0.0'} + peerDependencies: + picomatch: ^3 || ^4 + peerDependenciesMeta: + picomatch: + optional: true + fill-range@7.1.1: resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==} engines: {node: '>=8'} @@ -1418,6 +1126,9 @@ packages: js-tokens@4.0.0: resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==} + js-tokens@9.0.1: + resolution: {integrity: sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==} + js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} hasBin: true @@ -1447,9 +1158,15 @@ packages: resolution: {integrity: sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==} hasBin: true + loupe@3.2.1: + resolution: {integrity: sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==} + lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} + magic-string@0.30.21: + resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -1470,6 +1187,14 @@ packages: resolution: {integrity: sha512-tzzskb3bG8LvYGFF/mDTpq3jpI6Q9wc3LEmBaghu+DdCssd1FakN7Bc0hVNmEyGq1bq3RgfkCb3cmQLpNPOroA==} engines: {node: '>=4'} + ms@2.1.3: + resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} + + nanoid@3.3.11: + resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + neverthrow@8.2.0: resolution: {integrity: sha512-kOCT/1MCPAxY5iUV3wytNFUMUolzuwd/VF/1KCx7kf6CutrOsTie+84zTGTpgQycjvfLdBBdvBvFLqFD2c0wkQ==} engines: {node: '>=18'} @@ -1481,8 +1206,8 @@ packages: outdent@0.5.0: resolution: {integrity: sha512-/jHxFIzoMXdqPzTaCpFzAAWhpkSjZPF4Vsn6jAfNpmbH/ymsmd7Qc6VE9BGn0L6YMj6uwpQLxCECpus4ukKS9Q==} - ox@0.12.4: - resolution: {integrity: sha512-+P+C7QzuwPV8lu79dOwjBKfB2CbnbEXe/hfyyrff1drrO1nOOj3Hc87svHfcW1yneRr3WXaKr6nz11nq+/DF9Q==} + ox@0.14.7: + resolution: {integrity: sha512-zSQ/cfBdolj7U4++NAvH7sI+VG0T3pEohITCgcQj8KlawvTDY4vGVhDT64Atsm0d6adWfIYHDpu88iUBMMp+AQ==} peerDependencies: typescript: '>=5.4.0' peerDependenciesMeta: @@ -1497,22 +1222,6 @@ packages: typescript: optional: true - ox@0.9.3: - resolution: {integrity: sha512-KzyJP+fPV4uhuuqrTZyok4DC7vFzi7HLUFiUNEmpbyh59htKWkOC98IONC1zgXJPbHAhQgqs6B0Z6StCGhmQvg==} - peerDependencies: - typescript: '>=5.4.0' - peerDependenciesMeta: - typescript: - optional: true - - ox@0.9.6: - resolution: {integrity: sha512-8SuCbHPvv2eZLYXrNmC0EC12rdzXQLdhnOMlHDW2wiCPLxBrOOJwX5L5E61by+UjTPOryqQiRSnjIKCI+GykKg==} - peerDependencies: - typescript: '>=5.4.0' - peerDependenciesMeta: - typescript: - optional: true - p-filter@2.1.0: resolution: {integrity: sha512-ZBxxZ5sL2HghephhpGAQdoskxplTwr7ICaehZwLIlfL6acuVgZPm8yBNuRAFBGEqtD/hmUeq9eqLg2ys9Xr/yw==} engines: {node: '>=8'} @@ -1549,10 +1258,24 @@ packages: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} + pathe@2.0.3: + resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} + + pathval@2.0.1: + resolution: {integrity: sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==} + engines: {node: '>= 14.16'} + + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} + picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} engines: {node: '>=8.6'} + picomatch@4.0.4: + resolution: {integrity: sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==} + engines: {node: '>=12'} + pify@4.0.1: resolution: {integrity: sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==} engines: {node: '>=6'} @@ -1561,6 +1284,10 @@ packages: resolution: {integrity: sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==} engines: {node: '>=8'} + postcss@8.5.8: + resolution: {integrity: sha512-OW/rX8O/jXnm82Ey1k44pObPtdblfiuWnrd8X7GJ7emImCOstunGbXUpp7HdBrFQX6rJzn3sPT397Wp5aCwCHg==} + engines: {node: ^10 || ^12 || >=14} + preferred-pm@3.1.4: resolution: {integrity: sha512-lEHd+yEm22jXdCphDrkvIJQU66EuLojPPtvZkpKIkiD+l0DMThF/niqZKJSoU8Vl7iuvtmzyMhir9LdVy5WMnA==} engines: {node: '>=10'} @@ -1579,17 +1306,6 @@ packages: queue-microtask@1.2.3: resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==} - react-dom@18.3.1: - resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==} - peerDependencies: - react: ^18.3.1 - - react-use-websocket@4.8.1: - resolution: {integrity: sha512-FTXuG5O+LFozmu1BRfrzl7UIQngECvGJmL7BHsK4TYXuVt+mCizVA8lT0hGSIF0Z0TedF7bOo1nRzOUdginhDw==} - peerDependencies: - react: '>= 18.0.0' - react-dom: '>= 18.0.0' - react@18.3.1: resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==} engines: {node: '>=0.10.0'} @@ -1612,15 +1328,17 @@ packages: resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} + rollup@4.60.1: + resolution: {integrity: sha512-VmtB2rFU/GroZ4oL8+ZqXgSA38O6GR8KSIvWmEFv63pQ0G6KaBH9s07PO8XTXP4vI+3UJUEypOfjkGfmSBBR0w==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} safer-buffer@2.1.2: resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} - scheduler@0.23.2: - resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==} - semver@7.6.3: resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==} engines: {node: '>=10'} @@ -1634,6 +1352,9 @@ packages: resolution: {integrity: sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==} engines: {node: '>=0.10.0'} + siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + signal-exit@3.0.7: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} @@ -1641,12 +1362,22 @@ packages: resolution: {integrity: sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==} engines: {node: '>=8'} + source-map-js@1.2.1: + resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} + engines: {node: '>=0.10.0'} + spawndamnit@2.0.0: resolution: {integrity: sha512-j4JKEcncSjFlqIwU5L/rp2N5SIPsdxaRsIv678+TZxZ0SRDJTm8JrxJMjE/XuiEZNEir3S8l0Fa3Ke339WI4qA==} sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} + stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + + std-env@3.10.0: + resolution: {integrity: sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==} + strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -1655,6 +1386,9 @@ packages: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} + strip-literal@3.1.0: + resolution: {integrity: sha512-8r3mkIM/2+PpjHoOtiAW8Rg3jJLHaV7xPwG+YRGrv6FP0wwk/toTpATxWYOW0BKdWwl82VT2tFYi5DlROa0Mxg==} + supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -1666,6 +1400,28 @@ packages: tiny-invariant@1.3.3: resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==} + tinybench@2.9.0: + resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} + + tinyexec@0.3.2: + resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==} + + tinyglobby@0.2.15: + resolution: {integrity: sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==} + engines: {node: '>=12.0.0'} + + tinypool@1.1.1: + resolution: {integrity: sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==} + engines: {node: ^18.0.0 || >=20.0.0} + + tinyrainbow@2.0.0: + resolution: {integrity: sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==} + engines: {node: '>=14.0.0'} + + tinyspy@4.0.4: + resolution: {integrity: sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q==} + engines: {node: '>=14.0.0'} + tmp@0.0.33: resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} engines: {node: '>=0.6.0'} @@ -1674,11 +1430,6 @@ packages: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} - tsx@4.20.5: - resolution: {integrity: sha512-+wKjMNU9w/EaQayHXb7WA7ZaHY6hN8WgfvHNQ3t1PnU91/7O8TcTnIhCDYTZwnt8JsO9IBqZ30Ln1r7pPF52Aw==} - engines: {node: '>=18.0.0'} - hasBin: true - tsx@4.20.6: resolution: {integrity: sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==} engines: {node: '>=18.0.0'} @@ -1722,36 +1473,85 @@ packages: typescript: optional: true - viem@2.37.4: - resolution: {integrity: sha512-1ig5O6l1wJmaw3yrSrUimjRLQEZon2ymTqSDjdntu6Bry1/tLC2GClXeS3SiCzrifpLxzfCLQWDITYVTBA10KA==} + viem@2.47.6: + resolution: {integrity: sha512-zExmbI99NGvMdYa7fmqSTLgkwh48dmhgEqFrUgkpL4kfG4XkVefZ8dZqIKVUhZo6Uhf0FrrEXOsHm9LUyIvI2Q==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: typescript: optional: true - viem@2.39.0: - resolution: {integrity: sha512-rCN+IfnMESlrg/iPyyVL+M9NS/BHzyyNy72470tFmbTuscY3iPaZGMtJDcHKKV8TC6HV9DjWk0zWX6cpu0juyA==} - peerDependencies: - typescript: '>=5.0.4' - peerDependenciesMeta: - typescript: - optional: true + vite-node@3.2.4: + resolution: {integrity: sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true - viem@2.39.3: - resolution: {integrity: sha512-s11rPQRvUEdc5qHK3xT4fIk4qvgPAaLwaTFq+EbFlcJJD+Xn3R4mc9H6B6fquEiHl/mdsdbG/uKCnYpoNtHNHw==} + vite@7.3.1: + resolution: {integrity: sha512-w+N7Hifpc3gRjZ63vYBXA56dvvRlNWRczTdmCBBa+CotUzAPf5b7YMdMR/8CQoeYE5LX3W4wj6RYTgonm1b9DA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true peerDependencies: - typescript: '>=5.0.4' + '@types/node': ^20.19.0 || >=22.12.0 + jiti: '>=1.21.0' + less: ^4.0.0 + lightningcss: ^1.21.0 + sass: ^1.70.0 + sass-embedded: ^1.70.0 + stylus: '>=0.54.8' + sugarss: ^5.0.0 + terser: ^5.16.0 + tsx: ^4.8.1 + yaml: ^2.4.2 peerDependenciesMeta: - typescript: + '@types/node': + optional: true + jiti: + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + sass-embedded: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + tsx: + optional: true + yaml: optional: true - viem@2.46.2: - resolution: {integrity: sha512-w8Qv5Vyo7TfXcH3vgmxRa1NRvzJCDy2aSGSRsJn3503nC/qVbgEQ+n3aj/CkqWXbloudZh97h5o5aQrQSVGy0w==} + vitest@3.2.4: + resolution: {integrity: sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==} + engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0} + hasBin: true peerDependencies: - typescript: '>=5.0.4' + '@edge-runtime/vm': '*' + '@types/debug': ^4.1.12 + '@types/node': ^18.0.0 || ^20.0.0 || >=22.0.0 + '@vitest/browser': 3.2.4 + '@vitest/ui': 3.2.4 + happy-dom: '*' + jsdom: '*' peerDependenciesMeta: - typescript: + '@edge-runtime/vm': + optional: true + '@types/debug': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: optional: true webauthn-p256@0.0.5: @@ -1765,6 +1565,11 @@ packages: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} hasBin: true + why-is-node-running@2.3.0: + resolution: {integrity: sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==} + engines: {node: '>=8'} + hasBin: true + ws@8.17.1: resolution: {integrity: sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==} engines: {node: '>=10.0.0'} @@ -2021,81 +1826,161 @@ snapshots: '@esbuild/aix-ppc64@0.25.9': optional: true + '@esbuild/aix-ppc64@0.27.4': + optional: true + '@esbuild/android-arm64@0.25.9': optional: true + '@esbuild/android-arm64@0.27.4': + optional: true + '@esbuild/android-arm@0.25.9': optional: true + '@esbuild/android-arm@0.27.4': + optional: true + '@esbuild/android-x64@0.25.9': optional: true + '@esbuild/android-x64@0.27.4': + optional: true + '@esbuild/darwin-arm64@0.25.9': optional: true + '@esbuild/darwin-arm64@0.27.4': + optional: true + '@esbuild/darwin-x64@0.25.9': optional: true + '@esbuild/darwin-x64@0.27.4': + optional: true + '@esbuild/freebsd-arm64@0.25.9': optional: true + '@esbuild/freebsd-arm64@0.27.4': + optional: true + '@esbuild/freebsd-x64@0.25.9': optional: true + '@esbuild/freebsd-x64@0.27.4': + optional: true + '@esbuild/linux-arm64@0.25.9': optional: true + '@esbuild/linux-arm64@0.27.4': + optional: true + '@esbuild/linux-arm@0.25.9': optional: true + '@esbuild/linux-arm@0.27.4': + optional: true + '@esbuild/linux-ia32@0.25.9': optional: true + '@esbuild/linux-ia32@0.27.4': + optional: true + '@esbuild/linux-loong64@0.25.9': optional: true + '@esbuild/linux-loong64@0.27.4': + optional: true + '@esbuild/linux-mips64el@0.25.9': optional: true + '@esbuild/linux-mips64el@0.27.4': + optional: true + '@esbuild/linux-ppc64@0.25.9': optional: true + '@esbuild/linux-ppc64@0.27.4': + optional: true + '@esbuild/linux-riscv64@0.25.9': optional: true + '@esbuild/linux-riscv64@0.27.4': + optional: true + '@esbuild/linux-s390x@0.25.9': optional: true + '@esbuild/linux-s390x@0.27.4': + optional: true + '@esbuild/linux-x64@0.25.9': optional: true + '@esbuild/linux-x64@0.27.4': + optional: true + '@esbuild/netbsd-arm64@0.25.9': optional: true + '@esbuild/netbsd-arm64@0.27.4': + optional: true + '@esbuild/netbsd-x64@0.25.9': optional: true + '@esbuild/netbsd-x64@0.27.4': + optional: true + '@esbuild/openbsd-arm64@0.25.9': optional: true + '@esbuild/openbsd-arm64@0.27.4': + optional: true + '@esbuild/openbsd-x64@0.25.9': optional: true + '@esbuild/openbsd-x64@0.27.4': + optional: true + '@esbuild/openharmony-arm64@0.25.9': optional: true + '@esbuild/openharmony-arm64@0.27.4': + optional: true + '@esbuild/sunos-x64@0.25.9': optional: true + '@esbuild/sunos-x64@0.27.4': + optional: true + '@esbuild/win32-arm64@0.25.9': optional: true + '@esbuild/win32-arm64@0.27.4': + optional: true + '@esbuild/win32-ia32@0.25.9': optional: true - '@esbuild/win32-x64@0.25.9': + '@esbuild/win32-ia32@0.27.4': + optional: true + + '@esbuild/win32-x64@0.25.9': + optional: true + + '@esbuild/win32-x64@0.27.4': optional: true + '@jridgewell/sourcemap-codec@1.5.5': {} + '@manypkg/find-root@1.1.0': dependencies: '@babel/runtime': 7.25.4 @@ -2130,8 +2015,6 @@ snapshots: '@noble/hashes@1.8.0': {} - '@noble/secp256k1@2.3.0': {} - '@nodelib/fs.scandir@2.1.5': dependencies: '@nodelib/fs.stat': 2.0.5 @@ -2144,52 +2027,84 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.17.1 - '@renegade-fi/core@0.9.13(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3)': - dependencies: - axios: 1.7.5 - isows: 1.0.7(ws@8.18.3) - json-bigint: 1.0.0 - neverthrow: 8.2.0 - tiny-invariant: 1.3.3 - viem: 2.37.4(typescript@5.5.4)(zod@4.0.5) - zustand: 4.5.5(@types/react@18.3.4)(react@18.3.1) - optionalDependencies: - '@tanstack/query-core': 5.52.0 - transitivePeerDependencies: - - '@types/react' - - debug - - immer - - react - - ws + '@rollup/rollup-android-arm-eabi@4.60.1': + optional: true - '@renegade-fi/node@0.6.18(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3)': - dependencies: - '@renegade-fi/core': 0.9.13(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - tiny-invariant: 1.3.3 - viem: 2.37.4(typescript@5.5.4)(zod@4.0.5) - transitivePeerDependencies: - - '@tanstack/query-core' - - '@types/react' - - debug - - immer - - react - - ws + '@rollup/rollup-android-arm64@4.60.1': + optional: true - '@renegade-fi/token@0.0.32(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3)': - dependencies: - '@renegade-fi/core': 0.9.13(@tanstack/query-core@5.52.0)(@types/react@18.3.4)(react@18.3.1)(viem@2.37.4(typescript@5.5.4)(zod@4.0.5))(ws@8.18.3) - transitivePeerDependencies: - - '@tanstack/query-core' - - '@types/react' - - debug - - immer - - react - - viem - - ws + '@rollup/rollup-darwin-arm64@4.60.1': + optional: true + + '@rollup/rollup-darwin-x64@4.60.1': + optional: true + + '@rollup/rollup-freebsd-arm64@4.60.1': + optional: true + + '@rollup/rollup-freebsd-x64@4.60.1': + optional: true + + '@rollup/rollup-linux-arm-gnueabihf@4.60.1': + optional: true + + '@rollup/rollup-linux-arm-musleabihf@4.60.1': + optional: true + + '@rollup/rollup-linux-arm64-gnu@4.60.1': + optional: true + + '@rollup/rollup-linux-arm64-musl@4.60.1': + optional: true + + '@rollup/rollup-linux-loong64-gnu@4.60.1': + optional: true + + '@rollup/rollup-linux-loong64-musl@4.60.1': + optional: true + + '@rollup/rollup-linux-ppc64-gnu@4.60.1': + optional: true + + '@rollup/rollup-linux-ppc64-musl@4.60.1': + optional: true + + '@rollup/rollup-linux-riscv64-gnu@4.60.1': + optional: true + + '@rollup/rollup-linux-riscv64-musl@4.60.1': + optional: true + + '@rollup/rollup-linux-s390x-gnu@4.60.1': + optional: true '@rollup/rollup-linux-x64-gnu@4.35.0': optional: true + '@rollup/rollup-linux-x64-gnu@4.60.1': + optional: true + + '@rollup/rollup-linux-x64-musl@4.60.1': + optional: true + + '@rollup/rollup-openbsd-x64@4.60.1': + optional: true + + '@rollup/rollup-openharmony-arm64@4.60.1': + optional: true + + '@rollup/rollup-win32-arm64-msvc@4.60.1': + optional: true + + '@rollup/rollup-win32-ia32-msvc@4.60.1': + optional: true + + '@rollup/rollup-win32-x64-gnu@4.60.1': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.60.1': + optional: true + '@scure/base@1.1.7': {} '@scure/base@1.2.6': {} @@ -2218,10 +2133,14 @@ snapshots: '@tanstack/query-core@5.52.0': {} - '@tanstack/react-query@5.52.1(react@18.3.1)': + '@types/chai@5.2.3': dependencies: - '@tanstack/query-core': 5.52.0 - react: 18.3.1 + '@types/deep-eql': 4.0.2 + assertion-error: 2.0.1 + + '@types/deep-eql@4.0.2': {} + + '@types/estree@1.0.8': {} '@types/json-bigint@1.0.4': {} @@ -2231,19 +2150,59 @@ snapshots: dependencies: undici-types: 6.19.8 - '@types/prop-types@15.7.12': {} - - '@types/react-dom@18.3.0': - dependencies: - '@types/react': 18.3.4 + '@types/prop-types@15.7.12': + optional: true '@types/react@18.3.4': dependencies: '@types/prop-types': 15.7.12 csstype: 3.1.3 + optional: true '@types/semver@7.5.8': {} + '@vitest/expect@3.2.4': + dependencies: + '@types/chai': 5.2.3 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + tinyrainbow: 2.0.0 + + '@vitest/mocker@3.2.4(vite@7.3.1(@types/node@20.16.1)(tsx@4.20.6))': + dependencies: + '@vitest/spy': 3.2.4 + estree-walker: 3.0.3 + magic-string: 0.30.21 + optionalDependencies: + vite: 7.3.1(@types/node@20.16.1)(tsx@4.20.6) + + '@vitest/pretty-format@3.2.4': + dependencies: + tinyrainbow: 2.0.0 + + '@vitest/runner@3.2.4': + dependencies: + '@vitest/utils': 3.2.4 + pathe: 2.0.3 + strip-literal: 3.1.0 + + '@vitest/snapshot@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + magic-string: 0.30.21 + pathe: 2.0.3 + + '@vitest/spy@3.2.4': + dependencies: + tinyspy: 4.0.4 + + '@vitest/utils@3.2.4': + dependencies: + '@vitest/pretty-format': 3.2.4 + loupe: 3.2.1 + tinyrainbow: 2.0.0 + abitype@1.0.5(typescript@5.9.3)(zod@3.23.8): optionalDependencies: typescript: 5.9.3 @@ -2254,21 +2213,11 @@ snapshots: typescript: 5.9.3 zod: 3.23.8 - abitype@1.1.0(typescript@5.5.4)(zod@4.0.5): - optionalDependencies: - typescript: 5.5.4 - zod: 4.0.5 - - abitype@1.1.0(typescript@5.9.3)(zod@3.23.8): + abitype@1.2.3(typescript@5.9.3)(zod@3.23.8): optionalDependencies: typescript: 5.9.3 zod: 3.23.8 - abitype@1.1.0(typescript@5.9.3)(zod@4.0.5): - optionalDependencies: - typescript: 5.9.3 - zod: 4.0.5 - abitype@1.2.3(typescript@5.9.3)(zod@4.0.5): optionalDependencies: typescript: 5.9.3 @@ -2288,6 +2237,8 @@ snapshots: array-union@2.1.0: {} + assertion-error@2.0.1: {} + asynckit@0.4.0: {} axios@1.7.5: @@ -2308,6 +2259,16 @@ snapshots: dependencies: fill-range: 7.1.1 + cac@6.7.14: {} + + chai@5.3.3: + dependencies: + assertion-error: 2.0.1 + check-error: 2.1.3 + deep-eql: 5.0.2 + loupe: 3.2.1 + pathval: 2.0.1 + chalk@2.4.2: dependencies: ansi-styles: 3.2.1 @@ -2316,6 +2277,8 @@ snapshots: chardet@0.7.0: {} + check-error@2.1.3: {} + ci-info@3.9.0: {} color-convert@1.9.3: @@ -2334,7 +2297,14 @@ snapshots: shebang-command: 1.2.0 which: 1.3.1 - csstype@3.1.3: {} + csstype@3.1.3: + optional: true + + debug@4.4.3: + dependencies: + ms: 2.1.3 + + deep-eql@5.0.2: {} delayed-stream@1.0.0: {} @@ -2349,6 +2319,8 @@ snapshots: ansi-colors: 4.1.3 strip-ansi: 6.0.1 + es-module-lexer@1.7.0: {} + esbuild@0.25.9: optionalDependencies: '@esbuild/aix-ppc64': 0.25.9 @@ -2377,13 +2349,49 @@ snapshots: '@esbuild/win32-arm64': 0.25.9 '@esbuild/win32-ia32': 0.25.9 '@esbuild/win32-x64': 0.25.9 + optional: true + + esbuild@0.27.4: + optionalDependencies: + '@esbuild/aix-ppc64': 0.27.4 + '@esbuild/android-arm': 0.27.4 + '@esbuild/android-arm64': 0.27.4 + '@esbuild/android-x64': 0.27.4 + '@esbuild/darwin-arm64': 0.27.4 + '@esbuild/darwin-x64': 0.27.4 + '@esbuild/freebsd-arm64': 0.27.4 + '@esbuild/freebsd-x64': 0.27.4 + '@esbuild/linux-arm': 0.27.4 + '@esbuild/linux-arm64': 0.27.4 + '@esbuild/linux-ia32': 0.27.4 + '@esbuild/linux-loong64': 0.27.4 + '@esbuild/linux-mips64el': 0.27.4 + '@esbuild/linux-ppc64': 0.27.4 + '@esbuild/linux-riscv64': 0.27.4 + '@esbuild/linux-s390x': 0.27.4 + '@esbuild/linux-x64': 0.27.4 + '@esbuild/netbsd-arm64': 0.27.4 + '@esbuild/netbsd-x64': 0.27.4 + '@esbuild/openbsd-arm64': 0.27.4 + '@esbuild/openbsd-x64': 0.27.4 + '@esbuild/openharmony-arm64': 0.27.4 + '@esbuild/sunos-x64': 0.27.4 + '@esbuild/win32-arm64': 0.27.4 + '@esbuild/win32-ia32': 0.27.4 + '@esbuild/win32-x64': 0.27.4 escape-string-regexp@1.0.5: {} esprima@4.0.1: {} + estree-walker@3.0.3: + dependencies: + '@types/estree': 1.0.8 + eventemitter3@5.0.1: {} + expect-type@1.3.0: {} + extendable-error@0.1.7: {} external-editor@3.1.0: @@ -2404,6 +2412,10 @@ snapshots: dependencies: reusify: 1.0.4 + fdir@6.5.0(picomatch@4.0.4): + optionalDependencies: + picomatch: 4.0.4 + fill-range@7.1.1: dependencies: to-regex-range: 5.0.1 @@ -2449,6 +2461,7 @@ snapshots: get-tsconfig@4.10.1: dependencies: resolve-pkg-maps: 1.0.0 + optional: true glob-parent@5.1.2: dependencies: @@ -2505,6 +2518,8 @@ snapshots: js-tokens@4.0.0: {} + js-tokens@9.0.1: {} + js-yaml@3.14.1: dependencies: argparse: 1.0.10 @@ -2539,11 +2554,17 @@ snapshots: dependencies: js-tokens: 4.0.0 + loupe@3.2.1: {} + lru-cache@4.1.5: dependencies: pseudomap: 1.0.2 yallist: 2.1.2 + magic-string@0.30.21: + dependencies: + '@jridgewell/sourcemap-codec': 1.5.5 + merge2@1.4.1: {} micromatch@4.0.8: @@ -2559,6 +2580,10 @@ snapshots: mri@1.2.0: {} + ms@2.1.3: {} + + nanoid@3.3.11: {} + neverthrow@8.2.0: optionalDependencies: '@rollup/rollup-linux-x64-gnu': 4.35.0 @@ -2567,7 +2592,7 @@ snapshots: outdent@0.5.0: {} - ox@0.12.4(typescript@5.9.3)(zod@4.0.5): + ox@0.14.7(typescript@5.9.3)(zod@4.0.5): dependencies: '@adraffy/ens-normalize': 1.11.0 '@noble/ciphers': 1.3.0 @@ -2590,52 +2615,7 @@ snapshots: '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.3)(zod@3.23.8) - eventemitter3: 5.0.1 - optionalDependencies: - typescript: 5.9.3 - transitivePeerDependencies: - - zod - - ox@0.9.3(typescript@5.5.4)(zod@4.0.5): - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/ciphers': 1.3.0 - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.5.4)(zod@4.0.5) - eventemitter3: 5.0.1 - optionalDependencies: - typescript: 5.5.4 - transitivePeerDependencies: - - zod - - ox@0.9.6(typescript@5.5.4)(zod@4.0.5): - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/ciphers': 1.3.0 - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.5.4)(zod@4.0.5) - eventemitter3: 5.0.1 - optionalDependencies: - typescript: 5.5.4 - transitivePeerDependencies: - - zod - - ox@0.9.6(typescript@5.9.3)(zod@4.0.5): - dependencies: - '@adraffy/ens-normalize': 1.11.0 - '@noble/ciphers': 1.3.0 - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.3)(zod@4.0.5) + abitype: 1.2.3(typescript@5.9.3)(zod@3.23.8) eventemitter3: 5.0.1 optionalDependencies: typescript: 5.9.3 @@ -2670,14 +2650,28 @@ snapshots: path-type@4.0.0: {} + pathe@2.0.3: {} + + pathval@2.0.1: {} + + picocolors@1.1.1: {} + picomatch@2.3.1: {} + picomatch@4.0.4: {} + pify@4.0.1: {} pkg-dir@4.2.0: dependencies: find-up: 4.1.0 + postcss@8.5.8: + dependencies: + nanoid: 3.3.11 + picocolors: 1.1.1 + source-map-js: 1.2.1 + preferred-pm@3.1.4: dependencies: find-up: 5.0.0 @@ -2693,17 +2687,6 @@ snapshots: queue-microtask@1.2.3: {} - react-dom@18.3.1(react@18.3.1): - dependencies: - loose-envify: 1.4.0 - react: 18.3.1 - scheduler: 0.23.2 - - react-use-websocket@4.8.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1): - dependencies: - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) - react@18.3.1: dependencies: loose-envify: 1.4.0 @@ -2719,20 +2702,48 @@ snapshots: resolve-from@5.0.0: {} - resolve-pkg-maps@1.0.0: {} + resolve-pkg-maps@1.0.0: + optional: true reusify@1.0.4: {} + rollup@4.60.1: + dependencies: + '@types/estree': 1.0.8 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.60.1 + '@rollup/rollup-android-arm64': 4.60.1 + '@rollup/rollup-darwin-arm64': 4.60.1 + '@rollup/rollup-darwin-x64': 4.60.1 + '@rollup/rollup-freebsd-arm64': 4.60.1 + '@rollup/rollup-freebsd-x64': 4.60.1 + '@rollup/rollup-linux-arm-gnueabihf': 4.60.1 + '@rollup/rollup-linux-arm-musleabihf': 4.60.1 + '@rollup/rollup-linux-arm64-gnu': 4.60.1 + '@rollup/rollup-linux-arm64-musl': 4.60.1 + '@rollup/rollup-linux-loong64-gnu': 4.60.1 + '@rollup/rollup-linux-loong64-musl': 4.60.1 + '@rollup/rollup-linux-ppc64-gnu': 4.60.1 + '@rollup/rollup-linux-ppc64-musl': 4.60.1 + '@rollup/rollup-linux-riscv64-gnu': 4.60.1 + '@rollup/rollup-linux-riscv64-musl': 4.60.1 + '@rollup/rollup-linux-s390x-gnu': 4.60.1 + '@rollup/rollup-linux-x64-gnu': 4.60.1 + '@rollup/rollup-linux-x64-musl': 4.60.1 + '@rollup/rollup-openbsd-x64': 4.60.1 + '@rollup/rollup-openharmony-arm64': 4.60.1 + '@rollup/rollup-win32-arm64-msvc': 4.60.1 + '@rollup/rollup-win32-ia32-msvc': 4.60.1 + '@rollup/rollup-win32-x64-gnu': 4.60.1 + '@rollup/rollup-win32-x64-msvc': 4.60.1 + fsevents: 2.3.3 + run-parallel@1.2.0: dependencies: queue-microtask: 1.2.3 safer-buffer@2.1.2: {} - scheduler@0.23.2: - dependencies: - loose-envify: 1.4.0 - semver@7.6.3: {} shebang-command@1.2.0: @@ -2741,10 +2752,14 @@ snapshots: shebang-regex@1.0.0: {} + siginfo@2.0.0: {} + signal-exit@3.0.7: {} slash@3.0.0: {} + source-map-js@1.2.1: {} + spawndamnit@2.0.0: dependencies: cross-spawn: 5.1.0 @@ -2752,12 +2767,20 @@ snapshots: sprintf-js@1.0.3: {} + stackback@0.0.2: {} + + std-env@3.10.0: {} + strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 strip-bom@3.0.0: {} + strip-literal@3.1.0: + dependencies: + js-tokens: 9.0.1 + supports-color@5.5.0: dependencies: has-flag: 3.0.0 @@ -2766,6 +2789,21 @@ snapshots: tiny-invariant@1.3.3: {} + tinybench@2.9.0: {} + + tinyexec@0.3.2: {} + + tinyglobby@0.2.15: + dependencies: + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 + + tinypool@1.1.1: {} + + tinyrainbow@2.0.0: {} + + tinyspy@4.0.4: {} + tmp@0.0.33: dependencies: os-tmpdir: 1.0.2 @@ -2774,23 +2812,18 @@ snapshots: dependencies: is-number: 7.0.0 - tsx@4.20.5: - dependencies: - esbuild: 0.25.9 - get-tsconfig: 4.10.1 - optionalDependencies: - fsevents: 2.3.3 - tsx@4.20.6: dependencies: esbuild: 0.25.9 get-tsconfig: 4.10.1 optionalDependencies: fsevents: 2.3.3 + optional: true typescript@5.5.4: {} - typescript@5.9.3: {} + typescript@5.9.3: + optional: true undici-types@6.19.8: {} @@ -2835,49 +2868,15 @@ snapshots: - utf-8-validate - zod - viem@2.37.4(typescript@5.5.4)(zod@4.0.5): - dependencies: - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.5.4)(zod@4.0.5) - isows: 1.0.7(ws@8.18.3) - ox: 0.9.3(typescript@5.5.4)(zod@4.0.5) - ws: 8.18.3 - optionalDependencies: - typescript: 5.5.4 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - - viem@2.39.0(typescript@5.5.4)(zod@4.0.5): - dependencies: - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.5.4)(zod@4.0.5) - isows: 1.0.7(ws@8.18.3) - ox: 0.9.6(typescript@5.5.4)(zod@4.0.5) - ws: 8.18.3 - optionalDependencies: - typescript: 5.5.4 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - - viem@2.39.0(typescript@5.9.3)(zod@4.0.5): + viem@2.47.6(typescript@5.9.3)(zod@4.0.5): dependencies: '@noble/curves': 1.9.1 '@noble/hashes': 1.8.0 '@scure/bip32': 1.7.0 '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.3)(zod@4.0.5) + abitype: 1.2.3(typescript@5.9.3)(zod@4.0.5) isows: 1.0.7(ws@8.18.3) - ox: 0.9.6(typescript@5.9.3)(zod@4.0.5) + ox: 0.14.7(typescript@5.9.3)(zod@4.0.5) ws: 8.18.3 optionalDependencies: typescript: 5.9.3 @@ -2886,39 +2885,80 @@ snapshots: - utf-8-validate - zod - viem@2.39.3(typescript@5.9.3)(zod@4.0.5): + vite-node@3.2.4(@types/node@20.16.1)(tsx@4.20.6): dependencies: - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.1.0(typescript@5.9.3)(zod@4.0.5) - isows: 1.0.7(ws@8.18.3) - ox: 0.9.6(typescript@5.9.3)(zod@4.0.5) - ws: 8.18.3 - optionalDependencies: - typescript: 5.9.3 + cac: 6.7.14 + debug: 4.4.3 + es-module-lexer: 1.7.0 + pathe: 2.0.3 + vite: 7.3.1(@types/node@20.16.1)(tsx@4.20.6) transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod - - viem@2.46.2(typescript@5.9.3)(zod@4.0.5): - dependencies: - '@noble/curves': 1.9.1 - '@noble/hashes': 1.8.0 - '@scure/bip32': 1.7.0 - '@scure/bip39': 1.6.0 - abitype: 1.2.3(typescript@5.9.3)(zod@4.0.5) - isows: 1.0.7(ws@8.18.3) - ox: 0.12.4(typescript@5.9.3)(zod@4.0.5) - ws: 8.18.3 + - '@types/node' + - jiti + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml + + vite@7.3.1(@types/node@20.16.1)(tsx@4.20.6): + dependencies: + esbuild: 0.27.4 + fdir: 6.5.0(picomatch@4.0.4) + picomatch: 4.0.4 + postcss: 8.5.8 + rollup: 4.60.1 + tinyglobby: 0.2.15 optionalDependencies: - typescript: 5.9.3 + '@types/node': 20.16.1 + fsevents: 2.3.3 + tsx: 4.20.6 + + vitest@3.2.4(@types/node@20.16.1)(tsx@4.20.6): + dependencies: + '@types/chai': 5.2.3 + '@vitest/expect': 3.2.4 + '@vitest/mocker': 3.2.4(vite@7.3.1(@types/node@20.16.1)(tsx@4.20.6)) + '@vitest/pretty-format': 3.2.4 + '@vitest/runner': 3.2.4 + '@vitest/snapshot': 3.2.4 + '@vitest/spy': 3.2.4 + '@vitest/utils': 3.2.4 + chai: 5.3.3 + debug: 4.4.3 + expect-type: 1.3.0 + magic-string: 0.30.21 + pathe: 2.0.3 + picomatch: 4.0.4 + std-env: 3.10.0 + tinybench: 2.9.0 + tinyexec: 0.3.2 + tinyglobby: 0.2.15 + tinypool: 1.1.1 + tinyrainbow: 2.0.0 + vite: 7.3.1(@types/node@20.16.1)(tsx@4.20.6) + vite-node: 3.2.4(@types/node@20.16.1)(tsx@4.20.6) + why-is-node-running: 2.3.0 + optionalDependencies: + '@types/node': 20.16.1 transitivePeerDependencies: - - bufferutil - - utf-8-validate - - zod + - jiti + - less + - lightningcss + - msw + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + - tsx + - yaml webauthn-p256@0.0.5: dependencies: @@ -2934,6 +2974,11 @@ snapshots: dependencies: isexe: 2.0.0 + why-is-node-running@2.3.0: + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + ws@8.17.1: {} ws@8.18.3: {} @@ -2945,7 +2990,8 @@ snapshots: zod@3.23.8: optional: true - zod@4.0.5: {} + zod@4.0.5: + optional: true zustand@4.5.5(@types/react@18.3.4)(react@18.3.1): dependencies: diff --git a/wasm/.gitignore b/wasm/.gitignore deleted file mode 100644 index 1711838e..00000000 --- a/wasm/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -/target -**/*.rs.bk -bin/ -pkg/ -wasm-pack.log diff --git a/wasm/Cargo.lock b/wasm/Cargo.lock index 0a8df71b..08cefef1 100644 --- a/wasm/Cargo.lock +++ b/wasm/Cargo.lock @@ -1,54 +1,12 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 - -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - -[[package]] -name = "addr2line" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "aes" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", -] +version = 4 [[package]] name = "ahash" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" dependencies = [ "cfg-if", "once_cell", @@ -56,99 +14,6 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "alloy-primitives" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb3ead547f4532bc8af961649942f0b9c16ee9226e26caa3f38420651cc0bf4" -dependencies = [ - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "hex-literal", - "itoa", - "ruint", - "tiny-keccak", -] - -[[package]] -name = "alloy-rlp" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" -dependencies = [ - "arrayvec", - "bytes", -] - -[[package]] -name = "alloy-sol-macro" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b40397ddcdcc266f59f959770f601ce1280e699a91fc1862f29cef91707cd09" -dependencies = [ - "alloy-sol-macro-expander", - "alloy-sol-macro-input", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "alloy-sol-macro-expander" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "867a5469d61480fea08c7333ffeca52d5b621f5ca2e44f271b117ec1fc9a0525" -dependencies = [ - "alloy-sol-macro-input", - "const-hex", - "heck", - "indexmap", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.75", - "syn-solidity", - "tiny-keccak", -] - -[[package]] -name = "alloy-sol-macro-input" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e482dc33a32b6fadbc0f599adea520bd3aaa585c141a80b404d0a3e3fa72528" -dependencies = [ - "const-hex", - "dunce", - "heck", - "proc-macro2", - "quote", - "syn 2.0.75", - "syn-solidity", -] - -[[package]] -name = "alloy-sol-types" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a91ca40fa20793ae9c3841b83e74569d1cc9af29a2f5237314fd3452d51e38c7" -dependencies = [ - "alloy-primitives", - "alloy-sol-macro", - "const-hex", -] - [[package]] name = "ark-bn254" version = "0.4.0" @@ -156,8 +21,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" dependencies = [ "ark-ec", - "ark-ff 0.4.2", - "ark-std 0.4.0", + "ark-ff", + "ark-std", ] [[package]] @@ -166,13 +31,13 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" dependencies = [ - "ark-ff 0.4.2", + "ark-ff", "ark-poly", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-serialize", + "ark-std", "derivative", - "hashbrown 0.13.2", - "itertools 0.10.5", + "hashbrown", + "itertools", "num-traits", "zeroize", ] @@ -185,26 +50,8 @@ checksum = "71892f265d01650e34988a546b37ea1d2ba1da162a639597a03d1550f26004d8" dependencies = [ "ark-bn254", "ark-ec", - "ark-ff 0.4.2", - "ark-std 0.4.0", -] - -[[package]] -name = "ark-ff" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" -dependencies = [ - "ark-ff-asm 0.3.0", - "ark-ff-macros 0.3.0", - "ark-serialize 0.3.0", - "ark-std 0.3.0", - "derivative", - "num-bigint", - "num-traits", - "paste", - "rustc_version 0.3.3", - "zeroize", + "ark-ff", + "ark-std", ] [[package]] @@ -213,30 +60,20 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" dependencies = [ - "ark-ff-asm 0.4.2", - "ark-ff-macros 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", "derivative", - "digest 0.10.7", - "itertools 0.10.5", + "digest", + "itertools", "num-bigint", "num-traits", "paste", - "rustc_version 0.4.0", + "rustc_version", "zeroize", ] -[[package]] -name = "ark-ff-asm" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" -dependencies = [ - "quote", - "syn 1.0.109", -] - [[package]] name = "ark-ff-asm" version = "0.4.2" @@ -247,18 +84,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "ark-ff-macros" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" -dependencies = [ - "num-bigint", - "num-traits", - "quote", - "syn 1.0.109", -] - [[package]] name = "ark-ff-macros" version = "0.4.2" @@ -278,21 +103,11 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" dependencies = [ - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "ark-std 0.4.0", + "ark-ff", + "ark-serialize", + "ark-std", "derivative", - "hashbrown 0.13.2", -] - -[[package]] -name = "ark-serialize" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" -dependencies = [ - "ark-std 0.3.0", - "digest 0.9.0", + "hashbrown", ] [[package]] @@ -302,8 +117,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-serialize-derive", - "ark-std 0.4.0", - "digest 0.10.7", + "ark-std", + "digest", "num-bigint", ] @@ -320,3675 +135,297 @@ dependencies = [ [[package]] name = "ark-std" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", "rand", ] [[package]] -name = "ark-std" -version = "0.4.0" +name = "autocfg" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand", -] +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] -name = "arrayvec" -version = "0.7.6" +name = "bumpalo" +version = "3.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" [[package]] -name = "ascii-canvas" -version = "3.0.0" +name = "cfg-if" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" [[package]] -name = "async-trait" -version = "0.1.81" +name = "console_error_panic_hook" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e0c28dcc82d7c8ead5cb13beb15405b57b8546e93215673ff8ca0349a028107" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", + "cfg-if", + "wasm-bindgen", ] [[package]] -name = "async_io_stream" -version = "0.3.3" +name = "crypto-common" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" dependencies = [ - "futures", - "pharos", - "rustc_version 0.4.0", + "generic-array", + "typenum", ] [[package]] -name = "auto_impl" -version = "1.2.0" +name = "derivative" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 1.0.109", ] [[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.73" +name = "digest" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide 0.7.4", - "object", - "rustc-demangle", + "crypto-common", ] [[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base64" -version = "0.13.1" +name = "either" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" [[package]] -name = "base64" -version = "0.21.7" +name = "generic-array" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] [[package]] -name = "base64" -version = "0.22.1" +name = "hashbrown" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] [[package]] -name = "base64ct" -version = "1.6.0" +name = "hex" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "bech32" -version = "0.9.1" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] [[package]] -name = "bigdecimal" -version = "0.3.1" +name = "num-bigint" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "num-bigint", "num-integer", "num-traits", ] [[package]] -name = "bit-set" -version = "0.5.3" +name = "num-integer" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "bit-vec", + "num-traits", ] [[package]] -name = "bit-vec" -version = "0.6.3" +name = "num-traits" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] [[package]] -name = "bitflags" -version = "1.3.2" +name = "once_cell" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] -name = "bitflags" -version = "2.6.0" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] -name = "bitvec" -version = "1.0.1" +name = "ppv-lite86" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" dependencies = [ - "funty", - "radium", - "tap", - "wyz", + "zerocopy", ] [[package]] -name = "block-buffer" -version = "0.10.4" +name = "proc-macro2" +version = "1.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" dependencies = [ - "generic-array", + "unicode-ident", ] [[package]] -name = "bs58" -version = "0.5.1" +name = "quote" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ - "sha2", - "tinyvec", + "proc-macro2", ] [[package]] -name = "bumpalo" -version = "3.16.0" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_chacha", + "rand_core", +] [[package]] -name = "byte-slice-cast" -version = "1.2.2" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] [[package]] -name = "byteorder" -version = "1.5.0" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" [[package]] -name = "bytes" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +name = "renegade-sdk-wasm" +version = "0.1.0" dependencies = [ - "serde", + "ark-ec", + "ark-ed-on-bn254", + "ark-ff", + "ark-serialize", + "console_error_panic_hook", + "hex", + "wasm-bindgen", ] [[package]] -name = "bzip2" -version = "0.4.4" +name = "rustc_version" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ - "bzip2-sys", - "libc", + "semver", ] [[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" +name = "rustversion" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" [[package]] -name = "camino" -version = "1.1.9" +name = "semver" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" -dependencies = [ - "serde", -] +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" [[package]] -name = "cargo-platform" -version = "0.1.8" +name = "syn" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "serde", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "cargo_metadata" -version = "0.18.1" +name = "syn" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.23", - "serde", - "serde_json", - "thiserror", + "proc-macro2", + "quote", + "unicode-ident", ] [[package]] -name = "cc" -version = "1.1.14" +name = "typenum" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" -dependencies = [ - "jobserver", - "libc", - "shlex", -] +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] -name = "cfg-if" -version = "1.0.0" +name = "unicode-ident" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] -name = "chrono" -version = "0.4.38" +name = "version_check" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" -dependencies = [ - "num-traits", - "serde", -] +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] -name = "cipher" -version = "0.4.4" +name = "wasm-bindgen" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "0551fc1bb415591e3372d0bc4780db7e587d84e2a7e79da121051c5c4b89d0b0" dependencies = [ - "crypto-common", - "inout", + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", ] [[package]] -name = "cobs" -version = "0.2.3" +name = "wasm-bindgen-macro" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" - -[[package]] -name = "coins-bip32" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" -dependencies = [ - "bs58", - "coins-core", - "digest 0.10.7", - "hmac", - "k256", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" -dependencies = [ - "bitvec", - "coins-bip32", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" -dependencies = [ - "base64 0.21.7", - "bech32", - "bs58", - "digest 0.10.7", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2", - "sha3", - "thiserror", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "const-hex" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" -dependencies = [ - "cfg-if", - "cpufeatures", - "hex", - "proptest", - "serde", -] - -[[package]] -name = "const-oid" -version = "0.9.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "constants" -version = "0.1.0" -source = "git+https://github.com/renegade-fi/renegade.git#d5b3125241c64ac77635b6687b943725d9673caf" -dependencies = [ - "ark-bn254", - "ark-ec", - "ark-ed-on-bn254", -] - -[[package]] -name = "contracts-common" -version = "0.1.0" -source = "git+https://github.com/renegade-fi/renegade-contracts.git#4bbab0495ca9f1d431e2a2fddc639c9b12c7f78c" -dependencies = [ - "alloy-primitives", - "alloy-sol-types", - "ark-bn254", - "ark-ec", - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "serde", - "serde_with", -] - -[[package]] -name = "convert_case" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" - -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpufeatures" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-bigint" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" -dependencies = [ - "cipher", -] - -[[package]] -name = "darling" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.75", -] - -[[package]] -name = "darling_macro" -version = "0.20.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", -] - -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "derive_more" -version = "0.99.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" -dependencies = [ - "convert_case", - "proc-macro2", - "quote", - "rustc_version 0.4.0", - "syn 2.0.75", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "ecdsa" -version = "0.16.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" -dependencies = [ - "der", - "digest 0.10.7", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "elliptic-curve" -version = "0.13.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest 0.10.7", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "embedded-io" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" - -[[package]] -name = "embedded-io" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" - -[[package]] -name = "ena" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" -dependencies = [ - "log", -] - -[[package]] -name = "encoding_rs" -version = "0.8.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enr" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a3d8dc56e02f954cac8eb489772c552c473346fc34f67412bb6244fd647f7e4" -dependencies = [ - "base64 0.21.7", - "bytes", - "hex", - "k256", - "log", - "rand", - "rlp", - "serde", - "sha3", - "zeroize", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes", - "ctr", - "digest 0.10.7", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand", - "scrypt", - "serde", - "serde_json", - "sha2", - "sha3", - "thiserror", - "uuid 0.8.2", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - -[[package]] -name = "ethers" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816841ea989f0c69e459af1cf23a6b0033b19a55424a1ea3a30099becdb8dec0" -dependencies = [ - "ethers-addressbook", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "ethers-solc", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5495afd16b4faa556c3bba1f21b98b4983e53c1755022377051a975c3b021759" -dependencies = [ - "ethers-core", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fceafa3578c836eeb874af87abacfb041f92b4da0a78a5edd042564b8ecdaaa" -dependencies = [ - "const-hex", - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "futures-util", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04ba01fbc2331a38c429eb95d4a570166781f14290ef9fdb144278a90b5a739b" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core", - "ethers-etherscan", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn 2.0.75", - "toml", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87689dcabc0051cde10caaade298f9e9093d65f6125c14575db3fd8c669a168f" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen", - "ethers-core", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.75", -] - -[[package]] -name = "ethers-core" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82d80cc6ad30b14a48ab786523af33b37f28a8623fc06afd55324816ef18fb1f" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "syn 2.0.75", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "ethers-etherscan" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79e5973c26d4baf0ce55520bd732314328cabe53193286671b47144145b9649" -dependencies = [ - "chrono", - "ethers-core", - "reqwest", - "semver 1.0.23", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-middleware" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48f9fdf09aec667c099909d91908d5eaf9be1bd0e2500ba4172c1d28bfaa43de" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] - -[[package]] -name = "ethers-providers" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6434c9a33891f1effc9c75472e12666db2fa5a0fec4b29af6221680a6fe83ab2" -dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.7", - "bytes", - "const-hex", - "enr", - "ethers-core", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "http", - "instant", - "jsonwebtoken", - "once_cell", - "pin-project", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-tungstenite", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "ws_stream_wasm", -] - -[[package]] -name = "ethers-signers" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "228875491c782ad851773b652dd8ecac62cda8571d3bc32a5853644dd26766c2" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "rand", - "sha2", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-solc" -version = "2.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66244a771d9163282646dbeffe0e6eca4dda4146b6498644e678ac6089b11edd" -dependencies = [ - "cfg-if", - "const-hex", - "dirs", - "dunce", - "ethers-core", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.23", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - -[[package]] -name = "eyre" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" -dependencies = [ - "indenter", - "once_cell", -] - -[[package]] -name = "fastrand" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" - -[[package]] -name = "fastrlp" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", -] - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "flate2" -version = "1.0.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" -dependencies = [ - "crc32fast", - "miniz_oxide 0.8.0", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "gimli" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - -[[package]] -name = "h2" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" - -[[package]] -name = "hashers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" -dependencies = [ - "fxhash", -] - -[[package]] -name = "heck" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hex-literal" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "http" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" - -[[package]] -name = "httpdate" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" - -[[package]] -name = "hyper" -version = "0.14.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - -[[package]] -name = "indexmap" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" -dependencies = [ - "equivalent", - "hashbrown 0.14.5", -] - -[[package]] -name = "inout" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "instant" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "ipnet" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "jsonwebtoken" -version = "8.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" -dependencies = [ - "base64 0.21.7", - "pem", - "ring 0.16.20", - "serde", - "serde_json", - "simple_asn1", -] - -[[package]] -name = "k256" -version = "0.13.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", -] - -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "lalrpop" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55cb077ad656299f160924eb2912aa147d7339ea7d69e1b5517326fdcec3c1ca" -dependencies = [ - "ascii-canvas", - "bit-set", - "ena", - "itertools 0.11.0", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", - "walkdir", -] - -[[package]] -name = "lalrpop-util" -version = "0.20.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "507460a910eb7b32ee961886ff48539633b788a36b65692b95f225b844c82553" -dependencies = [ - "regex-automata", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" -dependencies = [ - "bitflags 2.6.0", - "libc", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" - -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest 0.10.7", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "miniz_oxide" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" -dependencies = [ - "adler", -] - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" -dependencies = [ - "hermit-abi", - "libc", - "wasi", - "windows-sys 0.52.0", -] - -[[package]] -name = "new_debug_unreachable" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" - -[[package]] -name = "num-bigint" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" -dependencies = [ - "num-integer", - "num-traits", - "rand", - "serde", -] - -[[package]] -name = "num-conv" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" - -[[package]] -name = "num-integer" -version = "0.1.46" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" -dependencies = [ - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "num_enum" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "object" -version = "0.36.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - -[[package]] -name = "parity-scale-codec" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets 0.52.6", -] - -[[package]] -name = "password-hash" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700" -dependencies = [ - "base64ct", - "rand_core", - "subtle", -] - -[[package]] -name = "paste" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" - -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.7", - "hmac", - "password-hash", - "sha2", -] - -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", - "hmac", -] - -[[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" -dependencies = [ - "base64 0.13.1", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pest" -version = "2.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" -dependencies = [ - "memchr", - "thiserror", - "ucd-trie", -] - -[[package]] -name = "petgraph" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" -dependencies = [ - "fixedbitset", - "indexmap", -] - -[[package]] -name = "pharos" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" -dependencies = [ - "futures", - "rustc_version 0.4.0", -] - -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "postcard" -version = "1.0.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f7f0a8d620d71c457dd1d47df76bb18960378da56af4527aaa10f515eee732e" -dependencies = [ - "cobs", - "embedded-io 0.4.0", - "embedded-io 0.6.1", - "serde", -] - -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - -[[package]] -name = "ppv-lite86" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" -dependencies = [ - "zerocopy", -] - -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - -[[package]] -name = "prettyplease" -version = "0.2.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" -dependencies = [ - "proc-macro2", - "syn 2.0.75", -] - -[[package]] -name = "primitive-types" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit 0.21.1", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "proptest" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" -dependencies = [ - "bitflags 2.6.0", - "lazy_static", - "num-traits", - "rand", - "rand_chacha", - "rand_xorshift", - "regex-syntax", - "unarray", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core", -] - -[[package]] -name = "rayon" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" -dependencies = [ - "either", - "rayon-core", -] - -[[package]] -name = "rayon-core" -version = "1.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" -dependencies = [ - "crossbeam-deque", - "crossbeam-utils", -] - -[[package]] -name = "redox_syscall" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" -dependencies = [ - "bitflags 2.6.0", -] - -[[package]] -name = "redox_users" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "renegade-crypto" -version = "0.1.0" -source = "git+https://github.com/renegade-fi/renegade.git#d5b3125241c64ac77635b6687b943725d9673caf" -dependencies = [ - "ark-ec", - "ark-ff 0.4.2", - "bigdecimal", - "constants", - "itertools 0.10.5", - "lazy_static", - "num-bigint", - "serde", - "serde_json", -] - -[[package]] -name = "renegade-utils" -version = "0.0.2" -dependencies = [ - "alloy-primitives", - "alloy-sol-types", - "ark-bn254", - "ark-ec", - "ark-ed-on-bn254", - "ark-ff 0.4.2", - "ark-serialize 0.4.2", - "base64 0.21.7", - "bigdecimal", - "console_error_panic_hook", - "contracts-common", - "derivative", - "ethers", - "eyre", - "getrandom", - "hex", - "hmac", - "indexmap", - "itertools 0.10.5", - "js-sys", - "k256", - "lazy_static", - "num-bigint", - "num-traits", - "postcard", - "renegade-crypto", - "ruint", - "serde", - "serde-wasm-bindgen", - "serde_json", - "serde_with", - "sha2", - "uuid 1.10.0", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "reqwest" -version = "0.11.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" -dependencies = [ - "base64 0.21.7", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper", - "system-configuration", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin 0.9.8", - "untrusted 0.9.0", - "windows-sys 0.52.0", -] - -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - -[[package]] -name = "rlp" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" -dependencies = [ - "bytes", - "rlp-derive", - "rustc-hex", -] - -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ruint" -version = "1.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" -dependencies = [ - "alloy-rlp", - "ark-ff 0.3.0", - "ark-ff 0.4.2", - "bytes", - "fastrlp", - "num-bigint", - "num-traits", - "parity-scale-codec", - "primitive-types", - "proptest", - "rand", - "rlp", - "ruint-macro", - "serde", - "valuable", - "zeroize", -] - -[[package]] -name = "ruint-macro" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustc_version" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" -dependencies = [ - "semver 0.11.0", -] - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver 1.0.23", -] - -[[package]] -name = "rustix" -version = "0.38.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "rustls" -version = "0.21.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" -dependencies = [ - "log", - "ring 0.17.8", - "rustls-webpki", - "sct", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" -dependencies = [ - "base64 0.21.7", -] - -[[package]] -name = "rustls-webpki" -version = "0.101.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - -[[package]] -name = "rustversion" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" -dependencies = [ - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "scrypt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" -dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2", -] - -[[package]] -name = "sct" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" -dependencies = [ - "ring 0.17.8", - "untrusted 0.9.0", -] - -[[package]] -name = "sec1" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "semver" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" -dependencies = [ - "serde", -] - -[[package]] -name = "semver-parser" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" -dependencies = [ - "pest", -] - -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - -[[package]] -name = "send_wrapper" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" - -[[package]] -name = "serde" -version = "1.0.197" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-wasm-bindgen" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b4c031cd0d9014307d82b8abf653c0290fbdaeb4c02d00c63cf52f728628bf" -dependencies = [ - "js-sys", - "serde", - "wasm-bindgen", -] - -[[package]] -name = "serde_derive" -version = "1.0.197" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "serde_json" -version = "1.0.125" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" -dependencies = [ - "base64 0.22.1", - "chrono", - "hex", - "serde", - "serde_derive", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.7", - "sha2-asm", -] - -[[package]] -name = "sha2-asm" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b845214d6175804686b2bd482bcffe96651bb2d1200742b712003504a2dac1ab" -dependencies = [ - "cc", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signature" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" -dependencies = [ - "digest 0.10.7", - "rand_core", -] - -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" - -[[package]] -name = "socket2" -version = "0.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "solang-parser" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" -dependencies = [ - "itertools 0.11.0", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - -[[package]] -name = "strsim" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" - -[[package]] -name = "strum" -version = "0.26.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.26.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.75", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "svm-rs" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" -dependencies = [ - "dirs", - "fs2", - "hex", - "once_cell", - "reqwest", - "semver 1.0.23", - "serde", - "serde_json", - "sha2", - "thiserror", - "url", - "zip", -] - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn-solidity" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c837dc8852cb7074e46b444afb81783140dab12c58867b49fb3898fbafedf7ea" -dependencies = [ - "paste", - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "sync_wrapper" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" - -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "tempfile" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" -dependencies = [ - "cfg-if", - "fastrand", - "once_cell", - "rustix", - "windows-sys 0.59.0", -] - -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - -[[package]] -name = "thiserror" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "time" -version = "0.3.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" -dependencies = [ - "deranged", - "itoa", - "num-conv", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" -dependencies = [ - "num-conv", - "time-core", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.39.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.52.0", -] - -[[package]] -name = "tokio-rustls" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" -dependencies = [ - "rustls", - "tokio", -] - -[[package]] -name = "tokio-tungstenite" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d5dcb2a1ce06d81107c3d0ffa3121fe974b73f068c8282cb1c32328113b6c" -dependencies = [ - "futures-util", - "log", - "rustls", - "tokio", - "tokio-rustls", - "tungstenite", - "webpki-roots", -] - -[[package]] -name = "tokio-util" -version = "0.7.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.20", -] - -[[package]] -name = "toml_datetime" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] - -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow 0.5.40", -] - -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.18", -] - -[[package]] -name = "tower-service" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", -] - -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "tungstenite" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e3dac10fd62eaf6617d3a904ae222845979aec67c615d1c842b4002c7666fb9" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http", - "httparse", - "log", - "rand", - "rustls", - "sha1", - "thiserror", - "url", - "utf-8", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "ucd-trie" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unarray" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - -[[package]] -name = "url" -version = "2.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] - -[[package]] -name = "uuid" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81dfa00651efa65069b0b6b651f4aaa31ba9e3c3ce0137aaad053604ee7e0314" -dependencies = [ - "getrandom", - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" -dependencies = [ - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" -dependencies = [ - "cfg-if", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.75", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "7fbdf9a35adf44786aecd5ff89b4563a90325f9da0923236f6104e603c7e86be" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3996,366 +433,62 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "dca9693ef2bab6d4e6707234500350d8dad079eb508dca05530c85dc3a529ff2" dependencies = [ + "bumpalo", "proc-macro2", "quote", - "syn 2.0.75", - "wasm-bindgen-backend", + "syn 2.0.117", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" - -[[package]] -name = "web-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki-roots" -version = "0.25.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +version = "0.2.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" -dependencies = [ - "windows-sys 0.59.0", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "winnow" -version = "0.5.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" -dependencies = [ - "memchr", -] - -[[package]] -name = "winnow" -version = "0.6.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.50.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "ws_stream_wasm" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7999f5f4217fe3818726b66257a4475f71e74ffd190776ad053fa159e50737f5" -dependencies = [ - "async_io_stream", - "futures", - "js-sys", - "log", - "pharos", - "rustc_version 0.4.0", - "send_wrapper 0.6.0", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +checksum = "39129a682a6d2d841b6c429d0c51e5cb0ed1a03829d8b3d1e69a011e62cb3d3b" dependencies = [ - "tap", + "unicode-ident", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zerocopy" -version = "0.7.35" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +checksum = "eed437bf9d6692032087e337407a86f04cd8d6a16a37199ed57949d415bd68e9" dependencies = [ - "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.35" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +checksum = "70e3cd084b1788766f53af483dd21f93881ff30d7320490ec3ef7526d203bad4" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.117", ] [[package]] name = "zeroize" -version = "1.8.1" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" dependencies = [ "zeroize_derive", ] [[package]] name = "zeroize_derive" -version = "1.4.2" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", -] - -[[package]] -name = "zip" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" -dependencies = [ - "aes", - "byteorder", - "bzip2", - "constant_time_eq", - "crc32fast", - "crossbeam-utils", - "flate2", - "hmac", - "pbkdf2 0.11.0", - "sha1", - "time", - "zstd", -] - -[[package]] -name = "zstd" -version = "0.11.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20cc960326ece64f010d2d2107537f26dc589a6573a316bd5b1dba685fa5fde4" -dependencies = [ - "zstd-safe", -] - -[[package]] -name = "zstd-safe" -version = "5.0.2+zstd.1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" -dependencies = [ - "libc", - "zstd-sys", -] - -[[package]] -name = "zstd-sys" -version = "2.0.13+zstd.1.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" -dependencies = [ - "cc", - "pkg-config", + "syn 2.0.117", ] diff --git a/wasm/Cargo.toml b/wasm/Cargo.toml index 2ff45843..6ab9806b 100644 --- a/wasm/Cargo.toml +++ b/wasm/Cargo.toml @@ -1,7 +1,6 @@ [package] -name = "renegade-utils" -description = "Utility functions from the Renegade relayer" -version = "0.0.2" +name = "renegade-sdk-wasm" +version = "0.1.0" edition = "2021" [lib] @@ -15,56 +14,10 @@ lto = true opt-level = 'z' [dependencies] -getrandom = { version = "0.2", features = ["js"] } -renegade-crypto = { git = "https://github.com/renegade-fi/renegade.git", default-features = false } -sha2 = { version = "0.10.8", features = ["asm"] } -uuid = { version = "1.1.2", features = ["v4", "serde"] } wasm-bindgen = "0.2" -wasm-bindgen-futures = "0.4" -js-sys = "0.3" - console_error_panic_hook = { version = "0.1.7", optional = true } - -# === Contracts Repo Dependencies === # -contracts-common = { git = "https://github.com/renegade-fi/renegade-contracts.git" } - -# === Cryptography / Arithmetic === # -ark-bn254 = "0.4" ark-ed-on-bn254 = "0.4" ark-ec = "0.4" ark-ff = "0.4" ark-serialize = "0.4" -num-bigint = { version = "0.4.3" } -num-traits = "0.2" -k256 = { version = "0.13", features = ["expose-field"] } -ruint = { version = "1.11.1", features = ["num-bigint"] } -hmac = "0.12" - -# === Ethereum Utils === # -alloy-primitives = { version = "0.7.7", default-features = false } -alloy-sol-types = { version = "0.7.7", default-features = false } -ethers = "2" - -# === Misc === # -base64 = "0.21" -derivative = "2.2" -eyre = "0.6" hex = "0.4" -indexmap = "2.0.2" -itertools = "0.10" -lazy_static = "1.4" - -# === Serde === # -serde = { version = "=1.0.197" } -serde_with = { version = "3.4", default-features = false, features = [ - "macros", - "alloc", -] } -serde-wasm-bindgen = "0.4" -serde_json = "1.0.64" -postcard = { version = "1", default-features = false, features = ["alloc"] } -bigdecimal = "0.3" - -[dependencies.web-sys] -version = "0.3.4" -features = ["console"] diff --git a/wasm/build.sh b/wasm/build.sh index 0b7e9855..0a57039e 100755 --- a/wasm/build.sh +++ b/wasm/build.sh @@ -1,29 +1,19 @@ #!/bin/bash +set -e +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" OUTPUT_NAME="index" +OUTPUT_DIR="$SCRIPT_DIR/../packages/direct-match/renegade-sdk-wasm" +TARGET="nodejs" -# Check for --node flag -OUTPUT_DIR="../packages/react/renegade-utils" -TARGET="web" for arg in "$@" do - if [ "$arg" == "--test" ]; then - TARGET="bundler" - elif [ "$arg" == "--node" ]; then - TARGET="nodejs" - OUTPUT_DIR="../packages/node/renegade-utils" + if [ "$arg" == "--web" ]; then + TARGET="web" fi done -# Build the WebAssembly package with conditional target +cd "$SCRIPT_DIR" wasm-pack build --target $TARGET --out-dir $OUTPUT_DIR --out-name $OUTPUT_NAME -# Copy the .d.ts file to the core package -if [ "$TARGET" == "nodejs" ]; then - cp $OUTPUT_DIR/$OUTPUT_NAME.d.ts ../packages/core/src/utils.d.ts -fi - - -# Delete the .gitignore file so the package is included -rm $OUTPUT_DIR/.gitignore - +rm -f $OUTPUT_DIR/.gitignore diff --git a/wasm/rust-toolchain b/wasm/rust-toolchain new file mode 100644 index 00000000..53d9855d --- /dev/null +++ b/wasm/rust-toolchain @@ -0,0 +1 @@ +nightly-2025-11-25 diff --git a/wasm/rust-toolchain.toml b/wasm/rust-toolchain.toml deleted file mode 100644 index c914e890..00000000 --- a/wasm/rust-toolchain.toml +++ /dev/null @@ -1,2 +0,0 @@ -[toolchain] -channel = "nightly-2024-03-14" diff --git a/wasm/src/circuit_types/balance.rs b/wasm/src/circuit_types/balance.rs deleted file mode 100644 index afc1728e..00000000 --- a/wasm/src/circuit_types/balance.rs +++ /dev/null @@ -1,67 +0,0 @@ -use num_bigint::BigUint; - -use serde::{Deserialize, Serialize}; - -use crate::types::{biguint_to_scalar, Scalar}; - -use super::{biguint_from_hex_string, biguint_to_hex_string, Amount}; - -/// Represents the base type of a balance in tuple holding a reference to the -/// ERC-20 token and its amount -#[derive(Clone, Default, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct Balance { - /// The mint (ERC-20 token address) of the token in the balance - #[serde( - serialize_with = "biguint_to_hex_string", - deserialize_with = "biguint_from_hex_string" - )] - pub mint: BigUint, - /// The amount of the given token stored in this balance - pub amount: Amount, - /// The amount of this balance owed to the managing relayer cluster - pub relayer_fee_balance: Amount, - /// The amount of this balance owed to the protocol - pub protocol_fee_balance: Amount, -} - -impl Balance { - /// Whether or not the instance is a default balance - pub fn is_default(&self) -> bool { - self.eq(&Balance::default()) - } - - /// Whether or not the balance is zero'd - pub fn is_zero(&self) -> bool { - self.amount == 0 && self.relayer_fee_balance == 0 && self.protocol_fee_balance == 0 - } - - /// Construct a zero'd balance from a mint - pub fn new_from_mint(mint: BigUint) -> Balance { - Balance { - mint, - amount: 0, - relayer_fee_balance: 0, - protocol_fee_balance: 0, - } - } - - /// Construct a balance with zero fees from a mint and amount - pub fn new_from_mint_and_amount(mint: BigUint, amount: Amount) -> Balance { - Balance { - mint, - amount, - relayer_fee_balance: 0, - protocol_fee_balance: 0, - } - } - - /// Converts the balance into a list of scalars. - pub fn to_scalars(&self) -> Vec { - vec![ - biguint_to_scalar(&self.mint), - Scalar::from(self.amount), - Scalar::from(self.relayer_fee_balance), - Scalar::from(self.protocol_fee_balance), - ] - } -} diff --git a/wasm/src/circuit_types/elgamal.rs b/wasm/src/circuit_types/elgamal.rs deleted file mode 100644 index 1a0e4089..00000000 --- a/wasm/src/circuit_types/elgamal.rs +++ /dev/null @@ -1,65 +0,0 @@ -use crate::types::Scalar; -use ark_ec::{ - twisted_edwards::{Projective, TECurveConfig}, - CurveGroup, -}; -use serde::{Deserialize, Serialize}; - -// --------------------- -// | ElGamal Key Types | -// --------------------- - -/// The config of the embedded curve -pub type EmbeddedCurveConfig = ark_ed_on_bn254::EdwardsConfig; - -/// The affine form of the embedded curve group -pub type EmbeddedCurveGroupAffine = ark_ed_on_bn254::EdwardsAffine; - -/// A type alias representing an encryption key in the ElGamal over BabyJubJub -/// cryptosystem -pub type EncryptionKey = BabyJubJubPoint; - -/// The affine representation of a point on the BabyJubJub curve -#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)] -pub struct BabyJubJubPoint { - /// The x coordinate of the point - pub x: Scalar, - /// The y coordinate of the point - pub y: Scalar, -} - -impl Default for BabyJubJubPoint { - fn default() -> Self { - // The group generator - let gen = EmbeddedCurveConfig::GENERATOR; - let x = Scalar::new(gen.x); - let y = Scalar::new(gen.y); - - BabyJubJubPoint { x, y } - } -} - -impl BabyJubJubPoint { - pub fn to_scalars(&self) -> Vec { - vec![self.x, self.y] - } -} - -impl From> for BabyJubJubPoint { - fn from(value: Projective) -> Self { - let affine = value.into_affine(); - BabyJubJubPoint { - x: Scalar::new(affine.x), - y: Scalar::new(affine.y), - } - } -} - -impl From for Projective { - fn from(value: BabyJubJubPoint) -> Self { - let x = value.x.inner(); - let y = value.y.inner(); - - Projective::from(EmbeddedCurveGroupAffine::new(x, y)) - } -} diff --git a/wasm/src/circuit_types/fixed_point.rs b/wasm/src/circuit_types/fixed_point.rs deleted file mode 100644 index ff9738ae..00000000 --- a/wasm/src/circuit_types/fixed_point.rs +++ /dev/null @@ -1,90 +0,0 @@ -use crate::types::bigint_to_scalar; -use crate::types::{biguint_to_scalar, Scalar, ScalarField}; -use bigdecimal::{BigDecimal, FromPrimitive, Num}; -use lazy_static::lazy_static; -use num_bigint::BigUint; -use num_bigint::ToBigInt; -use serde::{Deserialize, Serialize}; -use wasm_bindgen::JsError; - -/// The default fixed point decimal precision in bits -/// i.e. the number of bits allocated to a fixed point's decimal -pub const DEFAULT_FP_PRECISION: usize = 63; - -lazy_static! { - /// The shift used to generate a scalar representation from a fixed point - pub static ref TWO_TO_M: BigUint = BigUint::from(1u8) << DEFAULT_FP_PRECISION; - - /// The shift, converted to a scalar - pub static ref TWO_TO_M_SCALAR: ScalarField = biguint_to_scalar(&TWO_TO_M).inner(); -} - -/// Represents a fixed point number not yet allocated in the constraint system -/// -/// This is useful for centralizing conversion logic to provide an abstract -/// to_scalar, from_scalar interface to modules that commit to this value -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] -pub struct FixedPoint { - /// The underlying scalar representing the fixed point variable - pub repr: Scalar, -} - -/// Serialize and deserialize a fixed-point as an f64 -impl Serialize for FixedPoint { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - let repr_bigint = self.repr.to_biguint(); - repr_bigint - .to_str_radix(10 /* radix */) - .serialize(serializer) - } -} - -impl<'de> Deserialize<'de> for FixedPoint { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let decimal_string = String::deserialize(deserializer)?; - let repr_bigint = BigUint::from_str_radix(&decimal_string, 10 /* radix */) - .map_err(|e| serde::de::Error::custom(e.to_string()))?; - - Ok(Self { - repr: Scalar::from(repr_bigint), - }) - } -} - -impl FixedPoint { - /// Construct a fixed point value from its `Scalar` representation - pub fn from_repr(repr: Scalar) -> Self { - Self { repr } - } - - /// Create a new fixed point representation of the given u64 - pub fn from_integer(val: u64) -> Self { - let val_shifted = Scalar::from(val) * Scalar::new(*TWO_TO_M_SCALAR); - Self { repr: val_shifted } - } - - /// Create a new fixed point representation, rounding up to the nearest - /// representable float - pub fn from_f64_round_down(val: f64) -> Result { - // Convert to a bigdecimal to shift - let val_big_dec = - BigDecimal::from_f64(val).ok_or(JsError::new("Failed to convert f64 to BigDecimal"))?; - let shifted_val_big_dec = - val_big_dec * BigDecimal::from(2u64.pow(DEFAULT_FP_PRECISION as u32)); - - // Convert to a big integer - let val_bigint = shifted_val_big_dec - .to_bigint() - .ok_or(JsError::new("Failed to convert BigDecimal to BigInt"))?; - - Ok(Self { - repr: bigint_to_scalar(&val_bigint)?, - }) - } -} diff --git a/wasm/src/circuit_types/keychain.rs b/wasm/src/circuit_types/keychain.rs deleted file mode 100644 index 78939ef2..00000000 --- a/wasm/src/circuit_types/keychain.rs +++ /dev/null @@ -1,388 +0,0 @@ -use itertools::Itertools; -use k256::{ - ecdsa::{SigningKey as K256SigningKey, VerifyingKey as K256VerifyingKey}, - elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint}, - AffinePoint, EncodedPoint, FieldElement as K256FieldElement, -}; -use num_bigint::BigUint; -use serde::{de::Error as SerdeErr, Deserialize, Serialize}; -use std::iter; -use wasm_bindgen::JsError; - -use crate::{ - helpers::compute_poseidon_hash, - map_js_error, - types::{get_scalar_field_modulus, Scalar}, -}; - -use super::{ - biguint_from_hex_string, biguint_to_hex_string, scalar_from_hex_string, scalar_to_hex_string, -}; - -/// The number of keys held in a wallet's keychain -pub const NUM_KEYS: usize = 4; -/// The number of bytes used in a single scalar to represent a key -pub const SCALAR_MAX_BYTES: usize = 31; -/// The number of words needed to represent an element of k256's base field, -/// which is used to represent both public and private keys -const K256_FELT_WORDS: usize = 2; -/// The number of bytes in a k256 field element -const K256_FELT_BYTES: usize = 32; - -/// A public identification key is the image-under-hash of the secret -/// identification key knowledge of which is proved in a circuit -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] -pub struct PublicIdentificationKey { - pub key: Scalar, -} - -impl Serialize for PublicIdentificationKey { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - scalar_to_hex_string(&self.key, serializer) - } -} - -impl<'de> Deserialize<'de> for PublicIdentificationKey { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let scalar = scalar_from_hex_string(deserializer)?; - Ok(Self { key: scalar }) - } -} - -impl From for PublicIdentificationKey { - fn from(key: Scalar) -> Self { - Self { key } - } -} - -impl From for Scalar { - fn from(val: PublicIdentificationKey) -> Self { - val.key - } -} - -/// A secret identification key is the hash preimage of the public -/// identification key -#[derive(Copy, Clone, Debug, Default, PartialEq, Eq)] -pub struct SecretIdentificationKey { - pub key: Scalar, -} - -impl SecretIdentificationKey { - /// Get the public key corresponding to this secret key - pub fn get_public_key(&self) -> PublicIdentificationKey { - let key = compute_poseidon_hash(&[self.key]); - PublicIdentificationKey { key } - } -} - -impl Serialize for SecretIdentificationKey { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - scalar_to_hex_string(&self.key, serializer) - } -} - -impl<'de> Deserialize<'de> for SecretIdentificationKey { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let val = scalar_from_hex_string(deserializer)?; - Ok(Self { key: val }) - } -} - -impl From for SecretIdentificationKey { - fn from(key: Scalar) -> Self { - Self { key } - } -} - -impl From for Scalar { - fn from(val: SecretIdentificationKey) -> Self { - val.key - } -} - -/// A non-native scalar is an element of a non-native field -/// (i.e. not Bn254 scalar) -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct NonNativeScalar { - /// The native `Scalar` words used to represent the scalar - /// - /// Because the scalar is an element of a non-native field, its - /// representation requires a bigint-like approach - pub scalar_words: [Scalar; SCALAR_WORDS], -} - -impl Default for NonNativeScalar { - fn default() -> Self { - Self { - scalar_words: [Scalar::zero(); SCALAR_WORDS], - } - } -} - -impl NonNativeScalar { - /// Split a biguint into scalar words in little endian order - fn split_biguint_into_words(mut val: BigUint) -> Result<[Scalar; SCALAR_WORDS], JsError> { - let scalar_mod = get_scalar_field_modulus(); - let mut res = Vec::with_capacity(SCALAR_WORDS); - for _ in 0..SCALAR_WORDS { - let word = Scalar::from(&val % &scalar_mod); - val /= &scalar_mod; - res.push(word); - } - - res.try_into() - .map_err(|_| JsError::new("Failed to convert vector to fixed-size array")) - } - - /// Re-collect the key words into a biguint - fn combine_words_into_biguint(&self) -> BigUint { - let scalar_mod = get_scalar_field_modulus(); - self.scalar_words - .iter() - .rev() - .fold(BigUint::from(0u8), |acc, word| { - acc * &scalar_mod + word.to_biguint() - }) - } -} - -impl TryFrom<&BigUint> for NonNativeScalar { - type Error = JsError; - - fn try_from(val: &BigUint) -> Result { - Ok(Self { - scalar_words: Self::split_biguint_into_words(val.clone())?, - }) - } -} - -impl From<&NonNativeScalar> for BigUint { - fn from(value: &NonNativeScalar) -> Self { - value.combine_words_into_biguint() - } -} - -impl Serialize for NonNativeScalar { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - // Recover a bigint from the scalar words - biguint_to_hex_string(&self.into(), serializer) - } -} - -impl<'de, const SCALAR_WORDS: usize> Deserialize<'de> for NonNativeScalar { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let val = biguint_from_hex_string(deserializer)?; - let scalar = Self::try_from(&val) - .map_err(|_| SerdeErr::custom("Failed to convert BigUint to NonNativeScalar"))?; - - Ok(scalar) - } -} - -impl TryFrom<&NonNativeScalar> for K256FieldElement { - type Error = JsError; - - fn try_from(value: &NonNativeScalar) -> Result { - let val_bigint = BigUint::from(value); - let mut bytes = val_bigint - .to_bytes_le() - .into_iter() - .chain(iter::repeat(0)) - .take(K256_FELT_BYTES) - .collect_vec(); - bytes.reverse(); - - let bytes_arr: [u8; K256_FELT_BYTES] = bytes - .try_into() - .map_err(|_| JsError::new("Failed to convert bytes to array"))?; - - K256FieldElement::from_bytes(&bytes_arr.into()) - .into_option() - .ok_or(JsError::new("Failed to create K256FieldElement from bytes")) - } -} - -impl TryFrom<&K256FieldElement> for NonNativeScalar { - type Error = JsError; - - fn try_from(value: &K256FieldElement) -> Result { - let bytes = value.to_bytes(); - let val_bigint = BigUint::from_bytes_be(&bytes); - - Self::try_from(&val_bigint) - } -} - -// ----------------- -// | Keychain Type | -// ----------------- - -#[derive(Clone, Debug, PartialEq, Eq, Default, Serialize, Deserialize)] -pub struct PublicSigningKey { - /// The affine x-coordinate of the public key - pub x: NonNativeScalar, - /// The affine y-coordinate of the public key - pub y: NonNativeScalar, -} - -impl PublicSigningKey { - /// Construct a key from bytes - pub fn from_bytes(bytes: &[u8]) -> Result { - // Parse the encoded K256 point assumed to be compressed - let point = EncodedPoint::from_bytes(bytes).map_err(map_js_error!("{}"))?; - - // Convert to circuit-native types, it is simpler to go through the whole - // conversion than decompressing manually - let verifying_key = - K256VerifyingKey::from_encoded_point(&point).map_err(map_js_error!("{}"))?; - (&verifying_key).try_into() - } - - /// Convert the key to bytes - pub fn to_uncompressed_bytes(&self) -> Result, JsError> { - let verifying_key = K256VerifyingKey::try_from(self)?; - - let bytes = verifying_key - .to_encoded_point(false /* compress */) - .as_bytes() - .to_vec(); - - Ok(bytes) - } -} - -impl TryFrom<&PublicSigningKey> for K256VerifyingKey { - type Error = JsError; - - fn try_from(value: &PublicSigningKey) -> Result { - // Construct a point from the raw coordinates - let x_coord = K256FieldElement::try_from(&value.x)?; - let y_coord = K256FieldElement::try_from(&value.y)?; - - // `k256` does not expose direct access to coordinates except through a - // compressed form - let point = AffinePoint::from_encoded_point(&EncodedPoint::from_affine_coordinates( - &x_coord.to_bytes(), - &y_coord.to_bytes(), - false, // compress - )) - .into_option() - .ok_or(JsError::new( - "Failed to create AffinePoint from coordinates", - ))?; - - K256VerifyingKey::from_affine(point) - .map_err(map_js_error!("Failed to create VerifyingKey: {}")) - } -} - -impl TryFrom<&K256VerifyingKey> for PublicSigningKey { - type Error = JsError; - - fn try_from(value: &K256VerifyingKey) -> Result { - // Parse the coordinates of the affine representation of the key - let encoded_key = value.as_affine().to_encoded_point(false /* compress */); - let x_coord = K256FieldElement::from_bytes( - encoded_key - .x() - .ok_or(JsError::new("Failed to get x coordinate"))?, - ) - .into_option() - .ok_or(JsError::new( - "Failed to create K256FieldElement from x coordinate", - ))?; - - let y_coord = K256FieldElement::from_bytes( - encoded_key - .y() - .ok_or(JsError::new("Failed to get y coordinate"))?, - ) - .into_option() - .ok_or(JsError::new( - "Failed to create K256FieldElement from y coordinate", - ))?; - - // Convert to circuit-native types - let x = NonNativeScalar::try_from(&x_coord)?; - let y = NonNativeScalar::try_from(&y_coord)?; - - Ok(Self { x, y }) - } -} - -/// A type alias for readability -pub type SecretSigningKey = NonNativeScalar; - -impl TryFrom<&SecretSigningKey> for K256SigningKey { - type Error = JsError; - - fn try_from(value: &SecretSigningKey) -> Result { - let scalar = BigUint::from(value); - K256SigningKey::from_slice(&scalar.to_bytes_be()) - .map_err(map_js_error!("error deserializing signing key: {}")) - } -} - -impl TryFrom<&K256SigningKey> for SecretSigningKey { - type Error = JsError; - - fn try_from(value: &K256SigningKey) -> Result { - let bigint = BigUint::from_bytes_be(&value.to_bytes()); - NonNativeScalar::try_from(&bigint) - } -} - -#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct PublicKeyChain { - /// The public root key - pub pk_root: PublicSigningKey, - /// The public match key - pub pk_match: PublicIdentificationKey, - /// A nonce set by the wallet owner - /// - /// The owner may use this nonce to track the number of rotations of the - /// keychain. We only allow this nonce to change when authorized by the - /// end-user - pub nonce: Scalar, -} - -impl PublicKeyChain { - /// Create a new public keychain with nonce zero - pub fn new(pk_root: PublicSigningKey, pk_match: PublicIdentificationKey) -> Self { - Self { - pk_root, - pk_match, - nonce: Scalar::zero(), - } - } - - pub fn to_scalars(&self) -> Vec { - vec![ - self.pk_root.x.scalar_words[0], - self.pk_root.x.scalar_words[1], - self.pk_root.y.scalar_words[0], - self.pk_root.y.scalar_words[1], - self.pk_match.key, - self.nonce, - ] - } -} diff --git a/wasm/src/circuit_types/mod.rs b/wasm/src/circuit_types/mod.rs deleted file mode 100644 index cc9a0a0a..00000000 --- a/wasm/src/circuit_types/mod.rs +++ /dev/null @@ -1,192 +0,0 @@ -pub mod balance; -pub mod elgamal; -pub mod fixed_point; -pub mod keychain; -pub mod order; -pub mod transfers; -pub mod wallet; - -use num_bigint::BigUint; -use num_traits::Num; -use serde::{de::Error as SerdeErr, Deserialize, Deserializer, Serialize, Serializer}; - -use self::wallet::Wallet; -use crate::{helpers::compute_poseidon_hash, types::Scalar, MAX_BALANCES, MAX_ORDERS}; -use itertools::Itertools; - -// ------------- -// | Constants | -// ------------- -// Subsctitution for SizedWalletShare::NUM_SCALARS -const NUM_SCALARS: usize = 70; - -/// The type used to track an amount -pub type Amount = u128; - -// -------------------------- -// | Default Generic Values | -// -------------------------- - -/// A wallet with system-wide default generic parameters attached -pub type SizedWallet = Wallet; - -/// A helper to serialize a Scalar to a hex string -pub fn scalar_to_hex_string(val: &Scalar, s: S) -> Result -where - S: Serializer, -{ - biguint_to_hex_string(&val.to_biguint(), s) -} - -/// A helper to deserialize a Scalar from a hex string -pub fn scalar_from_hex_string<'de, D>(d: D) -> Result -where - D: Deserializer<'de>, -{ - Ok(Scalar::from(biguint_from_hex_string(d)?)) -} - -/// A helper to serialize a BigUint to a hex string -pub fn biguint_to_hex_string(val: &BigUint, s: S) -> Result -where - S: Serializer, -{ - s.serialize_str(&format!("0x{}", val.to_str_radix(16 /* radix */))) -} - -/// A helper to deserialize a BigUint from a hex string -pub fn biguint_from_hex_string<'de, D>(d: D) -> Result -where - D: Deserializer<'de>, -{ - // Deserialize as a string and remove "0x" if present - let hex_string = String::deserialize(d)?; - let hex_string = hex_string.strip_prefix("0x").unwrap_or(&hex_string); - - BigUint::from_str_radix(hex_string, 16 /* radix */) - .map_err(|e| SerdeErr::custom(format!("error deserializing BigUint from hex string: {e}"))) -} - -/// A helper for serializing array types -pub fn serialize_array( - arr: &[T; ARR_SIZE], - s: S, -) -> Result -where - S: Serializer, - T: Serialize + Clone, - [(); ARR_SIZE]: Sized, -{ - // Convert the array to a vec - let arr_vec: Vec = arr.clone().into(); - arr_vec.serialize(s) -} - -/// A helper for deserializing array types -pub fn deserialize_array<'de, const ARR_SIZE: usize, T, D>(d: D) -> Result<[T; ARR_SIZE], D::Error> -where - D: Deserializer<'de>, - T: Deserialize<'de>, - [(); ARR_SIZE]: Sized, -{ - // Deserialize a vec and then convert to an array - let deserialized_vec: Vec = Vec::deserialize(d)?; - deserialized_vec - .try_into() - .map_err(|_| SerdeErr::custom("incorrect size of serialized array")) -} - -// ----------------- -// | Wallet Shares | -// ----------------- - -/// Compute a commitment to the shares of a wallet -pub fn compute_wallet_share_commitment( - public_shares: &[Scalar], - private_shares: &[Scalar], -) -> Scalar -where - [(); MAX_BALANCES + MAX_ORDERS]: Sized, -{ - // Hash the private input, then append the public input and re-hash - let private_input_commitment = compute_wallet_private_share_commitment(private_shares); - let mut hash_input = vec![private_input_commitment]; - hash_input.append(&mut public_shares.to_vec()); - - compute_poseidon_hash(&hash_input) -} - -/// Compute a commitment to a single share of a wallet -pub fn compute_wallet_private_share_commitment( - private_share: &[Scalar], -) -> Scalar -where - [(); MAX_BALANCES + MAX_ORDERS]: Sized, -{ - compute_poseidon_hash(private_share) -} - -/// Create a secret sharing of a wallet given the secret shares and blinders -pub fn create_wallet_shares_with_randomness( - wallet: &Wallet, - blinder: Scalar, - private_blinder_share: Scalar, - secret_shares: T, -) -> (Vec, Vec) -where - T: IntoIterator, - [(); MAX_BALANCES + MAX_ORDERS]: Sized, -{ - let share_iter = secret_shares.into_iter(); - let wallet_scalars = wallet.to_scalars(); - let wallet_private_shares = share_iter.take(wallet_scalars.len()).collect_vec(); - let wallet_public_shares = wallet_scalars - .iter() - .zip_eq(wallet_private_shares.iter()) - .map(|(scalar, private_share)| *scalar - *private_share) - .collect_vec(); - - let mut private_shares = wallet_private_shares; - let mut public_shares = wallet_public_shares; - private_shares[NUM_SCALARS - 1] = private_blinder_share; - public_shares[NUM_SCALARS - 1] = blinder - private_blinder_share; - - let blinded_public_shares = blind_shares(&public_shares, blinder); - - (private_shares, blinded_public_shares) -} - -/// Construct public shares of a wallet given the private shares and blinder -/// -/// The return type is a tuple containing the private and public shares. -/// Note that the private shares returned are exactly those passed in -pub fn create_wallet_shares_from_private( - wallet: &Wallet, - private_shares: &[Scalar], - blinder: Scalar, -) -> (Vec, Vec) -where - [(); MAX_BALANCES + MAX_ORDERS]: Sized, -{ - // Serialize the wallet's private shares and use this as the secret share stream - let private_shares_ser = private_shares.to_vec(); - create_wallet_shares_with_randomness( - wallet, - blinder, - private_shares[NUM_SCALARS - 1], - private_shares_ser, - ) -} - -/// Blinds the wallet, but does not blind the blinder itself -/// -/// This is necessary because the default implementation of `blind` that is -/// derived by the macro will blind the blinder as well as the shares, -/// which is undesirable -pub fn blind_shares(shares: &[Scalar], blinder: Scalar) -> Vec { - let prev_blinder = shares[NUM_SCALARS - 1]; - let mut blinded = shares.iter().map(|share| *share + blinder).collect_vec(); - blinded[NUM_SCALARS - 1] = prev_blinder; - - blinded -} diff --git a/wasm/src/circuit_types/order.rs b/wasm/src/circuit_types/order.rs deleted file mode 100644 index 30189928..00000000 --- a/wasm/src/circuit_types/order.rs +++ /dev/null @@ -1,121 +0,0 @@ -use num_bigint::BigUint; - -use serde::{Deserialize, Serialize}; - -use crate::types::{biguint_to_scalar, Scalar}; - -use super::{biguint_from_hex_string, biguint_to_hex_string, fixed_point::FixedPoint, Amount}; - -#[derive(Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] -pub struct Order { - /// The mint (ERC-20 contract address) of the quote token - #[serde( - serialize_with = "biguint_to_hex_string", - deserialize_with = "biguint_from_hex_string" - )] - pub quote_mint: BigUint, - /// The mint (ERC-20 contract address) of the base token - #[serde( - serialize_with = "biguint_to_hex_string", - deserialize_with = "biguint_from_hex_string" - )] - pub base_mint: BigUint, - /// The side this order is for (0 = buy, 1 = sell) - pub side: OrderSide, - /// The amount of base currency to buy or sell - pub amount: Amount, - /// The worse case price the user is willing to accept on this order - /// - /// If the order is a buy, this is the maximum price the user is willing to - /// pay If the order is a sell, this is the minimum price the user is - /// willing to accept - pub worst_case_price: FixedPoint, - /// The minimum fill size for the order - #[serde(default)] - pub min_fill_size: Amount, - /// Whether or not to allow external matches - #[serde(default)] - pub allow_external_matches: bool, -} - -impl Order { - /// Whether or not this is the zero'd order - pub fn is_default(&self) -> bool { - self.eq(&Self::default()) - } - - /// Whether or not this order is for zero volume - /// - /// This is a superset of the class of orders that `is_default` returns - /// true for - pub fn is_zero(&self) -> bool { - self.amount == 0 - } - - /// The mint of the token sent by the creator of this order in the event - /// that the order is matched - pub fn send_mint(&self) -> &BigUint { - match self.side { - OrderSide::Buy => &self.quote_mint, - OrderSide::Sell => &self.base_mint, - } - } - - /// The mint of the token received by the creator of this order in the event - /// that the order is matched - pub fn receive_mint(&self) -> &BigUint { - match self.side { - OrderSide::Buy => &self.base_mint, - OrderSide::Sell => &self.quote_mint, - } - } - - /// Converts the order into a list of scalars. - pub fn to_scalars(&self) -> Vec { - vec![ - biguint_to_scalar(&self.quote_mint), - biguint_to_scalar(&self.base_mint), - Scalar::from(self.side.to_biguint()), - Scalar::from(self.amount), - self.worst_case_price.repr, - ] - } -} - -/// The side of the market a given order is on -#[derive(Clone, Copy, Default, Debug, PartialEq, Eq, Serialize)] -pub enum OrderSide { - /// Buy side - #[default] - Buy = 0, - /// Sell side - Sell, -} - -impl<'de> Deserialize<'de> for OrderSide { - fn deserialize(deserializer: D) -> Result - where - D: serde::Deserializer<'de>, - { - let s = String::deserialize(deserializer)?; - match s.to_lowercase().as_str() { - "buy" => Ok(OrderSide::Buy), - "sell" => Ok(OrderSide::Sell), - _ => Err(serde::de::Error::custom(format!("Invalid order side: {s}"))), - } - } -} - -impl OrderSide { - /// Converts the order side to a scalar. - pub fn to_biguint(&self) -> BigUint { - // Convert the enum to its integer representation - let value = match self { - OrderSide::Buy => 0u32, - OrderSide::Sell => 1, - }; - - // Convert the integer to BigUint - BigUint::from(value) - } -} diff --git a/wasm/src/circuit_types/transfers.rs b/wasm/src/circuit_types/transfers.rs deleted file mode 100644 index 3ebd50ba..00000000 --- a/wasm/src/circuit_types/transfers.rs +++ /dev/null @@ -1,103 +0,0 @@ -use crate::{ - errors::ConversionError, - helpers::biguint_to_address, - serde_def_types::{AddressDef, U256Def}, - sol::{ExternalTransfer as BaseExternalTransfer, TransferType as BaseTransferType}, -}; -use alloy_primitives::{Address, U256 as AlloyU256}; -use num_bigint::BigUint; -use ruint::aliases::{U160, U256}; -use serde::{Deserialize, Serialize}; -use serde_with::serde_as; - -use super::Amount; -/// The base external transfer type, not allocated in a constraint system -/// or an MPC circuit -#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)] -pub struct ExternalTransfer { - /// The address of the account contract to transfer to/from - pub account_addr: BigUint, - /// The mint (ERC20 address) of the token to transfer - pub mint: BigUint, - /// The amount of the token transferred - pub amount: Amount, - /// The direction of transfer - pub direction: ExternalTransferDirection, -} - -/// Represents the direction (deposit/withdraw) of a transfer -#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Default)] -pub enum ExternalTransferDirection { - /// Deposit an ERC20 into the darkpool from an external address - #[default] - Deposit = 0, - /// Withdraw an ERC20 from the darkpool to an external address - Withdrawal, -} - -/// Represents an external transfer of an ERC20 token -#[serde_as] -#[derive(Serialize, Deserialize, Default)] -pub struct ArbitrumExternalTransfer { - /// The address of the account contract to deposit from or withdraw to - #[serde_as(as = "AddressDef")] - pub account_addr: Address, - /// The mint (contract address) of the token being transferred - #[serde_as(as = "AddressDef")] - pub mint: Address, - /// The amount of the token transferred - #[serde_as(as = "U256Def")] - pub amount: AlloyU256, - /// Whether or not the transfer is a withdrawal (otherwise a deposit) - pub is_withdrawal: bool, -} - -/// Convert an [`ExternalTransfer`] to its corresponding Arbitrum smart contract type -pub fn to_arbitrum_external_transfer( - external_transfer: &ExternalTransfer, -) -> Result { - let account_addr: U160 = external_transfer - .account_addr - .clone() - .try_into() - .map_err(|_| ConversionError::InvalidUint)?; - let mint: U160 = external_transfer - .mint - .clone() - .try_into() - .map_err(|_| ConversionError::InvalidUint)?; - let amount: U256 = external_transfer - .amount - .try_into() - .map_err(|_| ConversionError::InvalidUint)?; - - Ok(ArbitrumExternalTransfer { - account_addr: Address::from(account_addr), - mint: Address::from(mint), - amount, - is_withdrawal: external_transfer.direction == ExternalTransferDirection::Withdrawal, - }) -} - -/// Convert an [`ExternalTransfer`] to its corresponding Base smart contract type -pub fn to_base_external_transfer( - external_transfer: &ExternalTransfer, -) -> Result { - let transfer_type = match external_transfer.direction { - ExternalTransferDirection::Deposit => BaseTransferType::Deposit, - ExternalTransferDirection::Withdrawal => BaseTransferType::Withdrawal, - }; - - let account = biguint_to_address(&external_transfer.account_addr) - .map_err(|_| ConversionError::InvalidUint)?; - let mint = - biguint_to_address(&external_transfer.mint).map_err(|_| ConversionError::InvalidUint)?; - let amount = U256::from(external_transfer.amount); - - Ok(BaseExternalTransfer { - account, - mint, - amount, - transferType: transfer_type, - }) -} diff --git a/wasm/src/circuit_types/wallet.rs b/wasm/src/circuit_types/wallet.rs deleted file mode 100644 index e37028cd..00000000 --- a/wasm/src/circuit_types/wallet.rs +++ /dev/null @@ -1,87 +0,0 @@ -use serde::{Deserialize, Serialize}; - -use crate::types::Scalar; - -use super::{ - balance::Balance, deserialize_array, elgamal::EncryptionKey, fixed_point::FixedPoint, - keychain::PublicKeyChain, order::Order, scalar_from_hex_string, scalar_to_hex_string, - serialize_array, -}; - -/// A commitment to the wallet's secret shares that is entered into the global -/// state -pub type WalletShareStateCommitment = Scalar; - -/// Nullifier type alias for readability -pub type Nullifier = Scalar; - -// -------------------- -// | Wallet Base Type | -// -------------------- - -/// Represents the base type of a wallet holding orders, balances, fees, keys -/// and cryptographic randomness -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct Wallet { - /// The list of balances in the wallet - #[serde( - serialize_with = "serialize_array", - deserialize_with = "deserialize_array" - )] - pub balances: [Balance; MAX_BALANCES], - /// The list of open orders in the wallet - #[serde( - serialize_with = "serialize_array", - deserialize_with = "deserialize_array" - )] - pub orders: [Order; MAX_ORDERS], - /// The key tuple used by the wallet; i.e. (pk_root, pk_match, pk_settle, - /// pk_view) - pub keys: PublicKeyChain, - /// The match fee authorized by the wallet owner that the relayer may take - /// on a match - pub match_fee: FixedPoint, - /// The public key of the cluster that this wallet has been delegated to for - /// matches - /// - /// Authorizes fees to be settled out of the wallet by the holder of the - /// corresponding private key - pub managing_cluster: EncryptionKey, - /// key The wallet randomness used to blind secret shares - #[serde( - serialize_with = "scalar_to_hex_string", - deserialize_with = "scalar_from_hex_string" - )] - pub blinder: Scalar, -} - -impl Wallet { - /// Converts the wallet into a flat list of scalars. - pub fn to_scalars(&self) -> Vec { - let mut scalars = Vec::new(); - - // Convert balances to scalars and append - for balance in self.balances.iter() { - scalars.extend(balance.to_scalars()); - } - - // Convert orders to scalars and append - for order in self.orders.iter() { - scalars.extend(order.to_scalars()); - } - - // Convert keys to scalars and append - scalars.extend(self.keys.to_scalars()); - - // Convert match_fee to scalar and append - scalars.push(self.match_fee.repr); - - // Convert managing_cluster to scalar and append - scalars.extend(self.managing_cluster.to_scalars()); - - // Append blinder directly as it is already a scalar - scalars.push(self.blinder); - - scalars - } -} diff --git a/wasm/src/common/balances.rs b/wasm/src/common/balances.rs deleted file mode 100644 index 796704d5..00000000 --- a/wasm/src/common/balances.rs +++ /dev/null @@ -1,136 +0,0 @@ -//! Wallet helpers for balances in the wallet - -use std::iter; - -use itertools::Itertools; -use num_bigint::BigUint; -use wasm_bindgen::JsError; - -use crate::{ - circuit_types::{balance::Balance, order::Order, Amount}, - MAX_BALANCES, -}; - -use super::types::Wallet; - -/// Error message emitted when a balance overflows -const ERR_BALANCE_OVERFLOW: &str = "balance overflowed"; -/// Error message emitted when the balances of a wallet are full -const ERR_BALANCES_FULL: &str = "balances full"; -/// Error message emitted when a wallet has insufficient balance for a -/// withdrawal -const ERR_INSUFFICIENT_BALANCE: &str = "insufficient balance"; - -impl Wallet { - // ----------- - // | Getters | - // ----------- - - /// Get the balance for a given mint - pub fn get_balance(&self, mint: &BigUint) -> Option<&Balance> { - self.balances.get(mint) - } - - /// Get the index a given balance is at - pub fn get_balance_index(&self, mint: &BigUint) -> Option { - self.balances.index_of(mint) - } - - /// Get a mutable reference to the balance for a given mint - pub fn get_balance_mut(&mut self, mint: &BigUint) -> Option<&mut Balance> { - self.balances.get_mut(mint) - } - - /// Get a mutable reference to the balance for the given mint or add a - /// zero'd balance if one does not exist - pub fn get_balance_mut_or_default(&mut self, mint: &BigUint) -> Result<&mut Balance, JsError> { - if !self.balances.contains_key(mint) { - let bal = Balance::new_from_mint(mint.clone()); - self.add_balance(bal)?; - } - - self.balances.get_mut(mint).ok_or(JsError::new(&format!( - "Balance not found for mint {}", - mint - ))) - } - - /// Get a list of balances in order in their circuit representation - pub fn get_balances_list(&self) -> Result<[Balance; MAX_BALANCES], JsError> { - self.balances - .clone() - .into_values() - .chain(iter::repeat(Balance::default())) - .take(MAX_BALANCES) - .collect_vec() - .try_into() - .map_err(|_| JsError::new("Failed to convert balances to fixed-size array")) - } - - /// Get the balance that covers the side sold by the given order - pub fn get_balance_for_order(&self, order: &Order) -> Option { - // Find a balance and fee to associate with this order - let order_mint = order.send_mint(); - let balance = self.get_balance(order_mint)?.clone(); - - Some(balance) - } - - // ----------- - // | Setters | - // ----------- - - /// Add a balance to the wallet, replacing the first default balance - pub fn add_balance(&mut self, balance: Balance) -> Result<(), JsError> { - // If the balance exists, increment it - if let Some(bal) = self.balances.get_mut(&balance.mint) { - bal.amount = bal - .amount - .checked_add(balance.amount) - .ok_or(JsError::new(ERR_BALANCE_OVERFLOW))?; - return Ok(()); - } - - if let Some(index) = self.find_first_replaceable_balance() { - self.balances - .replace_at_index(index, balance.mint.clone(), balance); - } else if self.balances.len() < MAX_BALANCES { - self.balances.append(balance.mint.clone(), balance); - } else { - return Err(JsError::new(ERR_BALANCES_FULL)); - } - - Ok(()) - } - - /// Find the first replaceable balance - fn find_first_replaceable_balance(&self) -> Option { - self.balances - .iter() - .position(|(_, balance)| balance.is_zero()) - } - - /// Withdraw an amount from the balance for the given mint - pub fn withdraw(&mut self, mint: &BigUint, amount: Amount) -> Result<(), JsError> { - let bal = self - .get_balance_mut(mint) - .ok_or(JsError::new(ERR_INSUFFICIENT_BALANCE))?; - - if bal.amount < amount { - return Err(JsError::new(ERR_INSUFFICIENT_BALANCE)); - } - - bal.amount = bal.amount.saturating_sub(amount); - Ok(()) - } - - /// Remove a balance from the wallet, replacing it with a default balance - pub fn remove_balance(&mut self, mint: &BigUint) -> Option { - // Replace the balance with a default balance to preserve the balance order for - // wallet update proofs - let bal = self.get_balance_mut(mint)?; - *bal = Balance::default(); - - Some(bal.clone()) - } -} diff --git a/wasm/src/common/derivation.rs b/wasm/src/common/derivation.rs deleted file mode 100644 index 7b8ce0d6..00000000 --- a/wasm/src/common/derivation.rs +++ /dev/null @@ -1,311 +0,0 @@ -use crate::{ - circuit_types::keychain::{NonNativeScalar, PublicKeyChain, SecretIdentificationKey}, - external_api::types::ApiWallet, - helpers::{bytes_from_hex_string, hex_to_signing_key, nonnative_scalar_to_hex_string}, - map_js_error, - types::Scalar, -}; - -use ethers::utils::keccak256; -use js_sys::{Function, Promise}; -use k256::ecdsa::{signature::Signer, Signature, SigningKey}; -use lazy_static::lazy_static; -use num_bigint::BigUint; -use num_traits::Num; -use wasm_bindgen::prelude::*; -use wasm_bindgen_futures::JsFuture; - -use super::{ - keychain::{HmacKey, KeyChain, PrivateKeyChain}, - types::{Wallet, WalletIdentifier}, -}; - -/// The message used to derive the blinder stream seed -const BLINDER_STREAM_SEED_MESSAGE: &[u8] = b"blinder seed"; -/// The messages used to derive the share stream seed -const SHARE_STREAM_SEED_MESSAGE: &[u8] = b"share seed"; -/// The message (concatenated with the nonce) used to derive the wallet's root key -const ROOT_KEY_MESSAGE: &[u8] = b"root key"; -/// The message used to derive the wallet's symmetric key -const SYMMETRIC_KEY_MESSAGE: &[u8] = b"symmetric key"; -/// The message used to derive the wallet's match key -const MATCH_KEY_MESSAGE: &[u8] = b"match key"; -/// The message used to derive the wallet's ID -const WALLET_ID_MESSAGE: &[u8] = b"wallet id"; - -/// The number of bytes from a keccak hash -const KECCAK_HASH_BYTES: usize = 32; -/// The number of bytes we extend into to get a scalar -const EXTENDED_BYTES: usize = 64; -/// The number of bytes in a wallet ID -const WALLET_ID_BYTES: usize = 16; - -/// Derive the root key from a seed -/// "root key" is used to refer to the signing key that is used to derive the first sk_root key, -/// which is used to derive the wallet_id, the blinder_seed, and the share_seed -pub fn derive_root_signing_key(seed: &str) -> Result { - let stripped = seed.strip_prefix("0x").unwrap_or(seed); - let bytes = hex::decode(stripped).map_err(map_js_error!("Failed to decode hex seed: {}"))?; - // Generate the root key - let keccak_bytes = keccak256(bytes); - let sig_bytes = extend_to_64_bytes(&keccak_bytes); - - // We must manually reduce the bytes to the base field as the k256 library - // expects byte representations to be of a valid base field element directly - let unreduced_val = BigUint::from_bytes_be(&sig_bytes); - let reduced_val = unreduced_val % &*SECP256K1_SCALAR_MODULUS; - - // Convert the reduced value to a fixed 32-byte array, padding with zeros if necessary - let mut key_bytes = [0u8; 32]; - let reduced_bytes = reduced_val.to_bytes_be(); - let start = 32 - reduced_bytes.len(); - key_bytes[start..].copy_from_slice(&reduced_bytes); - - SigningKey::from_bytes((&key_bytes).into()).map_err(map_js_error!( - "failed to derive signing key from signature: {}" - )) -} - -/// Derive the sk_root signing key using the root key -/// The first sk_root key (not rotated) is used to derive wallet_id, the blinder_seed, and the share_seed -pub fn derive_sk_root_signing_key( - seed: &str, - nonce: Option<&Scalar>, -) -> Result { - let sk_root_scalar = derive_sk_root_scalars(seed, nonce.unwrap_or(&Scalar::zero()))?; - let sk_root_hex = nonnative_scalar_to_hex_string(&sk_root_scalar); - hex_to_signing_key(&sk_root_hex) -} - -/// Derive the sk_root scalar from the root key and nonce -pub fn derive_sk_root_scalars(seed: &str, nonce: &Scalar) -> Result, JsError> { - let root_key = derive_root_signing_key(seed)?; - - let sk_root = derive_sk_root(&root_key, Some(nonce))?; - let sk_root_biguint = BigUint::from_bytes_be(&sk_root.to_bytes_be()); - let sk_root_nonnative = NonNativeScalar::try_from(&sk_root_biguint)?; - Ok(sk_root_nonnative) -} - -/// Construct sk_root by signing the concat of the root key message and the nonce -pub fn derive_sk_root(root_key: &SigningKey, nonce: Option<&Scalar>) -> Result { - // Use the provided nonce or default to 0 - let default_nonce = Scalar::zero(); - let nonce = nonce.unwrap_or(&default_nonce); - - // Sign the concat of the root key message and the nonce and convert to a scalar - let msg = [ROOT_KEY_MESSAGE, nonce.to_bytes_be().as_slice()].concat(); - derive_scalar(&msg, root_key) -} - -/// Derive a symmetric key from a signing key -pub fn derive_symmetric_key(root_key: &SigningKey) -> Result { - get_sig_bytes(SYMMETRIC_KEY_MESSAGE, root_key).map(HmacKey) -} - -lazy_static! { - /// The secp256k1 scalar field modulus as a BigUint - /// - /// See https://en.bitcoin.it/wiki/Secp256k1 for more information - static ref SECP256K1_SCALAR_MODULUS: BigUint = BigUint::from_str_radix( - "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141", - 16, - ).expect("Valid hex constant"); -} - -/// A helper to derive a wallet keychain from a given Ethereum keypair -/// -/// This does not necessarily match the implementation used in the clients to -/// generate their wallets -pub fn derive_wallet_keychain(root_key: &SigningKey) -> Result { - // Generate the root key - - let sk_root = root_key.try_into()?; - let pk_root = root_key.verifying_key().try_into()?; - - // Generate the match key, this time using the root key to derive it - let sk_match_key = derive_scalar(MATCH_KEY_MESSAGE, root_key)?; - let sk_match = SecretIdentificationKey::from(sk_match_key); - let pk_match = sk_match.get_public_key(); - - // Generate the symmetric key - let symmetric_key = derive_symmetric_key(root_key)?; - - Ok(KeyChain { - public_keys: PublicKeyChain::new(pk_root, pk_match), - secret_keys: PrivateKeyChain { - sk_root: Some(sk_root), - sk_match, - symmetric_key, - }, - }) -} - -/// Construct the blinder seed for the wallet -pub fn derive_blinder_seed(root_key: &SigningKey) -> Result { - // Sign the blinder seed message and convert to a scalar - derive_scalar(BLINDER_STREAM_SEED_MESSAGE, root_key) -} - -/// Construct the share seed for the wallet -pub fn derive_share_seed(root_key: &SigningKey) -> Result { - // Sign the share seed message and convert to a scalar - derive_scalar(SHARE_STREAM_SEED_MESSAGE, root_key) -} - -/// Construct a wallet ID from the given Ethereum keypair -/// -/// This is done to ensure deterministic wallet recovery -pub fn derive_wallet_id(root_key: &SigningKey) -> Result { - let bytes = get_extended_sig_bytes(WALLET_ID_MESSAGE, root_key)?; - WalletIdentifier::from_slice(&bytes[..WALLET_ID_BYTES]) - .map_err(map_js_error!("failed to derive wallet ID from key: {}")) -} - -/// Derive a new wallet from a private key -/// -/// Returns the wallet, the blinder seed, and the share seed -/// Should pass in first sk_root -pub fn derive_wallet_from_key( - signing_key: &SigningKey, -) -> Result<(ApiWallet, Scalar, Scalar), JsError> { - // Derive the seeds and keychain - let wallet_id = derive_wallet_id(signing_key)?; - let blinder_seed = derive_blinder_seed(signing_key)?; - let share_seed = derive_share_seed(signing_key)?; - let keychain = derive_wallet_keychain(signing_key)?; - - let wallet = Wallet::new_empty_wallet(wallet_id, blinder_seed, share_seed, keychain)?; - let api_wallet = wallet.try_into()?; - Ok((api_wallet, blinder_seed, share_seed)) -} - -/// Get a `Scalar` from a signature on a message -fn derive_scalar(msg: &[u8], key: &SigningKey) -> Result { - let bytes = get_extended_sig_bytes(msg, key)?; - - // TODO: Impelement Scalar::from_be_bytes_mod_order - Ok(Scalar::from(BigUint::from_bytes_be(&bytes))) -} - -/// Sign a message, serialize the signature into bytes -fn get_sig_bytes(msg: &[u8], key: &SigningKey) -> Result<[u8; KECCAK_HASH_BYTES], JsError> { - let digest = keccak256(msg); - let sig: Signature = key.sign(&digest); - - // Take the keccak hash of the signature to disperse its elements - let bytes = sig.to_vec(); - Ok(keccak256(bytes)) -} - -/// Sign a message, serialize the signature into bytes, and extend the bytes to -/// support secure reduction into a field -fn get_extended_sig_bytes(msg: &[u8], key: &SigningKey) -> Result<[u8; EXTENDED_BYTES], JsError> { - let bytes = get_sig_bytes(msg, key)?; - Ok(extend_to_64_bytes(&bytes)) -} - -/// Extend the given byte array to 64 bytes, double the length of the original -/// -/// This is necessary to give a uniform sampling of a field that these bytes are -/// reduced into, the bitlength must be significantly larger than the field's -/// bitlength to avoid sample bias via modular reduction -fn extend_to_64_bytes(bytes: &[u8]) -> [u8; EXTENDED_BYTES] { - let mut extended = [0; EXTENDED_BYTES]; - let top_bytes = keccak256(bytes); - extended[..KECCAK_HASH_BYTES].copy_from_slice(bytes); - extended[KECCAK_HASH_BYTES..].copy_from_slice(&top_bytes); - extended -} - -/// Construct a wallet ID from the given Ethereum keypair -/// -/// This is done to ensure deterministic wallet recovery -pub async fn derive_wallet_id_external( - sign_message: &Function, -) -> Result { - let bytes = get_extended_sig_bytes_external(WALLET_ID_MESSAGE, sign_message).await?; - let wallet_id = WalletIdentifier::from_slice(&bytes[..WALLET_ID_BYTES]) - .map_err(map_js_error!("Failed to create wallet ID: {}"))?; - - Ok(wallet_id) -} - -pub async fn derive_blinder_seed_external(sign_message: &Function) -> Result { - // Sign the blinder seed message and convert to a scalar - derive_scalar_external(BLINDER_STREAM_SEED_MESSAGE, sign_message).await -} - -/// Construct the share seed for the wallet -pub async fn derive_share_seed_external(sign_message: &Function) -> Result { - // Sign the share seed message and convert to a scalar - derive_scalar_external(SHARE_STREAM_SEED_MESSAGE, sign_message).await -} - -pub async fn derive_sk_match_external(sign_message: &Function) -> Result { - derive_scalar_external(MATCH_KEY_MESSAGE, sign_message).await -} - -pub async fn derive_symmetric_key_external(sign_message: &Function) -> Result { - get_sig_bytes_external(SYMMETRIC_KEY_MESSAGE, sign_message) - .await - .map(HmacKey) -} - -/// Get a `Scalar` from a signature on a message -async fn derive_scalar_external(msg: &[u8], sign_message: &Function) -> Result { - let bytes = get_extended_sig_bytes_external(msg, sign_message).await?; - Ok(Scalar::from(BigUint::from_bytes_be(&bytes))) -} - -/// Sign a message, serialize the signature into bytes, and extend the bytes to -/// support secure reduction into a field -async fn get_extended_sig_bytes_external( - msg: &[u8], - sign_message: &Function, -) -> Result<[u8; EXTENDED_BYTES], JsError> { - let bytes = get_sig_bytes_external(msg, sign_message).await?; - Ok(extend_to_64_bytes(&bytes)) -} - -async fn get_sig_bytes_external( - msg: &[u8], - sign_message: &Function, -) -> Result<[u8; KECCAK_HASH_BYTES], JsError> { - let digest = keccak256(msg); - let digest_hex = format!("0x{}", hex::encode(digest)); - let this = JsValue::null(); - let arg = JsValue::from_str(&digest_hex); - - let sig_promise: Promise = sign_message - .call1(&this, &arg) - .map_err(|e| { - JsError::new(&format!( - "Failed to invoke sign_message: {}", - e.as_string().unwrap_or_default() - )) - })? - .dyn_into() - .map_err(|e| { - JsError::new(&format!( - "Failed to convert Promise to Signature: {}", - e.as_string().unwrap_or_default() - )) - })?; - - let signature = JsFuture::from(sig_promise).await.map_err(|e| { - JsError::new(&format!( - "Failed to get signature: {}", - e.as_string().unwrap_or_default() - )) - })?; - - let sig_hex = signature - .as_string() - .ok_or_else(|| JsError::new("Failed to convert signature to string"))?; - - let bytes = bytes_from_hex_string(&sig_hex)?; - - // Take the keccak hash of the signature to disperse its elements - Ok(keccak256(bytes)) -} diff --git a/wasm/src/common/keychain.rs b/wasm/src/common/keychain.rs deleted file mode 100644 index b01dc95c..00000000 --- a/wasm/src/common/keychain.rs +++ /dev/null @@ -1,215 +0,0 @@ -//! Keychain helpers for the wallet - -use crate::circuit_types::keychain::{ - PublicIdentificationKey, PublicKeyChain, PublicSigningKey, SecretIdentificationKey, - SecretSigningKey, -}; -use crate::helpers::{bytes_from_hex_string, bytes_to_hex_string}; -use crate::{map_js_error, types::Scalar}; -use contracts_common::custom_serde::BytesSerializable; -use derivative::Derivative; -use ethers::{ - core::k256::ecdsa::SigningKey as EthersSigningKey, - types::{Signature, U256}, - utils::keccak256, -}; -use hmac::Mac; -use serde::{Deserialize, Serialize}; -use sha2::Sha256; -use wasm_bindgen::JsError; - -use super::derivation::{derive_sk_root_signing_key, derive_wallet_keychain}; -use super::types::Wallet; - -/// Type alias for the hmac core implementation -type HmacSha256 = hmac::Hmac; - -/// A type representing a symmetric HMAC key -#[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct HmacKey(pub [u8; 32]); -impl HmacKey { - /// Create a new HMAC key from a hex string - pub fn new(hex: &str) -> Result { - Self::from_hex_string(hex) - } - - /// Get the inner bytes - pub fn inner(&self) -> &[u8; 32] { - &self.0 - } - - /// Convert the HMAC key to a hex string - pub fn to_hex_string(&self) -> String { - bytes_to_hex_string(&self.0) - } - - /// Try to convert a hex string to an HMAC key - pub fn from_hex_string(hex: &str) -> Result { - let bytes = bytes_from_hex_string(hex)?; - if bytes.len() != 32 { - return Err(JsError::new(&format!( - "expected 32 byte HMAC key, got {}", - bytes.len() - ))); - } - - let bytes_arr: [u8; 32] = bytes - .try_into() - .map_err(|_| JsError::new("Failed to convert bytes to array"))?; - Ok(Self(bytes_arr)) - } - - /// Compute the HMAC of a message - pub fn compute_mac(&self, msg: &[u8]) -> Vec { - let mut hmac = - HmacSha256::new_from_slice(self.inner()).expect("hmac can handle all slice lengths"); - hmac.update(msg); - hmac.finalize().into_bytes().to_vec() - } - - /// Verify the HMAC of a message - pub fn verify_mac(&self, msg: &[u8], mac: &[u8]) -> bool { - self.compute_mac(msg) == mac - } -} - -/// Represents the private keys a relayer has access to for a given wallet -#[derive(Clone, Debug, Derivative, Serialize, Deserialize)] -#[derivative(PartialEq, Eq)] -pub struct PrivateKeyChain { - /// Optionally the relayer holds sk_root, in which case the relayer has - /// heightened permissions than the standard case - /// - /// We call such a relayer a "super relayer" - pub sk_root: Option, - /// The match private key, authorizes the relayer to match orders for the - /// wallet - pub sk_match: SecretIdentificationKey, - /// The symmetric HMAC key the user has registered with the relayer for API - /// authentication - pub symmetric_key: HmacKey, -} - -impl PrivateKeyChain { - /// Create a new private key chain from a match key and a root key - pub fn new( - sk_match: SecretIdentificationKey, - sk_root: Option, - symmetric_key: HmacKey, - ) -> Self { - Self { - sk_match, - sk_root, - symmetric_key, - } - } - - /// Create a new private key chain without the root key - pub fn new_without_root(sk_match: SecretIdentificationKey, symmetric_key: HmacKey) -> Self { - Self { - sk_match, - sk_root: None, - symmetric_key, - } - } -} - -/// Represents the public and private keys given to the relayer managing a -/// wallet -#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] -pub struct KeyChain { - /// The public keys in the wallet - pub public_keys: PublicKeyChain, - /// The secret keys in the wallet - pub secret_keys: PrivateKeyChain, -} - -impl KeyChain { - /// Increment the keychain nonce - pub fn increment_nonce(&mut self) { - self.public_keys.nonce += Scalar::one(); - } - - /// Get the public root key - pub fn pk_root(&self) -> PublicSigningKey { - self.public_keys.pk_root.clone() - } - - /// Set the public root key - pub fn set_pk_root(&mut self, pk_root: PublicSigningKey) { - self.public_keys.pk_root = pk_root; - } - - /// Get the public match key - pub fn pk_match(&self) -> PublicIdentificationKey { - self.public_keys.pk_match - } - - /// Get the secret root key - pub fn sk_root(&self) -> Option { - self.secret_keys.sk_root.clone() - } - - /// Get the secret match key - pub fn sk_match(&self) -> SecretIdentificationKey { - self.secret_keys.sk_match - } - - /// Get the symmetric key - pub fn symmetric_key(&self) -> HmacKey { - self.secret_keys.symmetric_key - } - - /// Get the next rotated keychain's public key without modifying the current keychain - pub fn get_next_rotated_public_key(&self, seed: &str) -> Result { - let next_nonce = self.public_keys.nonce + Scalar::one(); - let sk_root = derive_sk_root_signing_key(seed, Some(&next_nonce))?; - let rotated_keychain = derive_wallet_keychain(&sk_root)?; - Ok(rotated_keychain.public_keys.pk_root) - } - - // Rotate the keychain by incrementing the nonce and re-deriving the keys - pub fn rotate(&mut self, seed: &str) -> Result<(), JsError> { - self.increment_nonce(); - let nonce = self.public_keys.nonce; - - let sk_root = derive_sk_root_signing_key(seed, Some(&nonce))?; - let rotated_keychain = derive_wallet_keychain(&sk_root)?; - self.set_pk_root(rotated_keychain.public_keys.pk_root); - self.secret_keys.sk_root = rotated_keychain.secret_keys.sk_root; - Ok(()) - } -} - -/// Error message emitted when the wallet does not have an `sk_root` value -const ERR_NO_SK_ROOT: &str = "wallet does not have an `sk_root` value"; - -impl Wallet { - /// Sign a wallet transition commitment with the wallet's keychain - /// - /// The contracts expect a recoverable signature with the recover ID set to - /// 0/1; we use ethers `sign_prehash_recoverable` to generate this signature - pub fn sign_commitment(&self, commitment: Scalar) -> Result { - // Fetch the `sk_root` key - let root_key = self - .key_chain - .secret_keys - .sk_root - .as_ref() - .ok_or(JsError::new(ERR_NO_SK_ROOT))?; - let key = EthersSigningKey::try_from(root_key)?; - - // Hash the message and sign it - let comm_bytes = commitment.inner().serialize_to_bytes(); - let digest = keccak256(comm_bytes); - let (sig, recovery_id) = key - .sign_prehash_recoverable(&digest) - .map_err(map_js_error!("failed to sign commitment: {}"))?; - - Ok(Signature { - r: U256::from_big_endian(&sig.r().to_bytes()), - s: U256::from_big_endian(&sig.s().to_bytes()), - v: recovery_id.to_byte() as u64, - }) - } -} diff --git a/wasm/src/common/keyed_list.rs b/wasm/src/common/keyed_list.rs deleted file mode 100644 index abffdd6c..00000000 --- a/wasm/src/common/keyed_list.rs +++ /dev/null @@ -1,201 +0,0 @@ -//! The keyed list type provides a map-like interface that maintains the order -//! in which elements were added to the structure -//! -//! This is useful when indexing wallet information, the order of which changes -//! the commitment. We need to maintain the order of e.g. balances to ensure -//! that the locally stored wallet commits to the one on-chain - -use serde::{Deserialize, Serialize}; - -/// The ordered map type, a map-like interface that maintains insertion order -/// -/// Duplicate keys are explicitly _allowed_, though some setter methods allow -/// the caller to enforce a unique key. Some `get` methods short circuit, i.e. -/// they will return the first of such duplicate keys -#[derive(Clone, Debug, Serialize, Deserialize, Default, PartialEq, Eq)] -pub struct KeyedList { - /// The underlying store of keys and values - /// - /// Currently we only use the `KeyedList` for very small maps; for which a - /// vector is simpler and faster than a hash based structure - elems: Vec<(K, V)>, -} - -impl KeyedList { - /// Constructor - pub fn new() -> Self { - Self { elems: Vec::new() } - } - - // ----------- - // | Getters | - // ----------- - - /// Returns whether the number of elements is zero - pub fn is_empty(&self) -> bool { - self.elems.len() == 0 - } - - /// Returns the length of the map - pub fn len(&self) -> usize { - self.elems.len() - } - - /// Checks if the map contains the given key - pub fn contains_key(&self, key: &K) -> bool { - self.elems.iter().any(|(k, _)| k == key) - } - - /// Get the first key-value pair - pub fn first(&self) -> Option<&(K, V)> { - self.elems.first() - } - - /// Returns a reference to the value corresponding to the key - pub fn get(&self, key: &K) -> Option<&V> { - self.elems.iter().find_map(|(k, v)| (k == key).then_some(v)) - } - - /// Returns a mutable reference to the corresponding key and value - pub fn get_mut(&mut self, key: &K) -> Option<&mut V> { - self.elems - .iter_mut() - .find_map(|(k, v)| (k == key).then_some(v)) - } - - /// Returns the index of the value if it exists - pub fn index_of(&self, key: &K) -> Option { - self.elems.iter().position(|(k, _)| k == key) - } - - /// Get a borrowed reference to the value at the given index - pub fn get_index(&self, index: usize) -> Option<&V> { - self.elems.get(index).map(|(_, v)| v) - } - - /// Get a borrowed reference to the kv pair at the given index - pub fn get_index_full(&self, index: usize) -> Option<&(K, V)> { - self.elems.get(index) - } - - /// Get a mutable reference to the value at the given index - pub fn get_index_mut(&mut self, index: usize) -> Option<&mut V> { - self.elems.get_mut(index).map(|(_, v)| v) - } - - /// Get a mutable reference to the key and value at the given index - pub fn get_index_full_mut(&mut self, index: usize) -> Option<&mut (K, V)> { - self.elems.get_mut(index) - } - - /// Returns an iterator over the keys and values. The iterator yields - /// elements in the order they were inserted into the map. - pub fn iter(&self) -> impl Iterator { - self.elems.iter() - } - - /// Returns an iterator over the map that allows modifying each value. - pub fn iter_mut(&mut self) -> impl Iterator { - self.elems.iter_mut() - } - - /// Returns an iterator over borrowed keys - pub fn keys(&self) -> impl Iterator { - self.elems.iter().map(|(k, _)| k) - } - - /// Returns an iterator over the keys of a map that takes ownership of the - /// keys - pub fn into_keys(self) -> impl Iterator { - self.elems.into_iter().map(|(k, _)| k) - } - - /// Returns an iterator over borrowed values - pub fn values(&self) -> impl Iterator { - self.elems.iter().map(|(_, v)| v) - } - - /// Returns an iterator over the values of the map that takes ownership of - /// the values - pub fn into_values(self) -> impl Iterator { - self.elems.into_iter().map(|(_, v)| v) - } - - // ----------- - // | Setters | - // ----------- - - /// Inserts a key-value pair into the map - /// - /// If the map did not have this key present, `None` is returned. - /// - /// If the map did have this key present, the value is updated, and the old - /// value is returned. - pub fn insert(&mut self, key: K, value: V) -> Option { - match self.index_of(&key) { - Some(idx) => { - let old_value = self.elems[idx].1.clone(); - self.elems[idx].1 = value; - - Some(old_value) - } - None => { - self.elems.push((key, value)); - None - } - } - } - - /// Append a value to the elements, do not check if the key is already - /// present - pub fn append(&mut self, key: K, value: V) { - self.elems.push((key, value)); - } - - /// Insert a key-value pair at a specific index - pub fn insert_at_index(&mut self, index: usize, key: K, value: V) { - self.elems.insert(index, (key, value)); - } - - /// Replace the key-value pair at the given index - pub fn replace_at_index(&mut self, index: usize, key: K, value: V) { - self.elems[index] = (key, value); - } - - /// Removes a key from the map, returning the value at the key if the key - /// was previously in the map. - pub fn remove(&mut self, key: &K) -> Option { - let index = self.index_of(key)?; - Some(self.elems.remove(index).1) - } - - /// Retain only those elements that satisfy the predicate - pub fn retain(&mut self, mut f: F) - where - F: FnMut(&K, &V) -> bool, - { - self.elems.retain(|(k, v)| f(k, v)); - } - - /// Clears the map, removing all key-value pairs. - pub fn clear(&mut self) { - self.elems.clear() - } -} - -/// This `FromIterator` method allows duplicates -impl FromIterator<(K, V)> for KeyedList { - fn from_iter>(iter: I) -> Self { - let elems = iter.into_iter().collect(); - KeyedList { elems } - } -} - -impl IntoIterator for KeyedList { - type Item = (K, V); - type IntoIter = std::vec::IntoIter<(K, V)>; - - fn into_iter(self) -> Self::IntoIter { - self.elems.into_iter() - } -} diff --git a/wasm/src/common/mod.rs b/wasm/src/common/mod.rs deleted file mode 100644 index e4731802..00000000 --- a/wasm/src/common/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod balances; -pub mod derivation; -pub mod keychain; -pub mod keyed_list; -pub mod orders; -pub mod types; diff --git a/wasm/src/common/orders.rs b/wasm/src/common/orders.rs deleted file mode 100644 index 8a64bf31..00000000 --- a/wasm/src/common/orders.rs +++ /dev/null @@ -1,88 +0,0 @@ -//! Wallet helpers for orders in the wallet - -use itertools::Itertools; -use wasm_bindgen::JsError; - -use crate::{circuit_types::order::Order, MAX_ORDERS}; - -use super::types::{OrderIdentifier, Wallet}; - -/// Error message emitted when the orders of a wallet are full -const ERR_ORDERS_FULL: &str = "orders full"; - -impl Wallet { - // ----------- - // | Getters | - // ----------- - - /// Get the given order - pub fn get_order(&self, order_id: &OrderIdentifier) -> Option<&Order> { - self.orders.get(order_id) - } - - /// Get a mutable reference to the given order - pub fn get_order_mut(&mut self, order_id: &OrderIdentifier) -> Option<&mut Order> { - self.orders.get_mut(order_id) - } - - /// Get a list of orders in order in their circuit representation - pub fn get_orders_list(&self) -> Result<[Order; MAX_ORDERS], JsError> { - self.orders - .clone() - .into_values() - .chain(std::iter::repeat(Order::default())) - .take(MAX_ORDERS) - .collect::>() - .try_into() - .map_err(|_| JsError::new("Failed to convert orders to fixed-size array")) - } - - /// Get the list of orders that are eligible for matching - /// - /// An order is ready to match if it is non-zero and has a non-zero sell - /// balance backing it - pub fn get_matchable_orders(&self) -> Vec<(OrderIdentifier, Order)> { - self.orders - .iter() - .filter(|(_id, order)| { - let send_mint = order.send_mint(); - let has_balance = match self.get_balance(send_mint) { - Some(balance) => balance.amount > 0, - None => false, - }; - - !order.is_zero() && has_balance - }) - .cloned() - .collect_vec() - } - - // ----------- - // | Setters | - // ----------- - - /// Add an order to the wallet, replacing the first default order if the - /// wallet is full - pub fn add_order(&mut self, id: OrderIdentifier, order: Order) -> Result<(), JsError> { - // Append if the orders are not full - if let Some(index) = self.find_first_replaceable_order() { - self.orders.replace_at_index(index, id, order); - } else if self.orders.len() < MAX_ORDERS { - self.orders.append(id, order) - } else { - return Err(JsError::new(ERR_ORDERS_FULL)); - } - - Ok(()) - } - - /// Find the first default order in the wallet - fn find_first_replaceable_order(&self) -> Option { - self.orders.iter().position(|(_, order)| order.is_zero()) - } - - /// Remove an order from the wallet, replacing it with a default order - pub fn remove_order(&mut self, id: &OrderIdentifier) -> Option { - self.orders.remove(id) - } -} diff --git a/wasm/src/common/types.rs b/wasm/src/common/types.rs deleted file mode 100644 index a0d135b4..00000000 --- a/wasm/src/common/types.rs +++ /dev/null @@ -1,197 +0,0 @@ -use std::str::FromStr; - -use super::{keychain::KeyChain, keyed_list::KeyedList}; -use crate::{ - circuit_types::{ - balance::Balance, - compute_wallet_share_commitment, create_wallet_shares_from_private, - create_wallet_shares_with_randomness, - elgamal::EncryptionKey, - fixed_point::FixedPoint, - order::Order, - wallet::{Nullifier, WalletShareStateCommitment}, - SizedWallet as SizedCircuitWallet, - }, - helpers::{compute_poseidon_hash, evaluate_hash_chain, PoseidonCSPRNG}, - types::Scalar, - CLUSTER_SYMMETRIC_KEY_LENGTH, MAX_BALANCES, MAX_ORDERS, NUM_SCALARS, -}; -use derivative::Derivative; -use itertools::Itertools; -use num_bigint::BigUint; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use wasm_bindgen::JsError; - -/// A type alias for the wallet identifier type, currently a UUID -pub type WalletIdentifier = Uuid; -/// An identifier of an order used for caching -pub type OrderIdentifier = Uuid; -/// The type representing a cluster's symmetric key -pub type SymmetricAuthKey = [u8; CLUSTER_SYMMETRIC_KEY_LENGTH]; - -/// Represents a wallet managed by the local relayer -#[derive(Clone, Debug, Serialize, Derivative, Deserialize)] -#[derivative(PartialEq)] -pub struct Wallet { - /// The identifier used to index the wallet - pub wallet_id: WalletIdentifier, - /// A list of orders in this wallet - /// - /// We use an `IndexMap` here to preserve the order of insertion - /// on the orders. This is necessary because we must have - /// order parity with the secret shared wallet stored on-chain - pub orders: KeyedList, - /// A mapping of mint to Balance information - pub balances: KeyedList, - /// The keys that the relayer has access to for this wallet - pub key_chain: KeyChain, - /// The wallet blinder, used to blind secret shares the wallet holds - pub blinder: Scalar, - /// The match fee that the owner has authorized the relayer to take - pub match_fee: FixedPoint, - /// The key of the cluster that the wallet has delegated management to - pub managing_cluster: EncryptionKey, - // TODO: BigUint vs. Scalar, what do helper functions expect? - /// The private secret shares of the wallet - pub private_shares: Vec, - /// The public secret shares of the wallet - pub blinded_public_shares: Vec, -} - -impl TryFrom for SizedCircuitWallet { - type Error = JsError; - - fn try_from(wallet: Wallet) -> Result { - Ok(SizedCircuitWallet { - balances: wallet.get_balances_list()?, - orders: wallet.get_orders_list()?, - keys: wallet.key_chain.public_keys, - match_fee: wallet.match_fee, - managing_cluster: wallet.managing_cluster, - blinder: wallet.blinder, - }) - } -} - -impl Wallet { - /// Create a new empty wallet from the given seed information - pub fn new_empty_wallet( - wallet_id: WalletIdentifier, - blinder_seed: Scalar, - share_seed: Scalar, - key_chain: KeyChain, - ) -> Result { - // Create a wallet with dummy shares, compute the shares, then update the wallet - let dummy_shares = vec![Scalar::zero(); 70]; - - let mut wallet = Self { - wallet_id, - orders: KeyedList::new(), - balances: KeyedList::new(), - match_fee: FixedPoint::from_integer(0), - managing_cluster: EncryptionKey::default(), - key_chain, - blinded_public_shares: dummy_shares.clone(), - private_shares: dummy_shares, - blinder: Scalar::zero(), - }; - - // Cast the wallet to a circuit type to use the circuit helpers - let circuit_wallet: SizedCircuitWallet = wallet.clone().try_into()?; - - // Sample blinders and private shares - let mut blinder_csprng = PoseidonCSPRNG::new(blinder_seed); - let (blinder, blinder_private) = blinder_csprng - .next_tuple() - .ok_or(JsError::new("Failed to generate blinder tuple"))?; - - let share_csprng = PoseidonCSPRNG::new(share_seed); - let private_shares = share_csprng.take(NUM_SCALARS).collect_vec(); - - let (private_shares, blinded_public_shares) = create_wallet_shares_with_randomness( - &circuit_wallet, - blinder, - blinder_private, - private_shares, - ); - wallet.private_shares = private_shares; - wallet.blinded_public_shares = blinded_public_shares; - wallet.blinder = blinder; - - Ok(wallet) - } - - /// Compute the commitment to the full wallet shares - pub fn get_wallet_share_commitment(&self) -> WalletShareStateCommitment { - compute_wallet_share_commitment::( - &self.blinded_public_shares, - &self.private_shares, - ) - } - - /// Compute the wallet nullifier - pub fn get_wallet_nullifier(&self) -> Nullifier { - compute_poseidon_hash(&[self.get_wallet_share_commitment(), self.blinder]) - } - - // ----------- - // | Setters | - // ----------- - - /// Reblind the wallet, consuming the next set of blinders and secret shares - pub fn reblind_wallet(&mut self) -> Result<(), JsError> { - let private_shares_serialized: Vec = self.private_shares.clone(); - - // Sample a new blinder and private secret share - let n_shares = private_shares_serialized.len(); - let blinder_and_private_share = - evaluate_hash_chain(private_shares_serialized[n_shares - 1], 2 /* length */); - let new_blinder = blinder_and_private_share[0]; - let new_blinder_private_share = blinder_and_private_share[1]; - - // Sample new secret shares for the wallet - let mut new_private_shares = - evaluate_hash_chain(private_shares_serialized[n_shares - 2], n_shares - 1); - new_private_shares.push(new_blinder_private_share); - - let circuit_wallet: SizedCircuitWallet = self.clone().try_into()?; - let (new_private_share, new_public_share) = - create_wallet_shares_from_private(&circuit_wallet, &new_private_shares, new_blinder); - - self.private_shares = new_private_share; - self.blinded_public_shares = new_public_share; - self.blinder = new_blinder; - Ok(()) - } -} - -/// The chain environment -#[derive(Copy, Clone, Debug)] -pub enum Chain { - /// The Arbitrum Sepolia chain - ArbitrumSepolia, - /// The Arbitrum One chain - ArbitrumOne, - /// The Base Sepolia chain - BaseSepolia, - /// The Base Mainnet chain - BaseMainnet, - /// Any local devnet chain - Devnet, -} - -impl FromStr for Chain { - type Err = JsError; - - fn from_str(s: &str) -> Result { - match s.to_lowercase().as_str() { - "arbitrum-sepolia" => Ok(Chain::ArbitrumSepolia), - "arbitrum-one" => Ok(Chain::ArbitrumOne), - "base-sepolia" => Ok(Chain::BaseSepolia), - "base-mainnet" => Ok(Chain::BaseMainnet), - "devnet" => Ok(Chain::Devnet), - _ => Err(JsError::new(&format!("Invalid chain: {s}"))), - } - } -} diff --git a/wasm/src/errors.rs b/wasm/src/errors.rs deleted file mode 100644 index 800af1b2..00000000 --- a/wasm/src/errors.rs +++ /dev/null @@ -1,22 +0,0 @@ -/// Errors generated when converting between relayer and smart contract types -#[derive(Clone, Debug)] -pub enum ConversionError { - /// Error thrown when a variable-length input - /// can't be coerced into a fixed-length array - InvalidLength, - /// Error thrown when converting between uint types - InvalidUint, -} - -impl std::fmt::Display for ConversionError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{:?}", self) - } -} - -#[macro_export] -macro_rules! map_js_error { - ($fmt:expr $(, $($arg:tt)*)?) => { - |e| wasm_bindgen::JsError::new(&format!($fmt $(, $($arg)*)?, e)) - } -} diff --git a/wasm/src/external_api/auth/auth_helpers.rs b/wasm/src/external_api/auth/auth_helpers.rs deleted file mode 100644 index 12902468..00000000 --- a/wasm/src/external_api/auth/auth_helpers.rs +++ /dev/null @@ -1,82 +0,0 @@ -use crate::{common::keychain::HmacKey, map_js_error}; -use base64::engine::{general_purpose as b64_general_purpose, Engine}; -use std::collections::HashMap; -use wasm_bindgen::prelude::*; - -/// The header namespace to include in the HMAC -const RENEGADE_HEADER_NAMESPACE: &str = "x-renegade"; - -#[wasm_bindgen] -pub fn create_request_signature( - path: &str, - headers: JsValue, - body: &str, - key: &str, -) -> Result { - let key = HmacKey::from_hex_string(key)?; - let body_bytes = body.as_bytes(); - - let headers: HashMap = serde_wasm_bindgen::from_value(headers) - .map_err(map_js_error!("Failed to deserialize headers: {}"))?; - let mac = _create_request_signature(path, &headers, body_bytes, &key); - Ok(b64_general_purpose::STANDARD_NO_PAD.encode(mac)) -} - -/// Create a request signature -fn _create_request_signature( - path: &str, - headers: &HashMap, - body: &[u8], - key: &HmacKey, -) -> Vec { - // Compute the expected HMAC - let path_bytes = path.as_bytes(); - let header_bytes = get_header_bytes(headers); - let payload = [path_bytes, &header_bytes, body].concat(); - - key.compute_mac(&payload) -} - -/// Get the header bytes to validate in an HMAC -fn get_header_bytes(headers: &HashMap) -> Vec { - let mut headers_buf = Vec::new(); - - // Filter out non-Renegade headers and the auth header - let mut renegade_headers: Vec<_> = headers - .iter() - .filter_map(|(k, v)| { - let key = k.to_lowercase(); - if key.starts_with(RENEGADE_HEADER_NAMESPACE) && key != super::RENEGADE_AUTH_HEADER_NAME - { - Some((key, v)) - } else { - None - } - }) - .collect(); - - // Sort alphabetically, then add to the buffer - renegade_headers.sort_by(|a, b| a.0.cmp(&b.0)); - for (key, value) in renegade_headers { - headers_buf.extend_from_slice(key.as_bytes()); - headers_buf.extend_from_slice(value.as_bytes()); - } - - headers_buf -} - -#[wasm_bindgen] -pub fn b64_to_hex_hmac_key(b64_key: &str) -> Result { - // Decode the base64 string to bytes - let key_bytes = b64_general_purpose::STANDARD - .decode(b64_key) - .map_err(map_js_error!("Failed to decode base64 key: {}"))?; - - // Create an HmacKey from the decoded bytes - let hmac_key: [u8; 32] = key_bytes - .try_into() - .map_err(|_| JsError::new("Invalid key length"))?; - - // Convert the HmacKey to a hex string - Ok(hex::encode(hmac_key)) -} diff --git a/wasm/src/external_api/auth/mod.rs b/wasm/src/external_api/auth/mod.rs deleted file mode 100644 index 9deaf8d1..00000000 --- a/wasm/src/external_api/auth/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -mod auth_helpers; - -/// Header name for the HTTP auth signature; lower cased -pub const RENEGADE_AUTH_HEADER_NAME: &str = "x-renegade-auth"; -/// Header name for the expiration timestamp of a signature; lower cased -pub const RENEGADE_SIG_EXPIRATION_HEADER_NAME: &str = "x-renegade-auth-expiration"; diff --git a/wasm/src/external_api/create_wallet.rs b/wasm/src/external_api/create_wallet.rs deleted file mode 100644 index ae4dff68..00000000 --- a/wasm/src/external_api/create_wallet.rs +++ /dev/null @@ -1,96 +0,0 @@ -use wasm_bindgen::prelude::*; - -use crate::{ - common::types::Wallet, external_api::http::CreateWalletRequest, map_js_error, serialize_to_js, - types::scalar_to_biguint, -}; -use uuid::Uuid; - -use crate::{ - circuit_types::keychain::{PublicKeyChain, PublicSigningKey, SecretIdentificationKey}, - common::keychain::{HmacKey, KeyChain, PrivateKeyChain}, - helpers::{biguint_from_hex_string, bytes_from_hex_string}, - types::Scalar, -}; - -#[wasm_bindgen] -pub async fn create_external_wallet( - wallet_id: &str, - blinder_seed: &str, - share_seed: &str, - pk_root: &str, - sk_match: &str, - symmetric_key: &str, -) -> Result { - let params = CreateWalletParameters::new( - wallet_id, - blinder_seed, - share_seed, - pk_root, - sk_match, - symmetric_key, - )?; - - let wallet = Wallet::new_empty_wallet( - params.wallet_id, - params.blinder_seed, - params.share_seed, - params.key_chain, - )?; - - let api_wallet = wallet.try_into()?; - let request = CreateWalletRequest { - wallet: api_wallet, - blinder_seed: scalar_to_biguint(¶ms.blinder_seed), - }; - - serialize_to_js!(request) -} - -pub struct CreateWalletParameters { - pub wallet_id: Uuid, - pub blinder_seed: Scalar, - pub share_seed: Scalar, - pub key_chain: KeyChain, -} - -impl CreateWalletParameters { - pub fn new( - wallet_id: &str, - blinder_seed: &str, - share_seed: &str, - pk_root: &str, - sk_match: &str, - symmetric_key: &str, - ) -> Result { - // Wallet seed info - let wallet_id = Uuid::parse_str(wallet_id).map_err(map_js_error!("wallet_id: {}"))?; - let blinder_seed_bigint = biguint_from_hex_string(blinder_seed)?; - let blinder_seed = Scalar::from(blinder_seed_bigint); - let share_seed_bigint = biguint_from_hex_string(share_seed)?; - let share_seed = Scalar::from(share_seed_bigint); - - // KeyChain - let sk_match_bigint = biguint_from_hex_string(sk_match)?; - let sk_match_scalar = Scalar::from(sk_match_bigint); - let sk_match = SecretIdentificationKey::from(sk_match_scalar); - let pk_match = sk_match.get_public_key(); - let pk_root_bytes = bytes_from_hex_string(pk_root)?; - let pk_root = PublicSigningKey::from_bytes(&pk_root_bytes)?; - let symmetric_key = HmacKey::from_hex_string(symmetric_key)?; - let key_chain = KeyChain { - public_keys: PublicKeyChain::new(pk_root, pk_match), - secret_keys: PrivateKeyChain { - sk_root: None, - sk_match, - symmetric_key, - }, - }; - Ok(Self { - wallet_id, - blinder_seed, - share_seed, - key_chain, - }) - } -} diff --git a/wasm/src/external_api/find_wallet.rs b/wasm/src/external_api/find_wallet.rs deleted file mode 100644 index 2df84f37..00000000 --- a/wasm/src/external_api/find_wallet.rs +++ /dev/null @@ -1,88 +0,0 @@ -use num_bigint::BigUint; -use uuid::Uuid; -use wasm_bindgen::prelude::*; - -use crate::{ - circuit_types::keychain::{PublicKeyChain, PublicSigningKey, SecretIdentificationKey}, - common::keychain::{HmacKey, KeyChain, PrivateKeyChain}, - external_api::http::FindWalletRequest, - helpers::{biguint_from_hex_string, bytes_from_hex_string}, - map_js_error, serialize_to_js, - types::Scalar, -}; - -use super::types::ApiKeychain; - -#[wasm_bindgen] -pub async fn find_external_wallet( - wallet_id: &str, - blinder_seed: &str, - share_seed: &str, - pk_root: &str, - sk_match: &str, - symmetric_key: &str, -) -> Result { - let params = FindWalletParameters::new( - wallet_id, - blinder_seed, - share_seed, - pk_root, - sk_match, - symmetric_key, - )?; - - let request = FindWalletRequest { - wallet_id: params.wallet_id, - blinder_seed: params.blinder_seed, - secret_share_seed: params.share_seed, - private_keychain: params.key_chain.private_keys, - }; - - serialize_to_js!(request) -} -pub struct FindWalletParameters { - pub wallet_id: Uuid, - pub blinder_seed: BigUint, - pub share_seed: BigUint, - pub key_chain: ApiKeychain, -} - -impl FindWalletParameters { - pub fn new( - wallet_id: &str, - blinder_seed: &str, - share_seed: &str, - pk_root: &str, - sk_match: &str, - symmetric_key: &str, - ) -> Result { - // Wallet seed info - let wallet_id = - Uuid::parse_str(wallet_id).map_err(map_js_error!("Invalid wallet_id: {}"))?; - let blinder_seed = biguint_from_hex_string(blinder_seed)?; - let share_seed = biguint_from_hex_string(share_seed)?; - - // KeyChain - let sk_match_bigint = biguint_from_hex_string(sk_match)?; - let sk_match_scalar = Scalar::from(sk_match_bigint); - let sk_match = SecretIdentificationKey::from(sk_match_scalar); - let pk_match = sk_match.get_public_key(); - let pk_root_bytes = bytes_from_hex_string(pk_root)?; - let pk_root = PublicSigningKey::from_bytes(&pk_root_bytes)?; - let symmetric_key = HmacKey::from_hex_string(symmetric_key)?; - let key_chain = KeyChain { - public_keys: PublicKeyChain::new(pk_root, pk_match), - secret_keys: PrivateKeyChain { - sk_root: None, - sk_match, - symmetric_key, - }, - }; - Ok(Self { - wallet_id, - blinder_seed, - share_seed, - key_chain: key_chain.try_into()?, - }) - } -} diff --git a/wasm/src/external_api/http.rs b/wasm/src/external_api/http.rs deleted file mode 100644 index f5bb94eb..00000000 --- a/wasm/src/external_api/http.rs +++ /dev/null @@ -1,822 +0,0 @@ -#![allow(clippy::too_many_arguments)] - -use std::str::FromStr; - -use super::types::{ - ApiOrder, ApiOrderType, ApiPrivateKeychain, ApiWallet, SignedExternalQuote, - SponsoredQuoteResponse, -}; -use crate::{ - circuit_types::{balance::Balance, fixed_point::FixedPoint, order::OrderSide, Amount}, - common::{ - derivation::{derive_sk_root_signing_key, derive_wallet_from_key}, - types::{Chain, WalletIdentifier}, - }, - helpers::{ - biguint_from_hex_string, deserialize_biguint_from_hex_string, deserialize_wallet, - serialize_biguint_to_hex_string, - }, - key_rotation::handle_key_rotation, - map_js_error, - signature::{sign_wallet_commitment, sign_withdrawal_authorization}, -}; -use ethers::types::Bytes; -use js_sys::Function; -use num_bigint::BigUint; -use num_traits::ToPrimitive; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use wasm_bindgen::prelude::*; - -/// Error message displayed when a given order cannot be found -const ERR_ORDER_NOT_FOUND: &str = "order not found"; - -/// The type encapsulating a wallet update's authorization parameters -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct WalletUpdateAuthorization { - /// A signature of the circuit statement used in the proof of - /// VALID WALLET UPDATE by `sk_root`. This allows the contract - /// to guarantee that the wallet updates are properly authorized - pub statement_sig: Vec, - /// The new public root key to rotate to if desired by the client - /// - /// Hex encoded - pub new_root_key: Option, -} - -/// The request type to create a new wallet -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct CreateWalletRequest { - /// The wallet info to be created - pub wallet: ApiWallet, - /// The seed for the wallet's blinder CSPRNG - pub blinder_seed: BigUint, -} - -#[wasm_bindgen] -pub fn create_wallet(seed: &str) -> Result { - let sk_root = derive_sk_root_signing_key(seed, None)?; - let (mut wallet, blinder_seed, _) = derive_wallet_from_key(&sk_root)?; - wallet.key_chain.private_keys.delete_sk_root(); - let req = CreateWalletRequest { - wallet, - blinder_seed: blinder_seed.to_biguint(), - }; - - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type to find a wallet in contract storage and begin managing it -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct FindWalletRequest { - /// The ID to handle the wallet by - pub wallet_id: WalletIdentifier, - /// The seed for the wallet's blinder CSPRNG - pub blinder_seed: BigUint, - /// The seed for the wallet's secret share CSPRNG - pub secret_share_seed: BigUint, - /// The private keychain to use for management after the wallet is found - pub private_keychain: ApiPrivateKeychain, -} - -#[wasm_bindgen] -pub fn find_wallet(seed: &str) -> Result { - let sk_root = derive_sk_root_signing_key(seed, None)?; - let (mut wallet, blinder_seed, share_seed) = derive_wallet_from_key(&sk_root)?; - wallet.key_chain.private_keys.delete_sk_root(); - let req = FindWalletRequest { - wallet_id: wallet.id, - blinder_seed: blinder_seed.to_biguint(), - secret_share_seed: share_seed.to_biguint(), - // TODO: Remove sk_root - private_keychain: wallet.key_chain.private_keys, - }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type to deposit a balance into the darkpool -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct DepositBalanceRequest { - /// The arbitrum account contract address to send the balance from - #[serde( - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub from_addr: BigUint, - /// The mint (ERC-20 contract address) of the token to deposit - #[serde( - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub mint: BigUint, - /// The amount of the token to deposit - pub amount: BigUint, - /// The update authorization parameters - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, - /// The nonce used in the associated Permit2 permit - pub permit_nonce: BigUint, - /// The deadline used in the associated Permit2 permit - pub permit_deadline: BigUint, - /// The signature over the associated Permit2 permit, allowing - /// the contract to guarantee that the deposit is sourced from - /// the correct account - pub permit_signature: Vec, -} - -#[wasm_bindgen] -pub async fn deposit( - seed: Option, - wallet_str: &str, - from_addr: &str, - mint: &str, - amount: &str, - permit_nonce: &str, - permit_deadline: &str, - permit_signature: &str, - new_public_key: Option, - sign_message: Option, -) -> Result { - let mut new_wallet = deserialize_wallet(wallet_str)?; - - let (next_public_key, signing_key) = - handle_key_rotation(&mut new_wallet, seed.as_deref(), new_public_key)?; - - // Modify the wallet - let mint = biguint_from_hex_string(mint)?; - let amount = biguint_from_hex_string(amount)?; - new_wallet.add_balance(Balance::new_from_mint_and_amount( - mint.clone(), - amount - .to_u128() - .ok_or_else(|| JsError::new("Amount too large for u128"))?, - ))?; - new_wallet.reblind_wallet()?; - - // Sign a commitment to the new shares - let statement_sig = - sign_wallet_commitment(&new_wallet, signing_key.as_ref(), sign_message.as_ref()).await?; - - let update_auth = WalletUpdateAuthorization { - statement_sig, - new_root_key: next_public_key, - }; - - let req = DepositBalanceRequest { - from_addr: biguint_from_hex_string(from_addr)?, - mint, - amount, - update_auth, - permit_nonce: biguint_from_hex_string(permit_nonce)?, - permit_deadline: biguint_from_hex_string(permit_deadline)?, - permit_signature: biguint_from_hex_string(permit_signature)?.to_bytes_be(), - }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type to withdraw a balance from the Darkpool -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct WithdrawBalanceRequest { - /// The destination address to withdraw the balance to - #[serde( - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub destination_addr: BigUint, - /// The amount of the token to withdraw - pub amount: BigUint, - /// The authorization parameters for the update - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, - /// A signature over the external transfer, allowing the contract - /// to guarantee that the withdrawal is directed at the correct - /// recipient - pub external_transfer_sig: Vec, -} - -#[wasm_bindgen] -pub async fn withdraw( - chain: &str, - seed: Option, - wallet_str: &str, - mint: &str, - amount: &str, - destination_addr: &str, - new_public_key: Option, - sign_message: Option, -) -> Result { - let mut new_wallet = deserialize_wallet(wallet_str)?; - - let (next_public_key, signing_key) = - handle_key_rotation(&mut new_wallet, seed.as_deref(), new_public_key)?; - - // Modify the wallet - let mint = biguint_from_hex_string(mint)?; - let amount = biguint_from_hex_string(amount)?; - let destination_addr = biguint_from_hex_string(destination_addr)?; - - for (mint, balance) in new_wallet.balances.clone() { - if balance.relayer_fee_balance > 0 { - new_wallet - .get_balance_mut(&mint) - .ok_or_else(|| JsError::new("Balance not found"))? - .relayer_fee_balance = 0; - new_wallet.reblind_wallet()?; - } - - if balance.protocol_fee_balance > 0 { - new_wallet - .get_balance_mut(&mint) - .ok_or_else(|| JsError::new("Balance not found"))? - .protocol_fee_balance = 0; - new_wallet.reblind_wallet()?; - } - } - - new_wallet.withdraw( - &mint, - amount - .to_u128() - .ok_or_else(|| JsError::new("Amount too large for u128"))?, - )?; - new_wallet.reblind_wallet()?; - - // Sign a commitment to the new shares - let statement_sig = - sign_wallet_commitment(&new_wallet, signing_key.as_ref(), sign_message.as_ref()).await?; - - let update_auth = WalletUpdateAuthorization { - statement_sig, - new_root_key: next_public_key, - }; - - let chain = Chain::from_str(chain)?; - - let withdrawal_sig = sign_withdrawal_authorization( - &chain, - signing_key.as_ref(), - mint.clone(), - amount - .to_u128() - .ok_or_else(|| JsError::new("Amount too large for u128"))?, - destination_addr.clone(), - sign_message.as_ref(), - ) - .await?; - - let req = WithdrawBalanceRequest { - amount, - destination_addr, - external_transfer_sig: withdrawal_sig, - update_auth, - }; - - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// Serializes a calldata element for a contract call -pub fn serialize_calldata(t: &T) -> Result { - Ok(postcard::to_allocvec(t)?.into()) -} - -/// The request type to add a new order to a given wallet -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct CreateOrderRequest { - /// The order to be created - pub order: ApiOrder, - /// The authorization parameters for the update - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, -} - -/// The request type to add a new order to a given wallet, within a non-global -/// matching pool -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct CreateOrderInMatchingPoolRequest { - /// The order to be created - pub order: ApiOrder, - /// The update authorization - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, - /// The matching pool to create the order in - pub matching_pool: String, -} - -/// Create an order type from the args -fn create_order( - id: &str, - base_mint: &str, - quote_mint: &str, - side: &str, - amount: &str, - worst_case_price: &str, - min_fill_size: &str, - allow_external_matches: bool, -) -> Result { - // Parse the UUID from the string, or generate a new one if the string is empty - let id = if id.is_empty() { - Uuid::new_v4() - } else { - Uuid::parse_str(id).map_err(map_js_error!("Invalid UUID: {}"))? - }; - - // Convert the side string to OrderSide enum - let side = match side.to_lowercase().as_str() { - "sell" => OrderSide::Sell, - "buy" => OrderSide::Buy, - _ => return Err(JsError::new("Invalid order side")), - }; - - let amount = biguint_from_hex_string(amount)? - .to_u128() - .ok_or_else(|| JsError::new("Amount too large for u128"))?; - - let min_fill_size = biguint_from_hex_string(min_fill_size)? - .to_u128() - .ok_or_else(|| JsError::new("Min fill size too large for u128"))?; - - let worst_case_price = if worst_case_price.is_empty() { - match side { - OrderSide::Sell => FixedPoint::from_integer(0), - OrderSide::Buy => FixedPoint::from_integer(u64::MAX), - } - } else { - worst_case_price - .parse::() - .map_err(map_js_error!("Invalid worst_case_price: {}"))?; - FixedPoint::from_f64_round_down( - worst_case_price - .parse::() - .map_err(map_js_error!("Invalid worst_case_price: {}"))?, - )? - }; - - Ok(ApiOrder { - id, - base_mint: biguint_from_hex_string(base_mint)?, - quote_mint: biguint_from_hex_string(quote_mint)?, - side, - amount, - worst_case_price, - type_: ApiOrderType::Midpoint, - min_fill_size, - allow_external_matches, - }) -} - -pub async fn create_order_request( - seed: Option, - wallet_str: &str, - id: &str, - base_mint: &str, - quote_mint: &str, - side: &str, - amount: &str, - worst_case_price: &str, - min_fill_size: &str, - allow_external_matches: bool, - new_public_key: Option, - sign_message: Option, -) -> Result { - let mut new_wallet = deserialize_wallet(wallet_str)?; - - let (next_public_key, signing_key) = - handle_key_rotation(&mut new_wallet, seed.as_deref(), new_public_key)?; - - let order = create_order( - id, - base_mint, - quote_mint, - side, - amount, - worst_case_price, - min_fill_size, - allow_external_matches, - )?; - - // Modify the wallet - new_wallet.add_order(order.id, order.clone().into())?; - new_wallet.reblind_wallet()?; - - // Sign a commitment to the new shares - let statement_sig = - sign_wallet_commitment(&new_wallet, signing_key.as_ref(), sign_message.as_ref()).await?; - - let update_auth = WalletUpdateAuthorization { - statement_sig, - new_root_key: next_public_key, - }; - - Ok(CreateOrderRequest { order, update_auth }) -} - -#[wasm_bindgen] -pub async fn new_order( - seed: Option, - wallet_str: &str, - id: &str, - base_mint: &str, - quote_mint: &str, - side: &str, - amount: &str, - worst_case_price: &str, - min_fill_size: &str, - allow_external_matches: bool, - new_public_key: Option, - sign_message: Option, -) -> Result { - let req = create_order_request( - seed, - wallet_str, - id, - base_mint, - quote_mint, - side, - amount, - worst_case_price, - min_fill_size, - allow_external_matches, - new_public_key, - sign_message, - ) - .await?; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -#[wasm_bindgen] -pub async fn new_order_in_matching_pool( - seed: Option, - wallet_str: &str, - id: &str, - base_mint: &str, - quote_mint: &str, - side: &str, - amount: &str, - worst_case_price: &str, - min_fill_size: &str, - allow_external_matches: bool, - matching_pool: &str, - new_public_key: Option, - sign_message: Option, -) -> Result { - let create_order_req = create_order_request( - seed, - wallet_str, - id, - base_mint, - quote_mint, - side, - amount, - worst_case_price, - min_fill_size, - allow_external_matches, - new_public_key, - sign_message, - ) - .await?; - let req = CreateOrderInMatchingPoolRequest { - order: create_order_req.order, - update_auth: create_order_req.update_auth, - matching_pool: matching_pool.to_string(), - }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type to cancel a given order -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct CancelOrderRequest { - /// The authorization parameters for the update - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, -} - -#[wasm_bindgen] -pub async fn cancel_order( - seed: Option, - wallet_str: &str, - order_id: &str, - new_public_key: Option, - sign_message: Option, -) -> Result { - let mut new_wallet = deserialize_wallet(wallet_str)?; - - let (next_public_key, signing_key) = - handle_key_rotation(&mut new_wallet, seed.as_deref(), new_public_key)?; - - let order_id = Uuid::parse_str(order_id).map_err(map_js_error!("Invalid UUID: {}"))?; - - // Modify the wallet - new_wallet - .orders - .remove(&order_id) - .ok_or_else(|| JsError::new(ERR_ORDER_NOT_FOUND))?; - - new_wallet.reblind_wallet()?; - - // Sign a commitment to the new shares - let statement_sig = - sign_wallet_commitment(&new_wallet, signing_key.as_ref(), sign_message.as_ref()).await?; - - let update_auth = WalletUpdateAuthorization { - statement_sig, - new_root_key: next_public_key, - }; - - let req = CancelOrderRequest { update_auth }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type to update an order -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct UpdateOrderRequest { - /// The order to be updated - pub order: ApiOrder, - /// The authorization parameters for the update - #[serde(flatten)] - pub update_auth: WalletUpdateAuthorization, -} - -#[wasm_bindgen] -pub async fn update_order( - seed: Option, - wallet_str: &str, - id: &str, - base_mint: &str, - quote_mint: &str, - side: &str, - amount: &str, - worst_case_price: &str, - min_fill_size: &str, - allow_external_matches: bool, - new_public_key: Option, - sign_message: Option, -) -> Result { - let mut new_wallet = deserialize_wallet(wallet_str)?; - - let (next_public_key, signing_key) = - handle_key_rotation(&mut new_wallet, seed.as_deref(), new_public_key)?; - - let new_order = create_order( - id, - base_mint, - quote_mint, - side, - amount, - worst_case_price, - min_fill_size, - allow_external_matches, - )?; - - // Modify the wallet - // We edit the value of the underlying map in-place (as opposed to `pop` and - // `insert`) to maintain ordering of the orders. This is important for - // the circuit, which relies on the order of the orders to be consistent - // between the old and new wallets - let order = new_wallet - .orders - .get_mut(&new_order.id) - .ok_or_else(|| JsError::new(ERR_ORDER_NOT_FOUND))?; - *order = new_order.clone().into(); - new_wallet.reblind_wallet()?; - - // Sign a commitment to the new shares - let statement_sig = - sign_wallet_commitment(&new_wallet, signing_key.as_ref(), sign_message.as_ref()).await?; - - let update_auth = WalletUpdateAuthorization { - statement_sig, - new_root_key: next_public_key, - }; - - let req = UpdateOrderRequest { - order: new_order, - update_auth, - }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type for requesting an external match -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ExternalMatchRequest { - /// Whether or not to include gas estimation in the response - #[serde(default)] - pub do_gas_estimation: bool, - /// The receiver address of the match, if not the message sender - #[serde(default)] - pub receiver_address: Option, - /// The external order - pub external_order: ExternalOrder, -} - -/// An external order -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ExternalOrder { - /// The mint (erc20 address) of the quote token - #[serde( - alias = "quote", - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub quote_mint: BigUint, - /// The mint (erc20 address) of the base token - #[serde( - alias = "base", - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub base_mint: BigUint, - /// The side of the market this order is on - pub side: OrderSide, - /// The base amount of the order - #[serde(default, alias = "amount", alias = "baseAmount")] - pub base_amount: Amount, - /// The quote amount of the order - #[serde(default, alias = "quoteAmount")] - pub quote_amount: Amount, - /// The minimum fill size for the order - #[serde(default)] - pub min_fill_size: Amount, -} - -#[wasm_bindgen] -pub fn new_external_order( - base_mint: &str, - quote_mint: &str, - side: &str, - base_amount: &str, - quote_amount: &str, - min_fill_size: &str, - do_gas_estimation: bool, - receiver_address: &str, -) -> Result { - let external_order = build_external_order( - base_mint, - quote_mint, - side, - base_amount, - quote_amount, - min_fill_size, - )?; - - let receiver_address = if receiver_address.is_empty() { - None - } else { - Some(receiver_address.to_string()) - }; - - let req = ExternalMatchRequest { - do_gas_estimation, - receiver_address, - external_order, - }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type for requesting an external match quote -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ExternalQuoteRequest { - /// The external order - pub external_order: ExternalOrder, -} - -#[wasm_bindgen] -pub fn new_external_quote_request( - base_mint: &str, - quote_mint: &str, - side: &str, - base_amount: &str, - quote_amount: &str, - min_fill_size: &str, -) -> Result { - let external_order = build_external_order( - base_mint, - quote_mint, - side, - base_amount, - quote_amount, - min_fill_size, - )?; - - let req = ExternalQuoteRequest { external_order }; - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -/// The request type for assembling an external match, potentially with gas sponsorship -#[derive(Clone, Serialize, Deserialize)] -pub struct AssembleExternalMatchRequest { - /// Whether or not to include gas estimation in the response - #[serde(default)] - pub do_gas_estimation: bool, - /// Whether or not to allow shared access to the resulting bundle - /// - /// If true, the bundle may be sent to other clients requesting an external - /// match. If false, the bundle will be exclusively held for some time - #[serde(default)] - pub allow_shared: bool, - /// The signed external match quote - pub signed_quote: SignedExternalQuote, - /// The receiver address of the match, if not the message sender - #[serde(default)] - pub receiver_address: Option, - /// The updated order - #[serde(default)] - pub updated_order: Option, -} - -#[wasm_bindgen] -pub fn assemble_external_match( - do_gas_estimation: bool, - allow_shared: bool, - updated_order: &str, - sponsored_quote_response: &str, - receiver_address: &str, -) -> Result { - // Parse the updated order if it exists - let updated_order = if updated_order.is_empty() { - None - } else { - Some( - serde_json::from_str(updated_order) - .map_err(map_js_error!("Failed to parse updated order: {}"))?, - ) - }; - - let receiver_address = if receiver_address.is_empty() { - None - } else { - Some(receiver_address.to_string()) - }; - - let SponsoredQuoteResponse { - quote, signature, .. - } = serde_json::from_str(sponsored_quote_response).map_err(map_js_error!( - "Failed to parse sponsored quote response: {}" - ))?; - - let signed_quote = SignedExternalQuote { quote, signature }; - - let req = AssembleExternalMatchRequest { - do_gas_estimation, - allow_shared, - receiver_address, - updated_order, - signed_quote, - }; - - let serialized = - serde_json::to_string(&req).map_err(map_js_error!("Failed to serialize request: {}"))?; - Ok(JsValue::from_str(&serialized)) -} - -fn build_external_order( - base_mint: &str, - quote_mint: &str, - side: &str, - base_amount: &str, - quote_amount: &str, - min_fill_size: &str, -) -> Result { - let side = match side.to_lowercase().as_str() { - "sell" => OrderSide::Sell, - "buy" => OrderSide::Buy, - _ => return Err(JsError::new("Invalid order side")), - }; - let base_amount = biguint_from_hex_string(base_amount)? - .to_u128() - .ok_or_else(|| JsError::new("Base amount too large for u128"))?; - let quote_amount = biguint_from_hex_string(quote_amount)? - .to_u128() - .ok_or_else(|| JsError::new("Quote amount too large for u128"))?; - - let min_fill_size = biguint_from_hex_string(min_fill_size)? - .to_u128() - .ok_or_else(|| JsError::new("Min fill size too large for u128"))?; - Ok(ExternalOrder { - base_mint: biguint_from_hex_string(base_mint)?, - quote_mint: biguint_from_hex_string(quote_mint)?, - side, - base_amount, - quote_amount, - min_fill_size, - }) -} diff --git a/wasm/src/external_api/mod.rs b/wasm/src/external_api/mod.rs deleted file mode 100644 index 362e2b63..00000000 --- a/wasm/src/external_api/mod.rs +++ /dev/null @@ -1,6 +0,0 @@ -pub mod auth; -pub mod create_wallet; -pub mod find_wallet; -pub mod http; -pub mod types; -pub mod wallet_utils; diff --git a/wasm/src/external_api/types.rs b/wasm/src/external_api/types.rs deleted file mode 100644 index bdc4deb9..00000000 --- a/wasm/src/external_api/types.rs +++ /dev/null @@ -1,429 +0,0 @@ -use itertools::Itertools; -use num_bigint::BigUint; -use serde::{Deserialize, Serialize}; -use uuid::Uuid; -use wasm_bindgen::JsError; - -use crate::{ - circuit_types::{ - balance::Balance, - fixed_point::FixedPoint, - keychain::{PublicIdentificationKey, PublicKeyChain, SecretIdentificationKey}, - order::{Order, OrderSide}, - Amount, - }, - common::{ - keychain::{HmacKey, KeyChain, PrivateKeyChain}, - types::{OrderIdentifier, Wallet}, - }, - helpers::{ - deserialize_biguint_from_hex_string, jubjub_from_hex_string, jubjub_to_hex_string, - nonnative_scalar_from_hex_string, nonnative_scalar_to_hex_string, - public_sign_key_from_hex_string, public_sign_key_to_hex_string, scalar_from_hex_string, - scalar_to_hex_string, serialize_biguint_to_hex_string, - }, - types::{biguint_to_scalar, scalar_to_biguint, scalar_to_u64, Scalar}, -}; - -use super::http::ExternalOrder; - -// -------------------- -// | Wallet API Types | -// -------------------- - -/// The wallet type, holds all balances, orders, metadata, and randomness -/// for a trader -/// -/// Also the unit of commitment in the state tree -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ApiWallet { - /// Identifier - pub id: Uuid, - /// The orders maintained by this wallet - pub orders: Vec, - /// The balances maintained by the wallet to cover orders - pub balances: Vec, - /// The keys that authenticate wallet access - pub key_chain: ApiKeychain, - /// The managing cluster's public key - /// - /// The public encryption key of the cluster that may collect relayer fees - /// on this wallet - pub managing_cluster: String, - /// The take rate at which the managing cluster may collect relayer fees on - /// a match - pub match_fee: FixedPoint, - /// The public secret shares of the wallet - pub blinded_public_shares: Vec, - /// The private secret shares of the wallet - pub private_shares: Vec, - /// The wallet blinder, used to blind wallet secret shares - pub blinder: BigUint, -} - -/// Conversion from a wallet that has been indexed in the global state to the -/// API type -impl TryFrom for ApiWallet { - type Error = JsError; - - fn try_from(wallet: Wallet) -> Result { - // Build API types from the indexed wallet - let orders = wallet - .orders - .into_iter() - .map(|order| order.into()) - .collect_vec(); - let balances = wallet.balances.into_values().collect_vec(); - - // Serialize the shares then convert all values to BigUint - let blinded_public_shares = wallet - .blinded_public_shares - .iter() - .map(scalar_to_biguint) - .collect_vec(); - let private_shares = wallet - .private_shares - .iter() - .map(scalar_to_biguint) - .collect_vec(); - - Ok(Self { - id: wallet.wallet_id, - orders, - balances, - key_chain: wallet.key_chain.try_into()?, - managing_cluster: jubjub_to_hex_string(&wallet.managing_cluster)?, - match_fee: wallet.match_fee, - blinded_public_shares, - private_shares, - blinder: scalar_to_biguint(&wallet.blinder), - }) - } -} - -impl TryFrom for Wallet { - type Error = JsError; - - fn try_from(wallet: ApiWallet) -> Result { - let orders = wallet - .orders - .into_iter() - .map(|order| (order.id, order.into())) - .collect(); - let balances = wallet - .balances - .into_iter() - .map(|balance| (balance.mint.clone(), balance)) - .collect(); - - // Deserialize the shares to scalar then re-structure into WalletSecretShare - let blinded_public_shares: Vec = wallet - .blinded_public_shares - .iter() - .map(biguint_to_scalar) - .collect(); - let private_shares: Vec = wallet - .private_shares - .iter() - .map(biguint_to_scalar) - .collect(); - - let managing_cluster = jubjub_from_hex_string(&wallet.managing_cluster)?; - - Ok(Wallet { - wallet_id: wallet.id, - orders, - balances, - key_chain: wallet.key_chain.try_into()?, - match_fee: wallet.match_fee, - managing_cluster, - blinder: biguint_to_scalar(&wallet.blinder), - blinded_public_shares, - private_shares, - }) - } -} - -/// The order type, represents a trader's intention in the pool -#[derive(Clone, Debug, Default, Serialize, Deserialize)] -pub struct ApiOrder { - /// Identifier - pub id: Uuid, - /// The quote token mint - #[serde( - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub quote_mint: BigUint, - /// The base token mint - #[serde( - serialize_with = "serialize_biguint_to_hex_string", - deserialize_with = "deserialize_biguint_from_hex_string" - )] - pub base_mint: BigUint, - /// The side of the market this order is on - pub side: OrderSide, - /// The type of order - #[serde(rename = "type")] - pub type_: ApiOrderType, - /// The worse case price that the order may be executed at - /// - /// For buy side orders this is a maximum price, for sell side orders - /// this is a minimum price - pub worst_case_price: FixedPoint, - /// The order size - pub amount: Amount, - /// The minimum fill amount - #[serde(default)] - pub min_fill_size: Amount, - /// Whether or not to allow external matches - #[serde(default)] - pub allow_external_matches: bool, -} - -impl From<(OrderIdentifier, Order)> for ApiOrder { - fn from((order_id, order): (OrderIdentifier, Order)) -> Self { - ApiOrder { - id: order_id, - quote_mint: order.quote_mint, - base_mint: order.base_mint, - side: order.side, - type_: ApiOrderType::Midpoint, - worst_case_price: order.worst_case_price, - amount: order.amount, - min_fill_size: order.min_fill_size, - allow_external_matches: order.allow_external_matches, - } - } -} - -impl From for Order { - fn from(order: ApiOrder) -> Self { - Order { - quote_mint: order.quote_mint, - base_mint: order.base_mint, - side: order.side, - worst_case_price: order.worst_case_price, - amount: order.amount, - min_fill_size: order.min_fill_size, - allow_external_matches: order.allow_external_matches, - } - } -} - -/// The type of order, currently limit or midpoint -#[derive(Clone, Default, Debug, Serialize, Deserialize)] -pub enum ApiOrderType { - /// A market-midpoint pegged order - #[default] - Midpoint = 0, - /// A limit order with specified price attached - Limit, -} - -/// A keychain API type that maintains all keys as hex strings, conversion to -/// the runtime keychain type involves deserializing these keys into their -/// native types -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ApiKeychain { - /// The public keychain - pub public_keys: ApiPublicKeychain, - /// The private keychain - pub private_keys: ApiPrivateKeychain, - /// The nonce of the keychain - #[serde(default)] - pub nonce: u64, -} - -/// A public keychain for the API wallet -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ApiPublicKeychain { - /// The public root key of the wallet - pub pk_root: String, - /// The public match key of the wallet - pub pk_match: String, -} - -/// A private keychain for the API wallet -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ApiPrivateKeychain { - /// The private root key of the wallet - pub sk_root: Option, - /// The private match key of the wallet - pub sk_match: String, - /// The symmetric key of the wallet - pub symmetric_key: String, -} - -impl ApiPrivateKeychain { - /// Deletes the sk_root by setting it to None - pub fn delete_sk_root(&mut self) { - self.sk_root = None; - } -} - -impl TryFrom for PrivateKeyChain { - type Error = JsError; - - fn try_from(keys: ApiPrivateKeychain) -> Result { - let sk_root = keys - .sk_root - .clone() - .map(|k| nonnative_scalar_from_hex_string(&k)) - .transpose()?; - - Ok(PrivateKeyChain { - sk_root, - sk_match: SecretIdentificationKey { - key: scalar_from_hex_string(&keys.sk_match)?, - }, - symmetric_key: HmacKey::from_hex_string(&keys.symmetric_key)?, - }) - } -} - -impl TryFrom for ApiKeychain { - type Error = JsError; - - fn try_from(keys: KeyChain) -> Result { - Ok(Self { - public_keys: ApiPublicKeychain { - pk_root: public_sign_key_to_hex_string(&keys.pk_root())?, - pk_match: scalar_to_hex_string(&keys.pk_match().key), - }, - private_keys: ApiPrivateKeychain { - sk_root: keys.sk_root().map(|k| nonnative_scalar_to_hex_string(&k)), - sk_match: scalar_to_hex_string(&keys.sk_match().key), - symmetric_key: keys.symmetric_key().to_hex_string(), - }, - nonce: scalar_to_u64(&keys.public_keys.nonce)?, - }) - } -} - -impl TryFrom for KeyChain { - type Error = JsError; - - fn try_from(keys: ApiKeychain) -> Result { - Ok(KeyChain { - public_keys: PublicKeyChain { - pk_root: public_sign_key_from_hex_string(&keys.public_keys.pk_root)?, - pk_match: PublicIdentificationKey { - key: scalar_from_hex_string(&keys.public_keys.pk_match)?, - }, - nonce: keys.nonce.into(), - }, - secret_keys: PrivateKeyChain::try_from(keys.private_keys)?, - }) - } -} - -// ---------------------------- -// | External Match API Types | -// ---------------------------- - -/// The fee takes from a match -#[derive(Debug, Copy, Clone, Serialize, Deserialize)] -pub struct FeeTake { - /// The fee the relayer takes - pub relayer_fee: Amount, - /// The fee the protocol takes - pub protocol_fee: Amount, -} - -/// An external quote response, potentially with gas sponsorship info. -/// -/// We manually flatten the fields of [`SignedExternalQuote`] since `serde` -/// doesn't support `u128`s when using `#[serde(flatten)]` -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct SponsoredQuoteResponse { - /// The quote - pub quote: ApiExternalQuote, - /// The signature - pub signature: String, - /// The signed gas sponsorship info, if sponsorship was requested - pub gas_sponsorship_info: Option, -} -/// A signed quote for an external order -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct SignedExternalQuote { - /// The quote - pub quote: ApiExternalQuote, - /// The signature - pub signature: String, -} - -/// Signed metadata regarding gas sponsorship for a quote -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct SignedGasSponsorshipInfo { - /// The signed gas sponsorship info - pub gas_sponsorship_info: GasSponsorshipInfo, - /// The auth server's signature over the sponsorship info - #[deprecated(since = "0.0.2", note = "Gas sponsorship info is no longer signed")] - pub signature: String, -} - -/// Metadata regarding gas sponsorship for a quote -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct GasSponsorshipInfo { - /// The amount to be refunded as a result of gas sponsorship. - /// This amount is firm, it will not change when the quote is assembled. - pub refund_amount: u128, - /// Whether the refund is in terms of native ETH. - pub refund_native_eth: bool, - /// The address to which the refund will be sent, if set explicitly. - pub refund_address: Option, -} - -/// A quote for an external order -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ApiExternalQuote { - /// The external order - pub order: ExternalOrder, - /// The match result - pub match_result: ApiExternalMatchResult, - /// The estimated fees for the match - pub fees: FeeTake, - /// The amount sent by the external party - pub send: ApiExternalAssetTransfer, - /// The amount received by the external party, net of fees - pub receive: ApiExternalAssetTransfer, - /// The price of the match - pub price: ApiTimestampedPrice, - /// The timestamp of the quote - pub timestamp: u64, -} - -/// An API server external match result -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ApiExternalMatchResult { - /// The mint of the quote token in the matched asset pair - pub quote_mint: String, - /// The mint of the base token in the matched asset pair - pub base_mint: String, - /// The amount of the quote token exchanged by the match - pub quote_amount: Amount, - /// The amount of the base token exchanged by the match - pub base_amount: Amount, - /// The direction of the match - pub direction: OrderSide, -} - -/// An asset transfer from an external party -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ApiExternalAssetTransfer { - /// The mint of the asset - pub mint: String, - /// The amount of the asset - pub amount: Amount, -} - -/// The price of a quote -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct ApiTimestampedPrice { - /// The price, serialized as a string to prevent floating point precision - /// issues - pub price: String, - /// The timestamp, in milliseconds since the epoch - pub timestamp: u64, -} diff --git a/wasm/src/external_api/wallet_utils.rs b/wasm/src/external_api/wallet_utils.rs deleted file mode 100644 index d5002634..00000000 --- a/wasm/src/external_api/wallet_utils.rs +++ /dev/null @@ -1,37 +0,0 @@ -//! Utility functions for working with wallets - -use itertools::Itertools; -use wasm_bindgen::prelude::*; - -use crate::{ - common::derivation::{derive_blinder_seed, derive_sk_root_signing_key, derive_wallet_id}, - helpers::{deserialize_wallet, PoseidonCSPRNG}, -}; - -#[wasm_bindgen] -pub fn derive_blinder_share(seed: &str) -> Result { - let sk_root = derive_sk_root_signing_key(seed, None)?; - let blinder_seed = derive_blinder_seed(&sk_root)?; - let mut blinder_csprng = PoseidonCSPRNG::new(blinder_seed); - let (blinder, blinder_private) = blinder_csprng - .next_tuple() - .ok_or(JsError::new("Failed to generate blinder tuple"))?; - let blinder_share = blinder - blinder_private; - Ok(JsValue::from_str(&blinder_share.to_biguint().to_string())) -} - -#[wasm_bindgen] -pub fn wallet_id(seed: &str) -> Result { - let sk_root = derive_sk_root_signing_key(seed, None)?; - let wallet_id = derive_wallet_id(&sk_root)?; - Ok(JsValue::from_str(&wallet_id.to_string())) -} - -#[wasm_bindgen] -pub fn wallet_nullifier(wallet_str: &str) -> Result { - let wallet = deserialize_wallet(wallet_str)?; - let nullifier = wallet.get_wallet_nullifier(); - Ok(JsValue::bigint_from_str( - &nullifier.to_biguint().to_string(), - )) -} diff --git a/wasm/src/generation.rs b/wasm/src/generation.rs deleted file mode 100644 index e2da61a4..00000000 --- a/wasm/src/generation.rs +++ /dev/null @@ -1,65 +0,0 @@ -use js_sys::Function; -use serde::Serialize; -use wasm_bindgen::prelude::*; - -use crate::circuit_types::keychain::SecretIdentificationKey; -use crate::common::derivation::derive_blinder_seed_external; -use crate::common::derivation::derive_share_seed_external; -use crate::common::derivation::derive_sk_match_external; -use crate::common::derivation::derive_symmetric_key_external; -use crate::common::derivation::derive_wallet_id_external; -use crate::serialize_to_js; -use crate::{ - circuit_types::scalar_to_hex_string, - common::{keychain::HmacKey, types::WalletIdentifier}, - types::Scalar, -}; - -fn serialize_hmac_key(key: &HmacKey, serializer: S) -> Result -where - S: serde::Serializer, -{ - serializer.serialize_str(&key.to_hex_string()) -} - -#[derive(Serialize)] -pub struct GeneratedSecrets { - #[serde(serialize_with = "serialize_wallet_id")] - pub wallet_id: WalletIdentifier, - #[serde(serialize_with = "scalar_to_hex_string")] - pub blinder_seed: Scalar, - #[serde(serialize_with = "scalar_to_hex_string")] - pub share_seed: Scalar, - #[serde(serialize_with = "serialize_hmac_key")] - pub symmetric_key: HmacKey, - pub sk_match: SecretIdentificationKey, -} - -fn serialize_wallet_id(wallet_id: &WalletIdentifier, serializer: S) -> Result -where - S: serde::Serializer, -{ - serializer.serialize_str(&wallet_id.to_string()) -} - -#[wasm_bindgen] -pub async fn generate_wallet_secrets(sign_message: &Function) -> Result { - let wallet_id = derive_wallet_id_external(sign_message).await?; - let blinder_seed = derive_blinder_seed_external(sign_message).await?; - let share_seed = derive_share_seed_external(sign_message).await?; - - let sk_match = derive_sk_match_external(sign_message).await?; - let sk_match = SecretIdentificationKey::from(sk_match); - - let symmetric_key = derive_symmetric_key_external(sign_message).await?; - - let res = GeneratedSecrets { - wallet_id, - blinder_seed, - share_seed, - symmetric_key, - sk_match, - }; - - serialize_to_js!(res) -} diff --git a/wasm/src/helpers.rs b/wasm/src/helpers.rs deleted file mode 100644 index f1b3b710..00000000 --- a/wasm/src/helpers.rs +++ /dev/null @@ -1,267 +0,0 @@ -use alloy_primitives::{Address, U160}; -use ark_ec::{twisted_edwards::Projective, CurveGroup}; -use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; -use itertools::Itertools; -use k256::ecdsa::SigningKey; -use num_bigint::BigUint; -use num_traits::Num; -use renegade_crypto::hash::Poseidon2Sponge; -use serde::{de::Error as SerdeErr, Deserialize, Deserializer, Serializer}; -use wasm_bindgen::JsError; - -use crate::{ - circuit_types::{ - elgamal::BabyJubJubPoint, - keychain::{NonNativeScalar, PublicSigningKey}, - }, - common::types::Wallet, - external_api::types::ApiWallet, - map_js_error, - types::{biguint_to_scalar, scalar_to_biguint, Scalar}, -}; - -// -------- -// | Hash | -// -------- - -/// Compute the hash of the randomness of a given wallet -pub fn compute_poseidon_hash(values: &[Scalar]) -> Scalar { - let input_seq = values.iter().map(Scalar::inner).collect_vec(); - let mut hasher = Poseidon2Sponge::new(); - let res = hasher.hash(&input_seq); - - Scalar::new(res) -} - -/// Compute a chained Poseidon hash of the given length from the given seed -pub fn evaluate_hash_chain(seed: Scalar, length: usize) -> Vec { - let mut seed = seed.inner(); - let mut res = Vec::with_capacity(length); - - for _ in 0..length { - // Create a new hasher to reset the internal state - let mut hasher = Poseidon2Sponge::new(); - seed = hasher.hash(&[seed]); - - res.push(Scalar::new(seed)); - } - - res -} - -/// A hash chain from a seed used to compute CSPRNG values -pub struct PoseidonCSPRNG { - /// The seed of the CSPRNG, this is chained into a hash function - /// to give pseudorandom values - state: Scalar, -} - -impl PoseidonCSPRNG { - /// Constructor - pub fn new(seed: Scalar) -> Self { - Self { state: seed } - } -} - -impl Iterator for PoseidonCSPRNG { - type Item = Scalar; - - fn next(&mut self) -> Option { - let hash_res = compute_poseidon_hash(&[self.state]); - self.state = hash_res; - - Some(hash_res) - } -} - -// ------- -// | Hex | -// ------- - -/// Convert a byte array to a hex string -pub fn bytes_to_hex_string(bytes: &[u8]) -> String { - let encoded = hex::encode(bytes); - format!("0x{encoded}") -} - -/// Convert a hex string to a byte array -pub fn bytes_from_hex_string(hex: &str) -> Result, JsError> { - let hex = hex.strip_prefix("0x").unwrap_or(hex); - hex::decode(hex).map_err(map_js_error!( - "error deserializing bytes from hex string: {}" - )) -} - -/// A helper to serialize a BigUint to a hex string -pub fn biguint_to_hex_string(val: &BigUint) -> String { - format!("0x{}", val.to_str_radix(16 /* radix */)) -} - -/// Convert a `BigUint` to an `Address` -pub fn biguint_to_address(biguint: &BigUint) -> Result { - let u160: U160 = biguint - .try_into() - .map_err(map_js_error!("error converting BigUint to Address: {}"))?; - - Ok(Address::from(u160)) -} - -/// A helper to deserialize a BigUint from a hex string -pub fn biguint_from_hex_string(hex: &str) -> Result { - // Deserialize as a string and remove "0x" if present - let stripped = hex.strip_prefix("0x").unwrap_or(hex); - BigUint::from_str_radix(stripped, 16 /* radix */).map_err(map_js_error!( - "error deserializing BigUint from hex string: {}" - )) -} - -/// A helper to serialize a scalar to a hex string -pub fn scalar_to_hex_string(val: &Scalar) -> String { - let biguint = scalar_to_biguint(val); - biguint_to_hex_string(&biguint) -} - -/// A helper to deserialize a scalar from a hex string -pub fn scalar_from_hex_string(hex: &str) -> Result { - let biguint = biguint_from_hex_string(hex)?; - Ok(biguint_to_scalar(&biguint)) -} - -/// A helper to serialize a nonnative scalar to a hex string -pub fn nonnative_scalar_to_hex_string( - val: &NonNativeScalar, -) -> String { - biguint_to_hex_string(&val.into()) -} - -/// A helper method to deserialize a nonnative scalar from a hex string -pub fn nonnative_scalar_from_hex_string( - hex: &str, -) -> Result, JsError> { - let biguint = biguint_from_hex_string(hex)?; - NonNativeScalar::try_from(&biguint) -} - -/// A helper to serialize a signing key to a hex string -pub fn public_sign_key_to_hex_string(val: &PublicSigningKey) -> Result { - let bytes = val.to_uncompressed_bytes()?; - Ok(format!("0x{}", hex::encode(bytes))) -} - -/// A helper to deserialize a signing key from a hex string -pub fn public_sign_key_from_hex_string(hex: &str) -> Result { - // Deserialize as a string and remove "0x" if present - let stripped = hex.strip_prefix("0x").unwrap_or(hex); - let bytes = hex::decode(stripped).map_err(map_js_error!( - "error deserializing bytes from hex string: {}" - ))?; - - PublicSigningKey::from_bytes(&bytes) -} - -/// The config of the embedded curve -pub type EmbeddedCurveConfig = ark_ed_on_bn254::EdwardsConfig; -/// Convert a Baby-JubJub point to a hex string -pub fn jubjub_to_hex_string(point: &BabyJubJubPoint) -> Result { - let converted_point = Projective::::from(*point); - let mut bytes = vec![]; - converted_point - .into_affine() - .serialize_uncompressed(&mut bytes) - .map_err(map_js_error!("{}"))?; - - Ok(format!("0x{}", hex::encode(bytes))) -} - -/// Deserialize a Baby-JubJub point from a hex string -pub fn jubjub_from_hex_string(hex: &str) -> Result { - // Deserialize as a string and remove "0x" if present - let stripped = hex.strip_prefix("0x").unwrap_or(hex); - let bytes = hex::decode(stripped).map_err(map_js_error!( - "error deserializing bytes from hex string: {}" - ))?; - - let projective = Projective::::deserialize_uncompressed(bytes.as_slice()) - .map_err(map_js_error!( - "error deserializing projective point from bytes: {}" - ))?; - - Ok(projective.into()) -} - -/// A helper to serialize a BigUint to a hex string -pub fn serialize_biguint_to_hex_string(val: &BigUint, serializer: S) -> Result -where - S: Serializer, -{ - let hex = biguint_to_hex_string(val); - serializer.serialize_str(&hex) -} - -/// A helper to deserialize a BigUint from a hex string -pub fn deserialize_biguint_from_hex_string<'de, D>(deserializer: D) -> Result -where - D: Deserializer<'de>, -{ - let hex = String::deserialize(deserializer)?; - biguint_from_hex_string(&hex).map_err(|_| D::Error::custom("Invalid hex string")) -} - -// --------------- -// | Signing Key | -// --------------- -pub fn derive_signing_key_from_hex(sk_root: &str) -> Result { - let key_bigint = biguint_from_hex_string(sk_root)?; - SigningKey::from_slice(&key_bigint.to_bytes_be()).map_err(map_js_error!("{}")) -} - -pub fn hex_to_signing_key(hex: &str) -> Result { - let stripped = hex.strip_prefix("0x").unwrap_or(hex); - let padded = if stripped.len() < 64 { - format!("{:0>64}", stripped) - } else { - stripped.to_string() - }; - let bytes = hex::decode(padded).map_err(map_js_error!("{}"))?; - SigningKey::from_slice(&bytes).map_err(map_js_error!("{}")) -} - -// ----------------- -// | Wallet Helpers | -// ----------------- - -/// Deserializes a JSON string into a `Wallet` object. -pub fn deserialize_wallet(wallet_str: &str) -> Result { - let deserialized_wallet: ApiWallet = serde_json::from_reader(wallet_str.as_bytes()) - .map_err(map_js_error!("Failed to deserialize wallet: {}"))?; - - deserialized_wallet.try_into() -} - -/// Macro for serializing Rust types to JavaScript values -#[macro_export] -macro_rules! serialize_to_js { - ($expr:expr) => { - serde_json::to_string(&$expr) - .map(|result| JsValue::from_str(&result)) - .map_err($crate::map_js_error!("Serialization error: {}")) - }; -} - -#[cfg(test)] -mod tests { - use eyre::eyre; - - use super::*; - - #[test] - fn test_deserialize_wallet() { - let wallet_str = r#"{"id":"c9378d6a-b4e9-45b2-b98a-13c79de209cd","balances":[{"mint":"0x4af567288e68cad4aa93a272fe6139ca53859c70","amount":9000000000000000000,"relayer_fee_balance":0,"protocol_fee_balance":0},{"mint":"0x8e1308925a26cb5cf400afb402d67b3523473379","amount":3000000000000000000,"relayer_fee_balance":0,"protocol_fee_balance":0},{"mint":"0x1d55838a9ec169488d360783d65e6cd985007b72","amount":3808161837198978355816,"relayer_fee_balance":0,"protocol_fee_balance":0},{"mint":"0x0","amount":0,"relayer_fee_balance":0,"protocol_fee_balance":0},{"mint":"0x0","amount":0,"relayer_fee_balance":0,"protocol_fee_balance":0}],"orders":[{"id":"57451a3f-0bd8-43b9-af04-05b494488900","base_mint":"0x4af567288e68cad4aa93a272fe6139ca53859c70","quote_mint":"0x1d55838a9ec169488d360783d65e6cd985007b72","side":"Buy","type":"Midpoint","amount":1000000000000000000,"minimum_amount":null,"worst_case_price":"4503599627370496"},{"id":"02094c68-aa9b-46df-8c54-8528a11cf0a9","base_mint":"0x0","quote_mint":"0x0","side":"Buy","type":"Midpoint","amount":0,"minimum_amount":null,"worst_case_price":"0"},{"id":"2921af94-66bd-4768-a3ae-26dce5c51e5e","base_mint":"0x0","quote_mint":"0x0","side":"Buy","type":"Midpoint","amount":0,"minimum_amount":null,"worst_case_price":"0"},{"id":"5b9eea38-0d4a-4656-b98d-ec8b4cec3651","base_mint":"0x0","quote_mint":"0x0","side":"Buy","type":"Midpoint","amount":0,"minimum_amount":null,"worst_case_price":"0"},{"id":"a0c45ea0-9a5c-415a-a1cf-471be6bea917","base_mint":"0x0","quote_mint":"0x0","side":"Buy","type":"Midpoint","amount":0,"minimum_amount":null,"worst_case_price":"0"}],"key_chain":{"public_keys":{"pk_root":"0x0412c811977164429a00bb47cd8c9f01bef8473b0d2b8845ddb37c873233fce6fa6dd554dd2249918035d77692c0e8c5c008bce3ac56db264f701f9d3f5608e91b","pk_match":"0x1917553523c7ac3babba8ce6beac42888e952e38554348290ee492da5661d9cc"},"private_keys":{"sk_root":"0x6a6e3bfa1289e075c2cbbc9839b6e70d293f518e199316f16df60d059b348941","sk_match":"0x190237393aca1573c198a349ade7154cda2d3c2f361960aef0906352c2cb2ee5"}},"managing_cluster":"0xf5cb5b416fc545ee13163d38efc7f924f6f322233ec890dea269cb6ba8673226555fee03d18611b95efc9efab041aa4fb9c84fbf1f904037a842587479a2632a","match_fee":"8589934","blinded_public_shares":[[2024099596,2283622370,3373844387,3699225673,620365783,3616710419,3216809818,637167776],[3346402507,1997625821,3016310437,2061430707,2710254684,2558343763,3563986750,21037964],[1239964448,2330717746,3269894279,1608182849,4214242023,2900606234,3707022545,188253388],[348229254,1259151624,2774848289,3164415493,1366354724,245564652,2604703992,618521913],[850549311,1736122735,1312877726,3509295176,1126509314,827832022,459337343,193187863],[1948196524,1822855039,1209188594,3518138712,759881151,2938784293,4154874605,488613855],[1290160068,1876378430,1644623650,1388801348,828738404,1418665385,4123532292,283686066],[623950372,667130122,785474757,221780956,3239384809,250435065,2108799147,79388302],[1015884396,1020242737,3278516014,3129734041,581954895,2917408653,1227463037,767203897],[2064363123,1029299003,3115989797,2040914616,653708234,3350504366,2050961628,454387438],[3753117299,2007863504,739723825,2226099214,1173697653,1209052418,2887361517,637245571],[791931069,130075134,640030121,183570363,4070611108,2904076862,1802796448,177908598],[1817158290,2922927151,2879581373,2398983206,1973651319,2436941197,772583078,596213489],[526367336,1903547495,503709422,4042342713,1433335376,966344086,3720665675,69828250],[2907928696,4270583383,243251784,540382331,2765294722,3797192312,3576107301,277000872],[4242304471,1247705319,1471122147,1945163245,1747708545,1219125453,743827448,3396072],[3650520311,3369589260,1448526940,3854279310,2645240155,1074930590,3615648176,219700906],[1894825921,2546631470,3067737329,1186290711,2052892429,2844607738,3210030988,403303261],[1095231414,3893603491,1230878684,1901804403,3181790476,2745587331,2279096492,122681975],[1693821018,3679896823,2933571633,3251657893,1396133513,1713975412,3986617904,175101551],[2641248166,3031082908,1649672751,724910571,4029570651,1801337265,2734821062,123649388],[673994573,340717208,2758319387,1476459915,1973059187,4193749863,2746695559,484397652],[3552299441,3406844115,2536057439,3156053548,3311084209,863341429,1172282615,28905330],[2354833291,3560056596,1243244870,939842521,3686212360,4010927497,4039754214,375553231],[323447132,891470305,1222706381,590372408,2941282794,3962409641,3122467172,730847627],[3169663710,2211480912,1178027760,3641821768,2460641176,456211548,2848183498,365648393],[1286138537,225759036,2414963756,1257268685,217370270,1948429709,2816471676,110773611],[2455271390,3605533149,3274509536,3864800348,2850286283,1953454869,2364403450,803384340],[337249133,1199182626,4103530960,4176904884,1819218393,2614880304,1448143952,725497942],[3663412477,2190885965,1421488934,2405514506,785816519,3166124161,1831469090,586689683],[3946901763,2993255964,1759429385,2928921793,873210982,1993233404,2619987582,713987998],[1598092270,765980635,3710611955,1395122898,2982537706,2782054079,674059437,676978081],[2583239667,269181666,1911549991,1723845708,2552834775,664573821,3067409224,652647832],[1863829751,1504905478,2989125167,3487558353,2018438433,1451009710,2670251310,328977636],[908245063,2123754547,2920914567,2833721303,833426648,1911021207,3869614467,458377340],[188912296,813502033,40718708,4156389947,4061662294,3860994484,1294556848,481777814],[3186143629,2385023669,328092127,3185083038,3042498002,137201946,3244007638,562041684],[1112121528,2155902206,3331612981,1029526540,432911929,1936907261,112253963,350450020],[4252898288,2403404439,3923783269,2899635304,1945260797,1222177906,254588869,26821709],[2487650637,4200629267,2181540405,3752743105,1694866018,1489431679,709484654,628634349],[3492292745,785064544,342333694,514458633,2657985224,716051637,1993603512,385982051],[1211387494,692713803,2228726096,3650126440,1231149223,117006954,1763059095,35999192],[1514152140,3070734348,2649726968,1532278427,3665041207,2716893516,675144989,111694085],[3795898097,1412859154,1258124266,1757386457,3506991772,2829351418,2039189684,553672373],[789305044,1093264746,2516262273,669754858,354921762,1613149781,2679642416,199860293],[1625879483,2062227090,1099433950,2947443930,959509800,3573131062,88513690,513919979],[1957734510,2687469157,1246790133,3988101934,3704169322,1324566290,244369306,582922809],[2411092608,1158913049,3985203922,3490350081,2334699934,4030707402,4232688714,658870815],[2667276066,2004291287,903764519,414782682,2528879049,2282715232,2831326304,728654318],[397904404,3639312758,244800416,1906935184,2360453111,2691545103,3687342573,345220470],[2372229120,1243486321,2068219909,345048652,1805549381,3321140700,1635268615,295904524],[3597567080,945288549,3482696553,3020381516,168389121,2015523156,218714887,481073922],[1078187132,650118843,814067017,805718199,4144366824,1231980325,2289302333,781984129],[2198365136,3544029846,1866172406,4071523185,3370348284,3081692867,4147378543,577076581]],"private_shares":[[3326966370,4292767221,2370342860,114355725,1129453297,265896589,2041354418,323672654],[377167922,1267572973,2118845895,2983395206,4199164646,2526962069,2211018916,127922415],[2709836254,4272854491,3907458165,4111133504,572947640,982000773,1551141691,772587042],[3601571448,1049453317,107536860,2554900861,3420834939,3637042355,2653460244,342318517],[3691120184,620092883,1368225811,3722513047,1749325103,3054774986,503859597,767652568],[1836715602,1184241833,1673196555,2201177642,4027308512,943822714,1103289631,472226575],[2659640634,432226511,1237761499,35547710,3958451260,2463941622,1134631944,677154364],[3594285785,502592879,54714279,528077662,3670034522,539903471,3666206520,69572077],[870350340,589907382,1972997459,958090545,402410971,965198355,4030701199,193636533],[2490241267,3172814655,4061362854,3678401737,4133481429,532102641,3207202608,506452992],[196683403,300741437,2142661324,3493217140,3613492010,2673554589,2370802719,323594859],[3157869633,2178529807,2242355028,1240778695,716578556,978530145,3455367788,782931832],[2132642412,3680645086,2803775,3320333148,2813538344,1445665810,190613862,364626942],[3691868821,3561142802,336479613,1002483201,1181116658,4118961747,2054339991,79132129],[1041872006,2332988854,2639133364,883966727,2021894942,85414695,1682056935,683839558],[4270898982,4216984977,3664034184,3099662668,866743489,3866180380,736210922,145564308],[299280391,3233982977,1433858208,1865037044,2141949508,2807676417,1642516060,741139524],[2054974781,4056940767,4109615115,238058346,2734297235,1037999269,2048133248,557537169],[3123004743,1571086806,3904277647,3143021510,3727628854,2339718501,3495909174,26278404],[2255979684,2923675414,4243780811,2467658460,3391056150,2168631595,1271546332,785738879],[3808389321,1735152566,1559644608,2688423575,3371992178,3283968567,3040184604,25310991],[382104097,1940705088,2985867861,2337121483,4071727189,3983824440,2511468676,476442778],[665936716,2057846182,2599098892,1888772365,3598335121,4221964403,307755755,120055050],[108348787,3276346285,1639140278,484506537,1100977304,4166646806,1218410021,585287199],[3626353570,1418183212,1659678768,833976650,1845906870,4215164662,2135697063,229992803],[780136992,97124029,1704357389,2077494586,2326548487,3426395459,2409980738,595192037],[2932097620,943963965,2720192576,3787557228,2397081764,3136876124,2958533990,38186768],[1494529312,2998039088,3902842908,1854516005,1936903380,1929152138,2893760786,157456090],[3612551569,1109422315,3073821485,1542411469,2967971270,1267726703,3810020284,235342488],[286388225,117718976,1460896215,3313801848,4001373144,716482846,3426695146,374150747],[2898939,3610316273,1122955763,2790394561,3913978681,1889373603,2638176654,246852432],[2351708432,1542624306,3466740490,29226159,1804651958,1100552928,289137503,283862350],[1366561035,2039423275,970835158,3995470646,2234354888,3218033186,2190755012,308192598],[2085970951,803699463,4188227278,2231758000,2768751230,2431597297,2587912926,631862794],[3041555639,184850394,4256437878,2885595050,3953763015,1971585800,1388549769,502463090],[3760888406,1495102908,2841666441,1562926407,725527369,21612523,3963607388,479062616],[763657073,4218548568,2554293021,2534233316,1744691661,3745405061,2014156598,398798746],[2837679174,152702735,3845739464,394822517,59310439,1945699747,850942977,610390411],[4260305165,3061285857,1211373062,2145190609,669191237,3863127927,1225449501,122138671],[1462150065,2402942970,700844743,1966573249,3092323645,2393175328,253712286,332206082],[457507957,1523540397,2540051455,909890425,2129204440,3166555370,3264560724,574858379],[3006848663,477009198,2906430236,1394699473,1383302811,673331583,4011946572,112961187],[2704084017,2393955949,2485429363,3512547486,3244378123,2368412316,804893381,37266295],[153902605,895745787,1624260883,3961929897,1280197891,1053255589,3218974552,407168057],[3160495658,1215340195,366122876,754594200,137300606,2269457227,2578521820,760980137],[3196133437,3257660589,2513302268,2642322869,1891943478,321749559,2777079308,762022043],[1992066192,3916103080,1635595015,1731214420,1083020341,2558040717,718827634,377917622],[3519003543,753048075,564959064,1026582172,1343494919,3160610299,2634405102,520906950],[1282524638,304313654,1978620630,1009566376,2258310615,1599891775,2426837932,232186112],[974617781,2075238366,2025861364,1235064802,3452959188,979923136,2687951409,224699450],[1586161516,1065118620,814165240,1079300406,2981640283,561466307,3622895621,664935906],[1717204106,4221984387,2595987222,2644793820,3035556151,2508845779,3069816446,308724002],[3206002646,3624537743,4230845313,1280698419,1679762196,485336291,1142677326,78148980],[1751435566,3059542391,1016212742,1647793169,1416841379,800914140,1110785693,383763849]],"blinder":[4218236157,1169723001,840189036,749858618,2614452035,790338537,1480038371,148960380]}"#; - - let wallet = deserialize_wallet(wallet_str) - .map_err(|_| eyre!("Failed to deserialize wallet")) - .unwrap(); - - dbg!(wallet); - } -} diff --git a/wasm/src/key_rotation.rs b/wasm/src/key_rotation.rs deleted file mode 100644 index fbf58d81..00000000 --- a/wasm/src/key_rotation.rs +++ /dev/null @@ -1,80 +0,0 @@ -use crate::{ - circuit_types::keychain::PublicSigningKey, - common::{derivation::derive_sk_root_scalars, types::Wallet}, - helpers::{bytes_from_hex_string, public_sign_key_to_hex_string}, -}; -use k256::ecdsa::SigningKey; -use wasm_bindgen::JsError; - -/// Handles wallet key rotation based on whether a new external key is provided. -/// -/// For internal key rotation, uses the provided seed to derive the next key. -/// For external key rotation, uses the provided new_public_key. -/// -/// # Returns -/// A tuple containing: -/// - The new public key as a hex string, if rotation occurred -/// - The previous signing key, if seed was provided -pub fn handle_key_rotation( - wallet: &mut Wallet, - seed: Option<&str>, - new_public_key: Option, -) -> Result<(Option, Option), JsError> { - // Extract the current signing key if seed is provided - let old_signing_key = match seed { - Some(seed_str) => { - let sk_root_scalars = - derive_sk_root_scalars(seed_str, &wallet.key_chain.public_keys.nonce)?; - - Some(SigningKey::try_from(&sk_root_scalars)?) - } - None => None, - }; - - // Use existing rotation logic - let next_public_key = determine_next_key(wallet, seed, new_public_key)?; - - // If we have a new key, perform the rotation - if let Some(ref next_key) = next_public_key { - maybe_rotate_to_key(wallet, next_key)?; - } - - Ok((next_public_key, old_signing_key)) -} - -/// Gets the next public key based on whether a new external key is provided. -fn determine_next_key( - wallet: &Wallet, - seed: Option<&str>, - new_public_key: Option, -) -> Result, JsError> { - if let Some(key) = new_public_key { - return Ok(Some(key)); - } - - if let Some(seed) = seed { - let next_key = wallet.key_chain.get_next_rotated_public_key(seed)?; - let next_key_hex = public_sign_key_to_hex_string(&next_key)?; - return Ok(Some(next_key_hex)); - } - - Ok(None) -} - -/// Updates wallet's key if different from current. -fn maybe_rotate_to_key(wallet: &mut Wallet, new_key_hex: &str) -> Result<(), JsError> { - // Parse and validate the new key - let new_pk_root = bytes_from_hex_string(new_key_hex)?; - let current_pk_root = wallet.key_chain.pk_root().to_uncompressed_bytes()?; - - // Only rotate if the key is actually different - if current_pk_root != new_pk_root { - // Convert bytes to public key - let new_pk_root = PublicSigningKey::from_bytes(&new_pk_root)?; - - // Update the wallet's key - wallet.key_chain.increment_nonce(); - wallet.key_chain.set_pk_root(new_pk_root); - } - Ok(()) -} diff --git a/wasm/src/lib.rs b/wasm/src/lib.rs index 831e9126..7bbe22ea 100644 --- a/wasm/src/lib.rs +++ b/wasm/src/lib.rs @@ -1,130 +1,31 @@ -#![allow(incomplete_features)] -#![feature(generic_const_exprs)] - -use crate::types::Scalar; -use circuit_types::keychain::{NonNativeScalar, PublicSigningKey}; -use common::derivation::{ - derive_root_signing_key, derive_sk_root, derive_sk_root_signing_key, derive_symmetric_key, - derive_wallet_keychain, -}; -use contracts_common::custom_serde::BytesSerializable; -use ethers::{ - core::k256::ecdsa::SigningKey as EthersSigningKey, - types::{Signature as EthersSignature, U256}, - utils::keccak256, -}; -use helpers::{ - bytes_from_hex_string, nonnative_scalar_to_hex_string, public_sign_key_to_hex_string, -}; -use num_bigint::BigUint; +use ark_ec::{CurveGroup, Group}; +use ark_ed_on_bn254::{EdwardsProjective, Fr}; +use ark_ff::PrimeField; +use ark_serialize::CanonicalSerialize; use wasm_bindgen::prelude::*; -pub mod circuit_types; -pub mod common; -pub mod errors; -pub mod external_api; -pub mod generation; -pub mod helpers; -pub mod key_rotation; -pub mod serde_def_types; -pub mod signature; -pub mod sol; -pub mod types; -pub mod utils; - -// ------------------------- -// | System-Wide Constants | -// ------------------------- - -/// The system-wide value of MAX_BALANCES; the number of allowable balances a -/// wallet holds -pub const MAX_BALANCES: usize = 10; - -/// The system-wide value of MAX_ORDERS; the number of allowable orders a wallet -/// holds -pub const MAX_ORDERS: usize = 4; - -// Substitute for SizedWalletShare::NUM_SCALARS -pub const NUM_SCALARS: usize = 70; - -/// The number of bytes in a cluster symmetric key -pub const CLUSTER_SYMMETRIC_KEY_LENGTH: usize = 32; - -#[wasm_bindgen] -pub fn derive_sk_root_from_seed(seed: &str, nonce: u64) -> Result { - let root_key = derive_root_signing_key(seed)?; - - let sk_root = derive_sk_root(&root_key, Some(&Scalar::from(nonce)))?; - let sk_root_biguint = BigUint::from_bytes_be(&sk_root.to_bytes_be()); - // TODO: Should be able to .into() here - let sk_root_scalar: NonNativeScalar<2> = NonNativeScalar::try_from(&sk_root_biguint)?; - let sk_root_hex = nonnative_scalar_to_hex_string(&sk_root_scalar); - Ok(JsValue::from_str(&sk_root_hex)) +#[wasm_bindgen(start)] +pub fn init() { + #[cfg(feature = "console_error_panic_hook")] + console_error_panic_hook::set_once(); } +/// Derive a Schnorr public key from 64 extended signature bytes. +/// +/// Steps (matching the Rust SDK): +/// 1. Interpret bytes as big-endian integer, reduce mod Baby JubJub Fr +/// 2. Compute public key: scalar * G (generator point) +/// 3. Serialize as uncompressed affine (arkworks canonical format, little-endian) +/// 4. Return hex string with 0x prefix #[wasm_bindgen] -pub fn get_pk_root(seed: &str, nonce: u64) -> Result { - let sk_root = derive_sk_root_signing_key(seed, Some(&Scalar::from(nonce)))?; - let keychain = derive_wallet_keychain(&sk_root)?; - let pk_root = public_sign_key_to_hex_string(&keychain.public_keys.pk_root)?; - Ok(JsValue::from_str(&pk_root)) -} - -#[wasm_bindgen] -pub fn get_pk_root_scalars( - seed: Option, - nonce: Option, - public_key: Option, -) -> Result, JsError> { - if let Some(pk_hex) = public_key { - let pk_root_bytes = bytes_from_hex_string(&pk_hex)?; - let pk_root = PublicSigningKey::from_bytes(&pk_root_bytes)?; - Ok(vec![ - JsValue::from_str(&pk_root.x.scalar_words[0].to_biguint().to_string()), - JsValue::from_str(&pk_root.x.scalar_words[1].to_biguint().to_string()), - JsValue::from_str(&pk_root.y.scalar_words[0].to_biguint().to_string()), - JsValue::from_str(&pk_root.y.scalar_words[1].to_biguint().to_string()), - ]) - } else if let Some(seed_str) = seed { - let nonce_val = - nonce.ok_or(JsError::new("nonce must be provided when seed is provided"))?; - let sk_root = derive_sk_root_signing_key(&seed_str, Some(&Scalar::from(nonce_val)))?; - let keychain = derive_wallet_keychain(&sk_root)?; - Ok(keychain - .public_keys - .to_scalars() - .iter() - .map(|scalar| JsValue::from_str(&scalar.to_biguint().to_string())) - .collect()) - } else { - Err(JsError::new("Either seed or public_key must be provided")) - } -} - -#[wasm_bindgen] -pub fn get_symmetric_key(seed: &str) -> Result { - utils::set_panic_hook(); - let sk_root = derive_sk_root_signing_key(seed, None)?; - let symmetric_key = derive_symmetric_key(&sk_root)?; - - Ok(JsValue::from_str(&symmetric_key.to_hex_string())) -} +pub fn derive_schnorr_public_key(extended_sig_bytes: &[u8]) -> Result { + let scalar = Fr::from_be_bytes_mod_order(extended_sig_bytes); + let point = (EdwardsProjective::generator() * scalar).into_affine(); -pub fn sign_commitment( - key: &NonNativeScalar<2>, - commitment: Scalar, -) -> Result { - let signing_key = EthersSigningKey::try_from(key)?; - // Hash the message and sign it - let comm_bytes = commitment.inner().serialize_to_bytes(); - let digest = keccak256(comm_bytes); - let (sig, recovery_id) = signing_key - .sign_prehash_recoverable(&digest) - .map_err(map_js_error!("failed to sign commitment: {}"))?; + let mut bytes = Vec::new(); + point + .serialize_uncompressed(&mut bytes) + .map_err(|e: ark_serialize::SerializationError| JsError::new(&e.to_string()))?; - Ok(EthersSignature { - r: U256::from_big_endian(&sig.r().to_bytes()), - s: U256::from_big_endian(&sig.s().to_bytes()), - v: recovery_id.to_byte() as u64, - }) + Ok(format!("0x{}", hex::encode(bytes))) } diff --git a/wasm/src/serde_def_types.rs b/wasm/src/serde_def_types.rs deleted file mode 100644 index 9777bdb3..00000000 --- a/wasm/src/serde_def_types.rs +++ /dev/null @@ -1,100 +0,0 @@ -//! Types & trait implementations to enable deriving serde::{Serialize, Deserialize} -//! on the foreign Arkworks, Alloy, and other types that we compose into complex structs. - -use crate::types::ScalarField; -use alloy_primitives::{Address, FixedBytes, Uint}; -use ark_bn254::FrConfig; -use ark_ff::{BigInt, Fp, FpConfig, MontBackend}; -use core::marker::PhantomData; -use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DeserializeAs, SerializeAs}; - -/// This macro implements the `SerializeAs` and `DeserializeAs` traits for a given type, -/// allowing it to be serialized / deserialized as the remote type it mirrors. -macro_rules! impl_serde_as { - ($remote_type:ty, $def_type:ty, $($generics:tt)*) => { - impl<$($generics)*> SerializeAs<$remote_type> for $def_type { - fn serialize_as(source: &$remote_type, serializer: S) -> Result - where - S: serde::Serializer, - { - <$def_type>::serialize(source, serializer) - } - } - - impl<'de, $($generics)*> DeserializeAs<'de, $remote_type> for $def_type { - fn deserialize_as(deserializer: D) -> Result<$remote_type, D::Error> - where - D: serde::Deserializer<'de>, - { - <$def_type>::deserialize(deserializer) - } - } - }; -} - -/// A serde-compatible type mirroring [`BigInt`] -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(remote = "BigInt")] -pub struct BigIntDef(#[serde_as(as = "[_; N]")] pub [u64; N]); - -impl_serde_as!(BigInt, BigIntDef, const N: usize); - -/// A serde-compatible type mirroring [`Fp`] -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(remote = "Fp")] -pub struct FpDef, const N: usize>( - #[serde_as(as = "BigIntDef")] pub BigInt, - pub PhantomData

, -); - -impl_serde_as!(Fp, FpDef, P: FpConfig, const N: usize); - -/// A serde-compatible type alias mirroring [`ScalarField`] -pub type ScalarFieldDef = FpDef, 4>; - -/// A serde-compatible wrapper type around [`ScalarField`], -/// allowing direct access to the underlying type -#[serde_as] -#[derive(Serialize, Deserialize, Debug)] -pub struct SerdeScalarField(#[serde_as(as = "ScalarFieldDef")] pub ScalarField); - -/// A serde-compatible type mirroring [`FixedBytes`] -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(remote = "FixedBytes")] -pub(crate) struct FixedBytesDef(#[serde_as(as = "[_; N]")] pub [u8; N]); - -impl_serde_as!(FixedBytes, FixedBytesDef, const N: usize); - -/// A serde-compatible type mirroring [`Address`] -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(remote = "Address")] -pub(crate) struct AddressDef(#[serde_as(as = "FixedBytesDef<20>")] FixedBytes<20>); - -impl_serde_as!(Address, AddressDef,); - -/// A serde-compatible type mirroring [`Uint`] -#[serde_as] -#[derive(Serialize, Deserialize)] -#[serde(remote = "Uint")] -pub(crate) struct UintDef { - #[doc(hidden)] - #[serde_as(as = "[_; LIMBS]")] - #[serde(getter = "Uint::as_limbs")] - limbs: [u64; LIMBS], -} - -impl From> for Uint { - fn from(value: UintDef) -> Self { - Uint::from_limbs(value.limbs) - } -} - -impl_serde_as!(Uint, UintDef, const BITS: usize, const LIMBS: usize); - -/// A serde-compatible type alias mirroring [`U256`] -pub(crate) type U256Def = UintDef<256, 4>; diff --git a/wasm/src/signature.rs b/wasm/src/signature.rs deleted file mode 100644 index da94545d..00000000 --- a/wasm/src/signature.rs +++ /dev/null @@ -1,149 +0,0 @@ -use alloy_sol_types::SolValue; -use contracts_common::custom_serde::BytesSerializable; -use ethers::{ - types::{Signature, U256}, - utils::keccak256, -}; -use js_sys::{Function, Promise}; -use k256::ecdsa::SigningKey; -use num_bigint::BigUint; -use wasm_bindgen::prelude::*; -use wasm_bindgen_futures::JsFuture; - -use crate::{ - circuit_types::transfers::{ - to_arbitrum_external_transfer, to_base_external_transfer, ExternalTransfer, - ExternalTransferDirection, - }, - common::types::{Chain, Wallet}, - helpers::{bytes_from_hex_string, bytes_to_hex_string}, - map_js_error, -}; - -/// Signs a wallet commitment. -pub async fn sign_wallet_commitment( - wallet: &Wallet, - signing_key: Option<&SigningKey>, - external_signer: Option<&Function>, -) -> Result, JsError> { - let comm = wallet.get_wallet_share_commitment(); - let comm_bytes = comm.inner().serialize_to_bytes(); - sign_message(signing_key, &comm_bytes, external_signer).await -} - -/// Signs a withdrawal authorization. -pub async fn sign_withdrawal_authorization( - chain: &Chain, - signing_key: Option<&SigningKey>, - mint: BigUint, - amount: u128, - account_addr: BigUint, - external_signer: Option<&Function>, -) -> Result, JsError> { - let transfer = ExternalTransfer { - mint, - amount, - direction: ExternalTransferDirection::Withdrawal, - account_addr, - }; - - let contract_transfer_bytes = match chain { - &Chain::ArbitrumOne | &Chain::ArbitrumSepolia => { - let contract_transfer = to_arbitrum_external_transfer(&transfer) - .map_err(map_js_error!("Failed to convert transfer: {}"))?; - - postcard::to_allocvec(&contract_transfer) - .map_err(map_js_error!("Failed to serialize transfer: {}"))? - } - &Chain::BaseMainnet | &Chain::BaseSepolia => { - let contract_transfer = to_base_external_transfer(&transfer) - .map_err(map_js_error!("Failed to convert transfer: {}"))?; - - contract_transfer.abi_encode() - } - _ => { - return Err(JsError::new("Unsupported chain")); - } - }; - - sign_message(signing_key, &contract_transfer_bytes, external_signer).await -} - -/// Signs a message using either internal or external signing method. -/// -/// For internal signing, uses the provided SigningKey. -/// For external signing, uses the provided external_signer function. -pub async fn sign_message( - signing_key: Option<&SigningKey>, - message: &[u8], - external_signer: Option<&Function>, -) -> Result, JsError> { - if let Some(signer) = external_signer { - sign_with_external_key(message, Some(signer)).await - } else if let Some(key) = signing_key { - sign_with_internal_key(key, message) - } else { - Err(JsError::new( - "Either signing key or external signer is required", - )) - } -} - -/// Helper function to sign a message with a SigningKey and return an Ethers Signature -fn sign_with_internal_key(signing_key: &SigningKey, message: &[u8]) -> Result, JsError> { - let digest = keccak256(message); - let (sig, recovery_id) = signing_key - .sign_prehash_recoverable(&digest) - .map_err(map_js_error!("Failed to sign message: {}"))?; - - let signature = Signature { - r: U256::from_big_endian(&sig.r().to_bytes()), - s: U256::from_big_endian(&sig.s().to_bytes()), - v: recovery_id.to_byte() as u64, - }; - - Ok(signature.to_vec()) -} - -/// Generates a signature by calling the provided sign_message function with a message -async fn sign_with_external_key( - message: &[u8], - external_signer: Option<&Function>, -) -> Result, JsError> { - let sign_message = external_signer - .ok_or_else(|| JsError::new("sign_message function is required for external key type"))?; - - let message_hex = bytes_to_hex_string(message); - - let this = JsValue::null(); - let arg = JsValue::from_str(&message_hex); - - let sig_promise: Promise = sign_message - .call1(&this, &arg) - .map_err(|e| { - JsError::new(&format!( - "Failed to invoke sign_message: {}", - e.as_string().unwrap_or_default() - )) - })? - .dyn_into() - .map_err(|e| { - JsError::new(&format!( - "Failed to convert Promise to Signature: {}", - e.as_string().unwrap_or_default() - )) - })?; - - let signature = JsFuture::from(sig_promise).await.map_err(|e| { - JsError::new(&format!( - "Failed to invoke sign_message: {}", - e.as_string().unwrap_or_default() - )) - })?; - - let sig_hex = signature - .as_string() - .ok_or_else(|| JsError::new("Failed to convert signature to string"))?; - - bytes_from_hex_string(&sig_hex) -} diff --git a/wasm/src/sol.rs b/wasm/src/sol.rs deleted file mode 100644 index c6ebecff..00000000 --- a/wasm/src/sol.rs +++ /dev/null @@ -1,18 +0,0 @@ -//! Relevant Solidity ABI definitions from the Renegade contracts - -use alloy_sol_types::sol; - -// Base-specific ABI definitions -sol! { - enum TransferType { - Deposit, - Withdrawal, - } - - struct ExternalTransfer { - address account; - address mint; - uint256 amount; - TransferType transferType; - } -} diff --git a/wasm/src/types.rs b/wasm/src/types.rs deleted file mode 100644 index 80a68703..00000000 --- a/wasm/src/types.rs +++ /dev/null @@ -1,204 +0,0 @@ -use ark_bn254::Fr; -use ark_ff::PrimeField; -use num_bigint::{BigInt, BigUint, Sign}; -use serde::{Deserialize, Deserializer, Serialize, Serializer}; -use std::ops::{Add, AddAssign, Mul, Neg, Sub}; -use wasm_bindgen::JsError; - -use crate::map_js_error; - -pub type ScalarField = Fr; - -pub const fn n_bytes_field() -> usize { - // We add 7 and divide by 8 to emulate a ceiling operation considering that usize - // division is a floor - let n_bits = ScalarField::MODULUS_BIT_SIZE as usize; - (n_bits + 7) / 8 -} - -#[derive(Copy, Clone, Debug, PartialEq, Eq)] -pub struct Scalar(ScalarField); - -impl Scalar { - /// Returns the zero element of the scalar field. - pub fn zero() -> Self { - Scalar(ScalarField::from(0u8)) - } - - /// Returns the one element of the scalar field. - pub fn one() -> Self { - Scalar(ScalarField::from(1u8)) - } - - /// Construct a scalar from an inner field element - pub fn new(inner: ScalarField) -> Self { - Scalar(inner) - } - - /// Get the inner value of the scalar - pub fn inner(&self) -> ScalarField { - self.0 - } - - /// Convert to big endian bytes - /// - /// Pad to the maximum amount of bytes needed so that the resulting bytes - /// are of predictable length - pub fn to_bytes_be(&self) -> Vec { - let val_biguint = self.to_biguint(); - let mut bytes = val_biguint.to_bytes_be(); - - let n_bytes = n_bytes_field(); - let mut padding = vec![0u8; n_bytes - bytes.len()]; - padding.append(&mut bytes); - - padding - } - - /// Converts the Scalar back into a BigUint - pub fn to_biguint(&self) -> BigUint { - ScalarField::from(self.0).into() - } -} - -// Implement Serialize and Deserialize manually -impl Serialize for Scalar { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - // Convert Scalar to BigUint, then to String for JSON compatibility - let big_uint = self.to_biguint(); - let big_uint_str = big_uint.to_string(); - serializer.serialize_str(&big_uint_str) - } -} - -impl<'de> Deserialize<'de> for Scalar { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - // Deserialize a string and convert it to BigUint, then to Scalar - let s = String::deserialize(deserializer)?; - let big_uint = BigUint::parse_bytes(s.as_bytes(), 10) - .ok_or_else(|| serde::de::Error::custom("Failed to parse BigUint"))?; - Ok(Scalar::from(big_uint)) - } -} - -impl Default for Scalar { - fn default() -> Self { - Self::zero() - } -} - -impl From for Scalar { - fn from(val: BigUint) -> Self { - Scalar(ScalarField::from(val.clone())) - } -} - -impl From for Scalar { - fn from(val: u64) -> Self { - Scalar(ScalarField::from(val)) - } -} - -impl From for Scalar { - fn from(val: u128) -> Self { - Scalar(ScalarField::from(val)) - } -} - -impl Add for Scalar { - type Output = Self; - - fn add(self, other: Self) -> Self::Output { - Scalar(self.0 + other.0) - } -} - -impl AddAssign for Scalar { - fn add_assign(&mut self, other: Self) { - self.0 += other.0; - } -} - -impl Sub for Scalar { - type Output = Self; - - fn sub(self, other: Self) -> Self::Output { - Scalar(self.0 - other.0) - } -} - -impl Neg for Scalar { - type Output = Self; - - fn neg(self) -> Self::Output { - Scalar(-self.0) - } -} - -impl Mul for Scalar { - type Output = Self; - - fn mul(self, other: Self) -> Self::Output { - Scalar(self.0 * other.0) - } -} - -/// Return the modulus `r` of the `Scalar` ($Z_r$) field as a `BigUint` -pub fn get_scalar_field_modulus() -> BigUint { - ScalarField::MODULUS.into() -} - -// --------------------------- -// | Conversions From Scalar | -// --------------------------- - -/// Convert a scalar to a BigUint -pub fn scalar_to_biguint(a: &Scalar) -> BigUint { - a.to_biguint() -} - -/// Reduces the scalar to a u64, truncating anything above 2^64 - 1 -pub fn scalar_to_u64(a: &Scalar) -> Result { - let bytes = a.to_bytes_be(); - let len = bytes.len(); - - // Take the last 8 bytes (64 bits) - let bytes: [u8; 8] = bytes[len - 8..len] - .try_into() - .map_err(map_js_error!("Failed to convert bytes to u64: {}"))?; - Ok(u64::from_be_bytes(bytes)) -} - -// ---------------------------- -// | Conversions from Bigints | -// ---------------------------- - -/// Convert a bigint to a scalar -pub fn bigint_to_scalar(a: &BigInt) -> Result { - match a.sign() { - Sign::Minus => { - let biguint = a - .neg() - .to_biguint() - .ok_or(JsError::new("Failed to convert negative BigInt to BigUint"))?; - Ok(-Scalar::from(biguint)) - } - _ => { - let biguint = a - .to_biguint() - .ok_or(JsError::new("Failed to convert BigInt to BigUint"))?; - Ok(Scalar::from(biguint)) - } - } -} - -/// Convert a BigUint to a scalar -pub fn biguint_to_scalar(a: &BigUint) -> Scalar { - Scalar::from(a.clone()) -} diff --git a/wasm/src/utils.rs b/wasm/src/utils.rs deleted file mode 100644 index b1d7929d..00000000 --- a/wasm/src/utils.rs +++ /dev/null @@ -1,10 +0,0 @@ -pub fn set_panic_hook() { - // When the `console_error_panic_hook` feature is enabled, we can call the - // `set_panic_hook` function at least once during initialization, and then - // we will get better error messages if our code ever panics. - // - // For more details see - // https://github.com/rustwasm/console_error_panic_hook#readme - #[cfg(feature = "console_error_panic_hook")] - console_error_panic_hook::set_once(); -}