From 9c900dfdea66937e6dacfb8c61d100e04f64f931 Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 25 Jun 2024 16:49:41 -0700 Subject: [PATCH 1/5] Withdraw Queue addition --- package-lock.json | 739 ++++++++++++++---- package.json | 2 +- .../v1/BoringWithdrawQueueContractABI.tsx | 233 ++++++ .../v1/PendingWithdrawQueueStatuses.tsx | 81 ++ src/contexts/v1/BoringVaultContextV1.tsx | 141 +++- src/examples/v1.tsx | 11 + src/examples/v2.tsx | 1 + src/types/index.ts | 13 + webpack.config.js | 6 +- 9 files changed, 1069 insertions(+), 158 deletions(-) create mode 100644 src/abis/v1/BoringWithdrawQueueContractABI.tsx create mode 100644 src/components/v1/PendingWithdrawQueueStatuses.tsx diff --git a/package-lock.json b/package-lock.json index df411bb..f1035bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "boring-vault-ui", - "version": "1.4,2", + "version": "1.4.2", "license": "MIT", "dependencies": { "@chakra-ui/react": "^2.8.2", @@ -4552,6 +4552,72 @@ "uuid": "dist/bin/uuid" } }, + "node_modules/@metamask/json-rpc-middleware-stream": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@metamask/json-rpc-middleware-stream/-/json-rpc-middleware-stream-6.0.2.tgz", + "integrity": "sha512-jtyx3PRfc1kqoLpYveIVQNwsxYKefc64/LCl9h9Da1m3nUKEvypbYuXSIwi237qvOjKmNHQKsDOZg6f4uBf62Q==", + "dependencies": { + "@metamask/json-rpc-engine": "^7.3.2", + "@metamask/safe-event-emitter": "^3.0.0", + "@metamask/utils": "^8.3.0", + "readable-stream": "^3.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@metamask/json-rpc-middleware-stream/node_modules/@metamask/safe-event-emitter": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz", + "integrity": "sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@metamask/json-rpc-middleware-stream/node_modules/@metamask/utils": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-8.5.0.tgz", + "integrity": "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ==", + "dependencies": { + "@ethereumjs/tx": "^4.2.0", + "@metamask/superstruct": "^3.0.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.3", + "@types/debug": "^4.1.7", + "debug": "^4.3.4", + "pony-cause": "^2.1.10", + "semver": "^7.5.4", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@metamask/json-rpc-middleware-stream/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/@metamask/json-rpc-middleware-stream/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/@metamask/object-multiplex": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@metamask/object-multiplex/-/object-multiplex-1.3.0.tgz", @@ -4819,6 +4885,14 @@ "@babel/runtime": "^7.20.6" } }, + "node_modules/@metamask/superstruct": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@metamask/superstruct/-/superstruct-3.0.0.tgz", + "integrity": "sha512-TOm+Lt/lCJk9j/3QT2LucrPewRmqI7/GKT+blK2IIOAkBMS+9TmeNjd2Y+TlfpSSYstaYsGZyz1XwpiTCg6RLA==", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@metamask/utils": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-5.0.2.tgz", @@ -6032,9 +6106,9 @@ } }, "node_modules/@react-native-community/cli-server-api/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "peer": true, "engines": { "node": ">=8.3.0" @@ -6533,9 +6607,9 @@ } }, "node_modules/@react-native/dev-middleware/node_modules/ws": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz", + "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==", "peer": true, "dependencies": { "async-limiter": "~1.0.0" @@ -7823,14 +7897,14 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@walletconnect/jsonrpc-http-connection": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.7.tgz", - "integrity": "sha512-qlfh8fCfu8LOM9JRR9KE0s0wxP6ZG9/Jom8M0qsoIQeKF3Ni0FyV4V1qy/cc7nfI46SLQLSl4tgWSfLiE1swyQ==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.8.tgz", + "integrity": "sha512-+B7cRuaxijLeFDJUq5hAzNyef3e3tBDIxyaCNmFtjwnod5AGis3RToNqzFU33vpVcxFhofkpE7Cx+5MYejbMGw==", "dependencies": { "@walletconnect/jsonrpc-utils": "^1.0.6", "@walletconnect/safe-json": "^1.0.1", "cross-fetch": "^3.1.4", - "tslib": "1.14.1" + "events": "^3.3.0" } }, "node_modules/@walletconnect/jsonrpc-http-connection/node_modules/cross-fetch": { @@ -7841,11 +7915,6 @@ "node-fetch": "^2.6.12" } }, - "node_modules/@walletconnect/jsonrpc-http-connection/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@walletconnect/jsonrpc-provider": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", @@ -7902,9 +7971,9 @@ } }, "node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "engines": { "node": ">=8.3.0" }, @@ -7977,19 +8046,13 @@ } }, "node_modules/@walletconnect/relay-api": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", - "integrity": "sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg==", + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.10.tgz", + "integrity": "sha512-tqrdd4zU9VBNqUaXXQASaexklv6A54yEyQQEXYOCr+Jz8Ket0dmPBDyg19LVSNUN2cipAghQc45/KVmfFJ0cYw==", "dependencies": { - "@walletconnect/jsonrpc-types": "^1.0.2", - "tslib": "1.14.1" + "@walletconnect/jsonrpc-types": "^1.0.2" } }, - "node_modules/@walletconnect/relay-api/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@walletconnect/relay-auth": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz", @@ -8355,9 +8418,9 @@ "dev": true }, "node_modules/abitype": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", - "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.4.tgz", + "integrity": "sha512-UivtYZOGJGE8rsrM/N5vdRkUpqEZVmuTumfTuolm7m/6O09wprd958rx8kUBwVAAAhQDveGAgD0GJdBuR8s6tw==", "funding": { "url": "https://github.com/sponsors/wevm" }, @@ -9576,6 +9639,23 @@ } ] }, + "node_modules/cbw-sdk": { + "name": "@coinbase/wallet-sdk", + "version": "3.9.3", + "resolved": "https://registry.npmjs.org/@coinbase/wallet-sdk/-/wallet-sdk-3.9.3.tgz", + "integrity": "sha512-N/A2DRIf0Y3PHc1XAMvbBUu4zisna6qAdqABMZwBMNEfWrXpAwx16pZGkYCLGE+Rvv1edbcB2LYDRnACNcmCiw==", + "dependencies": { + "bn.js": "^5.2.1", + "buffer": "^6.0.3", + "clsx": "^1.2.1", + "eth-block-tracker": "^7.1.0", + "eth-json-rpc-filters": "^6.0.0", + "eventemitter3": "^5.0.1", + "keccak": "^3.0.3", + "preact": "^10.16.0", + "sha.js": "^2.4.11" + } + }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -11303,37 +11383,17 @@ } }, "node_modules/engine.io-client": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz", - "integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==", + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", + "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.11.0", + "ws": "~8.17.1", "xmlhttprequest-ssl": "~2.0.0" } }, - "node_modules/engine.io-client/node_modules/ws": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", - "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", - "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 - } - } - }, "node_modules/engine.io-parser": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.2.tgz", @@ -11692,9 +11752,9 @@ } }, "node_modules/ethers": { - "version": "6.11.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz", - "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", "funding": [ { "type": "individual", @@ -11712,7 +11772,7 @@ "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", - "ws": "8.5.0" + "ws": "8.17.1" }, "engines": { "node": ">=14.0.0" @@ -15622,27 +15682,6 @@ "node": ">=12" } }, - "node_modules/jsdom/node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "dev": true, - "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 - } - } - }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -16679,9 +16718,9 @@ } }, "node_modules/metro/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "peer": true, "engines": { "node": ">=8.3.0" @@ -18315,9 +18354,9 @@ } }, "node_modules/react-devtools-core/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "peer": true, "engines": { "node": ">=8.3.0" @@ -18605,9 +18644,9 @@ } }, "node_modules/react-native/node_modules/ws": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz", + "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==", "peer": true, "dependencies": { "async-limiter": "~1.0.0" @@ -21000,9 +21039,9 @@ } }, "node_modules/viem": { - "version": "2.9.15", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.9.15.tgz", - "integrity": "sha512-7kcmHqybc3JhpjL8gKY7YxBYpZt1//qhoTZIU5Ez9JdyRCnYMMnJu20s7wd7Gv6a3zPbq8jV8dCp94a/NLJJcA==", + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.16.2.tgz", + "integrity": "sha512-qor3v1cJFR3jcPtcJxPbKfKURAH2agNf2IWZIaSReV6teNLERiu4Sr7kbqpkIeTAEpiDCVQwg336M+mub1m+pg==", "funding": [ { "type": "github", @@ -21015,9 +21054,9 @@ "@noble/hashes": "1.3.2", "@scure/bip32": "1.3.2", "@scure/bip39": "1.2.1", - "abitype": "1.0.0", - "isows": "1.0.3", - "ws": "8.13.0" + "abitype": "1.0.4", + "isows": "1.0.4", + "ws": "8.17.1" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -21033,24 +21072,18 @@ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, - "node_modules/viem/node_modules/ws": { - "version": "8.13.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", - "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", - "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 + "node_modules/viem/node_modules/isows": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.4.tgz", + "integrity": "sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wagmi-dev" } + ], + "peerDependencies": { + "ws": "*" } }, "node_modules/vlq": { @@ -21080,12 +21113,12 @@ } }, "node_modules/wagmi": { - "version": "2.5.19", - "resolved": "https://registry.npmjs.org/wagmi/-/wagmi-2.5.19.tgz", - "integrity": "sha512-fy6s3qTuXpfrrghhoNXuV92yqOqJI7m/9iLIejHxEYxiddVDTR8BVdkt0BuBQZzoXSAutDkyIlJbtFcpX5dfrQ==", + "version": "2.10.7", + "resolved": "https://registry.npmjs.org/wagmi/-/wagmi-2.10.7.tgz", + "integrity": "sha512-RYh45bpqaPbQDcRYbfaiS0b5iZrEKVCCpjyFTJx83qtbkxZBvpT6MXy1rQbfLookVCgZz0PA3aYEYX8HJPajLg==", "dependencies": { - "@wagmi/connectors": "4.1.25", - "@wagmi/core": "2.6.16", + "@wagmi/connectors": "5.0.19", + "@wagmi/core": "2.11.5", "use-sync-external-store": "1.2.0" }, "funding": { @@ -21103,6 +21136,447 @@ } } }, + "node_modules/wagmi/node_modules/@coinbase/wallet-sdk": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@coinbase/wallet-sdk/-/wallet-sdk-4.0.3.tgz", + "integrity": "sha512-y/OGEjlvosikjfB+wk+4CVb9OxD1ob9cidEBLI5h8Hxaf/Qoob2XoVT1uvhtAzBx34KpGYSd+alKvh/GCRre4Q==", + "dependencies": { + "buffer": "^6.0.3", + "clsx": "^1.2.1", + "eventemitter3": "^5.0.1", + "keccak": "^3.0.3", + "preact": "^10.16.0", + "sha.js": "^2.4.11" + } + }, + "node_modules/wagmi/node_modules/@metamask/object-multiplex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@metamask/object-multiplex/-/object-multiplex-2.0.0.tgz", + "integrity": "sha512-+ItrieVZie3j2LfYE0QkdW3dsEMfMEp419IGx1zyeLqjRZ14iQUPRO0H6CGgfAAoC0x6k2PfCAGRwJUA9BMrqA==", + "dependencies": { + "once": "^1.4.0", + "readable-stream": "^3.6.2" + }, + "engines": { + "node": "^16.20 || ^18.16 || >=20" + } + }, + "node_modules/wagmi/node_modules/@metamask/providers": { + "version": "15.0.0", + "resolved": "https://registry.npmjs.org/@metamask/providers/-/providers-15.0.0.tgz", + "integrity": "sha512-FXvL1NQNl6I7fMOJTfQYcBlBZ33vSlm6w80cMpmn8sJh0Lb7wcBpe02UwBsNlARnI+Qsr26XeDs6WHUHQh8CuA==", + "dependencies": { + "@metamask/json-rpc-engine": "^7.3.2", + "@metamask/json-rpc-middleware-stream": "^6.0.2", + "@metamask/object-multiplex": "^2.0.0", + "@metamask/rpc-errors": "^6.2.1", + "@metamask/safe-event-emitter": "^3.0.0", + "@metamask/utils": "^8.3.0", + "detect-browser": "^5.2.0", + "extension-port-stream": "^3.0.0", + "fast-deep-equal": "^3.1.3", + "is-stream": "^2.0.0", + "readable-stream": "^3.6.2", + "webextension-polyfill": "^0.10.0" + }, + "engines": { + "node": "^18.18 || >=20" + } + }, + "node_modules/wagmi/node_modules/@metamask/safe-event-emitter": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz", + "integrity": "sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw==", + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/wagmi/node_modules/@metamask/sdk-communication-layer": { + "version": "0.26.2", + "resolved": "https://registry.npmjs.org/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.26.2.tgz", + "integrity": "sha512-YMqwjhCZ4sXYAsEp1LxLrZZycBwpUeEsA4yIx48m1yW9sZ8pv3NGnbjM+F0zf29DLjyqLxJdxHJ7b5YkgtB26g==", + "dependencies": { + "bufferutil": "^4.0.8", + "date-fns": "^2.29.3", + "debug": "^4.3.4", + "utf-8-validate": "^6.0.3", + "uuid": "^8.3.2" + }, + "peerDependencies": { + "cross-fetch": "^4.0.0", + "eciesjs": "^0.3.16", + "eventemitter2": "^6.4.7", + "readable-stream": "^3.6.2", + "socket.io-client": "^4.5.1" + } + }, + "node_modules/wagmi/node_modules/@metamask/utils": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-8.5.0.tgz", + "integrity": "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ==", + "dependencies": { + "@ethereumjs/tx": "^4.2.0", + "@metamask/superstruct": "^3.0.0", + "@noble/hashes": "^1.3.1", + "@scure/base": "^1.1.3", + "@types/debug": "^4.1.7", + "debug": "^4.3.4", + "pony-cause": "^2.1.10", + "semver": "^7.5.4", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/wagmi/node_modules/@metamask/utils/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" + } + }, + "node_modules/wagmi/node_modules/@wagmi/connectors": { + "version": "5.0.19", + "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-5.0.19.tgz", + "integrity": "sha512-yd0pkM3I7sJuIZf1lIiwxDApaWg5ZSFiN3ociM50SkcoWDAWAKcCWWP0FbaCZ4KT+TZQJEIqBpfk6eZ9mBAddQ==", + "dependencies": { + "@coinbase/wallet-sdk": "4.0.3", + "@metamask/sdk": "0.26.3", + "@safe-global/safe-apps-provider": "0.18.1", + "@safe-global/safe-apps-sdk": "8.1.0", + "@walletconnect/ethereum-provider": "2.13.0", + "@walletconnect/modal": "2.6.2", + "cbw-sdk": "npm:@coinbase/wallet-sdk@3.9.3" + }, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "@wagmi/core": "2.11.5", + "typescript": ">=5.0.4", + "viem": "2.x" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@wagmi/connectors/node_modules/@metamask/sdk": { + "version": "0.26.3", + "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.26.3.tgz", + "integrity": "sha512-DM4BFPr1BDAIhTz7/RWb3oWQRvX79TJVZH8EL/Ljp+CRY7IjCbaVwaLdyQjVd8Doyq1V7AL4N/JjXplpo2YyYg==", + "dependencies": { + "@metamask/onboarding": "^1.0.1", + "@metamask/providers": "^15.0.0", + "@metamask/sdk-communication-layer": "0.26.2", + "@metamask/sdk-install-modal-web": "0.26.0", + "@types/dom-screen-wake-lock": "^1.0.0", + "bowser": "^2.9.0", + "cross-fetch": "^4.0.0", + "debug": "^4.3.4", + "eciesjs": "^0.3.15", + "eth-rpc-errors": "^4.0.3", + "eventemitter2": "^6.4.7", + "i18next": "22.5.1", + "i18next-browser-languagedetector": "7.1.0", + "obj-multiplex": "^1.0.0", + "pump": "^3.0.0", + "qrcode-terminal-nooctal": "^0.12.1", + "react-native-webview": "^11.26.0", + "readable-stream": "^3.6.2", + "rollup-plugin-visualizer": "^5.9.2", + "socket.io-client": "^4.5.1", + "util": "^0.12.4", + "uuid": "^8.3.2" + }, + "peerDependencies": { + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@wagmi/connectors/node_modules/@metamask/sdk-install-modal-web": { + "version": "0.26.0", + "resolved": "https://registry.npmjs.org/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.26.0.tgz", + "integrity": "sha512-LyDQFIsWWyU0ZgZR3O9LzRqKzXcYUEGJRCNfb26IjFOquvmQosbhQV0jDNlVa8Tk2Fg4ykTPoaauANh6sVJYVQ==", + "dependencies": { + "qr-code-styling": "^1.6.0-rc.1" + }, + "peerDependencies": { + "i18next": "22.5.1", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "react-i18next": "^13.2.2", + "react-native": "*" + }, + "peerDependenciesMeta": { + "react": { + "optional": true + }, + "react-dom": { + "optional": true + }, + "react-native": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@wagmi/core": { + "version": "2.11.5", + "resolved": "https://registry.npmjs.org/@wagmi/core/-/core-2.11.5.tgz", + "integrity": "sha512-RmtZQkNf/ozdngyDST33WLTdKQHny9SsiNmxln8G06pbnOuhO4dDhnXnfiJ8Lh9GVIfFsjlmtqzfAIo1/86dqg==", + "dependencies": { + "eventemitter3": "5.0.1", + "mipd": "0.0.5", + "zustand": "4.4.1" + }, + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "@tanstack/query-core": ">=5.0.0", + "typescript": ">=5.0.4", + "viem": "2.x" + }, + "peerDependenciesMeta": { + "@tanstack/query-core": { + "optional": true + }, + "typescript": { + "optional": true + } + } + }, + "node_modules/wagmi/node_modules/@walletconnect/core": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.13.0.tgz", + "integrity": "sha512-blDuZxQenjeXcVJvHxPznTNl6c/2DO4VNrFnus+qHmO6OtT5lZRowdMtlCaCNb1q0OxzgrmBDcTOCbFcCpio/g==", + "dependencies": { + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-provider": "1.0.14", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/jsonrpc-ws-connection": "1.0.14", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/logger": "2.1.2", + "@walletconnect/relay-api": "1.0.10", + "@walletconnect/relay-auth": "1.0.4", + "@walletconnect/safe-json": "1.0.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.13.0", + "@walletconnect/utils": "2.13.0", + "events": "3.3.0", + "isomorphic-unfetch": "3.1.0", + "lodash.isequal": "4.5.0", + "uint8arrays": "3.1.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/ethereum-provider": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.13.0.tgz", + "integrity": "sha512-dnpW8mmLpWl1AZUYGYZpaAfGw1HFkL0WSlhk5xekx3IJJKn4pLacX2QeIOo0iNkzNQxZfux1AK4Grl1DvtzZEA==", + "dependencies": { + "@walletconnect/jsonrpc-http-connection": "1.0.8", + "@walletconnect/jsonrpc-provider": "1.0.14", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/modal": "2.6.2", + "@walletconnect/sign-client": "2.13.0", + "@walletconnect/types": "2.13.0", + "@walletconnect/universal-provider": "2.13.0", + "@walletconnect/utils": "2.13.0", + "events": "3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/heartbeat": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.2.tgz", + "integrity": "sha512-uASiRmC5MwhuRuf05vq4AT48Pq8RMi876zV8rr8cV969uTOzWdB/k+Lj5yI2PBtB1bGQisGen7MM1GcZlQTBXw==", + "dependencies": { + "@walletconnect/events": "^1.0.1", + "@walletconnect/time": "^1.0.2", + "events": "^3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/jsonrpc-provider": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.14.tgz", + "integrity": "sha512-rtsNY1XqHvWj0EtITNeuf8PHMvlCLiS3EjQL+WOkxEOA4KPxsohFnBDeyPYiNm4ZvkQdLnece36opYidmtbmow==", + "dependencies": { + "@walletconnect/jsonrpc-utils": "^1.0.8", + "@walletconnect/safe-json": "^1.0.2", + "events": "^3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/jsonrpc-types": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.4.tgz", + "integrity": "sha512-P6679fG/M+wuWg9TY8mh6xFSdYnFyFjwFelxyISxMDrlbXokorEVXYOxiqEbrU3x1BmBoCAJJ+vtEaEoMlpCBQ==", + "dependencies": { + "events": "^3.3.0", + "keyvaluestorage-interface": "^1.0.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/sign-client": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.13.0.tgz", + "integrity": "sha512-En7KSvNUlQFx20IsYGsFgkNJ2lpvDvRsSFOT5PTdGskwCkUfOpB33SQJ6nCrN19gyoKPNvWg80Cy6MJI0TjNYA==", + "dependencies": { + "@walletconnect/core": "2.13.0", + "@walletconnect/events": "1.0.1", + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/logger": "2.1.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.13.0", + "@walletconnect/utils": "2.13.0", + "events": "3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/types": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.13.0.tgz", + "integrity": "sha512-MWaVT0FkZwzYbD3tvk8F+2qpPlz1LUSWHuqbINUtMXnSzJtXN49Y99fR7FuBhNFtDalfuWsEK17GrNA+KnAsPQ==", + "dependencies": { + "@walletconnect/events": "1.0.1", + "@walletconnect/heartbeat": "1.2.2", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/keyvaluestorage": "1.1.1", + "@walletconnect/logger": "2.1.2", + "events": "3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/universal-provider": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.13.0.tgz", + "integrity": "sha512-B5QvO8pnk5Bqn4aIt0OukGEQn2Auk9VbHfhQb9cGwgmSCd1GlprX/Qblu4gyT5+TjHMb1Gz5UssUaZWTWbDhBg==", + "dependencies": { + "@walletconnect/jsonrpc-http-connection": "1.0.8", + "@walletconnect/jsonrpc-provider": "1.0.14", + "@walletconnect/jsonrpc-types": "1.0.4", + "@walletconnect/jsonrpc-utils": "1.0.8", + "@walletconnect/logger": "2.1.2", + "@walletconnect/sign-client": "2.13.0", + "@walletconnect/types": "2.13.0", + "@walletconnect/utils": "2.13.0", + "events": "3.3.0" + } + }, + "node_modules/wagmi/node_modules/@walletconnect/utils": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.13.0.tgz", + "integrity": "sha512-q1eDCsRHj5iLe7fF8RroGoPZpdo2CYMZzQSrw1iqL+2+GOeqapxxuJ1vaJkmDUkwgklfB22ufqG6KQnz78sD4w==", + "dependencies": { + "@stablelib/chacha20poly1305": "1.0.1", + "@stablelib/hkdf": "1.0.1", + "@stablelib/random": "1.0.2", + "@stablelib/sha256": "1.0.1", + "@stablelib/x25519": "1.0.3", + "@walletconnect/relay-api": "1.0.10", + "@walletconnect/safe-json": "1.0.2", + "@walletconnect/time": "1.0.2", + "@walletconnect/types": "2.13.0", + "@walletconnect/window-getters": "1.0.1", + "@walletconnect/window-metadata": "1.0.1", + "detect-browser": "5.3.0", + "query-string": "7.1.3", + "uint8arrays": "3.1.0" + } + }, + "node_modules/wagmi/node_modules/extension-port-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/extension-port-stream/-/extension-port-stream-3.0.0.tgz", + "integrity": "sha512-an2S5quJMiy5bnZKEf6AkfH/7r8CzHvhchU40gxN+OM6HPhe7Z9T1FUychcf2M9PpPOO0Hf7BAEfJkw2TDIBDw==", + "dependencies": { + "readable-stream": "^3.6.2 || ^4.4.2", + "webextension-polyfill": ">=0.10.0 <1.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/wagmi/node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "node_modules/wagmi/node_modules/i18next": { + "version": "22.5.1", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.5.1.tgz", + "integrity": "sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==", + "funding": [ + { + "type": "individual", + "url": "https://locize.com" + }, + { + "type": "individual", + "url": "https://locize.com/i18next.html" + }, + { + "type": "individual", + "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" + } + ], + "dependencies": { + "@babel/runtime": "^7.20.6" + } + }, + "node_modules/wagmi/node_modules/i18next-browser-languagedetector": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.1.0.tgz", + "integrity": "sha512-cr2k7u1XJJ4HTOjM9GyOMtbOA47RtUoWRAtt52z43r3AoMs2StYKyjS3URPhzHaf+mn10hY9dZWamga5WPQjhA==", + "dependencies": { + "@babel/runtime": "^7.19.4" + } + }, + "node_modules/wagmi/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/wagmi/node_modules/uint8arrays": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.0.tgz", + "integrity": "sha512-ei5rfKtoRO8OyOIor2Rz5fhzjThwIHJZ3uyDPnDHTXbP0aMQ1RN/6AI5B5d9dBxJOU+BvOAk7ZQ1xphsX8Lrog==", + "dependencies": { + "multiformats": "^9.4.2" + } + }, + "node_modules/wagmi/node_modules/utf-8-validate": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", + "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", + "hasInstallScript": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -21494,27 +21968,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/webpack-dev-server/node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", - "dev": true, - "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 - } - } - }, "node_modules/webpack-merge": { "version": "5.10.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", @@ -21829,15 +22282,15 @@ } }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { diff --git a/package.json b/package.json index 96ccfa8..1c8c0aa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "boring-vault-ui", - "version": "1.4.2", + "version": "1.5.0", "description": "A reusable package to quickly integrate boring vaults onto a UI.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/abis/v1/BoringWithdrawQueueContractABI.tsx b/src/abis/v1/BoringWithdrawQueueContractABI.tsx new file mode 100644 index 0000000..df43e40 --- /dev/null +++ b/src/abis/v1/BoringWithdrawQueueContractABI.tsx @@ -0,0 +1,233 @@ +export default [ + { + inputs: [{ internalType: "address", name: "user", type: "address" }], + name: "AtomicQueue__RequestDeadlineExceeded", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "user", type: "address" }], + name: "AtomicQueue__UserNotInSolve", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "user", type: "address" }], + name: "AtomicQueue__UserRepeated", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "user", type: "address" }], + name: "AtomicQueue__ZeroOfferAmount", + type: "error", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "offerToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "wantToken", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "offerAmountSpent", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "wantAmountReceived", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + ], + name: "AtomicRequestFulfilled", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: false, + internalType: "address", + name: "user", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "offerToken", + type: "address", + }, + { + indexed: false, + internalType: "address", + name: "wantToken", + type: "address", + }, + { + indexed: false, + internalType: "uint256", + name: "amount", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "minPrice", + type: "uint256", + }, + { + indexed: false, + internalType: "uint256", + name: "timestamp", + type: "uint256", + }, + ], + name: "AtomicRequestUpdated", + type: "event", + }, + { + inputs: [ + { internalType: "address", name: "user", type: "address" }, + { internalType: "contract ERC20", name: "offer", type: "address" }, + { internalType: "contract ERC20", name: "want", type: "address" }, + ], + name: "getUserAtomicRequest", + outputs: [ + { + components: [ + { internalType: "uint64", name: "deadline", type: "uint64" }, + { internalType: "uint88", name: "atomicPrice", type: "uint88" }, + { internalType: "uint96", name: "offerAmount", type: "uint96" }, + { internalType: "bool", name: "inSolve", type: "bool" }, + ], + internalType: "struct AtomicQueue.AtomicRequest", + name: "", + type: "tuple", + }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract ERC20", name: "offer", type: "address" }, + { internalType: "address", name: "user", type: "address" }, + { + components: [ + { internalType: "uint64", name: "deadline", type: "uint64" }, + { internalType: "uint88", name: "atomicPrice", type: "uint88" }, + { internalType: "uint96", name: "offerAmount", type: "uint96" }, + { internalType: "bool", name: "inSolve", type: "bool" }, + ], + internalType: "struct AtomicQueue.AtomicRequest", + name: "userRequest", + type: "tuple", + }, + ], + name: "isAtomicRequestValid", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract ERC20", name: "offer", type: "address" }, + { internalType: "contract ERC20", name: "want", type: "address" }, + { internalType: "address[]", name: "users", type: "address[]" }, + { internalType: "bytes", name: "runData", type: "bytes" }, + { internalType: "address", name: "solver", type: "address" }, + ], + name: "solve", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "contract ERC20", name: "offer", type: "address" }, + { internalType: "contract ERC20", name: "want", type: "address" }, + { + components: [ + { internalType: "uint64", name: "deadline", type: "uint64" }, + { internalType: "uint88", name: "atomicPrice", type: "uint88" }, + { internalType: "uint96", name: "offerAmount", type: "uint96" }, + { internalType: "bool", name: "inSolve", type: "bool" }, + ], + internalType: "struct AtomicQueue.AtomicRequest", + name: "userRequest", + type: "tuple", + }, + ], + name: "updateAtomicRequest", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "", type: "address" }, + { internalType: "contract ERC20", name: "", type: "address" }, + { internalType: "contract ERC20", name: "", type: "address" }, + ], + name: "userAtomicRequest", + outputs: [ + { internalType: "uint64", name: "deadline", type: "uint64" }, + { internalType: "uint88", name: "atomicPrice", type: "uint88" }, + { internalType: "uint96", name: "offerAmount", type: "uint96" }, + { internalType: "bool", name: "inSolve", type: "bool" }, + ], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "contract ERC20", name: "offer", type: "address" }, + { internalType: "contract ERC20", name: "want", type: "address" }, + { internalType: "address[]", name: "users", type: "address[]" }, + ], + name: "viewSolveMetaData", + outputs: [ + { + components: [ + { internalType: "address", name: "user", type: "address" }, + { internalType: "uint8", name: "flags", type: "uint8" }, + { internalType: "uint256", name: "assetsToOffer", type: "uint256" }, + { internalType: "uint256", name: "assetsForWant", type: "uint256" }, + ], + internalType: "struct AtomicQueue.SolveMetaData[]", + name: "metaData", + type: "tuple[]", + }, + { internalType: "uint256", name: "totalAssetsForWant", type: "uint256" }, + { internalType: "uint256", name: "totalAssetsToOffer", type: "uint256" }, + ], + stateMutability: "view", + type: "function", + }, +]; diff --git a/src/components/v1/PendingWithdrawQueueStatuses.tsx b/src/components/v1/PendingWithdrawQueueStatuses.tsx new file mode 100644 index 0000000..39d399a --- /dev/null +++ b/src/components/v1/PendingWithdrawQueueStatuses.tsx @@ -0,0 +1,81 @@ +import React, { useEffect, useState } from "react"; +import { Box, HStack, Text, VStack } from "@chakra-ui/react"; +import { useBoringVaultV1 } from "../../contexts/v1/BoringVaultContextV1"; +import { useEthersSigner } from "../../hooks/ethers"; +import { WithdrawQueueStatus } from "../../types"; + +interface PendingWithdrawQueueStatusesProps { + title?: string; // Optional title +} + +// TODO Abstract away style into props above same as DepositButton +const PendingWithdrawQueueStatuses: React.FC< + PendingWithdrawQueueStatusesProps +> = ({ title, ...pendingWithdrawQueueProps }) => { + const { isConnected, userAddress, ethersProvider, withdrawQueueStatuses } = + useBoringVaultV1(); + const [statuses, setStatuses] = useState([]); // State to store fetched statuses + const signer = useEthersSigner(); + + useEffect(() => { + const fetchStatuses = async () => { + const fetchedStatuses: WithdrawQueueStatus[] = + await withdrawQueueStatuses(signer!); + setStatuses(fetchedStatuses); + }; + + fetchStatuses(); + console.log("withdrawQueueStatuses", withdrawQueueStatuses); + }, [withdrawQueueStatuses, signer]); + + return ( + + {title && ( + + {title} + + )} + + {statuses.map((withdrawStatus: WithdrawQueueStatus, index) => { + return ( + + + + + Shares Withdrawing: {withdrawStatus.sharesWithdrawing} + + + Token Out:{" "} + {withdrawStatus.tokenOut.displayName} + + + Expiration (unix seconds):{" "} + {withdrawStatus.deadlineUnixSeconds} + + + Target Token Price:{" "} + {withdrawStatus.minSharePrice} + + + + {/* TODO: Cancel Button + + */} + + + + ); + })} + + + ); +}; + +export default PendingWithdrawQueueStatuses; diff --git a/src/contexts/v1/BoringVaultContextV1.tsx b/src/contexts/v1/BoringVaultContextV1.tsx index 639219b..07ac577 100644 --- a/src/contexts/v1/BoringVaultContextV1.tsx +++ b/src/contexts/v1/BoringVaultContextV1.tsx @@ -12,12 +12,14 @@ import { DepositStatus, WithdrawStatus, DelayWithdrawStatus, + WithdrawQueueStatus, Token, } from "../../types"; import BoringVaultABI from "../../abis/v1/BoringVaultABI"; import BoringTellerABI from "../../abis/v1/BoringTellerABI"; import BoringAccountantABI from "../../abis/v1/BoringAccountantABI"; import BoringLensABI from "../../abis/v1/BoringLensABI"; +import BoringWithdrawQueueContractABI from "../../abis/v1/BoringWithdrawQueueContractABI"; import { Provider, Contract, @@ -28,12 +30,16 @@ import { erc20Abi } from "viem"; import BigNumber from "bignumber.js"; import BoringDelayWithdrawContractABI from "../../abis/v1/BoringDelayWithdrawContractABI"; +const SEVEN_SEAS_BASE_API_URL = "https://api.sevenseas.capital"; + interface BoringVaultV1ContextProps { + chain: string; vaultEthersContract: Contract | null; tellerEthersContract: Contract | null; accountantEthersContract: Contract | null; lensEthersContract: Contract | null; delayWithdrawEthersContract: Contract | null; + withdrawQueueEthersContract: Contract | null; depositTokens: Token[]; withdrawTokens: Token[]; isConnected: boolean; @@ -53,6 +59,7 @@ interface BoringVaultV1ContextProps { amount: string, token: Token ) => Promise; + /* Delay Withdraws */ delayWithdraw: ( signer: JsonRpcSigner, shareAmount: string, @@ -71,6 +78,11 @@ interface BoringVaultV1ContextProps { signer: JsonRpcSigner, tokenOut: Token ) => Promise; + /* withdrawQueue */ + withdrawQueueStatuses: ( + Signer: JsonRpcSigner + ) => Promise; + /* Statuses */ depositStatus: DepositStatus; withdrawStatus: WithdrawStatus; isBoringV1ContextReady: boolean; @@ -82,11 +94,13 @@ const BoringVaultV1Context = createContext( ); export const BoringVaultV1Provider: React.FC<{ + chain: string; vaultContract: string; tellerContract: string; accountantContract: string; lensContract: string; delayWithdrawContract?: string; + withdrawQueueContract?: string; depositTokens: Token[]; withdrawTokens: Token[]; ethersProvider: Provider; @@ -95,6 +109,7 @@ export const BoringVaultV1Provider: React.FC<{ children: ReactNode; }> = ({ children, + chain, depositTokens, withdrawTokens, vaultContract, @@ -102,13 +117,13 @@ export const BoringVaultV1Provider: React.FC<{ accountantContract, lensContract, delayWithdrawContract, + withdrawQueueContract, ethersProvider, vaultDecimals, baseAsset, }) => { const { address } = useAccount(); const isConnected = !!address; - const [vaultEthersContract, setVaultEthersContract] = useState(null); const [tellerEthersContract, setTellerContract] = useState( @@ -121,6 +136,8 @@ export const BoringVaultV1Provider: React.FC<{ ); const [delayWithdrawEthersContract, setDelayWithdrawEthersContract] = useState(null); + const [withdrawQueueEthersContract, setWithdrawQueueEthersContract] = + useState(null); const [baseToken, setBaseToken] = useState(null); @@ -128,6 +145,7 @@ export const BoringVaultV1Provider: React.FC<{ useState(depositTokens); const [vaultWithdrawTokens, setVaultWithdrawTokens] = useState(withdrawTokens); + const [userAddress, setUserAddress] = useState(null); const [decimals, setDecimals] = useState(null); const [isBoringV1ContextReady, setIsBoringV1ContextReady] = @@ -143,6 +161,7 @@ export const BoringVaultV1Provider: React.FC<{ useEffect(() => { if ( + chain && vaultContract && tellerContract && accountantContract && @@ -183,6 +202,15 @@ export const BoringVaultV1Provider: React.FC<{ setDelayWithdrawEthersContract(delayWithdrawEthersContract); } + if (withdrawQueueContract) { + const withdrawQueueEthersContract = new Contract( + withdrawQueueContract, + BoringWithdrawQueueContractABI, + ethersProvider + ); + setWithdrawQueueEthersContract(withdrawQueueEthersContract); + } + setVaultEthersContract(vaultEthersContract); setTellerContract(tellerEthersContract); setAccountantEthersContract(accountantEthersContract); @@ -194,6 +222,7 @@ export const BoringVaultV1Provider: React.FC<{ } else { console.warn("Boring vault contracts not initialized"); console.warn("Missing: ", { + chain, vaultContract, tellerContract, accountantContract, @@ -206,6 +235,7 @@ export const BoringVaultV1Provider: React.FC<{ }); } }, [ + chain, vaultContract, tellerContract, accountantContract, @@ -509,6 +539,8 @@ export const BoringVaultV1Provider: React.FC<{ ] ); + /* Delay Withdraws */ + const delayWithdraw = useCallback( async ( signer: JsonRpcSigner, @@ -807,7 +839,6 @@ export const BoringVaultV1Provider: React.FC<{ success: true, tx_hash: cancelReceipt.hash, }); - } catch (error: any) { console.error("Error cancelling withdraw", error); setWithdrawStatus({ @@ -819,9 +850,15 @@ export const BoringVaultV1Provider: React.FC<{ return withdrawStatus; } return withdrawStatus; - - }, [delayWithdrawEthersContract, userAddress, decimals, ethersProvider, isBoringV1ContextReady]); - + }, + [ + delayWithdrawEthersContract, + userAddress, + decimals, + ethersProvider, + isBoringV1ContextReady, + ] + ); const delayWithdrawComplete = useCallback( async (signer: JsonRpcSigner, tokenOut: Token) => { @@ -864,13 +901,15 @@ export const BoringVaultV1Provider: React.FC<{ loading: true, }); - const completeTx = await delayWithdrawContractWithSigner.completeWithdraw( - tokenOut.address, - userAddress - ); + const completeTx = + await delayWithdrawContractWithSigner.completeWithdraw( + tokenOut.address, + userAddress + ); // Wait for confirmation - const completeReceipt: ContractTransactionReceipt = await completeTx.wait(); + const completeReceipt: ContractTransactionReceipt = + await completeTx.wait(); console.log("Withdraw Completed in tx: ", completeReceipt); @@ -894,7 +933,6 @@ export const BoringVaultV1Provider: React.FC<{ success: true, tx_hash: completeReceipt.hash, }); - } catch (error: any) { console.error("Error completing withdraw", error); setWithdrawStatus({ @@ -906,17 +944,95 @@ export const BoringVaultV1Provider: React.FC<{ return withdrawStatus; } return withdrawStatus; - }, [delayWithdrawEthersContract, userAddress, decimals, ethersProvider, isBoringV1ContextReady]); + }, + [ + delayWithdrawEthersContract, + userAddress, + decimals, + ethersProvider, + isBoringV1ContextReady, + ] + ); + + /* withdrawQueue */ + const withdrawQueueStatuses = useCallback( + async (signer: JsonRpcSigner) => { + if ( + !withdrawQueueEthersContract || + !isBoringV1ContextReady || + !userAddress || + !decimals || + !signer + ) { + console.error( + "Contracts or user not ready for withdraw queue statuses...", + { + withdrawQueueEthersContract, + isBoringV1ContextReady, + userAddress, + decimals, + signer, + } + ); + return []; + } + console.log("Fetching withdraw queue statuses ..."); + try { + const withdrawURL = `${SEVEN_SEAS_BASE_API_URL}/withdrawRequests/${chain.toLowerCase()}/${vaultContract}/${userAddress}`; + const response = await fetch(withdrawURL) + .then((response) => { + return response.json(); + }) + .catch((error) => { + console.error("Error fetching withdraw queue statuses", error); + return []; + }); + console.log("Response from Withdraw API: ", response); + // Parse on ["Response"]["open_requests"] + const openRequests = response["Response"]["open_requests"]; + + // Format the status object + return openRequests.map((request: any) => { + return { + sharesWithdrawing: Number(request["amount"]) / 10 ** vaultDecimals, + blockNumberOpened: Number(request["blockNumber"]), + deadlineUnixSeconds: Number(request["deadline"]), + errorCode: Number(request["errorCode"]), + minSharePrice: Number(request["minPrice"]) / 10 ** vaultDecimals, + timestampOpenedUnixSeconds: Number(request["timestamp"]), + transactionHashOpened: request["transactionHash"], + tokenOut: withdrawTokens.find( + (token) => + token.address.toLowerCase() === + request["wantToken"].toLowerCase() + )!, + } as WithdrawQueueStatus; + }); + } catch (error) { + console.error("Error fetching withdraw queue statuses", error); + return []; // Return an empty array in case of an error + } + }, + [ + withdrawQueueEthersContract, + userAddress, + decimals, + ethersProvider, + isBoringV1ContextReady, + ] + ); return ( { }, }} /> + @@ -182,10 +184,12 @@ const App = () => { { address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", decimals: 6, }, + { + displayName: "USDe", + image: + "https://s2.coinmarketcap.com/static/img/coins/64x64/29470.png", + address: "0x9D39A5DE30e57443BfF2A8307A4256c8797A3497", + decimals: 18, + }, ]} baseAsset={{ displayName: "USDC", diff --git a/src/examples/v2.tsx b/src/examples/v2.tsx index 62d6aaf..888b5b9 100644 --- a/src/examples/v2.tsx +++ b/src/examples/v2.tsx @@ -221,6 +221,7 @@ const App = () => { Date: Tue, 25 Jun 2024 16:54:57 -0700 Subject: [PATCH 2/5] Add back older dependencies --- package-lock.json | 741 +++++------------------ src/contexts/v1/BoringVaultContextV1.tsx | 2 +- 2 files changed, 145 insertions(+), 598 deletions(-) diff --git a/package-lock.json b/package-lock.json index f1035bd..a30a5e6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "boring-vault-ui", - "version": "1.4.2", + "version": "1.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "boring-vault-ui", - "version": "1.4.2", + "version": "1.5.0", "license": "MIT", "dependencies": { "@chakra-ui/react": "^2.8.2", @@ -4552,72 +4552,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/@metamask/json-rpc-middleware-stream": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@metamask/json-rpc-middleware-stream/-/json-rpc-middleware-stream-6.0.2.tgz", - "integrity": "sha512-jtyx3PRfc1kqoLpYveIVQNwsxYKefc64/LCl9h9Da1m3nUKEvypbYuXSIwi237qvOjKmNHQKsDOZg6f4uBf62Q==", - "dependencies": { - "@metamask/json-rpc-engine": "^7.3.2", - "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.3.0", - "readable-stream": "^3.6.2" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@metamask/json-rpc-middleware-stream/node_modules/@metamask/safe-event-emitter": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz", - "integrity": "sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/@metamask/json-rpc-middleware-stream/node_modules/@metamask/utils": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-8.5.0.tgz", - "integrity": "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ==", - "dependencies": { - "@ethereumjs/tx": "^4.2.0", - "@metamask/superstruct": "^3.0.0", - "@noble/hashes": "^1.3.1", - "@scure/base": "^1.1.3", - "@types/debug": "^4.1.7", - "debug": "^4.3.4", - "pony-cause": "^2.1.10", - "semver": "^7.5.4", - "uuid": "^9.0.1" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/@metamask/json-rpc-middleware-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@metamask/json-rpc-middleware-stream/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/@metamask/object-multiplex": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@metamask/object-multiplex/-/object-multiplex-1.3.0.tgz", @@ -4885,14 +4819,6 @@ "@babel/runtime": "^7.20.6" } }, - "node_modules/@metamask/superstruct": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@metamask/superstruct/-/superstruct-3.0.0.tgz", - "integrity": "sha512-TOm+Lt/lCJk9j/3QT2LucrPewRmqI7/GKT+blK2IIOAkBMS+9TmeNjd2Y+TlfpSSYstaYsGZyz1XwpiTCg6RLA==", - "engines": { - "node": ">=16.0.0" - } - }, "node_modules/@metamask/utils": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-5.0.2.tgz", @@ -6106,9 +6032,9 @@ } }, "node_modules/@react-native-community/cli-server-api/node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "peer": true, "engines": { "node": ">=8.3.0" @@ -6607,9 +6533,9 @@ } }, "node_modules/@react-native/dev-middleware/node_modules/ws": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz", - "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", + "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", "peer": true, "dependencies": { "async-limiter": "~1.0.0" @@ -7897,14 +7823,14 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, "node_modules/@walletconnect/jsonrpc-http-connection": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.8.tgz", - "integrity": "sha512-+B7cRuaxijLeFDJUq5hAzNyef3e3tBDIxyaCNmFtjwnod5AGis3RToNqzFU33vpVcxFhofkpE7Cx+5MYejbMGw==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-http-connection/-/jsonrpc-http-connection-1.0.7.tgz", + "integrity": "sha512-qlfh8fCfu8LOM9JRR9KE0s0wxP6ZG9/Jom8M0qsoIQeKF3Ni0FyV4V1qy/cc7nfI46SLQLSl4tgWSfLiE1swyQ==", "dependencies": { "@walletconnect/jsonrpc-utils": "^1.0.6", "@walletconnect/safe-json": "^1.0.1", "cross-fetch": "^3.1.4", - "events": "^3.3.0" + "tslib": "1.14.1" } }, "node_modules/@walletconnect/jsonrpc-http-connection/node_modules/cross-fetch": { @@ -7915,6 +7841,11 @@ "node-fetch": "^2.6.12" } }, + "node_modules/@walletconnect/jsonrpc-http-connection/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, "node_modules/@walletconnect/jsonrpc-provider": { "version": "1.0.13", "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.13.tgz", @@ -7971,9 +7902,9 @@ } }, "node_modules/@walletconnect/jsonrpc-ws-connection/node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "engines": { "node": ">=8.3.0" }, @@ -8046,13 +7977,19 @@ } }, "node_modules/@walletconnect/relay-api": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.10.tgz", - "integrity": "sha512-tqrdd4zU9VBNqUaXXQASaexklv6A54yEyQQEXYOCr+Jz8Ket0dmPBDyg19LVSNUN2cipAghQc45/KVmfFJ0cYw==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@walletconnect/relay-api/-/relay-api-1.0.9.tgz", + "integrity": "sha512-Q3+rylJOqRkO1D9Su0DPE3mmznbAalYapJ9qmzDgK28mYF9alcP3UwG/og5V7l7CFOqzCLi7B8BvcBUrpDj0Rg==", "dependencies": { - "@walletconnect/jsonrpc-types": "^1.0.2" + "@walletconnect/jsonrpc-types": "^1.0.2", + "tslib": "1.14.1" } }, + "node_modules/@walletconnect/relay-api/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, "node_modules/@walletconnect/relay-auth": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@walletconnect/relay-auth/-/relay-auth-1.0.4.tgz", @@ -8418,9 +8355,9 @@ "dev": true }, "node_modules/abitype": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.4.tgz", - "integrity": "sha512-UivtYZOGJGE8rsrM/N5vdRkUpqEZVmuTumfTuolm7m/6O09wprd958rx8kUBwVAAAhQDveGAgD0GJdBuR8s6tw==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", + "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", "funding": { "url": "https://github.com/sponsors/wevm" }, @@ -9639,23 +9576,6 @@ } ] }, - "node_modules/cbw-sdk": { - "name": "@coinbase/wallet-sdk", - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/@coinbase/wallet-sdk/-/wallet-sdk-3.9.3.tgz", - "integrity": "sha512-N/A2DRIf0Y3PHc1XAMvbBUu4zisna6qAdqABMZwBMNEfWrXpAwx16pZGkYCLGE+Rvv1edbcB2LYDRnACNcmCiw==", - "dependencies": { - "bn.js": "^5.2.1", - "buffer": "^6.0.3", - "clsx": "^1.2.1", - "eth-block-tracker": "^7.1.0", - "eth-json-rpc-filters": "^6.0.0", - "eventemitter3": "^5.0.1", - "keccak": "^3.0.3", - "preact": "^10.16.0", - "sha.js": "^2.4.11" - } - }, "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", @@ -11383,17 +11303,37 @@ } }, "node_modules/engine.io-client": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.4.tgz", - "integrity": "sha512-GeZeeRjpD2qf49cZQ0Wvh/8NJNfeXkXXcoGh+F77oEAgo9gUHwT1fCRxSNU+YEEaysOJTnsFHmM5oAcPy4ntvQ==", + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-6.5.3.tgz", + "integrity": "sha512-9Z0qLB0NIisTRt1DZ/8U2k12RJn8yls/nXMZLn+/N8hANT3TcYjKFKcwbw5zFQiN4NTde3TSY9zb79e1ij6j9Q==", "dependencies": { "@socket.io/component-emitter": "~3.1.0", "debug": "~4.3.1", "engine.io-parser": "~5.2.1", - "ws": "~8.17.1", + "ws": "~8.11.0", "xmlhttprequest-ssl": "~2.0.0" } }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.11.0.tgz", + "integrity": "sha512-HPG3wQd9sNQoT9xHyNCXoDUa+Xw/VevmY9FoHyQ+g+rrMn4j6FB4np7Z0OhdTgjx6MgQLK7jwSy1YecU1+4Asg==", + "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 + } + } + }, "node_modules/engine.io-parser": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-5.2.2.tgz", @@ -11752,9 +11692,9 @@ } }, "node_modules/ethers": { - "version": "6.13.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", - "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz", + "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==", "funding": [ { "type": "individual", @@ -11772,7 +11712,7 @@ "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", - "ws": "8.17.1" + "ws": "8.5.0" }, "engines": { "node": ">=14.0.0" @@ -15682,6 +15622,27 @@ "node": ">=12" } }, + "node_modules/jsdom/node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dev": true, + "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 + } + } + }, "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", @@ -16718,9 +16679,9 @@ } }, "node_modules/metro/node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "peer": true, "engines": { "node": ">=8.3.0" @@ -18354,9 +18315,9 @@ } }, "node_modules/react-devtools-core/node_modules/ws": { - "version": "7.5.10", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", - "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "version": "7.5.9", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", + "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", "peer": true, "engines": { "node": ">=8.3.0" @@ -18644,9 +18605,9 @@ } }, "node_modules/react-native/node_modules/ws": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz", - "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", + "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", "peer": true, "dependencies": { "async-limiter": "~1.0.0" @@ -21039,9 +21000,9 @@ } }, "node_modules/viem": { - "version": "2.16.2", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.16.2.tgz", - "integrity": "sha512-qor3v1cJFR3jcPtcJxPbKfKURAH2agNf2IWZIaSReV6teNLERiu4Sr7kbqpkIeTAEpiDCVQwg336M+mub1m+pg==", + "version": "2.9.15", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.9.15.tgz", + "integrity": "sha512-7kcmHqybc3JhpjL8gKY7YxBYpZt1//qhoTZIU5Ez9JdyRCnYMMnJu20s7wd7Gv6a3zPbq8jV8dCp94a/NLJJcA==", "funding": [ { "type": "github", @@ -21054,9 +21015,9 @@ "@noble/hashes": "1.3.2", "@scure/bip32": "1.3.2", "@scure/bip39": "1.2.1", - "abitype": "1.0.4", - "isows": "1.0.4", - "ws": "8.17.1" + "abitype": "1.0.0", + "isows": "1.0.3", + "ws": "8.13.0" }, "peerDependencies": { "typescript": ">=5.0.4" @@ -21072,18 +21033,24 @@ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, - "node_modules/viem/node_modules/isows": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.4.tgz", - "integrity": "sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/wagmi-dev" - } - ], + "node_modules/viem/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, "peerDependencies": { - "ws": "*" + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/vlq": { @@ -21113,12 +21080,12 @@ } }, "node_modules/wagmi": { - "version": "2.10.7", - "resolved": "https://registry.npmjs.org/wagmi/-/wagmi-2.10.7.tgz", - "integrity": "sha512-RYh45bpqaPbQDcRYbfaiS0b5iZrEKVCCpjyFTJx83qtbkxZBvpT6MXy1rQbfLookVCgZz0PA3aYEYX8HJPajLg==", + "version": "2.5.19", + "resolved": "https://registry.npmjs.org/wagmi/-/wagmi-2.5.19.tgz", + "integrity": "sha512-fy6s3qTuXpfrrghhoNXuV92yqOqJI7m/9iLIejHxEYxiddVDTR8BVdkt0BuBQZzoXSAutDkyIlJbtFcpX5dfrQ==", "dependencies": { - "@wagmi/connectors": "5.0.19", - "@wagmi/core": "2.11.5", + "@wagmi/connectors": "4.1.25", + "@wagmi/core": "2.6.16", "use-sync-external-store": "1.2.0" }, "funding": { @@ -21136,447 +21103,6 @@ } } }, - "node_modules/wagmi/node_modules/@coinbase/wallet-sdk": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@coinbase/wallet-sdk/-/wallet-sdk-4.0.3.tgz", - "integrity": "sha512-y/OGEjlvosikjfB+wk+4CVb9OxD1ob9cidEBLI5h8Hxaf/Qoob2XoVT1uvhtAzBx34KpGYSd+alKvh/GCRre4Q==", - "dependencies": { - "buffer": "^6.0.3", - "clsx": "^1.2.1", - "eventemitter3": "^5.0.1", - "keccak": "^3.0.3", - "preact": "^10.16.0", - "sha.js": "^2.4.11" - } - }, - "node_modules/wagmi/node_modules/@metamask/object-multiplex": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@metamask/object-multiplex/-/object-multiplex-2.0.0.tgz", - "integrity": "sha512-+ItrieVZie3j2LfYE0QkdW3dsEMfMEp419IGx1zyeLqjRZ14iQUPRO0H6CGgfAAoC0x6k2PfCAGRwJUA9BMrqA==", - "dependencies": { - "once": "^1.4.0", - "readable-stream": "^3.6.2" - }, - "engines": { - "node": "^16.20 || ^18.16 || >=20" - } - }, - "node_modules/wagmi/node_modules/@metamask/providers": { - "version": "15.0.0", - "resolved": "https://registry.npmjs.org/@metamask/providers/-/providers-15.0.0.tgz", - "integrity": "sha512-FXvL1NQNl6I7fMOJTfQYcBlBZ33vSlm6w80cMpmn8sJh0Lb7wcBpe02UwBsNlARnI+Qsr26XeDs6WHUHQh8CuA==", - "dependencies": { - "@metamask/json-rpc-engine": "^7.3.2", - "@metamask/json-rpc-middleware-stream": "^6.0.2", - "@metamask/object-multiplex": "^2.0.0", - "@metamask/rpc-errors": "^6.2.1", - "@metamask/safe-event-emitter": "^3.0.0", - "@metamask/utils": "^8.3.0", - "detect-browser": "^5.2.0", - "extension-port-stream": "^3.0.0", - "fast-deep-equal": "^3.1.3", - "is-stream": "^2.0.0", - "readable-stream": "^3.6.2", - "webextension-polyfill": "^0.10.0" - }, - "engines": { - "node": "^18.18 || >=20" - } - }, - "node_modules/wagmi/node_modules/@metamask/safe-event-emitter": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@metamask/safe-event-emitter/-/safe-event-emitter-3.1.1.tgz", - "integrity": "sha512-ihb3B0T/wJm1eUuArYP4lCTSEoZsClHhuWyfo/kMX3m/odpqNcPfsz5O2A3NT7dXCAgWPGDQGPqygCpgeniKMw==", - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/wagmi/node_modules/@metamask/sdk-communication-layer": { - "version": "0.26.2", - "resolved": "https://registry.npmjs.org/@metamask/sdk-communication-layer/-/sdk-communication-layer-0.26.2.tgz", - "integrity": "sha512-YMqwjhCZ4sXYAsEp1LxLrZZycBwpUeEsA4yIx48m1yW9sZ8pv3NGnbjM+F0zf29DLjyqLxJdxHJ7b5YkgtB26g==", - "dependencies": { - "bufferutil": "^4.0.8", - "date-fns": "^2.29.3", - "debug": "^4.3.4", - "utf-8-validate": "^6.0.3", - "uuid": "^8.3.2" - }, - "peerDependencies": { - "cross-fetch": "^4.0.0", - "eciesjs": "^0.3.16", - "eventemitter2": "^6.4.7", - "readable-stream": "^3.6.2", - "socket.io-client": "^4.5.1" - } - }, - "node_modules/wagmi/node_modules/@metamask/utils": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/@metamask/utils/-/utils-8.5.0.tgz", - "integrity": "sha512-I6bkduevXb72TIM9q2LRO63JSsF9EXduh3sBr9oybNX2hNNpr/j1tEjXrsG0Uabm4MJ1xkGAQEMwifvKZIkyxQ==", - "dependencies": { - "@ethereumjs/tx": "^4.2.0", - "@metamask/superstruct": "^3.0.0", - "@noble/hashes": "^1.3.1", - "@scure/base": "^1.1.3", - "@types/debug": "^4.1.7", - "debug": "^4.3.4", - "pony-cause": "^2.1.10", - "semver": "^7.5.4", - "uuid": "^9.0.1" - }, - "engines": { - "node": ">=16.0.0" - } - }, - "node_modules/wagmi/node_modules/@metamask/utils/node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/wagmi/node_modules/@wagmi/connectors": { - "version": "5.0.19", - "resolved": "https://registry.npmjs.org/@wagmi/connectors/-/connectors-5.0.19.tgz", - "integrity": "sha512-yd0pkM3I7sJuIZf1lIiwxDApaWg5ZSFiN3ociM50SkcoWDAWAKcCWWP0FbaCZ4KT+TZQJEIqBpfk6eZ9mBAddQ==", - "dependencies": { - "@coinbase/wallet-sdk": "4.0.3", - "@metamask/sdk": "0.26.3", - "@safe-global/safe-apps-provider": "0.18.1", - "@safe-global/safe-apps-sdk": "8.1.0", - "@walletconnect/ethereum-provider": "2.13.0", - "@walletconnect/modal": "2.6.2", - "cbw-sdk": "npm:@coinbase/wallet-sdk@3.9.3" - }, - "funding": { - "url": "https://github.com/sponsors/wevm" - }, - "peerDependencies": { - "@wagmi/core": "2.11.5", - "typescript": ">=5.0.4", - "viem": "2.x" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - } - }, - "node_modules/wagmi/node_modules/@wagmi/connectors/node_modules/@metamask/sdk": { - "version": "0.26.3", - "resolved": "https://registry.npmjs.org/@metamask/sdk/-/sdk-0.26.3.tgz", - "integrity": "sha512-DM4BFPr1BDAIhTz7/RWb3oWQRvX79TJVZH8EL/Ljp+CRY7IjCbaVwaLdyQjVd8Doyq1V7AL4N/JjXplpo2YyYg==", - "dependencies": { - "@metamask/onboarding": "^1.0.1", - "@metamask/providers": "^15.0.0", - "@metamask/sdk-communication-layer": "0.26.2", - "@metamask/sdk-install-modal-web": "0.26.0", - "@types/dom-screen-wake-lock": "^1.0.0", - "bowser": "^2.9.0", - "cross-fetch": "^4.0.0", - "debug": "^4.3.4", - "eciesjs": "^0.3.15", - "eth-rpc-errors": "^4.0.3", - "eventemitter2": "^6.4.7", - "i18next": "22.5.1", - "i18next-browser-languagedetector": "7.1.0", - "obj-multiplex": "^1.0.0", - "pump": "^3.0.0", - "qrcode-terminal-nooctal": "^0.12.1", - "react-native-webview": "^11.26.0", - "readable-stream": "^3.6.2", - "rollup-plugin-visualizer": "^5.9.2", - "socket.io-client": "^4.5.1", - "util": "^0.12.4", - "uuid": "^8.3.2" - }, - "peerDependencies": { - "react": "^18.2.0", - "react-dom": "^18.2.0" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - } - } - }, - "node_modules/wagmi/node_modules/@wagmi/connectors/node_modules/@metamask/sdk-install-modal-web": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/@metamask/sdk-install-modal-web/-/sdk-install-modal-web-0.26.0.tgz", - "integrity": "sha512-LyDQFIsWWyU0ZgZR3O9LzRqKzXcYUEGJRCNfb26IjFOquvmQosbhQV0jDNlVa8Tk2Fg4ykTPoaauANh6sVJYVQ==", - "dependencies": { - "qr-code-styling": "^1.6.0-rc.1" - }, - "peerDependencies": { - "i18next": "22.5.1", - "react": "^18.2.0", - "react-dom": "^18.2.0", - "react-i18next": "^13.2.2", - "react-native": "*" - }, - "peerDependenciesMeta": { - "react": { - "optional": true - }, - "react-dom": { - "optional": true - }, - "react-native": { - "optional": true - } - } - }, - "node_modules/wagmi/node_modules/@wagmi/core": { - "version": "2.11.5", - "resolved": "https://registry.npmjs.org/@wagmi/core/-/core-2.11.5.tgz", - "integrity": "sha512-RmtZQkNf/ozdngyDST33WLTdKQHny9SsiNmxln8G06pbnOuhO4dDhnXnfiJ8Lh9GVIfFsjlmtqzfAIo1/86dqg==", - "dependencies": { - "eventemitter3": "5.0.1", - "mipd": "0.0.5", - "zustand": "4.4.1" - }, - "funding": { - "url": "https://github.com/sponsors/wevm" - }, - "peerDependencies": { - "@tanstack/query-core": ">=5.0.0", - "typescript": ">=5.0.4", - "viem": "2.x" - }, - "peerDependenciesMeta": { - "@tanstack/query-core": { - "optional": true - }, - "typescript": { - "optional": true - } - } - }, - "node_modules/wagmi/node_modules/@walletconnect/core": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/core/-/core-2.13.0.tgz", - "integrity": "sha512-blDuZxQenjeXcVJvHxPznTNl6c/2DO4VNrFnus+qHmO6OtT5lZRowdMtlCaCNb1q0OxzgrmBDcTOCbFcCpio/g==", - "dependencies": { - "@walletconnect/heartbeat": "1.2.2", - "@walletconnect/jsonrpc-provider": "1.0.14", - "@walletconnect/jsonrpc-types": "1.0.4", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/jsonrpc-ws-connection": "1.0.14", - "@walletconnect/keyvaluestorage": "1.1.1", - "@walletconnect/logger": "2.1.2", - "@walletconnect/relay-api": "1.0.10", - "@walletconnect/relay-auth": "1.0.4", - "@walletconnect/safe-json": "1.0.2", - "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.0", - "@walletconnect/utils": "2.13.0", - "events": "3.3.0", - "isomorphic-unfetch": "3.1.0", - "lodash.isequal": "4.5.0", - "uint8arrays": "3.1.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/ethereum-provider": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/ethereum-provider/-/ethereum-provider-2.13.0.tgz", - "integrity": "sha512-dnpW8mmLpWl1AZUYGYZpaAfGw1HFkL0WSlhk5xekx3IJJKn4pLacX2QeIOo0iNkzNQxZfux1AK4Grl1DvtzZEA==", - "dependencies": { - "@walletconnect/jsonrpc-http-connection": "1.0.8", - "@walletconnect/jsonrpc-provider": "1.0.14", - "@walletconnect/jsonrpc-types": "1.0.4", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/modal": "2.6.2", - "@walletconnect/sign-client": "2.13.0", - "@walletconnect/types": "2.13.0", - "@walletconnect/universal-provider": "2.13.0", - "@walletconnect/utils": "2.13.0", - "events": "3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/heartbeat": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@walletconnect/heartbeat/-/heartbeat-1.2.2.tgz", - "integrity": "sha512-uASiRmC5MwhuRuf05vq4AT48Pq8RMi876zV8rr8cV969uTOzWdB/k+Lj5yI2PBtB1bGQisGen7MM1GcZlQTBXw==", - "dependencies": { - "@walletconnect/events": "^1.0.1", - "@walletconnect/time": "^1.0.2", - "events": "^3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/jsonrpc-provider": { - "version": "1.0.14", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-provider/-/jsonrpc-provider-1.0.14.tgz", - "integrity": "sha512-rtsNY1XqHvWj0EtITNeuf8PHMvlCLiS3EjQL+WOkxEOA4KPxsohFnBDeyPYiNm4ZvkQdLnece36opYidmtbmow==", - "dependencies": { - "@walletconnect/jsonrpc-utils": "^1.0.8", - "@walletconnect/safe-json": "^1.0.2", - "events": "^3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/jsonrpc-types": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.4.tgz", - "integrity": "sha512-P6679fG/M+wuWg9TY8mh6xFSdYnFyFjwFelxyISxMDrlbXokorEVXYOxiqEbrU3x1BmBoCAJJ+vtEaEoMlpCBQ==", - "dependencies": { - "events": "^3.3.0", - "keyvaluestorage-interface": "^1.0.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/sign-client": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/sign-client/-/sign-client-2.13.0.tgz", - "integrity": "sha512-En7KSvNUlQFx20IsYGsFgkNJ2lpvDvRsSFOT5PTdGskwCkUfOpB33SQJ6nCrN19gyoKPNvWg80Cy6MJI0TjNYA==", - "dependencies": { - "@walletconnect/core": "2.13.0", - "@walletconnect/events": "1.0.1", - "@walletconnect/heartbeat": "1.2.2", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/logger": "2.1.2", - "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.0", - "@walletconnect/utils": "2.13.0", - "events": "3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/types": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/types/-/types-2.13.0.tgz", - "integrity": "sha512-MWaVT0FkZwzYbD3tvk8F+2qpPlz1LUSWHuqbINUtMXnSzJtXN49Y99fR7FuBhNFtDalfuWsEK17GrNA+KnAsPQ==", - "dependencies": { - "@walletconnect/events": "1.0.1", - "@walletconnect/heartbeat": "1.2.2", - "@walletconnect/jsonrpc-types": "1.0.4", - "@walletconnect/keyvaluestorage": "1.1.1", - "@walletconnect/logger": "2.1.2", - "events": "3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/universal-provider": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/universal-provider/-/universal-provider-2.13.0.tgz", - "integrity": "sha512-B5QvO8pnk5Bqn4aIt0OukGEQn2Auk9VbHfhQb9cGwgmSCd1GlprX/Qblu4gyT5+TjHMb1Gz5UssUaZWTWbDhBg==", - "dependencies": { - "@walletconnect/jsonrpc-http-connection": "1.0.8", - "@walletconnect/jsonrpc-provider": "1.0.14", - "@walletconnect/jsonrpc-types": "1.0.4", - "@walletconnect/jsonrpc-utils": "1.0.8", - "@walletconnect/logger": "2.1.2", - "@walletconnect/sign-client": "2.13.0", - "@walletconnect/types": "2.13.0", - "@walletconnect/utils": "2.13.0", - "events": "3.3.0" - } - }, - "node_modules/wagmi/node_modules/@walletconnect/utils": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/@walletconnect/utils/-/utils-2.13.0.tgz", - "integrity": "sha512-q1eDCsRHj5iLe7fF8RroGoPZpdo2CYMZzQSrw1iqL+2+GOeqapxxuJ1vaJkmDUkwgklfB22ufqG6KQnz78sD4w==", - "dependencies": { - "@stablelib/chacha20poly1305": "1.0.1", - "@stablelib/hkdf": "1.0.1", - "@stablelib/random": "1.0.2", - "@stablelib/sha256": "1.0.1", - "@stablelib/x25519": "1.0.3", - "@walletconnect/relay-api": "1.0.10", - "@walletconnect/safe-json": "1.0.2", - "@walletconnect/time": "1.0.2", - "@walletconnect/types": "2.13.0", - "@walletconnect/window-getters": "1.0.1", - "@walletconnect/window-metadata": "1.0.1", - "detect-browser": "5.3.0", - "query-string": "7.1.3", - "uint8arrays": "3.1.0" - } - }, - "node_modules/wagmi/node_modules/extension-port-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/extension-port-stream/-/extension-port-stream-3.0.0.tgz", - "integrity": "sha512-an2S5quJMiy5bnZKEf6AkfH/7r8CzHvhchU40gxN+OM6HPhe7Z9T1FUychcf2M9PpPOO0Hf7BAEfJkw2TDIBDw==", - "dependencies": { - "readable-stream": "^3.6.2 || ^4.4.2", - "webextension-polyfill": ">=0.10.0 <1.0" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/wagmi/node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/wagmi/node_modules/i18next": { - "version": "22.5.1", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-22.5.1.tgz", - "integrity": "sha512-8TGPgM3pAD+VRsMtUMNknRz3kzqwp/gPALrWMsDnmC1mKqJwpWyooQRLMcbTwq8z8YwSmuj+ZYvc+xCuEpkssA==", - "funding": [ - { - "type": "individual", - "url": "https://locize.com" - }, - { - "type": "individual", - "url": "https://locize.com/i18next.html" - }, - { - "type": "individual", - "url": "https://www.i18next.com/how-to/faq#i18next-is-awesome.-how-can-i-support-the-project" - } - ], - "dependencies": { - "@babel/runtime": "^7.20.6" - } - }, - "node_modules/wagmi/node_modules/i18next-browser-languagedetector": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/i18next-browser-languagedetector/-/i18next-browser-languagedetector-7.1.0.tgz", - "integrity": "sha512-cr2k7u1XJJ4HTOjM9GyOMtbOA47RtUoWRAtt52z43r3AoMs2StYKyjS3URPhzHaf+mn10hY9dZWamga5WPQjhA==", - "dependencies": { - "@babel/runtime": "^7.19.4" - } - }, - "node_modules/wagmi/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/wagmi/node_modules/uint8arrays": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.1.0.tgz", - "integrity": "sha512-ei5rfKtoRO8OyOIor2Rz5fhzjThwIHJZ3uyDPnDHTXbP0aMQ1RN/6AI5B5d9dBxJOU+BvOAk7ZQ1xphsX8Lrog==", - "dependencies": { - "multiformats": "^9.4.2" - } - }, - "node_modules/wagmi/node_modules/utf-8-validate": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-6.0.4.tgz", - "integrity": "sha512-xu9GQDeFp+eZ6LnCywXN/zBancWvOpUMzgjLPSjy4BRHSmTelvn2E0DG0o1sTiw5hkCKBHo8rwSKncfRfv2EEQ==", - "hasInstallScript": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/walker": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", @@ -21968,6 +21494,27 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/webpack-dev-server/node_modules/ws": { + "version": "8.16.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", + "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "dev": true, + "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 + } + } + }, "node_modules/webpack-merge": { "version": "5.10.0", "resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.10.0.tgz", @@ -22282,15 +21829,15 @@ } }, "node_modules/ws": { - "version": "8.17.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", - "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": ">=5.0.2" + "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { diff --git a/src/contexts/v1/BoringVaultContextV1.tsx b/src/contexts/v1/BoringVaultContextV1.tsx index 07ac577..a63a343 100644 --- a/src/contexts/v1/BoringVaultContextV1.tsx +++ b/src/contexts/v1/BoringVaultContextV1.tsx @@ -27,7 +27,7 @@ import { ContractTransactionReceipt, } from "ethers"; import { erc20Abi } from "viem"; -import BigNumber from "bignumber.js"; +import BigNumber from "bignumber.js" import BoringDelayWithdrawContractABI from "../../abis/v1/BoringDelayWithdrawContractABI"; const SEVEN_SEAS_BASE_API_URL = "https://api.sevenseas.capital"; From c95548797d60cf0408953038f017261aec82454b Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 25 Jun 2024 19:26:53 -0700 Subject: [PATCH 3/5] Cancel withdraws --- .../v1/PendingWithdrawQueueStatuses.tsx | 10 +- .../v1/WithdrawQueueCancelButton.tsx | 32 ++++++ src/contexts/v1/BoringVaultContextV1.tsx | 98 +++++++++++++++++++ 3 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 src/components/v1/WithdrawQueueCancelButton.tsx diff --git a/src/components/v1/PendingWithdrawQueueStatuses.tsx b/src/components/v1/PendingWithdrawQueueStatuses.tsx index 39d399a..b64cde9 100644 --- a/src/components/v1/PendingWithdrawQueueStatuses.tsx +++ b/src/components/v1/PendingWithdrawQueueStatuses.tsx @@ -3,6 +3,7 @@ import { Box, HStack, Text, VStack } from "@chakra-ui/react"; import { useBoringVaultV1 } from "../../contexts/v1/BoringVaultContextV1"; import { useEthersSigner } from "../../hooks/ethers"; import { WithdrawQueueStatus } from "../../types"; +import WithdrawQueueCancelButton from "./WithdrawQueueCancelButton"; interface PendingWithdrawQueueStatusesProps { title?: string; // Optional title @@ -47,7 +48,8 @@ const PendingWithdrawQueueStatuses: React.FC< - Shares Withdrawing: {withdrawStatus.sharesWithdrawing} + Shares Withdrawing:{" "} + {withdrawStatus.sharesWithdrawing} Token Out:{" "} @@ -63,11 +65,7 @@ const PendingWithdrawQueueStatuses: React.FC< - {/* TODO: Cancel Button - - */} + diff --git a/src/components/v1/WithdrawQueueCancelButton.tsx b/src/components/v1/WithdrawQueueCancelButton.tsx new file mode 100644 index 0000000..a315c9a --- /dev/null +++ b/src/components/v1/WithdrawQueueCancelButton.tsx @@ -0,0 +1,32 @@ +// src/components/v1/WithdrawQueueCancelButton.tsx + +import React, { useEffect, useState } from "react"; +import { Box, Text, VStack, Button } from "@chakra-ui/react"; +import { useBoringVaultV1 } from "../../contexts/v1/BoringVaultContextV1"; +import { Token } from "../../types"; +import { useEthersSigner } from "../../hooks/ethers"; + +interface WithdrawQueueCancelButtonProps { + token: Token; +} + +const WithdrawQueueCancelButton: React.FC = ({ + token, +}) => { + const { withdrawQueueCancel } = useBoringVaultV1(); + const signer = useEthersSigner(); + + return ( + + ); +}; + +export default WithdrawQueueCancelButton; diff --git a/src/contexts/v1/BoringVaultContextV1.tsx b/src/contexts/v1/BoringVaultContextV1.tsx index a63a343..729b35e 100644 --- a/src/contexts/v1/BoringVaultContextV1.tsx +++ b/src/contexts/v1/BoringVaultContextV1.tsx @@ -79,6 +79,14 @@ interface BoringVaultV1ContextProps { tokenOut: Token ) => Promise; /* withdrawQueue */ + + + + // TODO: Create + withdrawQueueCancel: ( + signer: JsonRpcSigner, + token: Token + ) => Promise; withdrawQueueStatuses: ( Signer: JsonRpcSigner ) => Promise; @@ -1023,6 +1031,95 @@ export const BoringVaultV1Provider: React.FC<{ ] ); + const withdrawQueueCancel = useCallback( + async (signer: JsonRpcSigner, token: Token) => { + if ( + !withdrawQueueEthersContract || + !isBoringV1ContextReady || + !userAddress || + !decimals || + !signer + ) { + console.error("Contracts or user not ready to cancel withdraw", { + withdrawQueueEthersContract, + isBoringV1ContextReady, + userAddress, + decimals, + signer, + }); + + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: "Contracts or user not ready", + }); + + return withdrawStatus; + } + + console.log("Cancelling withdraw queue ..."); + const withdrawQueueContractWithSigner = new Contract( + withdrawQueueContract!, + BoringWithdrawQueueContractABI, + signer + ); + + setWithdrawStatus({ + initiated: true, + loading: true, + }); + + try { + // Update request with same token, but 0 amount + const cancelTx = await withdrawQueueContractWithSigner.updateAtomicRequest( + vaultContract, + token.address, + [ + 0, // Deadline + 0, // atomicPrice + 0, // offerAmount + false, // inSolver + ] + ); + + // Wait for confirmation + const cancelReceipt: ContractTransactionReceipt = await cancelTx.wait(); + + console.log("Withdraw Cancelled in tx: ", cancelReceipt); + if (!cancelReceipt.hash) { + console.error("Withdraw Cancel failed"); + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: "Withdraw Cancel reverted", + }); + return withdrawStatus; + } + console.log("Withdraw Cancel hash: ", cancelReceipt.hash); + + // Set status + setWithdrawStatus({ + initiated: false, + loading: false, + success: true, + tx_hash: cancelReceipt.hash, + }); + } catch (error: any) { + console.error("Error cancelling withdraw", error); + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: (error as Error).message, + }); + return withdrawStatus; + } + + return withdrawStatus; + }, [withdrawQueueEthersContract, userAddress, decimals, ethersProvider, isBoringV1ContextReady]); + return ( Date: Tue, 25 Jun 2024 19:58:47 -0700 Subject: [PATCH 4/5] Withdraw Button --- src/components/v1/WithdrawQueueButton.tsx | 270 +++++++++++++++++++++ src/contexts/v1/BoringVaultContextV1.tsx | 275 +++++++++++++++++----- src/examples/v1.tsx | 34 +++ 3 files changed, 519 insertions(+), 60 deletions(-) create mode 100644 src/components/v1/WithdrawQueueButton.tsx diff --git a/src/components/v1/WithdrawQueueButton.tsx b/src/components/v1/WithdrawQueueButton.tsx new file mode 100644 index 0000000..ed3cc10 --- /dev/null +++ b/src/components/v1/WithdrawQueueButton.tsx @@ -0,0 +1,270 @@ +// src/components/v1/WithdrawQueueButton.tsx + +import React, { useEffect } from "react"; +import { + Button, + Modal, + ModalOverlay, + ModalContent, + ModalBody, + ModalCloseButton, + useDisclosure, + ButtonProps, + ModalProps, + ModalOverlayProps, + ModalContentProps, + ModalBodyProps, + ModalCloseButtonProps, + Text, + HStack, + VStack, + Box, + Image, + Select, + InputGroup, + Input, + InputRightElement, + FormControl, + Flex, + FormHelperText, + FormLabel, + InputProps, + ButtonGroup, + ModalHeader, + ModalFooter, + Avatar, + useToast, +} from "@chakra-ui/react"; +import { useBoringVaultV1 } from "../../contexts/v1/BoringVaultContextV1"; +import { Token } from "../../types"; +import { Contract, formatUnits } from "ethers"; +import { erc20Abi } from "viem"; +import { useEthersSigner } from "../../hooks/ethers"; + +interface WithdrawQueueButtonProps { + buttonText: string; + popupText: string; + title?: string; // Optional title + bottomText?: string; // Optional bottom text (e.g. disclaimer, etc.) + buttonProps?: ButtonProps; + modalProps?: ModalProps; + modalOverlayProps?: ModalOverlayProps; + modalContentProps?: ModalContentProps; + modalBodyProps?: ModalBodyProps; + modalCloseButtonProps?: ModalCloseButtonProps; + inputProps?: any; +} + +const WithdrawQueueButton: React.FC = ({ + buttonText, + buttonProps, + modalProps, + modalOverlayProps, + modalContentProps, + modalBodyProps, + modalCloseButtonProps, + inputProps, + title, + bottomText, + ...withdrawButtonProps +}) => { + const { isOpen, onOpen, onClose } = useDisclosure(); + const { + withdrawTokens, + isConnected, + userAddress, + ethersProvider, + withdrawStatus, + queueWithdraw, + fetchUserShares, + } = useBoringVaultV1(); + + const [selectedToken, setSelectedToken] = React.useState( + withdrawTokens[0] + ); + const [balance, setBalance] = React.useState(0.0); + const [withdrawAmount, setWithdrawAmount] = React.useState(""); + const [discountPercent, setDiscountPercent] = React.useState(""); + const [daysValid, setDaysValid] = React.useState(""); + const signer = useEthersSigner(); + + useEffect(() => { + async function fetchBalance() { + if (!userAddress || !ethersProvider) return; + + try { + const shareBalance = await fetchUserShares(); + setBalance(shareBalance); + } catch (error) { + console.error("Failed to fetch share balance:", error); + setBalance(0); // Optionally reset balance on error + } + } + + fetchBalance(); + }, [userAddress, ethersProvider]); + + const handleSelectChange = (event: React.ChangeEvent) => { + const newTokenAddress = event.target.value; + console.log("New token address:", newTokenAddress); + console.log("Withdraw tokens:", withdrawTokens); + const newSelectedToken = withdrawTokens.find( + (token) => token.address === newTokenAddress + ); + setSelectedToken(newSelectedToken || withdrawTokens[0]); + }; + + // TODO: Allow people to pass in a toast to allow for custom toast branding + const toast = useToast(); + useEffect(() => { + if (withdrawStatus.loading) { + toast({ + title: "Processing withdraw...", + status: "info", + duration: 5000, + isClosable: true, + }); + } else if (withdrawStatus.success) { + toast({ + title: "Intent successful", + // Add link to etherscan + description: `Transaction hash: ${withdrawStatus.tx_hash}`, + status: "success", + duration: 5000, + isClosable: true, + }); + } else if (withdrawStatus.error) { + toast({ + title: "Failed to initiate withdraw", + description: withdrawStatus.error, + status: "error", + duration: 5000, + isClosable: true, + }); + } + }, [withdrawStatus, toast]); + + return ( + <> + + + + + {title && {title}} + + + + + + + Asset Out:{" "} + + + + + + + Shares to Redeem:{" "} + + {/* TODO: Sterilize input to only allow positive numbers */} + setWithdrawAmount(e.target.value)} + {...inputProps} + /> + + + Share Balance: {balance} + + + + + + Discount Percent (if share value is 1, a discount of 1% + means you'll accept a share price of 0.99):{" "} + + {/* TODO: Sterilize input to only allow positive numbers */} + setDiscountPercent(e.target.value)} + {...inputProps} + /> + + + + + + Days Valid (until order expires if unfulfilled):{" "} + + {/* TODO: Sterilize input to only allow positive numbers */} + setDaysValid(e.target.value)} + {...inputProps} + /> + + + + + + {/* Example static value, replace with actual conversion */} + + + + {bottomText && ( + + {bottomText} + + )} + + + + ); +}; + +export default WithdrawQueueButton; diff --git a/src/contexts/v1/BoringVaultContextV1.tsx b/src/contexts/v1/BoringVaultContextV1.tsx index 729b35e..65ec09b 100644 --- a/src/contexts/v1/BoringVaultContextV1.tsx +++ b/src/contexts/v1/BoringVaultContextV1.tsx @@ -27,7 +27,7 @@ import { ContractTransactionReceipt, } from "ethers"; import { erc20Abi } from "viem"; -import BigNumber from "bignumber.js" +import BigNumber from "bignumber.js"; import BoringDelayWithdrawContractABI from "../../abis/v1/BoringDelayWithdrawContractABI"; const SEVEN_SEAS_BASE_API_URL = "https://api.sevenseas.capital"; @@ -79,10 +79,13 @@ interface BoringVaultV1ContextProps { tokenOut: Token ) => Promise; /* withdrawQueue */ - - - - // TODO: Create + queueWithdraw: ( + signer: JsonRpcSigner, + amount: string, + token: Token, + discountPercent: string, + daysValid: string + ) => Promise; withdrawQueueCancel: ( signer: JsonRpcSigner, token: Token @@ -963,67 +966,141 @@ export const BoringVaultV1Provider: React.FC<{ ); /* withdrawQueue */ - const withdrawQueueStatuses = useCallback( - async (signer: JsonRpcSigner) => { + const queueWithdraw = useCallback( + async ( + signer: JsonRpcSigner, + amountHumanReadable: string, + token: Token, + discountPercent: string, + daysValid: string + ) => { if ( !withdrawQueueEthersContract || + !vaultEthersContract || !isBoringV1ContextReady || + !lensEthersContract || !userAddress || !decimals || !signer ) { - console.error( - "Contracts or user not ready for withdraw queue statuses...", - { - withdrawQueueEthersContract, - isBoringV1ContextReady, - userAddress, - decimals, - signer, - } - ); - return []; + console.error("Contracts or user not ready", { + withdrawQueueEthersContract, + isBoringV1ContextReady, + userAddress, + decimals, + signer, + }); + + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: "Contracts or user not ready", + }); + + return withdrawStatus; } - console.log("Fetching withdraw queue statuses ..."); + + console.log("Queueing withdraw ..."); + const withdrawQueueContractWithSigner = new Contract( + withdrawQueueContract!, + BoringWithdrawQueueContractABI, + signer + ); + + setWithdrawStatus({ + initiated: true, + loading: true, + }); try { - const withdrawURL = `${SEVEN_SEAS_BASE_API_URL}/withdrawRequests/${chain.toLowerCase()}/${vaultContract}/${userAddress}`; - const response = await fetch(withdrawURL) - .then((response) => { - return response.json(); - }) - .catch((error) => { - console.error("Error fetching withdraw queue statuses", error); - return []; + // Get the amount in base denomination + const bigNumAmt = new BigNumber(amountHumanReadable); + console.warn(amountHumanReadable); + console.warn("Amount to withdraw: ", bigNumAmt.toNumber()); + const amountWithdrawBaseDenom = bigNumAmt + .multipliedBy(new BigNumber(10).pow(vaultDecimals)) + .decimalPlaces(0, BigNumber.ROUND_DOWN); + console.warn( + "Amount to withdraw: ", + amountWithdrawBaseDenom.toNumber() + ); + + // Get the current share price + const sharePrice = await lensEthersContract.exchangeRate( + accountantContract + ); + + // Discounted share price + const discountedSharePrice = new BigNumber(sharePrice) + .multipliedBy( + new BigNumber(100) + .minus(new BigNumber(discountPercent)) + .dividedBy(100) + ) + .decimalPlaces(0, BigNumber.ROUND_DOWN); + + // Get the days valid + const daysValidSeconds = new BigNumber(daysValid).multipliedBy( + new BigNumber(86400) // 1 day in seconds + ); + // Get the current unix time seconds and add the days valid + const deadline = new BigNumber( + Math.floor(Date.now() / 1000) + + Math.floor(daysValidSeconds.toNumber()) + ).decimalPlaces(0, BigNumber.ROUND_DOWN); + + const queueTx = + await withdrawQueueContractWithSigner.updateAtomicRequest( + vaultContract, + token.address, + [ + deadline.toNumber(), // Deadline + discountedSharePrice.toNumber(), // atomicPrice + amountWithdrawBaseDenom.toNumber(), // offerAmount + false, // inSolver + ] + ); + + // Wait for confirmation + const queueReceipt: ContractTransactionReceipt = await queueTx.wait(); + + console.log("Withdraw Queued in tx: ", queueReceipt); + if (!queueReceipt.hash) { + console.error("Withdraw Queue failed"); + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: "Withdraw Queue reverted", }); - console.log("Response from Withdraw API: ", response); - // Parse on ["Response"]["open_requests"] - const openRequests = response["Response"]["open_requests"]; + return withdrawStatus; + } + console.log("Withdraw Queue hash: ", queueReceipt.hash); - // Format the status object - return openRequests.map((request: any) => { - return { - sharesWithdrawing: Number(request["amount"]) / 10 ** vaultDecimals, - blockNumberOpened: Number(request["blockNumber"]), - deadlineUnixSeconds: Number(request["deadline"]), - errorCode: Number(request["errorCode"]), - minSharePrice: Number(request["minPrice"]) / 10 ** vaultDecimals, - timestampOpenedUnixSeconds: Number(request["timestamp"]), - transactionHashOpened: request["transactionHash"], - tokenOut: withdrawTokens.find( - (token) => - token.address.toLowerCase() === - request["wantToken"].toLowerCase() - )!, - } as WithdrawQueueStatus; + // Set status + setWithdrawStatus({ + initiated: false, + loading: false, + success: true, + tx_hash: queueReceipt.hash, }); - } catch (error) { - console.error("Error fetching withdraw queue statuses", error); - return []; // Return an empty array in case of an error + } catch (error: any) { + console.error("Error queueing withdraw", error); + setWithdrawStatus({ + initiated: false, + loading: false, + success: false, + error: (error as Error).message, + }); + return withdrawStatus; } + + return withdrawStatus; }, [ withdrawQueueEthersContract, + lensEthersContract, userAddress, decimals, ethersProvider, @@ -1072,16 +1149,17 @@ export const BoringVaultV1Provider: React.FC<{ try { // Update request with same token, but 0 amount - const cancelTx = await withdrawQueueContractWithSigner.updateAtomicRequest( - vaultContract, - token.address, - [ - 0, // Deadline - 0, // atomicPrice - 0, // offerAmount - false, // inSolver - ] - ); + const cancelTx = + await withdrawQueueContractWithSigner.updateAtomicRequest( + vaultContract, + token.address, + [ + 0, // Deadline + 0, // atomicPrice + 0, // offerAmount + false, // inSolver + ] + ); // Wait for confirmation const cancelReceipt: ContractTransactionReceipt = await cancelTx.wait(); @@ -1118,7 +1196,83 @@ export const BoringVaultV1Provider: React.FC<{ } return withdrawStatus; - }, [withdrawQueueEthersContract, userAddress, decimals, ethersProvider, isBoringV1ContextReady]); + }, + [ + withdrawQueueEthersContract, + userAddress, + decimals, + ethersProvider, + isBoringV1ContextReady, + ] + ); + + const withdrawQueueStatuses = useCallback( + async (signer: JsonRpcSigner) => { + if ( + !withdrawQueueEthersContract || + !isBoringV1ContextReady || + !userAddress || + !decimals || + !signer + ) { + console.error( + "Contracts or user not ready for withdraw queue statuses...", + { + withdrawQueueEthersContract, + isBoringV1ContextReady, + userAddress, + decimals, + signer, + } + ); + return []; + } + console.log("Fetching withdraw queue statuses ..."); + + try { + const withdrawURL = `${SEVEN_SEAS_BASE_API_URL}/withdrawRequests/${chain.toLowerCase()}/${vaultContract}/${userAddress}`; + const response = await fetch(withdrawURL) + .then((response) => { + return response.json(); + }) + .catch((error) => { + console.error("Error fetching withdraw queue statuses", error); + return []; + }); + console.log("Response from Withdraw API: ", response); + // Parse on ["Response"]["open_requests"] + const openRequests = response["Response"]["open_requests"]; + + // Format the status object + return openRequests.map((request: any) => { + return { + sharesWithdrawing: Number(request["amount"]) / 10 ** vaultDecimals, + blockNumberOpened: Number(request["blockNumber"]), + deadlineUnixSeconds: Number(request["deadline"]), + errorCode: Number(request["errorCode"]), + minSharePrice: Number(request["minPrice"]) / 10 ** vaultDecimals, + timestampOpenedUnixSeconds: Number(request["timestamp"]), + transactionHashOpened: request["transactionHash"], + tokenOut: withdrawTokens.find( + (token) => + token.address.toLowerCase() === + request["wantToken"].toLowerCase() + )!, + } as WithdrawQueueStatus; + }); + } catch (error) { + console.error("Error fetching withdraw queue statuses", error); + return []; // Return an empty array in case of an error + } + }, + [ + withdrawQueueEthersContract, + userAddress, + decimals, + ethersProvider, + isBoringV1ContextReady, + ] + ); return ( { }, }} /> + From 13950769535a1af662302e70c9a7ef7c1e31dbfa Mon Sep 17 00:00:00 2001 From: Phil Date: Tue, 25 Jun 2024 20:00:40 -0700 Subject: [PATCH 5/5] README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 227103e..a4d2615 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # Boring Vault UI A reusable package to quickly integrate boring vaults onto a UI. +Full documentation for using this package can be found at https://www.notion.so/7seascapital/Boring-Vault-UI-SDK-545da170a9f349259176fa96eb000423 # Local Pkg Development Setup 1. Clone the repository