diff --git a/.eslintignore b/.eslintignore index fd6eec95a6..937d972dbb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -16,4 +16,6 @@ account-kit/rn-signer/lib/* **/build/* **/.cxx/* -**/vendor/* \ No newline at end of file +**/vendor/* +**/test-results/* +**/playwright-report/* \ No newline at end of file diff --git a/examples/ui-demo/contracts/README.md b/examples/ui-demo/contracts/README.md index 9265b45584..01be8148a4 100644 --- a/examples/ui-demo/contracts/README.md +++ b/examples/ui-demo/contracts/README.md @@ -48,7 +48,20 @@ $ anvil ### Deploy ```shell -$ forge script script/Counter.s.sol:CounterScript --rpc-url --private-key +$ FOUNDRY_PROFILE=optimized-build forge script script/DeploySwapVenue.s.sol -vv --verify --rpc-url +``` + +Make sure to have a verifier API key at the env var `ETHERSCAN_API_KEY` before using. + +Otherwise, verify manually with: + +```shell + +FOUNDRY_PROFILE=optimized-build forge verify-contract 0xB0AEC4c25E8332256A91bBaf169E3C32dfC3C33C Swap --rpc-url --watch + +FOUNDRY_PROFILE=optimized-build forge verify-contract 0xCFf7C6dA719408113DFcb5e36182c6d5aa491443 ERC20Mintable --rpc-url --watch --constructor-args $(cast abi-encode "constructor(string,string)" "DemoUSDC" "USDC") + +FOUNDRY_PROFILE=optimized-build forge verify-contract 0x0766798566D1f6e2f0b126f7783aaB2CBb81c66f ERC20Mintable --rpc-url --watch --constructor-args $(cast abi-encode "constructor(string,string)" "DemoWETH" "WETH") ``` ### Cast diff --git a/examples/ui-demo/contracts/broadcast/DeploySwapVenue.s.sol/421614/run-1739916739.json b/examples/ui-demo/contracts/broadcast/DeploySwapVenue.s.sol/421614/run-1739916739.json new file mode 100644 index 0000000000..0d80783261 --- /dev/null +++ b/examples/ui-demo/contracts/broadcast/DeploySwapVenue.s.sol/421614/run-1739916739.json @@ -0,0 +1,92 @@ +{ + "transactions": [ + { + "hash": "0x36e200072b8dabd8ee93a5e8ce602bcf1732b64f1cc864d35d72b6e1a278c91b", + "transactionType": "CREATE2", + "contractName": "Swap", + "contractAddress": "0xb0aec4c25e8332256a91bbaf169e3c32dfc3c33c", + "function": null, + "arguments": null, + "transaction": { + "from": "0x7f89ed1f3f0d52d303904101305471bca3cde710", + "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "gas": "0x21a364", + "value": "0x0", + "input": "0x00000000000000000000000000000000000000000000000000000000000000006080806040523461020c57610c80818101906001600160401b0382118383101761021057610882928184823960c0815f9460408152600860408201526744656d6f5553444360c01b60608201526080602082015260046080820152635553444360e01b60a08201520301905ff08015610201575f80546001600160a01b0319166001600160a01b03929092169182179055803b1561020c576040516340c10f1960e01b81523060048201526001600160a01b036024820152905f908290604490829084905af18015610201576101ec575b50604051818101939091906001600160401b038511838610176101d857839460c09284928339604081526008604082015267088cadadeae8aa8960c31b60608201526080602082015260046080820152630ae8aa8960e31b60a082015203019082f080156101cb57600180546001600160a01b0319166001600160a01b03929092169182179055803b156101c8576040516340c10f1960e01b81523060048201526001600160a01b03602482015291908290604490829084905af180156101bd576101a5575b60405161063a90816102488239f35b6101b0828092610224565b6101ba5780610196565b80fd5b6040513d84823e3d90fd5b50fd5b50604051903d90823e3d90fd5b634e487b7160e01b84526041600452602484fd5b6101f99192505f90610224565b5f905f6100d0565b6040513d5f823e3d90fd5b5f80fd5b634e487b7160e01b5f52604160045260245ffd5b601f909101601f19168101906001600160401b038211908210176102105760405256fe6080806040526004361015610012575f80fd5b5f905f3560e01c9081631b2ef1ca14610454575080633e413bee146104035780633fc8cef3146103b1578063ccdc7d761461022d5763eebba33314610055575f80fd5b3461022a5761006336610573565b90678ac7230489e8000082116101cc5782546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925283929060209083906064908290879073ffffffffffffffffffffffffffffffffffffffff165af19081156101c15760209261015d926101a6575b5073ffffffffffffffffffffffffffffffffffffffff60015416906040519485809481937fa9059cbb00000000000000000000000000000000000000000000000000000000835233600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b03925af1801561019b5761016f575080f35b6101909060203d602011610194575b61018881836105a7565b810190610615565b5080f35b503d61017e565b6040513d84823e3d90fd5b6101bc90843d86116101945761018881836105a7565b6100e9565b6040513d85823e3d90fd5b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f4d617820313020657468207377617020617420612074696d65000000000000006044820152fd5b80fd5b503461022a5761023c36610573565b9069152d02c7e14af68000008211610353576001546040517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152306024820152604481019290925283929060209083906064908290879073ffffffffffffffffffffffffffffffffffffffff165af19081156101c15760209261015d92610338575b5073ffffffffffffffffffffffffffffffffffffffff845416906040519485809481937fa9059cbb00000000000000000000000000000000000000000000000000000000835233600484016020909392919373ffffffffffffffffffffffffffffffffffffffff60408201951681520152565b61034e90843d86116101945761018881836105a7565b6102c5565b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f4d6178203130306b2055534443207377617020617420612074696d65000000006044820152fd5b503461022a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022a57602073ffffffffffffffffffffffffffffffffffffffff60015416604051908152f35b503461022a57807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc36011261022a5773ffffffffffffffffffffffffffffffffffffffff6020915416604051908152f35b823461056f5761046336610573565b929073ffffffffffffffffffffffffffffffffffffffff5f541690813b1561056f577f40c10f1900000000000000000000000000000000000000000000000000000000835233600484015260248301525f908290604490829084905af1801561056457610551575b50809173ffffffffffffffffffffffffffffffffffffffff60015416803b1561054d576040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481019290925282908290604490829084905af1801561019b5761053c5750f35b81610546916105a7565b61022a5780f35b5050fd5b61055d91505f906105a7565b5f826104cb565b6040513d5f823e3d90fd5b5f80fd5b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc604091011261056f576004359060243590565b90601f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0910116810190811067ffffffffffffffff8211176105e857604052565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b9081602091031261056f5751801515810361056f579056fea164736f6c634300081a000a60806040523461031057610c808038038061001981610314565b9283398101906040818303126103105780516001600160401b0381116103105782610045918301610339565b60208201519092906001600160401b038111610310576100659201610339565b81516001600160401b03811161022357600354600181811c91168015610306575b602082101461020557601f81116102a3575b50602092601f821160011461024257928192935f92610237575b50508160011b915f199060031b1c1916176003555b80516001600160401b03811161022357600454600181811c91168015610219575b602082101461020557601f81116101a2575b50602091601f8211600114610142579181925f92610137575b50508160011b915f199060031b1c1916176004555b6040516108f5908161038b8239f35b015190505f80610113565b601f1982169260045f52805f20915f5b85811061018a57508360019510610172575b505050811b01600455610128565b01515f1960f88460031b161c191690555f8080610164565b91926020600181928685015181550194019201610152565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f830160051c810191602084106101fb575b601f0160051c01905b8181106101f057506100fa565b5f81556001016101e3565b90915081906101da565b634e487b7160e01b5f52602260045260245ffd5b90607f16906100e8565b634e487b7160e01b5f52604160045260245ffd5b015190505f806100b2565b601f1982169360035f52805f20915f5b86811061028b5750836001959610610273575b505050811b016003556100c7565b01515f1960f88460031b161c191690555f8080610265565b91926020600181928685015181550194019201610252565b60035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c810191602084106102fc575b601f0160051c01905b8181106102f15750610098565b5f81556001016102e4565b90915081906102db565b90607f1690610086565b5f80fd5b6040519190601f01601f191682016001600160401b0381118382101761022357604052565b81601f82011215610310578051906001600160401b03821161022357610368601f8301601f1916602001610314565b928284526020838301011161031057815f9260208093018386015e830101529056fe6080806040526004361015610012575f80fd5b5f3560e01c90816306fdde03146106ab57508063095ea7b31461061c57806318160ddd146105ff57806323b872dd14610489578063313ce5671461046e57806340c10f19146102ec57806370a08231146102a857806395d89b411461012d578063a9059cbb146100fc5763dd62ed3e1461008a575f80fd5b346100f85760406003193601126100f8576100a36107ac565b73ffffffffffffffffffffffffffffffffffffffff6100c06107cf565b91165f52600160205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060405f2054604051908152f35b5f80fd5b346100f85760406003193601126100f8576101226101186107ac565b60243590336107f2565b602060405160018152f35b346100f8575f6003193601126100f8576040515f600454908160011c6001831692831561029e575b60208210841461027157818552849390811561022f57506001146101d3575b5003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b0390f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60045f90815291507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8183106102135750508101602001601f19610174565b60209193508060019154838588010152019101909183926101fd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208581019190915291151560051b84019091019150601f199050610174565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b90607f1690610155565b346100f85760206003193601126100f85773ffffffffffffffffffffffffffffffffffffffff6102d66107ac565b165f525f602052602060405f2054604051908152f35b346100f85760406003193601126100f8576103056107ac565b6024359073ffffffffffffffffffffffffffffffffffffffff82116103ea5773ffffffffffffffffffffffffffffffffffffffff169081156103be57600254908082018092116103915760207fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef915f9360025584845283825260408420818154019055604051908152a3005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b7fec442f05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4572726f723a206d6178206d696e7420616d6f756e742069732075696e74313660448201527f30206d61780000000000000000000000000000000000000000000000000000006064820152fd5b346100f8575f6003193601126100f857602060405160128152f35b346100f85760606003193601126100f8576104a26107ac565b6104aa6107cf565b6044359073ffffffffffffffffffffffffffffffffffffffff831692835f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110610526575b5061012293506107f2565b8381106105cb57841561059f57331561057357610122945f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f526020528360405f20910390558461051b565b7f94280d62000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b7fe602df05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b83907ffb8f41b2000000000000000000000000000000000000000000000000000000005f523360045260245260445260645ffd5b346100f8575f6003193601126100f8576020600254604051908152f35b346100f85760406003193601126100f8576106356107ac565b60243590331561059f5773ffffffffffffffffffffffffffffffffffffffff1690811561057357335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b346100f8575f6003193601126100f8575f600354908160011c60018316928315610778575b60208210841461027157818552849390811561022f575060011461071c575003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b60035f90815291507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b81831061075c5750508101602001601f19610174565b6020919350806001915483858801015201910190918392610746565b90607f16906106d0565b601f19601f602060409481855280519182918282880152018686015e5f8582860101520116010190565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b73ffffffffffffffffffffffffffffffffffffffff169081156108bc5773ffffffffffffffffffffffffffffffffffffffff169182156103be57815f525f60205260405f205481811061088a57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b827fe450d38c000000000000000000000000000000000000000000000000000000005f5260045260245260445260645ffd5b7f96c6fd1e000000000000000000000000000000000000000000000000000000005f525f60045260245ffdfea164736f6c634300081a000a", + "nonce": "0x16", + "chainId": "0x66eee" + }, + "additionalContracts": [ + { + "transactionType": "CREATE", + "address": "0xcff7c6da719408113dfcb5e36182c6d5aa491443", + "initCode": "0x60806040523461031057610c808038038061001981610314565b9283398101906040818303126103105780516001600160401b0381116103105782610045918301610339565b60208201519092906001600160401b038111610310576100659201610339565b81516001600160401b03811161022357600354600181811c91168015610306575b602082101461020557601f81116102a3575b50602092601f821160011461024257928192935f92610237575b50508160011b915f199060031b1c1916176003555b80516001600160401b03811161022357600454600181811c91168015610219575b602082101461020557601f81116101a2575b50602091601f8211600114610142579181925f92610137575b50508160011b915f199060031b1c1916176004555b6040516108f5908161038b8239f35b015190505f80610113565b601f1982169260045f52805f20915f5b85811061018a57508360019510610172575b505050811b01600455610128565b01515f1960f88460031b161c191690555f8080610164565b91926020600181928685015181550194019201610152565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f830160051c810191602084106101fb575b601f0160051c01905b8181106101f057506100fa565b5f81556001016101e3565b90915081906101da565b634e487b7160e01b5f52602260045260245ffd5b90607f16906100e8565b634e487b7160e01b5f52604160045260245ffd5b015190505f806100b2565b601f1982169360035f52805f20915f5b86811061028b5750836001959610610273575b505050811b016003556100c7565b01515f1960f88460031b161c191690555f8080610265565b91926020600181928685015181550194019201610252565b60035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c810191602084106102fc575b601f0160051c01905b8181106102f15750610098565b5f81556001016102e4565b90915081906102db565b90607f1690610086565b5f80fd5b6040519190601f01601f191682016001600160401b0381118382101761022357604052565b81601f82011215610310578051906001600160401b03821161022357610368601f8301601f1916602001610314565b928284526020838301011161031057815f9260208093018386015e830101529056fe6080806040526004361015610012575f80fd5b5f3560e01c90816306fdde03146106ab57508063095ea7b31461061c57806318160ddd146105ff57806323b872dd14610489578063313ce5671461046e57806340c10f19146102ec57806370a08231146102a857806395d89b411461012d578063a9059cbb146100fc5763dd62ed3e1461008a575f80fd5b346100f85760406003193601126100f8576100a36107ac565b73ffffffffffffffffffffffffffffffffffffffff6100c06107cf565b91165f52600160205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060405f2054604051908152f35b5f80fd5b346100f85760406003193601126100f8576101226101186107ac565b60243590336107f2565b602060405160018152f35b346100f8575f6003193601126100f8576040515f600454908160011c6001831692831561029e575b60208210841461027157818552849390811561022f57506001146101d3575b5003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b0390f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60045f90815291507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8183106102135750508101602001601f19610174565b60209193508060019154838588010152019101909183926101fd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208581019190915291151560051b84019091019150601f199050610174565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b90607f1690610155565b346100f85760206003193601126100f85773ffffffffffffffffffffffffffffffffffffffff6102d66107ac565b165f525f602052602060405f2054604051908152f35b346100f85760406003193601126100f8576103056107ac565b6024359073ffffffffffffffffffffffffffffffffffffffff82116103ea5773ffffffffffffffffffffffffffffffffffffffff169081156103be57600254908082018092116103915760207fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef915f9360025584845283825260408420818154019055604051908152a3005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b7fec442f05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4572726f723a206d6178206d696e7420616d6f756e742069732075696e74313660448201527f30206d61780000000000000000000000000000000000000000000000000000006064820152fd5b346100f8575f6003193601126100f857602060405160128152f35b346100f85760606003193601126100f8576104a26107ac565b6104aa6107cf565b6044359073ffffffffffffffffffffffffffffffffffffffff831692835f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110610526575b5061012293506107f2565b8381106105cb57841561059f57331561057357610122945f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f526020528360405f20910390558461051b565b7f94280d62000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b7fe602df05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b83907ffb8f41b2000000000000000000000000000000000000000000000000000000005f523360045260245260445260645ffd5b346100f8575f6003193601126100f8576020600254604051908152f35b346100f85760406003193601126100f8576106356107ac565b60243590331561059f5773ffffffffffffffffffffffffffffffffffffffff1690811561057357335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b346100f8575f6003193601126100f8575f600354908160011c60018316928315610778575b60208210841461027157818552849390811561022f575060011461071c575003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b60035f90815291507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b81831061075c5750508101602001601f19610174565b6020919350806001915483858801015201910190918392610746565b90607f16906106d0565b601f19601f602060409481855280519182918282880152018686015e5f8582860101520116010190565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b73ffffffffffffffffffffffffffffffffffffffff169081156108bc5773ffffffffffffffffffffffffffffffffffffffff169182156103be57815f525f60205260405f205481811061088a57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b827fe450d38c000000000000000000000000000000000000000000000000000000005f5260045260245260445260645ffd5b7f96c6fd1e000000000000000000000000000000000000000000000000000000005f525f60045260245ffdfea164736f6c634300081a000a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000844656d6f5553444300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045553444300000000000000000000000000000000000000000000000000000000" + }, + { + "transactionType": "CREATE", + "address": "0x0766798566d1f6e2f0b126f7783aab2cbb81c66f", + "initCode": "0x60806040523461031057610c808038038061001981610314565b9283398101906040818303126103105780516001600160401b0381116103105782610045918301610339565b60208201519092906001600160401b038111610310576100659201610339565b81516001600160401b03811161022357600354600181811c91168015610306575b602082101461020557601f81116102a3575b50602092601f821160011461024257928192935f92610237575b50508160011b915f199060031b1c1916176003555b80516001600160401b03811161022357600454600181811c91168015610219575b602082101461020557601f81116101a2575b50602091601f8211600114610142579181925f92610137575b50508160011b915f199060031b1c1916176004555b6040516108f5908161038b8239f35b015190505f80610113565b601f1982169260045f52805f20915f5b85811061018a57508360019510610172575b505050811b01600455610128565b01515f1960f88460031b161c191690555f8080610164565b91926020600181928685015181550194019201610152565b60045f527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b601f830160051c810191602084106101fb575b601f0160051c01905b8181106101f057506100fa565b5f81556001016101e3565b90915081906101da565b634e487b7160e01b5f52602260045260245ffd5b90607f16906100e8565b634e487b7160e01b5f52604160045260245ffd5b015190505f806100b2565b601f1982169360035f52805f20915f5b86811061028b5750836001959610610273575b505050811b016003556100c7565b01515f1960f88460031b161c191690555f8080610265565b91926020600181928685015181550194019201610252565b60035f527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b601f830160051c810191602084106102fc575b601f0160051c01905b8181106102f15750610098565b5f81556001016102e4565b90915081906102db565b90607f1690610086565b5f80fd5b6040519190601f01601f191682016001600160401b0381118382101761022357604052565b81601f82011215610310578051906001600160401b03821161022357610368601f8301601f1916602001610314565b928284526020838301011161031057815f9260208093018386015e830101529056fe6080806040526004361015610012575f80fd5b5f3560e01c90816306fdde03146106ab57508063095ea7b31461061c57806318160ddd146105ff57806323b872dd14610489578063313ce5671461046e57806340c10f19146102ec57806370a08231146102a857806395d89b411461012d578063a9059cbb146100fc5763dd62ed3e1461008a575f80fd5b346100f85760406003193601126100f8576100a36107ac565b73ffffffffffffffffffffffffffffffffffffffff6100c06107cf565b91165f52600160205273ffffffffffffffffffffffffffffffffffffffff60405f2091165f52602052602060405f2054604051908152f35b5f80fd5b346100f85760406003193601126100f8576101226101186107ac565b60243590336107f2565b602060405160018152f35b346100f8575f6003193601126100f8576040515f600454908160011c6001831692831561029e575b60208210841461027157818552849390811561022f57506001146101d3575b5003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b0390f35b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60045f90815291507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8183106102135750508101602001601f19610174565b60209193508060019154838588010152019101909183926101fd565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660208581019190915291151560051b84019091019150601f199050610174565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b90607f1690610155565b346100f85760206003193601126100f85773ffffffffffffffffffffffffffffffffffffffff6102d66107ac565b165f525f602052602060405f2054604051908152f35b346100f85760406003193601126100f8576103056107ac565b6024359073ffffffffffffffffffffffffffffffffffffffff82116103ea5773ffffffffffffffffffffffffffffffffffffffff169081156103be57600254908082018092116103915760207fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef915f9360025584845283825260408420818154019055604051908152a3005b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b7fec442f05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b60846040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602560248201527f4572726f723a206d6178206d696e7420616d6f756e742069732075696e74313660448201527f30206d61780000000000000000000000000000000000000000000000000000006064820152fd5b346100f8575f6003193601126100f857602060405160128152f35b346100f85760606003193601126100f8576104a26107ac565b6104aa6107cf565b6044359073ffffffffffffffffffffffffffffffffffffffff831692835f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f5260205260405f20547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8110610526575b5061012293506107f2565b8381106105cb57841561059f57331561057357610122945f52600160205260405f2073ffffffffffffffffffffffffffffffffffffffff33165f526020528360405f20910390558461051b565b7f94280d62000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b7fe602df05000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b83907ffb8f41b2000000000000000000000000000000000000000000000000000000005f523360045260245260445260645ffd5b346100f8575f6003193601126100f8576020600254604051908152f35b346100f85760406003193601126100f8576106356107ac565b60243590331561059f5773ffffffffffffffffffffffffffffffffffffffff1690811561057357335f52600160205260405f20825f526020528060405f20556040519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560203392a3602060405160018152f35b346100f8575f6003193601126100f8575f600354908160011c60018316928315610778575b60208210841461027157818552849390811561022f575060011461071c575003601f01601f191681019067ffffffffffffffff8211818310176101a6576101a282918260405282610782565b60035f90815291507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b81831061075c5750508101602001601f19610174565b6020919350806001915483858801015201910190918392610746565b90607f16906106d0565b601f19601f602060409481855280519182918282880152018686015e5f8582860101520116010190565b6004359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b6024359073ffffffffffffffffffffffffffffffffffffffff821682036100f857565b73ffffffffffffffffffffffffffffffffffffffff169081156108bc5773ffffffffffffffffffffffffffffffffffffffff169182156103be57815f525f60205260405f205481811061088a57817fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92602092855f525f84520360405f2055845f525f825260405f20818154019055604051908152a3565b827fe450d38c000000000000000000000000000000000000000000000000000000005f5260045260245260445260645ffd5b7f96c6fd1e000000000000000000000000000000000000000000000000000000005f525f60045260245ffdfea164736f6c634300081a000a00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000844656d6f5745544800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000045745544800000000000000000000000000000000000000000000000000000000" + } + ], + "isFixedGasLimit": false + } + ], + "receipts": [ + { + "status": "0x1", + "cumulativeGasUsed": "0x196faa", + "logs": [ + { + "address": "0xcff7c6da719408113dfcb5e36182c6d5aa491443", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000b0aec4c25e8332256a91bbaf169e3c32dfc3c33c" + ], + "data": "0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0xa771a0192daf910648eaa0b4c6565c1cee944b7fc354bc247df716b2bc958d8d", + "blockNumber": "0x7747c6d", + "transactionHash": "0x36e200072b8dabd8ee93a5e8ce602bcf1732b64f1cc864d35d72b6e1a278c91b", + "transactionIndex": "0x1", + "logIndex": "0x0", + "removed": false + }, + { + "address": "0x0766798566d1f6e2f0b126f7783aab2cbb81c66f", + "topics": [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000b0aec4c25e8332256a91bbaf169e3c32dfc3c33c" + ], + "data": "0x000000000000000000000000ffffffffffffffffffffffffffffffffffffffff", + "blockHash": "0xa771a0192daf910648eaa0b4c6565c1cee944b7fc354bc247df716b2bc958d8d", + "blockNumber": "0x7747c6d", + "transactionHash": "0x36e200072b8dabd8ee93a5e8ce602bcf1732b64f1cc864d35d72b6e1a278c91b", + "transactionIndex": "0x1", + "logIndex": "0x1", + "removed": false + } + ], + "logsBloom": "0x00000000000000000000000000000000000000000020000000000000000000200000000000000000000000000000000000000000000000001000000000000000000000000000000000000008000000000000000000008000000000000000000000000000020001000000000000000800000000000000000000000010000000000000001000000000000000000000000000400000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "type": "0x2", + "transactionHash": "0x36e200072b8dabd8ee93a5e8ce602bcf1732b64f1cc864d35d72b6e1a278c91b", + "transactionIndex": "0x1", + "blockHash": "0xa771a0192daf910648eaa0b4c6565c1cee944b7fc354bc247df716b2bc958d8d", + "blockNumber": "0x7747c6d", + "gasUsed": "0x196faa", + "effectiveGasPrice": "0x5f5e100", + "from": "0x7f89ed1f3f0d52d303904101305471bca3cde710", + "to": "0x4e59b44847b379578588920ca78fbf26c0b4956c", + "contractAddress": null, + "gasUsedForL1": "0x0", + "l1BlockNumber": "0x760d1e", + "timeboosted": false + } + ], + "libraries": [], + "pending": [], + "returns": {}, + "timestamp": 1739916739, + "chain": 421614, + "commit": "c16b0d56" +} \ No newline at end of file diff --git a/examples/ui-demo/e2e/7702.spec.ts b/examples/ui-demo/e2e/7702.spec.ts new file mode 100644 index 0000000000..0386aeb910 --- /dev/null +++ b/examples/ui-demo/e2e/7702.spec.ts @@ -0,0 +1,24 @@ +import { test, expect } from "@playwright/test"; +import { mintWithGoogleAuthWorkflow } from "./helpers/mintWorkflow"; +const googleEmail = process.env.PLAYWRIGHT_GOOGLE_EMAIL; +const googlePassword = process.env.PLAYWRIGHT_GOOGLE_PASSWORD; + +test.beforeEach(async ({ page, baseURL }) => { + await page.goto(baseURL!); +}); +test("Google sign in", async ({ page }) => { + if (!googleEmail || !googlePassword) { + throw new Error( + "PLAYWRIGHT_GOOGLE_EMAIL and PLAYWRIGHT_GOOGLE_PASSWORD must be set" + ); + } + await expect(page).toHaveTitle(/Account Kit/); + // Fast way to initialize the page and ensure config is loaded + await page.getByRole("switch", { name: "Email" }).click(); + await page.getByRole("switch", { name: "Email" }).click(); + const walletSwitch = await page.locator("#wallet-switch"); + if ((await walletSwitch.getAttribute("aria-checked")) === "false") { + await walletSwitch.click(); + } + await mintWithGoogleAuthWorkflow(page, googleEmail, googlePassword); +}); diff --git a/examples/ui-demo/e2e/helpers/mintWorkflow.ts b/examples/ui-demo/e2e/helpers/mintWorkflow.ts new file mode 100644 index 0000000000..a067edcce3 --- /dev/null +++ b/examples/ui-demo/e2e/helpers/mintWorkflow.ts @@ -0,0 +1,55 @@ +// sharedWorkflow.ts +import { Page, expect } from "@playwright/test"; + +export async function mintWithGoogleAuthWorkflow( + page: Page, + googleEmail: string, + googlePassword: string +) { + // Google sign in + await page.locator("button[aria-label='Google sign in']").click(); + const popup = await page.waitForEvent("popup"); + await popup.waitForLoadState("networkidle"); + + const emailInput = popup.getByRole("textbox"); + await emailInput.fill(googleEmail); + await popup.getByRole("button", { name: /Next/i }).click(); + await expect(popup.getByText(/Enter your password/i)).toBeVisible(); + + const passwordInput = popup.locator("input[type='password']:visible"); + await passwordInput.fill(googlePassword); + await popup.getByRole("button", { name: /Next/i }).click(); + + // Wait for page to load after sign in + await expect(page.getByText(/Gasless transactions/i)).toBeVisible(); + const avatar = page.getByRole("button", { name: `Hello, ${googleEmail}` }); + await expect(avatar).toBeVisible(); + await page.locator("img[alt='An NFT']"); + + // Collect NFT + await page.getByRole("button", { name: "Collect NFT" }).click(); + await expect(page.getByText("Success", { exact: true })).toBeVisible({ + timeout: 30000, + }); + + // Create session key + await page.getByRole("button", { name: "Create session key" }).click(); + await expect(page.getByText("Bought 1 ETH")).toBeVisible({ + timeout: 30000, + }); + + // Check external links + await expect(page.locator("a[aria-label='View transaction']")).toBeVisible(); + await expect(page.getByRole("link", { name: "Quickstart" })).toHaveAttribute( + "href", + "https://accountkit.alchemy.com/react/quickstart" + ); + await expect(page.locator("a[aria-label='GitHub']")).toHaveAttribute( + "href", + "https://github.com/alchemyplatform/aa-sdk/tree/v4.x.x" + ); + await expect(page.getByRole("link", { name: "CSS" })).toHaveAttribute( + "href", + "https://github.com/alchemyplatform/aa-sdk/blob/v4.x.x/account-kit/react/src/tailwind/types.ts#L6" + ); +} diff --git a/examples/ui-demo/e2e/smart-contract-mint.spec.ts b/examples/ui-demo/e2e/smart-contract-mint.spec.ts deleted file mode 100644 index 55b2ae044c..0000000000 --- a/examples/ui-demo/e2e/smart-contract-mint.spec.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { test, expect } from "@playwright/test"; - -const googleEmail = process.env.PLAYWRIGHT_GOOGLE_EMAIL; -const googlePassword = process.env.PLAYWRIGHT_GOOGLE_PASSWORD; - -test.beforeEach(async ({ page, baseURL }) => { - await page.goto(baseURL!); -}); -test("Google sign in", async ({ page }) => { - if (!googleEmail || !googlePassword) { - throw new Error( - "PLAYWRIGHT_GOOGLE_EMAIL and PLAYWRIGHT_GOOGLE_PASSWORD must be set" - ); - } - await expect(page).toHaveTitle(/Account Kit/); - // Enabling and disabling email to ensure config is loaded - // TODO: find a better way to determine init complete. - await page.getByRole("switch", { name: "Email" }).click(); - await page.getByRole("switch", { name: "Email" }).click(); - await page.locator("button[aria-label='Google sign in']").click(); - const pagePromise = page.waitForEvent("popup"); - const popup = await pagePromise; - await popup.waitForLoadState("networkidle"); - const emailInput = await popup.getByRole("textbox"); - - await emailInput.fill(googleEmail); - await popup.getByRole("button", { name: /Next/i }).click(); - await expect(popup.getByText(/Enter your password/i)).toBeVisible(); - const passwordInput = await popup.locator("input[type='password']:visible"); - await passwordInput.fill(googlePassword); - await popup.getByRole("button", { name: /Next/i }).click(); - - // Wait for the page to load after sign in - await expect(page.getByText(/One-click checkout/i).first()).toBeVisible(); - const avatar = await page.getByRole("button", { - name: `Hello, ${googleEmail}`, - }); - expect(avatar).toBeVisible(); - await page.locator("img[alt='An NFT']"); - - // Collect NFT - await page.getByRole("button", { name: "Collect NFT" }).click(); - await expect(await page.getByText("Success", { exact: true })).toBeVisible({ - timeout: 30000, - }); - - // Check external links - await expect( - page.getByRole("link", { name: "View transaction" }) - ).toBeVisible(); - await expect( - await page.getByRole("link", { name: "Build with Account kit" }) - ).toHaveAttribute( - "href", - "https://dashboard.alchemy.com/accounts?utm_source=demo_alchemy_com&utm_medium=referral&utm_campaign=demo_to_dashboard" - ); - await expect( - await page.getByRole("link", { name: "Learn how." }) - ).toHaveAttribute("href", "https://accountkit.alchemy.com/react/sponsor-gas"); - await expect( - await page.getByRole("link", { name: "View docs" }) - ).toHaveAttribute("href", "https://accountkit.alchemy.com/react/quickstart"); - await expect( - await page.getByRole("link", { name: "Quickstart" }) - ).toHaveAttribute("href", "https://accountkit.alchemy.com/react/quickstart"); - await expect(await page.locator("a[aria-label='GitHub']")).toHaveAttribute( - "href", - "https://github.com/alchemyplatform/aa-sdk/tree/v4.x.x" - ); - await expect(await page.getByRole("link", { name: "CSS" })).toHaveAttribute( - "href", - "https://github.com/alchemyplatform/aa-sdk/blob/v4.x.x/account-kit/react/src/tailwind/types.ts#L6" - ); -}); diff --git a/examples/ui-demo/e2e/smart-contract.spec.ts b/examples/ui-demo/e2e/smart-contract.spec.ts new file mode 100644 index 0000000000..66d3d50abc --- /dev/null +++ b/examples/ui-demo/e2e/smart-contract.spec.ts @@ -0,0 +1,26 @@ +import { test, expect } from "@playwright/test"; +import { mintWithGoogleAuthWorkflow } from "./helpers/mintWorkflow"; +const googleEmail = process.env.PLAYWRIGHT_GOOGLE_EMAIL; +const googlePassword = process.env.PLAYWRIGHT_GOOGLE_PASSWORD; + +test.beforeEach(async ({ page, baseURL }) => { + await page.goto(baseURL!); +}); +test("Google sign in", async ({ page }) => { + if (!googleEmail || !googlePassword) { + throw new Error( + "PLAYWRIGHT_GOOGLE_EMAIL and PLAYWRIGHT_GOOGLE_PASSWORD must be set" + ); + } + await expect(page).toHaveTitle(/Account Kit/); + // Fast way to initialize the page and ensure config is loaded + await page.getByRole("switch", { name: "Email" }).click(); + await page.getByRole("switch", { name: "Email" }).click(); + + const walletSwitch = await page.locator("#wallet-switch"); + if ((await walletSwitch.getAttribute("aria-checked")) === "true") { + await walletSwitch.click(); + } + + await mintWithGoogleAuthWorkflow(page, googleEmail, googlePassword); +}); diff --git a/examples/ui-demo/src/app/config.tsx b/examples/ui-demo/src/app/config.tsx index f44adf0019..1075e3e0e7 100644 --- a/examples/ui-demo/src/app/config.tsx +++ b/examples/ui-demo/src/app/config.tsx @@ -1,4 +1,5 @@ import { AuthCardHeader } from "@/components/shared/AuthCardHeader"; +import { odyssey, splitOdysseyTransport } from "@/hooks/7702/transportSetup"; import { alchemy, arbitrumSepolia } from "@account-kit/infra"; import { cookieStorage, createConfig } from "@account-kit/react"; import { AccountKitTheme } from "@account-kit/react/tailwind"; @@ -86,8 +87,19 @@ export const alchemyConfig = () => { transport: alchemy({ rpcUrl: "/api/rpc" }), chain: arbitrumSepolia, + chains: [ + { + chain: arbitrumSepolia, + transport: alchemy({ rpcUrl: "/api/rpc" }), + policyId: process.env.NEXT_PUBLIC_PAYMASTER_POLICY_ID, + }, + { + chain: odyssey, + transport: splitOdysseyTransport, + policyId: process.env.NEXT_PUBLIC_PAYMASTER_POLICY_ID, + }, + ], ssr: true, - policyId: process.env.NEXT_PUBLIC_PAYMASTER_POLICY_ID, connectors: [ walletConnect({ projectId: "30e7ffaff99063e68cc9870c105d905b" }), ], diff --git a/examples/ui-demo/src/components/configuration/Configuration.tsx b/examples/ui-demo/src/components/configuration/Configuration.tsx index 1f6cee70c9..bf3efba406 100644 --- a/examples/ui-demo/src/components/configuration/Configuration.tsx +++ b/examples/ui-demo/src/components/configuration/Configuration.tsx @@ -1,23 +1,27 @@ -// import { useState } from "react"; import { cn } from "@/lib/utils"; import { SettingsIcon } from "../icons/settings"; -// import { HelpTooltip } from "../shared/HelpTooltip"; import { WalletTypeSwitch } from "../shared/WalletTypeSwitch"; import ExternalLink from "../shared/ExternalLink"; import { useConfigStore } from "@/state"; import { WalletTypes } from "@/app/config"; +import { useChain } from "@account-kit/react"; +import { arbitrumSepolia } from "@account-kit/infra"; +import { odyssey } from "@/hooks/7702/transportSetup"; export const Configuration = ({ className }: { className?: string }) => { const { setWalletType, walletType } = useConfigStore(); - // const [walletType, setWalletType] = useState(WalletTypes.smart); + const { setChain } = useChain(); const onSwitchWalletType = () => { - setWalletType( + const newValue = walletType === WalletTypes.smart ? WalletTypes.hybrid7702 - : WalletTypes.smart - ); + : WalletTypes.smart; + setWalletType(newValue); + setChain({ + chain: newValue === WalletTypes.smart ? arbitrumSepolia : odyssey, + }); }; return ( @@ -27,13 +31,16 @@ export const Configuration = ({ className }: { className?: string }) => { Configuration
-

+

+ {/* */}
diff --git a/examples/ui-demo/src/components/shared/ExternalLink.tsx b/examples/ui-demo/src/components/shared/ExternalLink.tsx index b7616054c1..0e680a0e4d 100644 --- a/examples/ui-demo/src/components/shared/ExternalLink.tsx +++ b/examples/ui-demo/src/components/shared/ExternalLink.tsx @@ -1,20 +1,22 @@ import Link, { LinkProps } from "next/link"; +import { forwardRef, ReactNode } from "react"; -const ExternalLink = ({ - className, - children, - ...rest -}: LinkProps & { className?: string; children: React.ReactNode }) => { +const ExternalLink = forwardRef< + HTMLAnchorElement, + LinkProps & { className?: string; children: ReactNode } +>(({ className, children, ...rest }, ref) => { return ( {children} ); -}; +}); +ExternalLink.displayName = "ExternalLink"; export default ExternalLink; diff --git a/examples/ui-demo/src/components/small-cards/MintStages.tsx b/examples/ui-demo/src/components/small-cards/MintStages.tsx index 2f9dcc6384..6c7c8df649 100644 --- a/examples/ui-demo/src/components/small-cards/MintStages.tsx +++ b/examples/ui-demo/src/components/small-cards/MintStages.tsx @@ -27,7 +27,12 @@ export const MintStages = ({ Deploying your smart account... {status.batch === "success" && transactionUrl && ( - + )} diff --git a/examples/ui-demo/src/components/user-connection-avatar/UserAddressLink.tsx b/examples/ui-demo/src/components/user-connection-avatar/UserAddressLink.tsx index 8f7f48db35..8c01940a96 100644 --- a/examples/ui-demo/src/components/user-connection-avatar/UserAddressLink.tsx +++ b/examples/ui-demo/src/components/user-connection-avatar/UserAddressLink.tsx @@ -6,12 +6,22 @@ import { TooltipContent, TooltipArrow, } from "@radix-ui/react-tooltip"; -import { useState } from "react"; +import { useState, useMemo } from "react"; +import ExternalLink from "../shared/ExternalLink"; +import { useChain } from "@account-kit/react"; -export const UserAddressLink = ({ address }: { address: string | null }) => { +export const UserAddressTooltip = ({ + address, + linkEnabled, +}: { + address: string | null; + /** If link is enabled, clicking the address will open it using the chain's explorer URL. If disabled, clicking it will copy it to the clipboard. */ + linkEnabled?: boolean; +}) => { const [showCopied, setShowCopied] = useState(false); const [isOpen, setIsOpen] = useState(false); const truncatedAddress = truncateAddress(address ?? ""); + const { chain } = useChain(); const handleClick = async () => { if (!address) return; @@ -21,16 +31,33 @@ export const UserAddressLink = ({ address }: { address: string | null }) => { setTimeout(() => setShowCopied(false), 2000); }; + const explorerLink = useMemo(() => { + const explorer = chain?.blockExplorers?.default; + if (!address || !explorer) { + return undefined; + } + return `${explorer.url}/address/${address}`; + }, [address, chain]); + return ( - + {linkEnabled && explorerLink ? ( + + {truncatedAddress} + + ) : ( + + )} EOA Address - + {/* Logout */} @@ -80,12 +80,13 @@ export function UserConnectionDetails({ {walletType === WalletTypes.smart ? "Smart account" : "Address"} - @@ -119,7 +120,7 @@ export function UserConnectionDetails({ - + ) : (