Added basic PKP wallet connect sign in POC

This commit is contained in:
Samuel Andert 2023-07-20 18:43:41 +02:00
parent 07a61a4d3a
commit eb647b7aad
6 changed files with 485 additions and 4 deletions

View File

@ -39,7 +39,9 @@
"dependencies": {
"@lit-protocol/constants": "^2.2.41",
"@lit-protocol/lit-node-client": "^2.2.41",
"@lit-protocol/pkp-client": "^2.2.41",
"@lit-protocol/pkp-ethers": "^2.2.41",
"@lit-protocol/pkp-walletconnect": "^2.2.41",
"@lit-protocol/types": "^2.2.41",
"@wagmi/core": "^1.3.8",
"viem": "^1.3.0"

View File

@ -7,9 +7,15 @@ dependencies:
'@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)
'@lit-protocol/pkp-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)
'@lit-protocol/pkp-ethers':
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/pkp-walletconnect':
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/types':
specifier: ^2.2.41
version: 2.2.41
@ -1318,6 +1324,119 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/pkp-client@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):
resolution: {integrity: sha512-wO+GGJeBdrE5R+2dWsTOVhVi2wYgTgtoiLuLZpypzNv6bQ0nhWl7usTFsfAxqeoIV1aAK0S7bWbdiSo2IP46Zg==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.41
'@lit-protocol/auth-browser': 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/auth-helpers': 2.2.41(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.41
'@lit-protocol/constants': 2.2.41
'@lit-protocol/core': 2.2.41
'@lit-protocol/crypto': 2.2.41
'@lit-protocol/ecdsa-sdk': 2.2.41
'@lit-protocol/encryption': 2.2.41(node-fetch@2.6.12)
'@lit-protocol/lit-node-client': 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/lit-node-client-nodejs': 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
'@lit-protocol/lit-third-party-libs': 2.2.41
'@lit-protocol/misc': 2.2.41
'@lit-protocol/misc-browser': 2.2.41
'@lit-protocol/nacl': 2.2.41
'@lit-protocol/pkp-base': 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/pkp-cosmos': 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/pkp-ethers': 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/types': 2.2.41
'@lit-protocol/uint8arrays': 2.2.41
'@metamask/eth-sig-util': 5.0.2
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.4.3)
'@web3modal/standalone': 2.4.3(react@18.2.0)
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
node-fetch: 2.6.12
secp256k1: 5.0.0
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
uint8arrays: 4.0.4
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/pkp-cosmos@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):
resolution: {integrity: sha512-5u2tK6JV/Ey59VLGbPrqnMgLZkZcgMx2Bwlns89EUhpCgZ0wAVaNhMMqw2ixRh3bty32tuR3tPJy57qquOGb0Q==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.41
'@lit-protocol/auth-browser': 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/auth-helpers': 2.2.41(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.41
'@lit-protocol/constants': 2.2.41
'@lit-protocol/core': 2.2.41
'@lit-protocol/crypto': 2.2.41
'@lit-protocol/ecdsa-sdk': 2.2.41
'@lit-protocol/encryption': 2.2.41(node-fetch@2.6.12)
'@lit-protocol/lit-node-client': 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/lit-node-client-nodejs': 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
'@lit-protocol/lit-third-party-libs': 2.2.41
'@lit-protocol/misc': 2.2.41
'@lit-protocol/misc-browser': 2.2.41
'@lit-protocol/nacl': 2.2.41
'@lit-protocol/pkp-base': 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/types': 2.2.41
'@lit-protocol/uint8arrays': 2.2.41
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.4.3)
'@web3modal/standalone': 2.4.3(react@18.2.0)
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
node-fetch: 2.6.12
secp256k1: 5.0.0
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
uint8arrays: 4.0.4
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/pkp-ethers@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):
resolution: {integrity: sha512-UrOkoNpPNYNS8dQVZVYo5GSVEff0xG+N+YYeIhhTRLITscC0P+x7XtbYV7NHRDZYLdMVLNr4+ZC3MnX64eCHlw==}
dependencies:
@ -1374,6 +1493,69 @@ packages:
- utf-8-validate
dev: false
/@lit-protocol/pkp-walletconnect@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):
resolution: {integrity: sha512-IVEc3PblRaYrLrvSM+pGgkn+MaTbxj5DApYqLhzwwFQ7xjqyvdL/v1P6TOfgvwUYvRYHjewjASYzYUYeGrYsxA==}
dependencies:
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@lit-protocol/access-control-conditions': 2.2.41
'@lit-protocol/auth-browser': 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/auth-helpers': 2.2.41(ethers@5.7.2)
'@lit-protocol/bls-sdk': 2.2.41
'@lit-protocol/constants': 2.2.41
'@lit-protocol/core': 2.2.41
'@lit-protocol/crypto': 2.2.41
'@lit-protocol/ecdsa-sdk': 2.2.41
'@lit-protocol/encryption': 2.2.41(node-fetch@2.6.12)
'@lit-protocol/lit-node-client': 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/lit-node-client-nodejs': 2.2.41(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
'@lit-protocol/lit-third-party-libs': 2.2.41
'@lit-protocol/misc': 2.2.41
'@lit-protocol/misc-browser': 2.2.41
'@lit-protocol/nacl': 2.2.41
'@lit-protocol/pkp-base': 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/pkp-client': 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/pkp-cosmos': 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/pkp-ethers': 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/types': 2.2.41
'@lit-protocol/uint8arrays': 2.2.41
'@metamask/eth-sig-util': 5.0.2
'@walletconnect/core': 2.7.5
'@walletconnect/ethereum-provider': 2.7.0(@web3modal/standalone@2.4.3)
'@walletconnect/types': 2.7.5
'@walletconnect/utils': 2.7.5
'@walletconnect/web3wallet': 1.7.3
'@web3modal/standalone': 2.4.3(react@18.2.0)
blockstore-core: 3.0.0
ethers: 5.7.2
ipfs-http-client: 56.0.0(node-fetch@2.6.12)
ipfs-unixfs-importer: 12.0.1
jszip: 3.10.1
lit-connect-modal-to-be-deprecated: 0.0.1
lit-siwe: 1.1.8(@ethersproject/contracts@5.7.0)(@ethersproject/hash@5.7.0)(@ethersproject/providers@5.7.2)(@ethersproject/wallet@5.7.0)
node-fetch: 2.6.12
secp256k1: 5.0.0
siwe: 2.1.4(ethers@5.7.2)
siwe-recap: 0.0.2-alpha.0(ethers@5.7.2)
tslib: 2.6.0
tweetnacl: 1.0.3
tweetnacl-util: 0.15.1
uint8arrays: 4.0.4
transitivePeerDependencies:
- '@ethersproject/contracts'
- '@ethersproject/hash'
- '@ethersproject/providers'
- '@ethersproject/wallet'
- '@react-native-async-storage/async-storage'
- bufferutil
- debug
- encoding
- lokijs
- react
- supports-color
- utf-8-validate
dev: false
/@lit-protocol/types@2.2.41:
resolution: {integrity: sha512-2pz7klTgnllNXRC4pji7FCG+qmYNvH2ohDLpJgLJPKR7Dwad12CjTJxjCjNoIiH1DNh5dcKRMTEIrIHb4yrjpg==}
dependencies:
@ -2244,6 +2426,31 @@ packages:
- zod
dev: false
/@walletconnect/auth-client@2.1.0:
resolution: {integrity: sha512-k6zZLEdlBpYIvbOL5tBWd+3DUJ2R4VFDyHpdp4TuRzC//njRkIzRSksEnsr8gN8P+IKuoJTLPsDy2sWR4qVTNQ==}
engines: {node: '>=16'}
dependencies:
'@ethersproject/hash': 5.7.0
'@ethersproject/transactions': 5.7.0
'@stablelib/random': 1.0.2
'@stablelib/sha256': 1.0.1
'@walletconnect/core': 2.9.0
'@walletconnect/events': 1.0.1
'@walletconnect/heartbeat': 1.2.1
'@walletconnect/jsonrpc-utils': 1.0.8
'@walletconnect/logger': 2.0.1
'@walletconnect/time': 1.0.2
'@walletconnect/utils': 2.9.0
events: 3.3.0
isomorphic-unfetch: 3.1.0
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- bufferutil
- encoding
- lokijs
- utf-8-validate
dev: false
/@walletconnect/core@2.7.0:
resolution: {integrity: sha512-xUeFPpElybgn1a+lknqtHleei4VyuV/4qWgB1nP8qQUAO6a5pNsioODrnB2VAPdUHJYBdx2dCt2maRk6g53IPQ==}
dependencies:
@ -2269,6 +2476,31 @@ packages:
- utf-8-validate
dev: false
/@walletconnect/core@2.7.5:
resolution: {integrity: sha512-nI5RTGZAOcheCcrVUWHLO4iEnyDrDa8HnuNRm9jbYf7ESLdmunShQ+jStnb0pmjEJ8uI/oIEahQwzTN8iLIjpA==}
dependencies:
'@walletconnect/heartbeat': 1.2.1
'@walletconnect/jsonrpc-provider': 1.0.13
'@walletconnect/jsonrpc-utils': 1.0.8
'@walletconnect/jsonrpc-ws-connection': 1.0.12
'@walletconnect/keyvaluestorage': 1.0.2
'@walletconnect/logger': 2.0.1
'@walletconnect/relay-api': 1.0.9
'@walletconnect/relay-auth': 1.0.4
'@walletconnect/safe-json': 1.0.2
'@walletconnect/time': 1.0.2
'@walletconnect/types': 2.7.5
'@walletconnect/utils': 2.7.5
events: 3.3.0
lodash.isequal: 4.5.0
uint8arrays: 3.1.1
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- bufferutil
- lokijs
- utf-8-validate
dev: false
/@walletconnect/core@2.9.0:
resolution: {integrity: sha512-MZYJghS9YCvGe32UOgDj0mCasaOoGHQaYXWeQblXE/xb8HuaM6kAWhjIQN9P+MNp5QP134BHP5olQostcCotXQ==}
dependencies:
@ -2426,6 +2658,14 @@ packages:
- encoding
dev: false
/@walletconnect/jsonrpc-provider@1.0.12:
resolution: {integrity: sha512-6uI2y5281gloZSzICOjk+CVC7CVu0MhtMt2Yzpj05lPb0pzm/bK2oZ2ibxwLerPrqpNt/5bIFVRmoOgPw1mHAQ==}
dependencies:
'@walletconnect/jsonrpc-utils': 1.0.8
'@walletconnect/safe-json': 1.0.2
tslib: 1.14.1
dev: false
/@walletconnect/jsonrpc-provider@1.0.13:
resolution: {integrity: sha512-K73EpThqHnSR26gOyNEL+acEex3P7VWZe6KE12ZwKzAt2H4e5gldZHbjsu2QR9cLeJ8AXuO7kEMOIcRv1QEc7g==}
dependencies:
@ -2441,6 +2681,14 @@ packages:
tslib: 1.14.1
dev: false
/@walletconnect/jsonrpc-utils@1.0.7:
resolution: {integrity: sha512-zJziApzUF/Il4VcwabnaU+0yo1QI4eUkYX99zmCVTHJvZOf2l0zjADf/OpKqWyeNFC3Io56Z/8uJHVtcNVvyFA==}
dependencies:
'@walletconnect/environment': 1.0.1
'@walletconnect/jsonrpc-types': 1.0.3
tslib: 1.14.1
dev: false
/@walletconnect/jsonrpc-utils@1.0.8:
resolution: {integrity: sha512-vdeb03bD8VzJUL6ZtzRYsFMq1eZQcM3EAzT0a3st59dyLfJ0wq+tKMpmGH7HlB7waD858UWgfIcudbPFsbzVdw==}
dependencies:
@ -2622,6 +2870,25 @@ packages:
- utf-8-validate
dev: false
/@walletconnect/sign-client@2.7.5:
resolution: {integrity: sha512-99oc0g4eR4hllrB0m4N74EsnNKDrl0L5HdLDGBHQIYnl+/FUjn652QCTOjPzqiUlxvQCo0wrIugb/tgtIGPTfg==}
dependencies:
'@walletconnect/core': 2.7.5
'@walletconnect/events': 1.0.1
'@walletconnect/heartbeat': 1.2.1
'@walletconnect/jsonrpc-utils': 1.0.8
'@walletconnect/logger': 2.0.1
'@walletconnect/time': 1.0.2
'@walletconnect/types': 2.7.5
'@walletconnect/utils': 2.7.5
events: 3.3.0
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- bufferutil
- lokijs
- utf-8-validate
dev: false
/@walletconnect/sign-client@2.9.0:
resolution: {integrity: sha512-mEKc4LlLMebCe45qzqh+MX4ilQK4kOEBzLY6YJpG8EhyT45eX4JMNA7qQoYa9MRMaaVb/7USJcc4e3ZrjZvQmA==}
dependencies:
@ -2661,6 +2928,20 @@ packages:
- lokijs
dev: false
/@walletconnect/types@2.7.5:
resolution: {integrity: sha512-uEsMXtVbhT5+E/g3loyfNBrjEsPeUaPZkFeVsOErWhxg25CL+MrrWUKerV6tC/ACbFVR5KgKS+uioMath/cV7A==}
dependencies:
'@walletconnect/events': 1.0.1
'@walletconnect/heartbeat': 1.2.1
'@walletconnect/jsonrpc-types': 1.0.3
'@walletconnect/keyvaluestorage': 1.0.2
'@walletconnect/logger': 2.0.1
events: 3.3.0
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- lokijs
dev: false
/@walletconnect/types@2.9.0:
resolution: {integrity: sha512-ORopsMfSRvUYqtjKKd6scfg8o4/aGebipLxx92AuuUgMTERSU6cGmIrK6rdLu7W6FBJkmngPLEGc9mRqAb9Lug==}
dependencies:
@ -2740,6 +3021,29 @@ packages:
- lokijs
dev: false
/@walletconnect/utils@2.7.5:
resolution: {integrity: sha512-uSf71P3kFMC+S4RidQYFIWXglVvYTCLK7AaO9PrUDLO9ocRnBk6hNmOhYSA5jSP6OLf1vYm4ADHbzkeOb4u6aQ==}
dependencies:
'@stablelib/chacha20poly1305': 1.0.1
'@stablelib/hkdf': 1.0.1
'@stablelib/random': 1.0.2
'@stablelib/sha256': 1.0.1
'@stablelib/x25519': 1.0.3
'@walletconnect/jsonrpc-utils': 1.0.8
'@walletconnect/relay-api': 1.0.9
'@walletconnect/safe-json': 1.0.2
'@walletconnect/time': 1.0.2
'@walletconnect/types': 2.7.5
'@walletconnect/window-getters': 1.0.1
'@walletconnect/window-metadata': 1.0.1
detect-browser: 5.3.0
query-string: 7.1.3
uint8arrays: 3.1.1
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- lokijs
dev: false
/@walletconnect/utils@2.9.0:
resolution: {integrity: sha512-7Tu3m6dZL84KofrNBcblsgpSqU2vdo9ImLD7zWimLXERVGNQ8smXG+gmhQYblebIBhsPzjy9N38YMC3nPlfQNw==}
dependencies:
@ -2762,6 +3066,25 @@ packages:
- lokijs
dev: false
/@walletconnect/web3wallet@1.7.3:
resolution: {integrity: sha512-rXvpdG3SrYh7vp/oqC+LM7IXHMz/RGzyybHEomqgO1hIUgkCHL3+DupIaJlI9iAMZyRLYDkLzp5RuYxk7nRzYA==}
dependencies:
'@walletconnect/auth-client': 2.1.0
'@walletconnect/core': 2.7.5
'@walletconnect/jsonrpc-provider': 1.0.12
'@walletconnect/jsonrpc-utils': 1.0.7
'@walletconnect/logger': 2.0.1
'@walletconnect/sign-client': 2.7.5
'@walletconnect/types': 2.7.5
'@walletconnect/utils': 2.7.5
transitivePeerDependencies:
- '@react-native-async-storage/async-storage'
- bufferutil
- encoding
- lokijs
- utf-8-validate
dev: false
/@walletconnect/window-getters@1.0.1:
resolution: {integrity: sha512-vHp+HqzGxORPAN8gY03qnbTMnhqIwjeRJNOMOAzePRg4xVEEE2WvYsI9G2NMjOknA8hnuYbU3/hwLcKbjhc8+Q==}
dependencies:
@ -4473,6 +4796,15 @@ packages:
engines: {node: '>=12'}
dev: false
/isomorphic-unfetch@3.1.0:
resolution: {integrity: sha512-geDJjpoZ8N0kWexiwkX8F9NkTsXhetLPVbZFQ+JTW239QNOwvB0gniuR1Wc6f0AMTn7/mFGyXvHTifrCp/GH8Q==}
dependencies:
node-fetch: 2.6.12
unfetch: 4.2.0
transitivePeerDependencies:
- encoding
dev: false
/isomorphic-ws@4.0.1(ws@7.5.9):
resolution: {integrity: sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==}
peerDependencies:
@ -6326,6 +6658,10 @@ packages:
busboy: 1.6.0
dev: true
/unfetch@4.2.0:
resolution: {integrity: sha512-F9p7yYCn6cIW9El1zi0HI6vqpeIvBsr3dSuRO6Xuppb1u5rXpCPmMvLSyECLhybr9isec8Ohl0hPekMVrEinDA==}
dev: false
/update-browserslist-db@1.0.11(browserslist@4.21.9):
resolution: {integrity: sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==}
hasBin: true

View File

@ -1,6 +1,4 @@
<script>
import { waitForTransaction } from '@wagmi/core';
export let pkpWallet;
const sendTransaction = async () => {

View File

@ -5,6 +5,8 @@
export let pkpWallet;
export let authSig = null;
const pkpPubKey =
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571';
onMount(async () => {
const storedAuthSig = await localStorage.getItem(LOCAL_STORAGE_KEYS.AUTH_SIGNATURE);
@ -13,8 +15,7 @@
authSig = JSON.parse(storedAuthSig);
pkpWallet = new PKPEthersWallet({
controllerAuthSig: authSig,
pkpPubKey:
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571',
pkpPubKey,
rpc: 'https://rpc.gnosischain.com/'
});
await pkpWallet.init();

View File

@ -0,0 +1,139 @@
<script>
import { onMount } from 'svelte';
import { PKPClient } from '@lit-protocol/pkp-client';
import { PKPWalletConnect } from '@lit-protocol/pkp-walletconnect';
const CONTROLLER_AUTHSIG = {
sig: '0xace8d4a052d437cb834393e6a41c2ff0f2a3c877b0961fad94cca74cb9adb1be192a869b7f41bbeb2b073cef29bf2aa8f0aa8f0796c5b9bf3a4ad6a44b3997b21b',
derivedVia: 'web3.eth.personal.sign',
signedMessage:
'localhost:5173 wants you to sign in with your Ethereum account:\n0x1A5cfC9EA11afb50011F847fb7dC07bA1e18b05A\n\n\nURI: http://localhost:5173/\nVersion: 1\nChain ID: 100\nNonce: s5u4vZcvFgQHN17ns\nIssued At: 2023-07-20T13:30:44.566Z\nExpiration Time: 2023-07-27T13:30:43.591Z',
address: '0x1a5cfc9ea11afb50011f847fb7dc07ba1e18b05a'
};
let uri = '';
const PKP_PUBKEY =
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571';
// Set up PKP client
const pkpClient = new PKPClient({
controllerAuthSig: CONTROLLER_AUTHSIG,
pkpPubKey: PKP_PUBKEY
});
// Set up PKP WalletConnect
const pkpWalletConnect = new PKPWalletConnect();
// Initialize PKPClient
async function initializePKPClient() {
await pkpClient.connect();
pkpWalletConnect.addPKPClient(pkpClient);
}
// Initialize WalletConnect
async function initializeWalletConnect() {
const config = {
projectId: '7db8ca514b865088d90cebec1bf28318',
metadata: {
name: 'Test Wallet',
description: 'Test Wallet',
url: '#',
icons: ['https://walletconnect.com/walletconnect-logo.png']
}
};
await pkpWalletConnect.initWalletConnect(config);
}
// Get initialized SignClient
function getSignClient() {
return pkpWalletConnect.getSignClient();
}
// Event listeners
function onSessionProposal(proposal) {
console.log('Received session proposal: ', proposal);
// Accept session proposal
pkpWalletConnect.approveSessionProposal(proposal).then(() => {
// Print active sessions
const sessions = Object.values(pkpWalletConnect.getActiveSessions());
for (const session of sessions) {
const { name, url } = session.peer.metadata;
console.log(`Active Session: ${name} (${url})`);
}
console.log('\n' + '*'.repeat(50) + '\n');
});
}
function onSessionRequest(requestEvent) {
console.log('Received session request: ', requestEvent);
const { topic, params } = requestEvent;
const { request } = params;
const requestSession = getSignClient().session.get(topic);
const { name, url } = requestSession.peer.metadata;
// Accept session request
console.log(`\nApproving ${request.method} request for session ${name} (${url})...\n`);
pkpWalletConnect.approveSessionRequest(requestEvent).then(() => {
console.log(`Check the ${name} dapp to confirm whether the request was approved`);
console.log('\n' + '*'.repeat(50) + '\n');
});
}
function onSessionDelete(event) {
// React to session delete event
console.log(`Session deleted ${JSON.stringify(event)}`);
console.log('\n' + '*'.repeat(50) + '\n');
}
// Connect to dapp
function connectToDapp(uri) {
// Pair using given URI
console.log(`Received URI: ${uri}`);
pkpWalletConnect.pair({ uri: uri }).then(() => {
// Print number of pairings
console.log(`Number of pairings: ${getSignClient().core.pairing.pairings.values.length}`);
console.log('\n' + '*'.repeat(50) + '\n');
});
}
onMount(async () => {
await initializePKPClient();
await initializeWalletConnect();
// Set up event listeners
pkpWalletConnect.on('session_proposal', onSessionProposal);
pkpWalletConnect.on('session_request', onSessionRequest);
getSignClient().on('session_delete', onSessionDelete);
const uri = ''; // Set the initial URI value here
connectToDapp(uri);
});
function handleConnect() {
connectToDapp(uri);
}
</script>
<main>
<h1>Connect to dapp:</h1>
<input type="text" bind:value={uri} placeholder="Enter the URI" />
<button on:click={handleConnect}>Connect</button>
</main>
<style>
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
input {
padding: 8px;
margin-bottom: 16px;
font-size: 16px;
width: 300px;
}
</style>

View File

@ -4,8 +4,11 @@
import Wallet from '$lib/Wallet.svelte';
import Send from '$lib/Send.svelte';
import Balance from '$lib/Balance.svelte';
import WalletConnect from '$lib/WalletConnect.svelte';
let pkpWallet;
let authSig;
let pkpPubKey =
'046da3ba67065fd1e2726242ca01cd4601524893f4aa4b0042578fa6cbec28fa8c9a28eb9f7893932fc09717edc9e1db57e157a21eed346247c1db5a722a01f571';
</script>
<LitStatus />
@ -15,4 +18,6 @@
<Wallet bind:pkpWallet bind:authSig />
<Send bind:pkpWallet />
<Balance />
<WalletConnect bind:pkpWallet bind:authSig bind:pkpPubKey />
</div>