From 702c33a3734a92250f9a3fecbce970e8b4e95695 Mon Sep 17 00:00:00 2001 From: Samuel Andert Date: Thu, 20 Jul 2023 12:50:54 +0200 Subject: [PATCH] Added Send 0.01xdai with PKP --- package.json | 6 +- pnpm-lock.yaml | 321 +++++++++++++++++++++++++++++++ src/app/page.js | 2 +- svelte/package.json | 2 +- svelte/pnpm-lock.yaml | 108 +++-------- svelte/src/lib/AuthSig.svelte | 56 ++++++ svelte/src/lib/LitStatus.svelte | 16 +- svelte/src/lib/connect.svelte | 31 --- svelte/src/lib/provider.svelte | 17 -- svelte/src/lib/send.svelte | 75 +++++--- svelte/src/routes/+layout.svelte | 2 - svelte/src/routes/+page.svelte | 4 + 12 files changed, 473 insertions(+), 167 deletions(-) create mode 100644 svelte/src/lib/AuthSig.svelte delete mode 100644 svelte/src/lib/connect.svelte delete mode 100644 svelte/src/lib/provider.svelte diff --git a/package.json b/package.json index 5679e3e..1dbbc2a 100644 --- a/package.json +++ b/package.json @@ -9,17 +9,21 @@ "lint": "next lint" }, "dependencies": { + "@lit-protocol/auth-browser": "^2.2.41", "@lit-protocol/contracts-sdk": "^2.2.41", "@lit-protocol/lit-node-client": "^2.2.41", "@lit-protocol/pkp-ethers": "^2.2.41", "@rainbow-me/rainbowkit": "^0.12.17", "eslint": "8.44.0", "eslint-config-next": "13.4.9", + "ethers": "^5.7.2", "next": "13.4.9", "react": "18.2.0", "react-dom": "18.2.0", "vite-plugin-global": "^0.0.1", - "wagmi": "^0.12.19" + "wagmi": "^0.12.19", + "web3": "^4.0.3", + "web3-providers-http": "^4.0.3" }, "devDependencies": { "autoprefixer": "^10.4.14", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54af2a0..2573d33 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,6 +1,9 @@ lockfileVersion: '6.0' dependencies: + '@lit-protocol/auth-browser': + specifier: ^2.2.41 + version: 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0) '@lit-protocol/contracts-sdk': specifier: ^2.2.41 version: 2.2.41 @@ -19,6 +22,9 @@ dependencies: eslint-config-next: specifier: 13.4.9 version: 13.4.9(eslint@8.44.0)(typescript@5.1.6) + ethers: + specifier: ^5.7.2 + version: 5.7.2 next: specifier: 13.4.9 version: 13.4.9(react-dom@18.2.0)(react@18.2.0) @@ -34,6 +40,12 @@ dependencies: wagmi: specifier: ^0.12.19 version: 0.12.19(ethers@5.7.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.6) + web3: + specifier: ^4.0.3 + version: 4.0.3 + web3-providers-http: + specifier: ^4.0.3 + version: 4.0.3 devDependencies: autoprefixer: @@ -53,6 +65,10 @@ packages: engines: {node: '>=0.10.0'} dev: false + /@adraffy/ens-normalize@1.9.2: + resolution: {integrity: sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==} + dev: false + /@alloc/quick-lru@5.2.0: resolution: {integrity: sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==} engines: {node: '>=10'} @@ -1817,6 +1833,12 @@ packages: '@types/node': 20.4.2 dev: false + /@types/ws@8.5.5: + resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} + dependencies: + '@types/node': 20.4.2 + dev: false + /@typescript-eslint/parser@5.62.0(eslint@8.44.0)(typescript@5.1.6): resolution: {integrity: sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3142,6 +3164,12 @@ packages: protobufjs: 6.11.3 dev: false + /crc-32@1.2.2: + resolution: {integrity: sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ==} + engines: {node: '>=0.8'} + hasBin: true + dev: false + /cross-fetch@3.1.8: resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==} dependencies: @@ -4060,6 +4088,18 @@ packages: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: false + /generate-function@2.3.1: + resolution: {integrity: sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==} + dependencies: + is-property: 1.0.2 + dev: false + + /generate-object-property@1.2.0: + resolution: {integrity: sha512-TuOwZWgJ2VAMEGJvAyPWvpqxSANF0LDpmyHauMjFYzaACvn+QTT/AZomvPCzVBV7yDN3OmwHQ5OvHaeLKre3JQ==} + dependencies: + is-property: 1.0.2 + dev: false + /get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} @@ -4618,6 +4658,20 @@ packages: ip-regex: 4.3.0 dev: false + /is-my-ip-valid@1.0.1: + resolution: {integrity: sha512-jxc8cBcOWbNK2i2aTkCZP6i7wkHF1bqKFrwEHuN5Jtg5BSaZHUZQ/JTOJwoV41YvHnOaRyWWh72T/KvfNz9DJg==} + dev: false + + /is-my-json-valid@2.20.6: + resolution: {integrity: sha512-1JQwulVNjx8UqkPE/bqDaxtH4PXCe/2VRh/y3p99heOV87HG4Id5/VfDswd+YiAfHcRTfDlWgISycnHuhZq1aw==} + dependencies: + generate-function: 2.3.1 + generate-object-property: 1.2.0 + is-my-ip-valid: 1.0.1 + jsonpointer: 5.0.1 + xtend: 4.0.2 + dev: false + /is-negative-zero@2.0.2: resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} engines: {node: '>= 0.4'} @@ -4644,6 +4698,10 @@ packages: engines: {node: '>=8'} dev: false + /is-property@1.0.2: + resolution: {integrity: sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==} + dev: false + /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} engines: {node: '>= 0.4'} @@ -4731,6 +4789,14 @@ packages: ws: 7.5.9 dev: false + /isomorphic-ws@5.0.0(ws@8.13.0): + resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==} + peerDependencies: + ws: '*' + dependencies: + ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10) + dev: false + /it-all@1.0.6: resolution: {integrity: sha512-3cmCc6Heqe3uWi3CVM/k51fa/XbMFpQVzFoDsV0IZNHSQDyAXl3c4MjHkFX5kF3922OGj7Myv1nSEUgRtcuM1A==} dev: false @@ -4884,6 +4950,11 @@ packages: engines: {'0': node >= 0.2.0} dev: false + /jsonpointer@5.0.1: + resolution: {integrity: sha512-p/nXbhSEcu3pZRdkW1OfJhpsVtW1gd4Wa1fnQc9YLiTfAjn0312eMKimbdIQzuZl9aa9xUGaRlP9T/CJE/ditQ==} + engines: {node: '>=0.10.0'} + dev: false + /jsx-ast-utils@3.3.4: resolution: {integrity: sha512-fX2TVdCViod6HwKEtSWGHs57oFhVfCMwieb9PuRDgjDPh5XeqJiHFFFJCHxU5cnTc3Bu/GRL+kPiFmw8XWOfKw==} engines: {node: '>=4.0'} @@ -6830,6 +6901,256 @@ packages: resolution: {integrity: sha512-n9fZ5/bG1oeDkyxLWyep0eahrNcPDF6bFqoyispt7xkW0xhDzpUBTgyDKqWDi1twT0MgH4HvvqzpUyh0ZxZV4A==} dev: false + /web3-core@4.0.3: + resolution: {integrity: sha512-KJaH1+ajm/gelvhImkXZx8HrBaGZDERqhOCRpikuwReVDTf4X3TlXqF+oKt153qf5HUXWR4CUL6NkNKNQWjhbA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-errors: 1.0.2 + web3-eth-iban: 4.0.3 + web3-providers-http: 4.0.3 + web3-providers-ws: 4.0.3 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + optionalDependencies: + web3-providers-ipc: 4.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-errors@1.0.2: + resolution: {integrity: sha512-LtRUASAQKeCKyxHRhfyU5xiE9asUmo7KJ9bEzzaPlkVYLl5lzhUXzd6lvnQfSaSXJnlzoUXvhI5I0Hpzc8Lohg==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-types: 1.0.2 + dev: false + + /web3-eth-abi@4.0.3: + resolution: {integrity: sha512-is1sKkTna5LQri25iRbxJ43kQ6qlFR/Syi6dnpwsFua0qAyKuDTxLZDoMaBfdH8NvxvjuGWFUWALwuSk8gk5Xg==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + '@ethersproject/abi': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + dev: false + + /web3-eth-accounts@4.0.3: + resolution: {integrity: sha512-qS4r25weJYlKzHPIneL3g33LG+I6QkRCs25ZtooK6elurlZY4HyRE04BIWv12xZswtsvdmMt4HysMUNKgLrgPg==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + '@ethereumjs/rlp': 4.0.1 + crc-32: 1.2.2 + ethereum-cryptography: 2.1.2 + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + dev: false + + /web3-eth-contract@4.0.3: + resolution: {integrity: sha512-x8YsIVVUeONwLCnUmswk5KD3luYxaKuN/xnSzxpb8fE4/KBA6eJswYcIGPrK9QILrVR26yDV/QQpgLU1IJS14g==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-core: 4.0.3 + web3-errors: 1.0.2 + web3-eth: 4.0.3 + web3-eth-abi: 4.0.3 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-eth-ens@4.0.3: + resolution: {integrity: sha512-1tk1WWJB6lsViRFxHR9kt8qgfMV0cySeNBa8H/bZ9/HZ1G8L/c2cboVrG4D0QsPO1im1jQl4Cf3ceKH0PW1KZg==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + '@adraffy/ens-normalize': 1.9.2 + web3-core: 4.0.3 + web3-errors: 1.0.2 + web3-eth: 4.0.3 + web3-eth-contract: 4.0.3 + web3-net: 4.0.3 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-eth-iban@4.0.3: + resolution: {integrity: sha512-9gn6fb034fh3DvQeutuhaG3J9+ZSriPC/O/H7K+lgUWJZh/lpaZy5A06nhHzNcleCWC07Q6J7d7VZlNjaBPtOA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + dev: false + + /web3-eth-personal@4.0.3: + resolution: {integrity: sha512-Gugz45w/D4wlUNbUth8iHWkv0c5fFZGWZqFvpACJul0z9h0Ou8HzuJMUv3U0xFOQJF5fniVegfp6l0FJQ3hGrQ==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-core: 4.0.3 + web3-eth: 4.0.3 + web3-rpc-methods: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-eth@4.0.3: + resolution: {integrity: sha512-4t1+lpqzk3ljubr0CKE9Ila82p2Pim6Bn7ZIruVfMt9AOA5wL6M0OeMTy0fWBODLJiZJ7R77Ugm0kvEVWD3lqg==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + setimmediate: 1.0.5 + web3-core: 4.0.3 + web3-errors: 1.0.2 + web3-eth-abi: 4.0.3 + web3-eth-accounts: 4.0.3 + web3-net: 4.0.3 + web3-providers-ws: 4.0.3 + web3-rpc-methods: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-net@4.0.3: + resolution: {integrity: sha512-qe+stvVgYhO8AiPgDykZW5gS4mZ3GRWdQ8xn3eTvderresIMvdZYSAoUla2jWl1CgpcqzaoOSO9Pf8t43fr8SA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-core: 4.0.3 + web3-rpc-methods: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-providers-http@4.0.3: + resolution: {integrity: sha512-5E6nKjWrwlJdhGImOxyTnFDT6UcZu4waO6AJrENBRh2vdoCfP/Piiv3PLywHs71gwTMsAjy6CNPL5lZdGf+JQA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + cross-fetch: 3.1.8 + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + transitivePeerDependencies: + - encoding + dev: false + + /web3-providers-ipc@4.0.3: + resolution: {integrity: sha512-v+Ugp5XXUVcAQju/u4ThdjI3FM9lq674F6cJ7yz3R6uTel+wNPDiT47Se8hvm5grgHid7z3MbVYCQpDCiiAFHw==} + engines: {node: '>=14', npm: '>=6.12.0'} + requiresBuild: true + dependencies: + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + dev: false + optional: true + + /web3-providers-ws@4.0.3: + resolution: {integrity: sha512-V2bYiMvhv+xBYxFdf8V1zGTwhJoAkBQNMECVGNjQIz1qBKuqu6hXHasmkYSJV780LD6qoL58KlfTggjf4SUSaA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + '@types/ws': 8.5.5 + isomorphic-ws: 5.0.0(ws@8.13.0) + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10) + transitivePeerDependencies: + - bufferutil + - utf-8-validate + dev: false + + /web3-rpc-methods@1.0.2: + resolution: {integrity: sha512-VhLHvgR62JUNgo0op8hP4LcRkvdF0WaHD9xhcEKGLcri9VfYvR1yTZ3CVh6NTgRCmfDePObbp5blHfbla1cC5Q==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + web3-core: 4.0.3 + web3-types: 1.0.2 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + + /web3-types@1.0.2: + resolution: {integrity: sha512-tLzA9vevGGWdHlxXvPRJjEIIR0UnZBI5Kq9qiENRS/vSekTHAHp7u+WGDxt+6kP105gKlbep50TogQIvJqLfnA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dev: false + + /web3-utils@4.0.3: + resolution: {integrity: sha512-clBvm/vWR2mAc9nPnsPYBZMikIhVG9RAsXdrxvXI4e2jAQ3DTtHKMhqy+Cl214dQaAdAEYyVb5ILW5lKKqk2vA==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + ethereum-cryptography: 2.1.2 + web3-errors: 1.0.2 + web3-types: 1.0.2 + web3-validator: 1.0.2 + dev: false + + /web3-validator@1.0.2: + resolution: {integrity: sha512-orx1CQAEnwJUnl/8iF2II2zSA4wiooNJvFmVE0Dbmt/kE370SugIDViQP76snhxtouG2AXzz4GyKbPCMlLGh/A==} + engines: {node: '>=14', npm: '>=6.12.0'} + dependencies: + ethereum-cryptography: 2.1.2 + is-my-json-valid: 2.20.6 + util: 0.12.5 + web3-errors: 1.0.2 + web3-types: 1.0.2 + dev: false + + /web3@4.0.3: + resolution: {integrity: sha512-rUMxui5f52yPWjiMRQV6xqIrTQSovYM2CNhl57y+xj/fGXNLbI1D5FsLPnUMZjMaFHJBTteaBxq/sTEaw/1jNA==} + engines: {node: '>=14.0.0', npm: '>=6.12.0'} + dependencies: + web3-core: 4.0.3 + web3-errors: 1.0.2 + web3-eth: 4.0.3 + web3-eth-abi: 4.0.3 + web3-eth-accounts: 4.0.3 + web3-eth-contract: 4.0.3 + web3-eth-ens: 4.0.3 + web3-eth-iban: 4.0.3 + web3-eth-personal: 4.0.3 + web3-net: 4.0.3 + web3-providers-http: 4.0.3 + web3-providers-ws: 4.0.3 + web3-rpc-methods: 1.0.2 + web3-types: 1.0.2 + web3-utils: 4.0.3 + web3-validator: 1.0.2 + transitivePeerDependencies: + - bufferutil + - encoding + - utf-8-validate + dev: false + /webidl-conversions@3.0.1: resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==} dev: false diff --git a/src/app/page.js b/src/app/page.js index ecf238c..913ae81 100644 --- a/src/app/page.js +++ b/src/app/page.js @@ -20,6 +20,7 @@ export default function Home() { setAuthSig(null); setError(null); try { + console.log("LOG " + (useSigner.data)) const newAuthSig = await ethConnect.signAndSaveAuthMessage({ web3: signer.provider, account: address.toLowerCase(), @@ -144,7 +145,6 @@ export default function Home() { - ) } diff --git a/svelte/package.json b/svelte/package.json index 9b8021f..76b2e2a 100644 --- a/svelte/package.json +++ b/svelte/package.json @@ -37,11 +37,11 @@ }, "type": "module", "dependencies": { + "@lit-protocol/constants": "^2.2.41", "@lit-protocol/lit-node-client": "^2.2.41", "@lit-protocol/pkp-ethers": "^2.2.41", "@lit-protocol/types": "^2.2.41", "@wagmi/core": "^1.3.8", - "svelte-wagmi": "^0.3.4", "viem": "^1.3.0" } } \ No newline at end of file diff --git a/svelte/pnpm-lock.yaml b/svelte/pnpm-lock.yaml index 0dfa524..74f0b49 100644 --- a/svelte/pnpm-lock.yaml +++ b/svelte/pnpm-lock.yaml @@ -1,6 +1,9 @@ lockfileVersion: '6.0' dependencies: + '@lit-protocol/constants': + specifier: ^2.2.41 + version: 2.2.41 '@lit-protocol/lit-node-client': specifier: ^2.2.41 version: 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)(react@18.2.0) @@ -13,9 +16,6 @@ dependencies: '@wagmi/core': specifier: ^1.3.8 version: 1.3.8(react@18.2.0)(typescript@5.1.6)(viem@1.3.0) - svelte-wagmi: - specifier: ^0.3.4 - version: 0.3.4(@wagmi/core@1.3.8)(react@18.2.0)(svelte@4.0.5)(viem@1.3.0) viem: specifier: ^1.3.0 version: 1.3.0(typescript@5.1.6) @@ -101,6 +101,7 @@ packages: dependencies: '@jridgewell/gen-mapping': 0.3.3 '@jridgewell/trace-mapping': 0.3.18 + dev: true /@assemblyscript/loader@0.9.4: resolution: {integrity: sha512-HazVq9zwTVwGmqdwYzu7WyQ6FQVZ7SwET0KKQuKm55jD0IfUpZgN0OPIiZG3zV1iSrVYcN0bdwLRXI/VNCYsUA==} @@ -897,26 +898,32 @@ packages: '@jridgewell/set-array': 1.1.2 '@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/trace-mapping': 0.3.18 + dev: true /@jridgewell/resolve-uri@3.1.0: resolution: {integrity: sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==} engines: {node: '>=6.0.0'} + dev: true /@jridgewell/set-array@1.1.2: resolution: {integrity: sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==} engines: {node: '>=6.0.0'} + dev: true /@jridgewell/sourcemap-codec@1.4.14: resolution: {integrity: sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==} + dev: true /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true /@jridgewell/trace-mapping@0.3.18: resolution: {integrity: sha512-w+niJYzMHdd7USdiH2U6869nqhD2nbfZXND5Yp93qIbEmnDNk7PD48o+YchRVpzMU7M6jVCbenTR7PA1FLQ9pA==} dependencies: '@jridgewell/resolve-uri': 3.1.0 '@jridgewell/sourcemap-codec': 1.4.14 + dev: true /@json-rpc-tools/provider@1.7.6: resolution: {integrity: sha512-z7D3xvJ33UfCGv77n40lbzOYjZKVM3k2+5cV7xS8G6SCvKTzMkhkUYuD/qzQUNT4cG/lv0e9mRToweEEVLVVmA==} @@ -1651,7 +1658,7 @@ packages: resolution: {integrity: sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==} dependencies: '@noble/curves': 1.0.0 - '@noble/hashes': 1.3.0 + '@noble/hashes': 1.3.1 '@scure/base': 1.1.1 dev: false @@ -1673,7 +1680,7 @@ packages: /@scure/bip39@1.2.0: resolution: {integrity: sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==} dependencies: - '@noble/hashes': 1.3.0 + '@noble/hashes': 1.3.1 '@scure/base': 1.1.1 dev: false @@ -1951,6 +1958,7 @@ packages: /@types/estree@1.0.1: resolution: {integrity: sha512-LG4opVs2ANWZ1TJoKc937iMmNstM/d0ae1vNbnBvBhqCSezgVUOzcLCqbI5elV8Vy6WKwKjaqR+zO9VKirBBCA==} + dev: true /@types/json-schema@7.0.12: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} @@ -2785,33 +2793,6 @@ packages: - react dev: false - /@web3modal/core@2.7.0(react@18.2.0): - resolution: {integrity: sha512-8P4gNHrUjLBelLiAGCrfxYv4Cgg2+1WBSbdi7yT/8KJzI8t8U2A1eQYz049I2FV6GxJVMXWV1Uy0OAH4zH5XKg==} - dependencies: - valtio: 1.10.7(react@18.2.0) - transitivePeerDependencies: - - react - dev: false - - /@web3modal/ethereum@2.7.0(@wagmi/core@1.3.8)(viem@1.3.0): - resolution: {integrity: sha512-JudpjRjpt5ZGIxmdzG2abi4SDkQqu0HFXa7CtQ2KYjTrXRB4GI+5WDxsjCtl4G8K84Tx23G4YPr0CiX+LdL8gQ==} - peerDependencies: - '@wagmi/core': '>=1' - viem: '>=1' - dependencies: - '@wagmi/core': 1.3.8(react@18.2.0)(typescript@5.1.6)(viem@1.3.0) - viem: 1.3.0(typescript@5.1.6) - dev: false - - /@web3modal/html@2.7.0(react@18.2.0): - resolution: {integrity: sha512-/tPW4suHHVXDHN/SC4o13hqr+2777ay8o6DZEfaEXeD0Aerc+Y7xo/2vandZc8pAf9v7iD9ShXR+ZjJ8VBNK8w==} - dependencies: - '@web3modal/core': 2.7.0(react@18.2.0) - '@web3modal/ui': 2.7.0(react@18.2.0) - transitivePeerDependencies: - - react - dev: false - /@web3modal/standalone@2.2.1(react@18.2.0): resolution: {integrity: sha512-pHPL+UykZtOZhEhNl+l3wWnNvZZdm8cgJgVQVo8yL7m4N9kTyRbDArsQenlIeIm2xi0kFncXBJbe1kaxl8AWTA==} deprecated: This package has been deprecated in favor of @walletconnect/modal. Please read more at https://docs.walletconnect.com @@ -2854,17 +2835,6 @@ packages: - react dev: false - /@web3modal/ui@2.7.0(react@18.2.0): - resolution: {integrity: sha512-Cn0Ddidcl9vJpV7WQP5chcH91+wtLhf9gy10gsN+CzDz97a6B1JoEZZ3ZuT4NqCrS/fC06pC0E2DvAiG446dRA==} - dependencies: - '@web3modal/core': 2.7.0(react@18.2.0) - lit: 2.7.6 - motion: 10.16.2 - qrcode: 1.5.3 - transitivePeerDependencies: - - react - dev: false - /JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} hasBin: true @@ -2914,6 +2884,7 @@ packages: resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==} engines: {node: '>=0.4.0'} hasBin: true + dev: true /aes-js@3.0.0: resolution: {integrity: sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==} @@ -2990,6 +2961,7 @@ packages: resolution: {integrity: sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==} dependencies: dequal: 2.0.3 + dev: true /array-union@2.1.0: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} @@ -3044,6 +3016,7 @@ packages: resolution: {integrity: sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==} dependencies: dequal: 2.0.3 + dev: true /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} @@ -3294,6 +3267,7 @@ packages: acorn: 8.10.0 estree-walker: 3.0.3 periscopic: 3.1.0 + dev: true /color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} @@ -3361,6 +3335,7 @@ packages: dependencies: mdn-data: 2.0.30 source-map-js: 1.0.2 + dev: true /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} @@ -3433,6 +3408,7 @@ packages: /dequal@2.0.3: resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==} engines: {node: '>=6'} + dev: true /detect-browser@5.3.0: resolution: {integrity: sha512-53rsFbGdwMwlF7qvCt0ypLM5V5/Mbl0szB7GPN8y9NCcbknYOeVVXdrXEq+90IwAfrrzt6Hd+u2E2ntakICU8w==} @@ -3755,6 +3731,7 @@ packages: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} dependencies: '@types/estree': 1.0.1 + dev: true /esutils@2.0.3: resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} @@ -4470,6 +4447,7 @@ packages: resolution: {integrity: sha512-baJJdQLiYaJdvFbJqXrcGv3WU3QCzBlUcI5QhbesIm6/xPsvmO+2CDoi/GMOFBQEQm+PXkwOPrp9KK5ozZsp2w==} dependencies: '@types/estree': 1.0.1 + dev: true /is-typed-array@1.1.12: resolution: {integrity: sha512-Z14TF2JNG8Lss5/HMqt0//T9JeHXttXy5pH/DBU4vi98ozO2btxzq9MwYDZYnKwU8nRsz/+GVFVRDq3DkVuSPg==} @@ -4779,14 +4757,6 @@ packages: lit-html: 2.7.5 dev: false - /lit@2.7.6: - resolution: {integrity: sha512-1amFHA7t4VaaDe+vdQejSVBklwtH9svGoG6/dZi9JhxtJBBlqY5D1RV7iLUYY0trCqQc4NfhYYZilZiVHt7Hxg==} - dependencies: - '@lit/reactive-element': 1.6.2 - lit-element: 3.3.2 - lit-html: 2.7.5 - dev: false - /local-pkg@0.4.3: resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} engines: {node: '>=14'} @@ -4794,6 +4764,7 @@ packages: /locate-character@3.0.0: resolution: {integrity: sha512-SW13ws7BjaeJ6p7Q6CO2nchbYEc3X3J6WrmTTDto7yMPqVSZTUyY5Tjbid+Ab8gLnATtygYtiDIJGQRRn2ZOiA==} + dev: true /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} @@ -4856,9 +4827,11 @@ packages: engines: {node: '>=12'} dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + dev: true /mdn-data@2.0.30: resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} + dev: true /merge-options@3.0.4: resolution: {integrity: sha512-2Sug1+knBjkaMsMgf1ctR1Ujx+Ayku4EdJN4Z+C2+JzoeF7A3OZ9KM2GY0CpQS51NR61LTurMJrRKPhSs3ZRTQ==} @@ -5227,6 +5200,7 @@ packages: '@types/estree': 1.0.1 estree-walker: 3.0.3 is-reference: 3.0.1 + dev: true /picocolors@1.0.0: resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} @@ -5897,6 +5871,7 @@ packages: /source-map-js@1.0.2: resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} engines: {node: '>=0.10.0'} + dev: true /sparse-array@1.3.2: resolution: {integrity: sha512-ZT711fePGn3+kQyLuv1fpd3rNSkNF8vd5Kv2D+qnOANeyKs3fx6bUMGWRPvgTTcYV64QMqZKZwcuaQSP3AZ0tg==} @@ -6135,22 +6110,6 @@ packages: typescript: 5.1.6 dev: true - /svelte-wagmi@0.3.4(@wagmi/core@1.3.8)(react@18.2.0)(svelte@4.0.5)(viem@1.3.0): - resolution: {integrity: sha512-e7bTOpAZvDbxCY412NgWmPS5jwnAajrS6yZhXVRZWfVZQKBT9NacaCMk8uE5ZhmMiiivnwWqbpHPxxQoyjIE0w==} - peerDependencies: - '@wagmi/core': ^1.0.8 - svelte: '>=3 <5' - viem: ^1.1.6 - dependencies: - '@wagmi/core': 1.3.8(react@18.2.0)(typescript@5.1.6)(viem@1.3.0) - '@web3modal/ethereum': 2.7.0(@wagmi/core@1.3.8)(viem@1.3.0) - '@web3modal/html': 2.7.0(react@18.2.0) - svelte: 4.0.5 - viem: 1.3.0(typescript@5.1.6) - transitivePeerDependencies: - - react - dev: false - /svelte@4.0.5: resolution: {integrity: sha512-PHKPWP1wiWHBtsE57nCb8xiWB3Ht7/3Kvi3jac0XIxUM2rep8alO7YoAtgWeGD7++tFy46krilOrPW0mG3Dx+A==} engines: {node: '>=16'} @@ -6168,6 +6127,7 @@ packages: locate-character: 3.0.0 magic-string: 0.30.1 periscopic: 3.1.0 + dev: true /symbol-observable@2.0.3: resolution: {integrity: sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==} @@ -6462,20 +6422,6 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - /valtio@1.10.7(react@18.2.0): - resolution: {integrity: sha512-XUwXJ9twXqwfVhXlcbYlCcRUUSOmp8RcJODVAxPrUZc2jh3com13B49MOL/cbgcTOX+5yf7wdMqbFGR7ba2sPg==} - engines: {node: '>=12.20.0'} - peerDependencies: - react: '>=16.8' - peerDependenciesMeta: - react: - optional: true - dependencies: - proxy-compare: 2.5.1 - react: 18.2.0 - use-sync-external-store: 1.2.0(react@18.2.0) - dev: false - /varint@6.0.0: resolution: {integrity: sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==} dev: false diff --git a/svelte/src/lib/AuthSig.svelte b/svelte/src/lib/AuthSig.svelte new file mode 100644 index 0000000..a1f3ddd --- /dev/null +++ b/svelte/src/lib/AuthSig.svelte @@ -0,0 +1,56 @@ + + + +{#if authSig} +
+

+ AuthSig Address: {authSig.address} +

+
+ +{:else if error} +
+

{error}

+
+ +{:else} +
+ +
+{/if} diff --git a/svelte/src/lib/LitStatus.svelte b/svelte/src/lib/LitStatus.svelte index 846fd87..c57eaa4 100644 --- a/svelte/src/lib/LitStatus.svelte +++ b/svelte/src/lib/LitStatus.svelte @@ -27,8 +27,14 @@ }); -{#if isNetworkLoading} -

Loading...

-{:else} -

Network Status: {networkStatus}

-{/if} +
+ {#if isNetworkLoading} +

+ LIT Network Status: Loading ... +

+ {:else} +

+ LIT Network Status: {networkStatus} +

+ {/if} +
diff --git a/svelte/src/lib/connect.svelte b/svelte/src/lib/connect.svelte deleted file mode 100644 index ff9cecc..0000000 --- a/svelte/src/lib/connect.svelte +++ /dev/null @@ -1,31 +0,0 @@ - - -{#if $connected} -
-

Connected to Ethereum

-

Chain ID: {$chainId}

-

Signer address: {$signerAddress}

-

Balance: {userBalance} ETH

-
-{:else if $web3Modal} - -{:else} -

Web3Modal not yet available

-{/if} diff --git a/svelte/src/lib/provider.svelte b/svelte/src/lib/provider.svelte deleted file mode 100644 index 8c2d35a..0000000 --- a/svelte/src/lib/provider.svelte +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/svelte/src/lib/send.svelte b/svelte/src/lib/send.svelte index 2eef6eb..1791ad3 100644 --- a/svelte/src/lib/send.svelte +++ b/svelte/src/lib/send.svelte @@ -2,47 +2,66 @@ import { onMount } from 'svelte'; import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; - - // Access the environment variable - const authSig = JSON.parse(import.meta.env.VITE_AUTH_SIG); + import { LOCAL_STORAGE_KEYS } from '@lit-protocol/constants'; let pkpWallet; + let authSig = null; // Load wallet on component mount onMount(async () => { - pkpWallet = new PKPEthersWallet({ - controllerAuthSig: authSig, - pkpPubKey: - '046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571', - rpc: 'https://rpc.gnosischain.com/' - }); + const storedAuthSig = localStorage.getItem(LOCAL_STORAGE_KEYS.AUTH_SIGNATURE); - await pkpWallet.init(); - console.log(pkpWallet); + if (storedAuthSig) { + authSig = JSON.parse(storedAuthSig); + pkpWallet = new PKPEthersWallet({ + controllerAuthSig: authSig, + pkpPubKey: + '046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571', + rpc: 'https://rpc.gnosischain.com/' + }); + await pkpWallet.init(); + console.log(pkpWallet); + } else { + alert('no authsig'); + } }); const sendTransaction = async () => { - console.log('transaction initiated'); - const from = '0x06B6BE47c86cfcDF3f77c0e17e7aD8af750782aE'; - const to = '0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A'; - const value = BigInt(1000000000000000); + if (!authSig) { + alert('no authsig'); + } else { + console.log('transaction initiated'); + const from = pkpWallet.address; + const to = '0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A'; + const value = BigInt(10000000000000000); + const gasLimit = 21000; - // @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const transactionRequest = { - from, - to, - value - }; - console.log('transaction request created'); + // @lit-protocol/pkp-ethers will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const transactionRequest = { + from, + to, + value, + gasLimit + }; + console.log('transaction request created'); - const signedTransactionRequest = await pkpWallet.signTransaction(transactionRequest); - await pkpWallet.sendTransaction(signedTransactionRequest); + const signedTransactionRequest = await pkpWallet.signTransaction(transactionRequest); + await pkpWallet.sendTransaction(signedTransactionRequest); + console.log('transaction sent'); + } }; -
-

Sending transaction...

-
diff --git a/svelte/src/routes/+layout.svelte b/svelte/src/routes/+layout.svelte index e5dad5a..2e511e0 100644 --- a/svelte/src/routes/+layout.svelte +++ b/svelte/src/routes/+layout.svelte @@ -1,7 +1,5 @@ - diff --git a/svelte/src/routes/+page.svelte b/svelte/src/routes/+page.svelte index 1b298ba..222469a 100644 --- a/svelte/src/routes/+page.svelte +++ b/svelte/src/routes/+page.svelte @@ -1,5 +1,9 @@ + +