diff --git a/package-lock.json b/package-lock.json index 9aafb9bf..2be4537c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "elliptic": "6.5.6", "hash.js": "^1.1.7", "js-sha3": "^0.9.3", - "rlp": "^3.0.0", "secp256k1": "5.0.0", "uuid": "^10.0.0" }, @@ -6519,14 +6518,6 @@ "inherits": "^2.0.1" } }, - "node_modules/rlp": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-3.0.0.tgz", - "integrity": "sha512-PD6U2PGk6Vq2spfgiWZdomLvRGDreBLxi5jv5M8EpRo3pU6VEm31KO+HFxE18Q3vgqfDrQ9pZA3FP95rkijNKw==", - "bin": { - "rlp": "bin/rlp" - } - }, "node_modules/rollup": { "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", diff --git a/src/__test__/integration/__mocks__/handlers.ts b/src/__test__/integration/__mocks__/handlers.ts index d390ae9d..88258130 100644 --- a/src/__test__/integration/__mocks__/handlers.ts +++ b/src/__test__/integration/__mocks__/handlers.ts @@ -1,4 +1,4 @@ -import { rest } from 'msw'; +import { http, HttpResponse } from 'msw'; import connectResponse from './connect.json'; import getAddressesResponse from './getAddresses.json'; import signResponse from './sign.json'; @@ -22,80 +22,78 @@ import { } from './4byte'; export const handlers = [ - rest.post('https://signing.gridpl.us/test/connect', (req, res, ctx) => { - return res(ctx.json(connectResponse)); + http.post('https://signing.gridpl.us/test/connect', () => { + return HttpResponse.json(connectResponse); }), - rest.post('https://signing.gridpl.us/test/getAddresses', (req, res, ctx) => { - return res(ctx.json(getAddressesResponse)); + http.post('https://signing.gridpl.us/test/getAddresses', () => { + return HttpResponse.json(getAddressesResponse); }), - rest.post('https://signing.gridpl.us/test/sign', (req, res, ctx) => { - return res(ctx.json(signResponse)); + http.post('https://signing.gridpl.us/test/sign', () => { + return HttpResponse.json(signResponse); }), - rest.post( - 'https://signing.gridpl.us/test/fetchActiveWallet', - (req, res, ctx) => { - return res(ctx.json(fetchActiveWalletResponse)); - }, - ), - rest.post('https://signing.gridpl.us/test/addKvRecords', (req, res, ctx) => { - return res(ctx.json(addKvRecordsResponse)); + http.post('https://signing.gridpl.us/test/fetchActiveWallet', () => { + return HttpResponse.json(fetchActiveWalletResponse); }), - rest.post('https://signing.gridpl.us/test/getKvRecords', (req, res, ctx) => { - return res(ctx.json(getKvRecordsResponse)); + http.post('https://signing.gridpl.us/test/addKvRecords', () => { + return HttpResponse.json(addKvRecordsResponse); }), - rest.post( - 'https://signing.gridpl.us/test/removeKvRecords', - (req, res, ctx) => { - return res(ctx.json(removeKvRecordsResponse)); - }, - ), - rest.get('https://api.etherscan.io/api', (req, res, ctx) => { - const module = req.url.searchParams.get('module'); - const action = req.url.searchParams.get('action'); - const address = req.url.searchParams.get('address'); + http.post('https://signing.gridpl.us/test/getKvRecords', () => { + return HttpResponse.json(getKvRecordsResponse); + }), + http.post('https://signing.gridpl.us/test/removeKvRecords', () => { + return HttpResponse.json(removeKvRecordsResponse); + }), + http.get('https://api.etherscan.io/api', ({ request }) => { + const url = new URL(request.url); + const module = url.searchParams.get('module'); + const action = url.searchParams.get('action'); + const address = url.searchParams.get('address'); if (module === 'contract' && action === 'getabi') { if (address === '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48') { - return res( - ctx.json({ result: JSON.stringify(etherscanResponse0xa0b86991) }), - ); + return HttpResponse.json({ + result: JSON.stringify(etherscanResponse0xa0b86991), + }); } if (address === '0x7a250d5630b4cf539739df2c5dacb4c659f2488d') { - return res( - ctx.json({ result: JSON.stringify(etherscanResponse0x7a250d56) }), - ); + return HttpResponse.json({ + result: JSON.stringify(etherscanResponse0x7a250d56), + }); } if (address === '0xc36442b4a4522e871399cd717abdd847ab11fe88') { - return res( - ctx.json({ result: JSON.stringify(etherscanResponse0xc36442b6) }), - ); + return HttpResponse.json({ + result: JSON.stringify(etherscanResponse0xc36442b6), + }); } if (address === '0x06412d7ebfbf66c25607e2ed24c1d207043be327') { - return res( - ctx.json({ result: JSON.stringify(etherscanResponse0x06412d7e) }), - ); + return HttpResponse.json({ + result: JSON.stringify(etherscanResponse0x06412d7e), + }); } } + return new HttpResponse(null, { status: 404 }); }), - rest.get('https://www.4byte.directory/api/v1/signatures', (req, res, ctx) => { - const hexSignature = req.url.searchParams.get('hex_signature'); + http.get('https://www.4byte.directory/api/v1/signatures', ({ request }) => { + const url = new URL(request.url); + const hexSignature = url.searchParams.get('hex_signature'); if (hexSignature === '0xa9059cbb') { - return res(ctx.json(fourbyteResponse0xa9059cbb)); + return HttpResponse.json(fourbyteResponse0xa9059cbb); } if (hexSignature === '0x38ed1739') { - return res(ctx.json(fourbyteResponse0x38ed1739)); + return HttpResponse.json(fourbyteResponse0x38ed1739); } if (hexSignature === '0xac9650d8') { - return res(ctx.json(fourbyteResponseac9650d8)); + return HttpResponse.json(fourbyteResponseac9650d8); } if (hexSignature === '0x0c49ccbe') { - return res(ctx.json(fourbyteResponse0c49ccbe)); + return HttpResponse.json(fourbyteResponse0c49ccbe); } if (hexSignature === '0xfc6f7865') { - return res(ctx.json(fourbyteResponsefc6f7865)); + return HttpResponse.json(fourbyteResponsefc6f7865); } if (hexSignature === '0x6a761202') { - return res(ctx.json(fourbyteResponse0x6a761202)); + return HttpResponse.json(fourbyteResponse0x6a761202); } + return new HttpResponse(null, { status: 404 }); }), ];