From 2571fc6add0aaea2c752f2ae1d9a577ea721bf21 Mon Sep 17 00:00:00 2001 From: FreezyEx Date: Wed, 7 Dec 2022 13:11:32 +0100 Subject: [PATCH] added ENS support --- client/package-lock.json | 16 +++++++++++ client/package.json | 1 + client/src/ABIs/Collector.json | 4 +-- .../foreground/ForegroundComponents.tsx | 28 +++++++++++++++---- yarn.lock | 5 ++++ 5 files changed, 46 insertions(+), 8 deletions(-) create mode 100644 client/package-lock.json diff --git a/client/package-lock.json b/client/package-lock.json new file mode 100644 index 0000000..7abd6b9 --- /dev/null +++ b/client/package-lock.json @@ -0,0 +1,16 @@ +{ + "name": "client", + "version": "0.1.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@types/node": { + "version": "16.18.3" + }, + "usehooks-ts": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/usehooks-ts/-/usehooks-ts-2.9.1.tgz", + "integrity": "sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA==" + } + } +} diff --git a/client/package.json b/client/package.json index 6a2712e..af873bd 100644 --- a/client/package.json +++ b/client/package.json @@ -32,6 +32,7 @@ "three": "^0.145.0", "three-stdlib": "^2.17.3", "typescript": "^4.8.4", + "usehooks-ts": "^2.9.1", "wagmi": "0.8.4", "web-vitals": "^2.1.4" }, diff --git a/client/src/ABIs/Collector.json b/client/src/ABIs/Collector.json index 63332ee..998c06a 100644 --- a/client/src/ABIs/Collector.json +++ b/client/src/ABIs/Collector.json @@ -182,8 +182,8 @@ "type": "receive" } ], - "bytecode": "0x60a060405234801561001057600080fd5b50604051610b6d380380610b6d83398101604081905261002f91610096565b61003833610046565b6001919091556080526100ba565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100a957600080fd5b505080516020909101519092909150565b608051610a916100dc6000396000818161030001526103dc0152610a916000f3fe60806040526004361061007f5760003560e01c8063c884ef831161004e578063c884ef831461012c578063ebf0c7171461015c578063f2fde38b14610180578063f9edeaa2146101a057600080fd5b8063500386c61461008b578063715018a6146100c05780637c5b4a37146100d75780638da5cb5b146100f757600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a6366004610837565b6101c0565b60405190151581526020015b60405180910390f35b3480156100cc57600080fd5b506100d5610466565b005b3480156100e357600080fd5b506100d56100f236600461090f565b61047a565b34801561010357600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561013857600080fd5b506100ab610147366004610928565b60026020526000908152604090205460ff1681565b34801561016857600080fd5b5061017260015481565b6040519081526020016100b7565b34801561018c57600080fd5b506100d561019b366004610928565b6104b3565b3480156101ac57600080fd5b506100d56101bb36600461090f565b61056a565b3360009081526002602052604081205460ff161561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064015b60405180910390fd5b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1660208201526000906034016040516020818303038152906040528051906020012090506102988560015483610577565b6102fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4661696c6564206d65726b6c652070726f6f66000000000000000000000000006044820152606401610236565b7f0000000000000000000000000000000000000000000000000000000000000000471015610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610236565b3360009081526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555173ffffffffffffffffffffffffffffffffffffffff8516917f000000000000000000000000000000000000000000000000000000000000000080156108fc02929091818181858888f19350505050158015610421573d6000803e3d6000fd5b507fc8fdf13a4b928b8811a082d6f49538b13d9279cc130d1312406e8fa8742997353385604051610453929190610943565b60405180910390a1506001949350505050565b61046e61058d565b610478600061060e565b565b61048261058d565b604051339082156108fc029083906000818181858888f193505050501580156104af573d6000803e3d6000fd5b5050565b6104bb61058d565b73ffffffffffffffffffffffffffffffffffffffff811661055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610236565b6105678161060e565b50565b61057261058d565b600155565b6000826105848584610683565b14949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610236565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b84518110156106c8576106b4828683815181106106a7576106a76109cd565b60200260200101516106d0565b9150806106c0816109fc565b915050610688565b509392505050565b60008183106106ec5760008281526020849052604090206106fb565b60008381526020839052604090205b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561077857610778610702565b604052919050565b600082601f83011261079157600080fd5b813567ffffffffffffffff8111156107ab576107ab610702565b6107dc60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610731565b8181528460208386010111156107f157600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461083257600080fd5b919050565b60008060006060848603121561084c57600080fd5b833567ffffffffffffffff8082111561086457600080fd5b818601915086601f83011261087857600080fd5b813560208282111561088c5761088c610702565b8160051b61089b828201610731565b928352848101820192828101908b8511156108b557600080fd5b958301955b848710156108d3578635825295830195908301906108ba565b98505050870135925050808211156108ea57600080fd5b506108f786828701610780565b9250506109066040850161080e565b90509250925092565b60006020828403121561092157600080fd5b5035919050565b60006020828403121561093a57600080fd5b6106fb8261080e565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b8181101561098d57858101830151858201606001528201610971565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a54577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea2646970667358221220813941a700512d87265c41e09494c5296d3688f1b91a4785880c687e80e9dfe764736f6c63430008100033", - "deployedBytecode": "0x60806040526004361061007f5760003560e01c8063c884ef831161004e578063c884ef831461012c578063ebf0c7171461015c578063f2fde38b14610180578063f9edeaa2146101a057600080fd5b8063500386c61461008b578063715018a6146100c05780637c5b4a37146100d75780638da5cb5b146100f757600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a6366004610837565b6101c0565b60405190151581526020015b60405180910390f35b3480156100cc57600080fd5b506100d5610466565b005b3480156100e357600080fd5b506100d56100f236600461090f565b61047a565b34801561010357600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561013857600080fd5b506100ab610147366004610928565b60026020526000908152604090205460ff1681565b34801561016857600080fd5b5061017260015481565b6040519081526020016100b7565b34801561018c57600080fd5b506100d561019b366004610928565b6104b3565b3480156101ac57600080fd5b506100d56101bb36600461090f565b61056a565b3360009081526002602052604081205460ff161561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064015b60405180910390fd5b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1660208201526000906034016040516020818303038152906040528051906020012090506102988560015483610577565b6102fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4661696c6564206d65726b6c652070726f6f66000000000000000000000000006044820152606401610236565b7f0000000000000000000000000000000000000000000000000000000000000000471015610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610236565b3360009081526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555173ffffffffffffffffffffffffffffffffffffffff8516917f000000000000000000000000000000000000000000000000000000000000000080156108fc02929091818181858888f19350505050158015610421573d6000803e3d6000fd5b507fc8fdf13a4b928b8811a082d6f49538b13d9279cc130d1312406e8fa8742997353385604051610453929190610943565b60405180910390a1506001949350505050565b61046e61058d565b610478600061060e565b565b61048261058d565b604051339082156108fc029083906000818181858888f193505050501580156104af573d6000803e3d6000fd5b5050565b6104bb61058d565b73ffffffffffffffffffffffffffffffffffffffff811661055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610236565b6105678161060e565b50565b61057261058d565b600155565b6000826105848584610683565b14949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610236565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b84518110156106c8576106b4828683815181106106a7576106a76109cd565b60200260200101516106d0565b9150806106c0816109fc565b915050610688565b509392505050565b60008183106106ec5760008281526020849052604090206106fb565b60008381526020839052604090205b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561077857610778610702565b604052919050565b600082601f83011261079157600080fd5b813567ffffffffffffffff8111156107ab576107ab610702565b6107dc60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610731565b8181528460208386010111156107f157600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461083257600080fd5b919050565b60008060006060848603121561084c57600080fd5b833567ffffffffffffffff8082111561086457600080fd5b818601915086601f83011261087857600080fd5b813560208282111561088c5761088c610702565b8160051b61089b828201610731565b928352848101820192828101908b8511156108b557600080fd5b958301955b848710156108d3578635825295830195908301906108ba565b98505050870135925050808211156108ea57600080fd5b506108f786828701610780565b9250506109066040850161080e565b90509250925092565b60006020828403121561092157600080fd5b5035919050565b60006020828403121561093a57600080fd5b6106fb8261080e565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b8181101561098d57858101830151858201606001528201610971565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a54577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea2646970667358221220813941a700512d87265c41e09494c5296d3688f1b91a4785880c687e80e9dfe764736f6c63430008100033", + "bytecode": "0x60a060405234801561001057600080fd5b50604051610b6d380380610b6d83398101604081905261002f91610096565b61003833610046565b6001919091556080526100ba565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156100a957600080fd5b505080516020909101519092909150565b608051610a916100dc6000396000818161030001526103dc0152610a916000f3fe60806040526004361061007f5760003560e01c8063c884ef831161004e578063c884ef831461012c578063ebf0c7171461015c578063f2fde38b14610180578063f9edeaa2146101a057600080fd5b8063500386c61461008b578063715018a6146100c05780637c5b4a37146100d75780638da5cb5b146100f757600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a6366004610837565b6101c0565b60405190151581526020015b60405180910390f35b3480156100cc57600080fd5b506100d5610466565b005b3480156100e357600080fd5b506100d56100f236600461090f565b61047a565b34801561010357600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561013857600080fd5b506100ab610147366004610928565b60026020526000908152604090205460ff1681565b34801561016857600080fd5b5061017260015481565b6040519081526020016100b7565b34801561018c57600080fd5b506100d561019b366004610928565b6104b3565b3480156101ac57600080fd5b506100d56101bb36600461090f565b61056a565b3360009081526002602052604081205460ff161561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064015b60405180910390fd5b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1660208201526000906034016040516020818303038152906040528051906020012090506102988560015483610577565b6102fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4661696c6564206d65726b6c652070726f6f66000000000000000000000000006044820152606401610236565b7f0000000000000000000000000000000000000000000000000000000000000000471015610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610236565b3360009081526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555173ffffffffffffffffffffffffffffffffffffffff8516917f000000000000000000000000000000000000000000000000000000000000000080156108fc02929091818181858888f19350505050158015610421573d6000803e3d6000fd5b507fc8fdf13a4b928b8811a082d6f49538b13d9279cc130d1312406e8fa8742997353385604051610453929190610943565b60405180910390a1506001949350505050565b61046e61058d565b610478600061060e565b565b61048261058d565b604051339082156108fc029083906000818181858888f193505050501580156104af573d6000803e3d6000fd5b5050565b6104bb61058d565b73ffffffffffffffffffffffffffffffffffffffff811661055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610236565b6105678161060e565b50565b61057261058d565b600155565b6000826105848584610683565b14949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610236565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b84518110156106c8576106b4828683815181106106a7576106a76109cd565b60200260200101516106d0565b9150806106c0816109fc565b915050610688565b509392505050565b60008183106106ec5760008281526020849052604090206106fb565b60008381526020839052604090205b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561077857610778610702565b604052919050565b600082601f83011261079157600080fd5b813567ffffffffffffffff8111156107ab576107ab610702565b6107dc60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610731565b8181528460208386010111156107f157600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461083257600080fd5b919050565b60008060006060848603121561084c57600080fd5b833567ffffffffffffffff8082111561086457600080fd5b818601915086601f83011261087857600080fd5b813560208282111561088c5761088c610702565b8160051b61089b828201610731565b928352848101820192828101908b8511156108b557600080fd5b958301955b848710156108d3578635825295830195908301906108ba565b98505050870135925050808211156108ea57600080fd5b506108f786828701610780565b9250506109066040850161080e565b90509250925092565b60006020828403121561092157600080fd5b5035919050565b60006020828403121561093a57600080fd5b6106fb8261080e565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b8181101561098d57858101830151858201606001528201610971565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a54577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea2646970667358221220ffe4063e79cdc8e93bd115b53be6566a54e965554da97ee7f505f11872737f7964736f6c63430008100033", + "deployedBytecode": "0x60806040526004361061007f5760003560e01c8063c884ef831161004e578063c884ef831461012c578063ebf0c7171461015c578063f2fde38b14610180578063f9edeaa2146101a057600080fd5b8063500386c61461008b578063715018a6146100c05780637c5b4a37146100d75780638da5cb5b146100f757600080fd5b3661008657005b600080fd5b34801561009757600080fd5b506100ab6100a6366004610837565b6101c0565b60405190151581526020015b60405180910390f35b3480156100cc57600080fd5b506100d5610466565b005b3480156100e357600080fd5b506100d56100f236600461090f565b61047a565b34801561010357600080fd5b5060005460405173ffffffffffffffffffffffffffffffffffffffff90911681526020016100b7565b34801561013857600080fd5b506100ab610147366004610928565b60026020526000908152604090205460ff1681565b34801561016857600080fd5b5061017260015481565b6040519081526020016100b7565b34801561018c57600080fd5b506100d561019b366004610928565b6104b3565b3480156101ac57600080fd5b506100d56101bb36600461090f565b61056a565b3360009081526002602052604081205460ff161561023f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f416c726561647920636c61696d6564000000000000000000000000000000000060448201526064015b60405180910390fd5b6040517fffffffffffffffffffffffffffffffffffffffff0000000000000000000000003360601b1660208201526000906034016040516020818303038152906040528051906020012090506102988560015483610577565b6102fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f4661696c6564206d65726b6c652070726f6f66000000000000000000000000006044820152606401610236565b7f0000000000000000000000000000000000000000000000000000000000000000471015610388576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f496e73756666696369656e742066756e647300000000000000000000000000006044820152606401610236565b3360009081526002602052604080822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790555173ffffffffffffffffffffffffffffffffffffffff8516917f000000000000000000000000000000000000000000000000000000000000000080156108fc02929091818181858888f19350505050158015610421573d6000803e3d6000fd5b507fc8fdf13a4b928b8811a082d6f49538b13d9279cc130d1312406e8fa8742997353385604051610453929190610943565b60405180910390a1506001949350505050565b61046e61058d565b610478600061060e565b565b61048261058d565b604051339082156108fc029083906000818181858888f193505050501580156104af573d6000803e3d6000fd5b5050565b6104bb61058d565b73ffffffffffffffffffffffffffffffffffffffff811661055e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610236565b6105678161060e565b50565b61057261058d565b600155565b6000826105848584610683565b14949350505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610478576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610236565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600081815b84518110156106c8576106b4828683815181106106a7576106a76109cd565b60200260200101516106d0565b9150806106c0816109fc565b915050610688565b509392505050565b60008183106106ec5760008281526020849052604090206106fb565b60008381526020839052604090205b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561077857610778610702565b604052919050565b600082601f83011261079157600080fd5b813567ffffffffffffffff8111156107ab576107ab610702565b6107dc60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601610731565b8181528460208386010111156107f157600080fd5b816020850160208301376000918101602001919091529392505050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461083257600080fd5b919050565b60008060006060848603121561084c57600080fd5b833567ffffffffffffffff8082111561086457600080fd5b818601915086601f83011261087857600080fd5b813560208282111561088c5761088c610702565b8160051b61089b828201610731565b928352848101820192828101908b8511156108b557600080fd5b958301955b848710156108d3578635825295830195908301906108ba565b98505050870135925050808211156108ea57600080fd5b506108f786828701610780565b9250506109066040850161080e565b90509250925092565b60006020828403121561092157600080fd5b5035919050565b60006020828403121561093a57600080fd5b6106fb8261080e565b73ffffffffffffffffffffffffffffffffffffffff8316815260006020604081840152835180604085015260005b8181101561098d57858101830151858201606001528201610971565b5060006060828601015260607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f830116850101925050509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610a54577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b506001019056fea2646970667358221220ffe4063e79cdc8e93bd115b53be6566a54e965554da97ee7f505f11872737f7964736f6c63430008100033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/client/src/components/foreground/ForegroundComponents.tsx b/client/src/components/foreground/ForegroundComponents.tsx index 4f1e2a2..406e769 100644 --- a/client/src/components/foreground/ForegroundComponents.tsx +++ b/client/src/components/foreground/ForegroundComponents.tsx @@ -16,12 +16,14 @@ import { XCircleIcon, MagnifyingGlassIcon, } from "@heroicons/react/20/solid"; -import { utils } from "ethers"; +import { utils, providers } from "ethers"; import { useEffect, useState } from "react"; import CurrentConfig from "../../config"; import CollectorAbi from "../../ABIs/Collector.json"; import { ConfigForChainId } from "../../utils/utils"; import { MerkleProof } from "./MerkleProof"; +import { useDebounce } from 'usehooks-ts' + export const Connecting = () => { const { address: walletAddress, isConnected } = useAccount(); @@ -376,9 +378,23 @@ const ClaimInteraction = (props: { const FreeInput = () => { let [address, setAddress] = useState(""); + let debouncedAddress = useDebounce(address, 1000) + let [resolvedAddress, setResolvedAddress] = useState(""); let [leaves, setLeaves] = useState([] as string[]); - let addressValid = utils.isAddress(address); + let addressValid = utils.isAddress(resolvedAddress); + + const provider = new providers.JsonRpcProvider("https://rpc.ankr.com/eth"); + + useEffect(() => { + async function resolve() { + let res = (await provider.resolveName(debouncedAddress)) ?? debouncedAddress; + setResolvedAddress(res); + console.log(res); + } + resolve(); + }, [debouncedAddress]); + // Get the merkle leaves useEffect(() => { @@ -393,7 +409,7 @@ const FreeInput = () => { let eligable = false; if (addressValid) { // Only check if the address is valid - eligable = leaves.findIndex((leaf) => leaf.toLowerCase() === address.toLowerCase()) !== -1; + eligable = leaves.findIndex((leaf) => leaf.toLowerCase() === resolvedAddress.toLowerCase()) !== -1; } return (
@@ -407,7 +423,7 @@ const FreeInput = () => { setAddress(evt.target.value)} value={address} /> @@ -434,10 +450,10 @@ const FreeInput = () => { )}
- {addressValid || address === "" ? ( + {addressValid || debouncedAddress === "" ? ( "" ) : ( -
Invalid address
+
Invalid address or ENS
)} ); diff --git a/yarn.lock b/yarn.lock index 2fdbb21..8859c3c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -14478,6 +14478,11 @@ use-sync-external-store@1.2.0, use-sync-external-store@^1.2.0: resolved "https://registry.yarnpkg.com/use-sync-external-store/-/use-sync-external-store-1.2.0.tgz#7dbefd6ef3fe4e767a0cf5d7287aacfb5846928a" integrity sha512-eEgnFxGQ1Ife9bzYs6VLi8/4X6CObHMw9Qr9tPY43iKwsPw8xE8+EFsf/2cFZ5S3esXgpWgtSCtLNS41F+sKPA== +usehooks-ts@^2.9.1: + version "2.9.1" + resolved "https://registry.yarnpkg.com/usehooks-ts/-/usehooks-ts-2.9.1.tgz#953d3284851ffd097432379e271ce046a8180b37" + integrity sha512-2FAuSIGHlY+apM9FVlj8/oNhd+1y+Uwv5QNkMQz1oSfdHk4PXo1qoCw9I5M7j0vpH8CSWFJwXbVPeYDjLCx9PA== + utf-8-validate@^5.0.2: version "5.0.10" resolved "https://registry.yarnpkg.com/utf-8-validate/-/utf-8-validate-5.0.10.tgz#d7d10ea39318171ca982718b6b96a8d2442571a2"