diff --git a/migration/1702374813793-addChainTypeToProjectAddressAndDonation.ts b/migration/1702374813793-addChainTypeToProjectAddressAndDonation.ts new file mode 100644 index 000000000..a79a771a2 --- /dev/null +++ b/migration/1702374813793-addChainTypeToProjectAddressAndDonation.ts @@ -0,0 +1,23 @@ +import { MigrationInterface, QueryRunner } from 'typeorm'; + +export class addChainTypeToProjectAddressAndDonation1702374813793 + implements MigrationInterface +{ + public async up(queryRunner: QueryRunner): Promise { + // Add chainType to projectAddress + await queryRunner.query( + `ALTER TABLE "project_address" ADD "chainType" character varying NOT NULL DEFAULT 'EVM'`, + ); + // Add chainType to donation + await queryRunner.query( + `ALTER TABLE "donation" ADD "chainType" character varying NOT NULL DEFAULT 'EVM'`, + ); + + // Update chainType for projectAddress + await queryRunner.query(`UPDATE "project_address" SET "chainType" = 'EVM'`); + // Update chainType for donation + await queryRunner.query(`UPDATE "donation" SET "chainType" = 'EVM'`); + } + + public async down(queryRunner: QueryRunner): Promise {} +} diff --git a/package-lock.json b/package-lock.json index 6d35318d9..ef2016721 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,6 +19,7 @@ "@giveth/monoswap": "^1.3.2", "@sentry/node": "6.16.1", "@sentry/tracing": "^6.2.0", + "@solana/web3.js": "^1.87.6", "@types/bcryptjs": "^2.4.2", "@types/connect-redis": "0.0.13", "@types/cors": "^2.8.10", @@ -2168,16 +2169,21 @@ } }, "node_modules/@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.6.tgz", + "integrity": "sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + }, "node_modules/@babel/template": { "version": "7.20.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.20.7.tgz", @@ -3490,6 +3496,28 @@ "rlp": "^2.2.3" } }, + "node_modules/@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "dependencies": { + "@noble/hashes": "1.3.3" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@noble/curves/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -4453,6 +4481,115 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, + "node_modules/@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "dependencies": { + "buffer": "~6.0.3" + }, + "engines": { + "node": ">=5.10" + } + }, + "node_modules/@solana/buffer-layout/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solana/web3.js": { + "version": "1.87.6", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.87.6.tgz", + "integrity": "sha512-LkqsEBgTZztFiccZZXnawWa8qNCATEqE97/d0vIwjTclmVlc8pBpD1DmjfVHtZ1HS5fZorFlVhXfpwnCNDZfyg==", + "dependencies": { + "@babel/runtime": "^7.23.2", + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.1", + "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.3.0", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^4.1.0", + "node-fetch": "^2.6.12", + "rpc-websockets": "^7.5.1", + "superstruct": "^0.14.2" + } + }, + "node_modules/@solana/web3.js/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@solana/web3.js/node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node_modules/@solana/web3.js/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/@spruceid/siwe-parser": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@spruceid/siwe-parser/-/siwe-parser-1.1.3.tgz", @@ -5589,6 +5726,14 @@ "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.11.tgz", "integrity": "sha512-WqTos+CnAKN64YwyBMhgUYhb5VsTNKwUY6AuzG5qu9/pFZJar/RJFMZBXwX7VS+uzYi+lIAr3WkvuWqEI9F2eg==" }, + "node_modules/@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", @@ -6014,6 +6159,17 @@ "node": ">= 6.0.0" } }, + "node_modules/agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "dependencies": { + "humanize-ms": "^1.2.1" + }, + "engines": { + "node": ">= 8.0.0" + } + }, "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -6408,6 +6564,18 @@ "node": "*" } }, + "node_modules/bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.3.0" + }, + "engines": { + "node": ">= 10.0.0" + } + }, "node_modules/bigint-crypto-utils": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.1.8.tgz", @@ -6445,6 +6613,19 @@ "node": ">=8" } }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bindings/node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -6516,6 +6697,16 @@ "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==" }, + "node_modules/borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "dependencies": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, "node_modules/brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -6677,7 +6868,6 @@ "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", "hasInstallScript": true, "optional": true, - "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -7701,6 +7891,17 @@ "node": ">=4" } }, + "node_modules/delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -8008,6 +8209,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "node_modules/es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "dependencies": { + "es6-promise": "^4.0.3" + } + }, "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -8302,6 +8516,11 @@ "node": ">=6" } }, + "node_modules/eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, "node_modules/evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -8491,6 +8710,14 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==", + "engines": { + "node": "> 0.1.90" + } + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -8518,6 +8745,11 @@ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, + "node_modules/fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" + }, "node_modules/fast-text-encoding": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz", @@ -10067,6 +10299,14 @@ "node": ">= 6" } }, + "node_modules/humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "dependencies": { + "ms": "^2.0.0" + } + }, "node_modules/husky": { "version": "4.3.8", "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", @@ -10743,11 +10983,54 @@ "node": ">=0.10.0" } }, + "node_modules/isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "peerDependencies": { + "ws": "*" + } + }, "node_modules/iterall": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==" }, + "node_modules/jayson": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", + "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "dependencies": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "bin": { + "jayson": "bin/jayson.js" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jayson/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "node_modules/jayson/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + }, "node_modules/jest-docblock": { "version": "21.2.0", "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", @@ -10866,6 +11149,11 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, "node_modules/json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -10893,6 +11181,29 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "engines": [ + "node >= 0.2.0" + ] + }, + "node_modules/JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "dependencies": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + }, + "bin": { + "JSONStream": "bin.js" + }, + "engines": { + "node": "*" + } + }, "node_modules/jsonwebtoken": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", @@ -14348,6 +14659,45 @@ "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.3.tgz", "integrity": "sha512-85aZYCxweiD5J8yTEbw+E6A27zSnLPNDL0WfPdw3YYodq7WjnTKo0q4dtyQ2gz23iPT8Q9CUyJtAaUNcTxRf5Q==" }, + "node_modules/rpc-websockets": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.8.0.tgz", + "integrity": "sha512-AStkq6KDvSAmA4WiwlK1pDvj/33BWmExTATUokC0v+NhWekXSTNzXS5OGXeYwq501/pj6lBZMofg/h4dx4/tCg==", + "dependencies": { + "@babel/runtime": "^7.17.2", + "eventemitter3": "^4.0.7", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "funding": { + "type": "paypal", + "url": "https://paypal.me/kozjak" + }, + "optionalDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + } + }, + "node_modules/rpc-websockets/node_modules/ws": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.0.tgz", + "integrity": "sha512-H/Z3H55mrcrgjFwI+5jKavgXvwQLtfPCUEp6pi35VhoB0pfcHnSoyuTzkBEZpzq49g1193CUEwIvmsjcotenYw==", + "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/run-parallel-limit": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", @@ -15419,6 +15769,11 @@ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" }, + "node_modules/superstruct": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", + "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" + }, "node_modules/supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -15540,6 +15895,11 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" }, + "node_modules/text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + }, "node_modules/text-mask-addons": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/text-mask-addons/-/text-mask-addons-3.8.0.tgz", @@ -16609,7 +16969,6 @@ "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "hasInstallScript": true, "optional": true, - "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -18530,11 +18889,18 @@ } }, "@babel/runtime": { - "version": "7.20.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.20.7.tgz", - "integrity": "sha512-UF0tvkUtxwAgZ5W/KrkHf0Rn0fdnLDU9ScxBrEVNUprE/MzirjK4MJUX1/BVDv00Sv8cljtukVK1aky++X1SjQ==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.6.tgz", + "integrity": "sha512-zHd0eUrf5GZoOWVCXp6koAKQTfZV07eit6bGPmJgnZdnSAvvZee6zniW2XMF7Cmc4ISOOnPy3QaSiIJGJkVEDQ==", "requires": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + } } }, "@babel/template": { @@ -19455,6 +19821,21 @@ } } }, + "@noble/curves": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz", + "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==", + "requires": { + "@noble/hashes": "1.3.3" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + } + } + }, "@noble/hashes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", @@ -20172,6 +20553,71 @@ "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", "dev": true }, + "@solana/buffer-layout": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz", + "integrity": "sha512-E1ImOIAD1tBZFRdjeM4/pzTiTApC0AOBGwyAMS4fwIodCWArzJ3DWdoh8cKxeFM2fElkxBh2Aqts1BPC373rHA==", + "requires": { + "buffer": "~6.0.3" + }, + "dependencies": { + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + } + } + }, + "@solana/web3.js": { + "version": "1.87.6", + "resolved": "https://registry.npmjs.org/@solana/web3.js/-/web3.js-1.87.6.tgz", + "integrity": "sha512-LkqsEBgTZztFiccZZXnawWa8qNCATEqE97/d0vIwjTclmVlc8pBpD1DmjfVHtZ1HS5fZorFlVhXfpwnCNDZfyg==", + "requires": { + "@babel/runtime": "^7.23.2", + "@noble/curves": "^1.2.0", + "@noble/hashes": "^1.3.1", + "@solana/buffer-layout": "^4.0.0", + "agentkeepalive": "^4.3.0", + "bigint-buffer": "^1.1.5", + "bn.js": "^5.2.1", + "borsh": "^0.7.0", + "bs58": "^4.0.1", + "buffer": "6.0.3", + "fast-stable-stringify": "^1.0.0", + "jayson": "^4.1.0", + "node-fetch": "^2.6.12", + "rpc-websockets": "^7.5.1", + "superstruct": "^0.14.2" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "requires": { + "whatwg-url": "^5.0.0" + } + } + } + }, "@spruceid/siwe-parser": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/@spruceid/siwe-parser/-/siwe-parser-1.1.3.tgz", @@ -21081,6 +21527,14 @@ "resolved": "https://registry.npmjs.org/@types/validator/-/validator-13.7.11.tgz", "integrity": "sha512-WqTos+CnAKN64YwyBMhgUYhb5VsTNKwUY6AuzG5qu9/pFZJar/RJFMZBXwX7VS+uzYi+lIAr3WkvuWqEI9F2eg==" }, + "@types/ws": { + "version": "7.4.7", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-7.4.7.tgz", + "integrity": "sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==", + "requires": { + "@types/node": "*" + } + }, "@types/yauzl": { "version": "2.10.0", "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.10.0.tgz", @@ -21421,6 +21875,14 @@ "debug": "4" } }, + "agentkeepalive": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", + "integrity": "sha512-5GG/5IbQQpC9FpkRGsSvZI5QYeSCzlJHdpBQntCsuTOxhKD8lqKhrleg2Yi7yvMIf82Ycmmqln9U8V9qwEiJew==", + "requires": { + "humanize-ms": "^1.2.1" + } + }, "aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", @@ -21725,6 +22187,14 @@ "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==" }, + "bigint-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bigint-buffer/-/bigint-buffer-1.1.5.tgz", + "integrity": "sha512-trfYco6AoZ+rKhKnxA0hgX0HAbVP/s808/EuDSe2JDzUnCp/xAsli35Orvk67UrTEcwuxZqYZDmfA2RXJgxVvA==", + "requires": { + "bindings": "^1.3.0" + } + }, "bigint-crypto-utils": { "version": "3.1.8", "resolved": "https://registry.npmjs.org/bigint-crypto-utils/-/bigint-crypto-utils-3.1.8.tgz", @@ -21750,6 +22220,21 @@ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==" }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "requires": { + "file-uri-to-path": "1.0.0" + }, + "dependencies": { + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + } + } + }, "bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -21819,6 +22304,16 @@ "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.2.0.tgz", "integrity": "sha512-d0II/GO9uf9lfUHH2BQsjxzRJZBdsjgsBiW4BvhWk/3qoKwQFjIDVN19PfX8F2D/r9PCMTtLWjYVCFrpeYUzsw==" }, + "borsh": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/borsh/-/borsh-0.7.0.tgz", + "integrity": "sha512-CLCsZGIBCFnPtkNnieW/a8wmreDmfUtjU2m9yHrzPXIlNbqVs0AQrSatSG6vdNYUqdc83tkQi2eHfF98ubzQLA==", + "requires": { + "bn.js": "^5.2.0", + "bs58": "^4.0.0", + "text-encoding-utf-8": "^1.0.2" + } + }, "brace-expansion": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", @@ -21940,7 +22435,6 @@ "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", "optional": true, - "peer": true, "requires": { "node-gyp-build": "^4.3.0" } @@ -22717,6 +23211,11 @@ } } }, + "delay": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/delay/-/delay-5.0.0.tgz", + "integrity": "sha512-ReEBKkIfe4ya47wlPYf/gu5ib6yUG0/Aez0JQZQz94kiWtRQvZIQbTiehsnwHvLSWJnQdhVeqYue7Id1dKr0qw==" + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -22976,6 +23475,19 @@ "is-symbol": "^1.0.2" } }, + "es6-promise": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", + "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" + }, + "es6-promisify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/es6-promisify/-/es6-promisify-5.0.0.tgz", + "integrity": "sha512-C+d6UdsYDk0lMebHNR4S2NybQMMngAOnOwYBQjTOiv0MkoJMP0Myw2mgpDLBcpfCmRLxyFqYhS/CfOENq4SJhQ==", + "requires": { + "es6-promise": "^4.0.3" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -23211,6 +23723,11 @@ "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==" }, + "eventemitter3": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", + "integrity": "sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==" + }, "evp_bytestokey": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", @@ -23377,6 +23894,11 @@ } } }, + "eyes": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/eyes/-/eyes-0.1.8.tgz", + "integrity": "sha512-GipyPsXO1anza0AOZdy69Im7hGFCNB7Y/NGjDlZGJ3GJJLtwNSb2vrzYrTYJRrRloVx7pl+bhUaTB8yiccPvFQ==" + }, "fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -23401,6 +23923,11 @@ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==" }, + "fast-stable-stringify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fast-stable-stringify/-/fast-stable-stringify-1.0.0.tgz", + "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" + }, "fast-text-encoding": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/fast-text-encoding/-/fast-text-encoding-1.0.6.tgz", @@ -24562,6 +25089,14 @@ "debug": "4" } }, + "humanize-ms": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", + "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "requires": { + "ms": "^2.0.0" + } + }, "husky": { "version": "4.3.8", "resolved": "https://registry.npmjs.org/husky/-/husky-4.3.8.tgz", @@ -24992,11 +25527,48 @@ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==" }, + "isomorphic-ws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", + "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", + "requires": {} + }, "iterall": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/iterall/-/iterall-1.3.0.tgz", "integrity": "sha512-QZ9qOMdF+QLHxy1QIpUHUU1D5pS2CG2P69LF6L6CPjPYA/XMOmKV3PZpawHoAjHNyB0swdVTRxdYT4tbBbxqwg==" }, + "jayson": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/jayson/-/jayson-4.1.0.tgz", + "integrity": "sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==", + "requires": { + "@types/connect": "^3.4.33", + "@types/node": "^12.12.54", + "@types/ws": "^7.4.4", + "commander": "^2.20.3", + "delay": "^5.0.0", + "es6-promisify": "^5.0.0", + "eyes": "^0.1.8", + "isomorphic-ws": "^4.0.1", + "json-stringify-safe": "^5.0.1", + "JSONStream": "^1.3.5", + "uuid": "^8.3.2", + "ws": "^7.4.5" + }, + "dependencies": { + "@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==" + }, + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==" + } + } + }, "jest-docblock": { "version": "21.2.0", "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-21.2.0.tgz", @@ -25096,6 +25668,11 @@ "jsonify": "^0.0.1" } }, + "json-stringify-safe": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + }, "json5": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", @@ -25114,6 +25691,20 @@ "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.1.tgz", "integrity": "sha512-2/Ki0GcmuqSrgFyelQq9M05y7PS0mEwuIzrf3f1fPqkVDVRvZrPZtVSMHxdgo8Aq0sxAOb/cr2aqqA3LeWHVPg==" }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==" + }, + "JSONStream": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", + "integrity": "sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==", + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, "jsonwebtoken": { "version": "9.0.0", "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.0.tgz", @@ -27765,6 +28356,27 @@ "resolved": "https://registry.npmjs.org/rope-sequence/-/rope-sequence-1.3.3.tgz", "integrity": "sha512-85aZYCxweiD5J8yTEbw+E6A27zSnLPNDL0WfPdw3YYodq7WjnTKo0q4dtyQ2gz23iPT8Q9CUyJtAaUNcTxRf5Q==" }, + "rpc-websockets": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/rpc-websockets/-/rpc-websockets-7.8.0.tgz", + "integrity": "sha512-AStkq6KDvSAmA4WiwlK1pDvj/33BWmExTATUokC0v+NhWekXSTNzXS5OGXeYwq501/pj6lBZMofg/h4dx4/tCg==", + "requires": { + "@babel/runtime": "^7.17.2", + "bufferutil": "^4.0.1", + "eventemitter3": "^4.0.7", + "utf-8-validate": "^5.0.2", + "uuid": "^8.3.2", + "ws": "^8.5.0" + }, + "dependencies": { + "ws": { + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.15.0.tgz", + "integrity": "sha512-H/Z3H55mrcrgjFwI+5jKavgXvwQLtfPCUEp6pi35VhoB0pfcHnSoyuTzkBEZpzq49g1193CUEwIvmsjcotenYw==", + "requires": {} + } + } + }, "run-parallel-limit": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz", @@ -28596,6 +29208,11 @@ "proxy-agent": "^5.0.0" } }, + "superstruct": { + "version": "0.14.2", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.14.2.tgz", + "integrity": "sha512-nPewA6m9mR3d6k7WkZ8N8zpTWfenFH3q9pA2PkuiZxINr9DKB2+40wEQf0ixn8VaGuJ78AB6iWOtStI+/4FKZQ==" + }, "supports-color": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", @@ -28690,6 +29307,11 @@ } } }, + "text-encoding-utf-8": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/text-encoding-utf-8/-/text-encoding-utf-8-1.0.2.tgz", + "integrity": "sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==" + }, "text-mask-addons": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/text-mask-addons/-/text-mask-addons-3.8.0.tgz", @@ -29401,7 +30023,6 @@ "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", "optional": true, - "peer": true, "requires": { "node-gyp-build": "^4.3.0" } diff --git a/package.json b/package.json index bb0c07ee6..8ffad3dc1 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "@giveth/monoswap": "^1.3.2", "@sentry/node": "6.16.1", "@sentry/tracing": "^6.2.0", + "@solana/web3.js": "^1.87.6", "@types/bcryptjs": "^2.4.2", "@types/connect-redis": "0.0.13", "@types/cors": "^2.8.10", diff --git a/src/entities/donation.ts b/src/entities/donation.ts index 1d413a63a..d041c1e6d 100644 --- a/src/entities/donation.ts +++ b/src/entities/donation.ts @@ -13,6 +13,7 @@ import { import { Project } from './project'; import { User } from './user'; import { QfRound } from './qfRound'; +import { ChainType } from '../types/network'; export const DONATION_STATUS = { PENDING: 'pending', @@ -58,6 +59,14 @@ export class Donation extends BaseEntity { @Column({ nullable: false }) transactionNetworkId: number; + @Field() + @Column({ + type: 'enum', + enum: ChainType, + default: ChainType.EVM, + }) + chainType: ChainType; + @Field() @Column('boolean', { default: false }) // https://github.com/Giveth/impact-graph/issues/407#issuecomment-1066892258 diff --git a/src/entities/project.ts b/src/entities/project.ts index 7426447f3..163d84a80 100644 --- a/src/entities/project.ts +++ b/src/entities/project.ts @@ -84,6 +84,7 @@ export enum FilterField { AcceptFundOnPolygon = 'acceptFundOnPolygon', AcceptFundOnCelo = 'acceptFundOnCelo', AcceptFundOnOptimism = 'acceptFundOnOptimism', + AcceptFundOnSolana = 'acceptFundOnSolana', GivingBlock = 'fromGivingBlock', BoostedWithGivPower = 'boostedWithGivPower', ActiveQfRound = 'ActiveQfRound', diff --git a/src/entities/projectAddress.ts b/src/entities/projectAddress.ts index ef7cf95a6..a98e5d560 100644 --- a/src/entities/projectAddress.ts +++ b/src/entities/projectAddress.ts @@ -13,6 +13,7 @@ import { import { Field, ID, ObjectType } from 'type-graphql'; import { Project } from './project'; import { User } from './user'; +import { ChainType } from '../types/network'; @Entity() @ObjectType() @@ -31,6 +32,14 @@ export class ProjectAddress extends BaseEntity { @Column() networkId: number; + @Field() + @Column({ + type: 'enum', + enum: ChainType, + default: ChainType.EVM, + }) + chainType: ChainType; + @Index() @Field() @Column() diff --git a/src/repositories/projectAddressRepository.test.ts b/src/repositories/projectAddressRepository.test.ts index bf6a50c07..dbd4469dd 100644 --- a/src/repositories/projectAddressRepository.test.ts +++ b/src/repositories/projectAddressRepository.test.ts @@ -17,6 +17,7 @@ import { } from '../../test/testUtils'; import { assert } from 'chai'; import { NETWORK_IDS } from '../provider'; +import { ChainType } from '../types/network'; describe('getPurpleListAddresses test cases', getPurpleListAddressesTestCases); describe( @@ -146,6 +147,7 @@ function addNewProjectAddressTestCases() { networkId: NETWORK_IDS.XDAI, project, user, + chainType: ChainType.EVM, }); assert.isOk(newRelatedAddress); assert.equal(newRelatedAddress.address, newAddress), @@ -181,6 +183,7 @@ function addBulkNewProjectAddressTestCases() { { address: newAddress, networkId: NETWORK_IDS.XDAI, + chainType: ChainType.EVM, project, user, }, @@ -207,12 +210,14 @@ function addBulkNewProjectAddressTestCases() { { address: newAddress1, networkId: NETWORK_IDS.XDAI, + chainType: ChainType.EVM, project, user, }, { address: newAddress2, networkId: NETWORK_IDS.XDAI, + chainType: ChainType.EVM, project, user, }, diff --git a/src/repositories/projectAddressRepository.ts b/src/repositories/projectAddressRepository.ts index f9d914386..17697f007 100644 --- a/src/repositories/projectAddressRepository.ts +++ b/src/repositories/projectAddressRepository.ts @@ -1,7 +1,7 @@ import { ProjectAddress } from '../entities/projectAddress'; import { Project } from '../entities/project'; import { User } from '../entities/user'; -import { BaseEntity } from 'typeorm'; +import { ChainType } from '../types/network'; export const getPurpleListAddresses = async (): Promise< { projectAddress: string }[] @@ -37,13 +37,24 @@ export const isWalletAddressInPurpleList = async ( export const findRelatedAddressByWalletAddress = async ( walletAddress: string, + chainType?: ChainType, ) => { - return ProjectAddress.createQueryBuilder('projectAddress') - .where(`LOWER(address) = :walletAddress`, { - walletAddress: walletAddress.toLowerCase(), - }) - .leftJoinAndSelect('projectAddress.project', 'project') - .getOne(); + let query = ProjectAddress.createQueryBuilder('projectAddress'); + + switch (chainType) { + case ChainType.SOLANA: + query = query.where(`address = :walletAddress`, { + walletAddress, + }); + break; + case ChainType.EVM: + default: + query = query.where(`LOWER(address) = :walletAddress`, { + walletAddress: walletAddress.toLowerCase(), + }); + break; + } + return query.leftJoinAndSelect('projectAddress.project', 'project').getOne(); }; export const findAllRelatedAddressByWalletAddress = async ( walletAddress: string, @@ -79,8 +90,9 @@ export const addNewProjectAddress = async (params: { title?: string; isRecipient?: boolean; networkId: number; + chainType?: ChainType; }): Promise => { - const projectAddress = await ProjectAddress.create(params as ProjectAddress); + const projectAddress = ProjectAddress.create(params as ProjectAddress); return projectAddress.save(); }; @@ -92,6 +104,7 @@ export const addBulkNewProjectAddress = async ( title?: string; isRecipient?: boolean; networkId: number; + chainType?: ChainType; }[], ): Promise => { await ProjectAddress.insert( diff --git a/src/repositories/userRepository.ts b/src/repositories/userRepository.ts index 93c553b36..d2ed4b2b3 100644 --- a/src/repositories/userRepository.ts +++ b/src/repositories/userRepository.ts @@ -4,6 +4,7 @@ import { Donation } from '../entities/donation'; import { Reaction } from '../entities/reaction'; import { PowerBoosting } from '../entities/powerBoosting'; import { ethers } from 'ethers'; +import { isEvmAddress } from '../utils/networks'; export const findAdminUserByEmail = async ( email: string, @@ -72,7 +73,7 @@ export const findAllUsers = async (params: { export const createUserWithPublicAddress = async ( _walletAddress: string, ): Promise => { - const walletAddress = ethers.utils.isAddress(_walletAddress) + const walletAddress = isEvmAddress(_walletAddress) ? _walletAddress.toLocaleLowerCase() : _walletAddress; const user = await User.create({ diff --git a/src/resolvers/donationResolver.ts b/src/resolvers/donationResolver.ts index de6d4c931..5b0d7ceb7 100644 --- a/src/resolvers/donationResolver.ts +++ b/src/resolvers/donationResolver.ts @@ -67,6 +67,7 @@ import { CHAIN_ID } from '@giveth/monoswap/dist/src/sdk/sdkFactory'; import { ethers } from 'ethers'; import { getChainvineReferralInfoForDonation } from '../services/chainvineReferralService'; import { relatedActiveQfRoundForProject } from '../services/qfRoundService'; +import { detectAddressChainType } from '../utils/networks'; @ObjectType() class PaginateDonations { @@ -459,7 +460,7 @@ export class DonationResolver { // WalletAddresses are translanted to huge integers // this breaks postgresql query integer limit - if (!ethers.utils.isAddress(searchTerm)) { + if (detectAddressChainType(searchTerm) === undefined) { const amount = Number(searchTerm); qb.orWhere('donation.amount = :number', { diff --git a/src/resolvers/projectResolver.test.ts b/src/resolvers/projectResolver.test.ts index 98c637f18..672cc0ebb 100644 --- a/src/resolvers/projectResolver.test.ts +++ b/src/resolvers/projectResolver.test.ts @@ -111,6 +111,7 @@ import { refreshProjectDonationSummaryView, refreshProjectEstimatedMatchingView, } from '../services/projectViewsService'; +import { ChainType } from '../types/network'; const ARGUMENT_VALIDATION_ERROR_MESSAGE = new ArgumentValidationError([ { property: '' }, @@ -1903,10 +1904,12 @@ function createProjectTestCases() { { address: generateRandomEtheriumAddress(), networkId: NETWORK_IDS.XDAI, + chainType: ChainType.EVM, }, { address: generateRandomEtheriumAddress(), networkId: NETWORK_IDS.MAIN_NET, + chainType: ChainType.EVM, }, ], }; diff --git a/src/resolvers/projectResolver.ts b/src/resolvers/projectResolver.ts index 8f22de2f9..4b5f9bf3b 100644 --- a/src/resolvers/projectResolver.ts +++ b/src/resolvers/projectResolver.ts @@ -109,6 +109,8 @@ import { FeaturedUpdate } from '../entities/featuredUpdate'; import { PROJECT_UPDATE_CONTENT_MAX_LENGTH } from '../constants/validators'; import { calculateGivbackFactor } from '../services/givbackService'; import { ProjectBySlugResponse } from './types/projectResolver'; +import { ChainType } from '../types/network'; +import { detectAddressChainType } from '../utils/networks'; @ObjectType() class AllProjects { @@ -177,6 +179,11 @@ registerEnumType(OrderDirection, { description: 'Order direction', }); +registerEnumType(ChainType, { + name: 'ChainType', + description: 'Chain type (EVM or SOLANA)', +}); + @InputType() export class OrderBy { @Field(type => OrderField) @@ -475,65 +482,6 @@ export class ProjectResolver { return allProjects; } - static addFilterQuery( - query: SelectQueryBuilder, - filter: string, - filterValue: boolean, - ) { - if (!filter) return query; - - if (filter === 'givingBlocksId') { - const acceptGiv = filterValue ? 'IS' : 'IS NOT'; - return query.andWhere(`project.${filter} ${acceptGiv} NULL`); - } - - if (filter === 'traceCampaignId') { - const isRequested = filterValue ? 'IS NOT' : 'IS'; - return query.andWhere(`project.${filter} ${isRequested} NULL`); - } - - if ( - (filter === FilterField.AcceptFundOnGnosis || - filter === FilterField.AcceptFundOnCelo || - filter === FilterField.AcceptFundOnPolygon || - filter === FilterField.AcceptFundOnOptimism) && - filterValue - ) { - const networkIds: number[] = []; - - if (filter === 'acceptFundOnGnosis') { - networkIds.push(NETWORK_IDS.XDAI); - } - - if (filter === 'acceptFundOnCelo') { - networkIds.push(NETWORK_IDS.CELO); - } - - if (filter === 'acceptFundOnPolygon') { - networkIds.push(NETWORK_IDS.POLYGON); - } - - if (filter === 'acceptFundOnOptimism') { - networkIds.push(NETWORK_IDS.OPTIMISTIC); - } - return query.andWhere( - new Brackets(subQuery => { - subQuery.where( - `EXISTS ( - SELECT * - FROM project_address - WHERE "isRecipient" = true AND "networkId" IN (${networkIds.join( - ', ', - )}) AND "projectId" = project.id - )`, - ); - }), - ); - } - - return query.andWhere(`project.${filter} = ${filterValue}`); - } - static addFiltersQuery( query: SelectQueryBuilder, filtersArray: FilterField[] = [], @@ -565,6 +513,7 @@ export class ProjectResolver { ); } + // TODO: This logic seems wrong! since it allows only one of these fundings to be accepted if ( (filter === FilterField.AcceptFundOnGnosis || filter === FilterField.AcceptFundOnCelo || @@ -593,13 +542,26 @@ export class ProjectResolver { networkIds.push(NETWORK_IDS.OPTIMISTIC); } + // TODO: This logic seems wrong! since only one of the following filters can be true at the same time + return subQuery.andWhere( + `EXISTS ( + SELECT * + FROM project_address + WHERE "isRecipient" = true AND + "projectId" = project.id AND + "networkId" IN (${networkIds.join(', ')}) + )`, + ); + } + + if (filter === FilterField.AcceptFundOnSolana) { return subQuery.andWhere( `EXISTS ( SELECT * FROM project_address - WHERE "isRecipient" = true AND "networkId" IN (${networkIds.join( - ', ', - )}) AND "projectId" = project.id + WHERE "isRecipient" = true AND + "projectId" = project.id AND + "chainType" = '${ChainType.SOLANA}' )`, ); } @@ -1044,6 +1006,7 @@ export class ProjectResolver { project, user: adminUser, address: relatedAddress.address, + chainType: relatedAddress.chainType, networkId: relatedAddress.networkId, isRecipient: true, }; @@ -1067,6 +1030,8 @@ export class ProjectResolver { @Arg('projectId') projectId: number, @Arg('networkId') networkId: number, @Arg('address') address: string, + @Arg('chainType', type => ChainType, { defaultValue: ChainType.EVM }) + chainType: ChainType, @Ctx() { req: { user } }: ApolloContext, ) { if (!user) @@ -1085,7 +1050,7 @@ export class ProjectResolver { ); } - await validateProjectWalletAddress(address, projectId); + await validateProjectWalletAddress(address, projectId, chainType); const adminUser = (await findUserById(Number(project.admin))) as User; await addNewProjectAddress({ @@ -1094,6 +1059,7 @@ export class ProjectResolver { address, networkId, isRecipient: true, + chainType, }); project.adminUser = adminUser; @@ -1288,11 +1254,14 @@ export class ProjectResolver { // newProject.adminUser = adminUser; await addBulkNewProjectAddress( projectInput?.addresses.map(relatedAddress => { + const { networkId, address, chainType } = relatedAddress; return { project, user, - address: relatedAddress.address.toLowerCase(), - networkId: relatedAddress.networkId, + address: + chainType === ChainType.EVM ? address.toLowerCase() : address, + chainType, + networkId, isRecipient: true, }; }), diff --git a/src/resolvers/types/ProjectVerificationUpdateInput.ts b/src/resolvers/types/ProjectVerificationUpdateInput.ts index 8635c2b75..a0f9cd1b0 100644 --- a/src/resolvers/types/ProjectVerificationUpdateInput.ts +++ b/src/resolvers/types/ProjectVerificationUpdateInput.ts @@ -1,6 +1,7 @@ import { Field, InputType } from 'type-graphql'; import { ProjectContacts } from '../../entities/projectVerificationForm'; import { Column } from 'typeorm'; +import { ChainType } from '../../types/network'; @InputType() class ProjectPersonalInfoInputType { @@ -46,6 +47,8 @@ export class RelatedAddressInputType { address: string; @Field({ nullable: true }) networkId: number; + @Field(type => ChainType, { defaultValue: ChainType.EVM }) + chainType?: ChainType; } @InputType() diff --git a/src/types/network.ts b/src/types/network.ts new file mode 100644 index 000000000..de3cc0dcc --- /dev/null +++ b/src/types/network.ts @@ -0,0 +1,4 @@ +export enum ChainType { + EVM = 'EVM', + SOLANA = 'SOLANA', +} diff --git a/src/utils/networks.ts b/src/utils/networks.ts new file mode 100644 index 000000000..d2775aeb9 --- /dev/null +++ b/src/utils/networks.ts @@ -0,0 +1,29 @@ +import { ethers } from 'ethers'; +import { ChainType } from '../types/network'; +import { PublicKey } from '@solana/web3.js'; + +export const isSolanaAddress = (address: string): boolean => { + try { + new PublicKey(address.trim()); + return true; + } catch (e) { + return false; + } +}; + +export const isEvmAddress = (address: string): boolean => { + return ethers.utils.isAddress(address); +}; + +export const detectAddressChainType = ( + address: string, +): ChainType | undefined => { + switch (true) { + case isSolanaAddress(address): + return ChainType.SOLANA; + case isEvmAddress(address): + return ChainType.EVM; + default: + return undefined; + } +}; diff --git a/src/utils/validators/projectValidator.ts b/src/utils/validators/projectValidator.ts index 3a051ae5b..4f6e6deb8 100644 --- a/src/utils/validators/projectValidator.ts +++ b/src/utils/validators/projectValidator.ts @@ -7,18 +7,25 @@ import { RelatedAddressInputType } from '../../resolvers/types/ProjectVerificati import { findProjectById } from '../../repositories/projectRepository'; import { titleWithoutSpecialCharacters } from '../utils'; import { ethers } from 'ethers'; +import { ChainType } from '../../types/network'; +import { detectAddressChainType } from '../networks'; -export function isWalletAddressValid(address) { - return Boolean( - address && address.length === 42 && ethers.utils.isAddress(address), - ); +export function isWalletAddressValid(address, chainType?: ChainType) { + if (!address) { + return false; + } + const detectedChainType = detectAddressChainType(address); + return chainType === undefined + ? detectedChainType !== undefined + : chainType === detectedChainType; } export const validateProjectWalletAddress = async ( walletAddress: string, projectId?: number, + chainType?: ChainType, ): Promise => { - if (!isWalletAddressValid(walletAddress)) { + if (!isWalletAddressValid(walletAddress, chainType)) { throw new Error( i18n.__(translationErrorMessagesKeys.INVALID_WALLET_ADDRESS), ); @@ -31,7 +38,10 @@ export const validateProjectWalletAddress = async ( // `Eth address ${walletAddress} is a smart contract. We do not support smart contract wallets at this time because we use multiple blockchains, and there is a risk of your losing donations.`, // ); // } - const relatedAddress = await findRelatedAddressByWalletAddress(walletAddress); + const relatedAddress = await findRelatedAddressByWalletAddress( + walletAddress, + chainType, + ); if (relatedAddress && relatedAddress?.project?.id !== projectId) { throw new Error( `Eth address ${walletAddress} is already being used for a project`, @@ -49,7 +59,11 @@ export const validateProjectRelatedAddresses = async ( ); } for (const relateAddress of relatedAddresses) { - await validateProjectWalletAddress(relateAddress.address, projectId); + await validateProjectWalletAddress( + relateAddress.address, + projectId, + relateAddress.chainType, + ); } }; diff --git a/test/testUtils.ts b/test/testUtils.ts index 198dba439..3822217d8 100644 --- a/test/testUtils.ts +++ b/test/testUtils.ts @@ -27,6 +27,7 @@ import { import { MainCategory } from '../src/entities/mainCategory'; import { Category, CATEGORY_NAMES } from '../src/entities/category'; import { FeaturedUpdate } from '../src/entities/featuredUpdate'; +import { ChainType } from '../src/types/network'; // tslint:disable-next-line:no-var-requires const moment = require('moment'); @@ -233,6 +234,7 @@ export const saveProjectDirectlyToDb = async ( isRecipient: true, address: projectData.walletAddress, networkId, + chainType: ChainType.EVM, }); } // default projectUpdate for liking projects