wallet/beta.102 (#35)

This commit is contained in:
Ilja 2022-07-12 15:02:17 +07:00 committed by GitHub
parent 3ce43b887a
commit be11029dad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 105 additions and 75 deletions

10
node_modules/.yarn-integrity generated vendored Normal file
View File

@ -0,0 +1,10 @@
{
"systemParams": "darwin-arm64-108",
"modulesFolders": [],
"flags": [],
"linkedModules": [],
"topLevelPatterns": [],
"lockfileEntries": {},
"files": [],
"artifacts": {}
}

View File

@ -14,8 +14,8 @@
"@json-rpc-tools/utils": "1.7.6",
"@nextui-org/react": "1.0.8-beta.5",
"@solana/web3.js": "1.43.0",
"@walletconnect/sign-client": "2.0.0-beta.101",
"@walletconnect/utils": "2.0.0-beta.101",
"@walletconnect/sign-client": "2.0.0-beta.102",
"@walletconnect/utils": "2.0.0-beta.102",
"bs58": "5.0.0",
"cosmos-wallet": "1.2.0",
"ethers": "5.6.6",
@ -32,7 +32,7 @@
"devDependencies": {
"@types/node": "17.0.35",
"@types/react": "18.0.9",
"@walletconnect/types": "2.0.0-beta.101",
"@walletconnect/types": "2.0.0-beta.102",
"eslint": "8.15.0",
"eslint-config-next": "12.1.6",
"eslint-config-prettier": "8.5.0",

View File

@ -2,14 +2,14 @@ import PageHeader from '@/components/PageHeader'
import PairingCard from '@/components/PairingCard'
import { signClient } from '@/utils/WalletConnectUtil'
import { Text } from '@nextui-org/react'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
import { Fragment, useState } from 'react'
export default function PairingsPage() {
const [pairings, setPairings] = useState(signClient.pairing.values)
async function onDelete(topic: string) {
await signClient.disconnect({ topic, reason: ERROR.DELETED.format() })
await signClient.disconnect({ topic, reason: getSdkError('USER_DISCONNECTED') })
const newPairings = pairings.filter(pairing => pairing.topic !== topic)
setPairings(newPairings)
}

View File

@ -3,7 +3,7 @@ import ProjectInfoCard from '@/components/ProjectInfoCard'
import SessionChainCard from '@/components/SessionChainCard'
import { signClient } from '@/utils/WalletConnectUtil'
import { Button, Divider, Loading, Row, Text } from '@nextui-org/react'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
import { useRouter } from 'next/router'
import { Fragment, useEffect, useState } from 'react'
@ -35,7 +35,7 @@ export default function SessionPage() {
// Handle deletion of a session
async function onDeleteSession() {
setLoading(true)
await signClient.disconnect({ topic, reason: ERROR.DELETED.format() })
await signClient.disconnect({ topic, reason: getSdkError('USER_DISCONNECTED') })
replace('/sessions')
setLoading(false)
}

View File

@ -3,7 +3,7 @@ import { cosmosAddresses, cosmosWallets } from '@/utils/CosmosWalletUtil'
import { getWalletAddressFromParams } from '@/utils/HelperUtil'
import { formatJsonRpcError, formatJsonRpcResult } from '@json-rpc-tools/utils'
import { SignClientTypes } from '@walletconnect/types'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
import { parseSignDocValues } from 'cosmos-wallet'
export async function approveCosmosRequest(
@ -29,12 +29,12 @@ export async function approveCosmosRequest(
return formatJsonRpcResult(id, signedAmino.signature)
default:
throw new Error(ERROR.UNKNOWN_JSONRPC_METHOD.format().message)
throw new Error(getSdkError('INVALID_METHOD').message)
}
}
export function rejectCosmosRequest(request: SignClientTypes.EventArguments['session_request']) {
const { id } = request
return formatJsonRpcError(id, ERROR.JSONRPC_REQUEST_METHOD_REJECTED.format().message)
return formatJsonRpcError(id, getSdkError('USER_REJECTED_METHODS').message)
}

View File

@ -7,7 +7,7 @@ import {
} from '@/utils/HelperUtil'
import { formatJsonRpcError, formatJsonRpcResult } from '@json-rpc-tools/utils'
import { SignClientTypes } from '@walletconnect/types'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
import { providers } from 'ethers'
export async function approveEIP155Request(
@ -46,12 +46,12 @@ export async function approveEIP155Request(
return formatJsonRpcResult(id, signature)
default:
throw new Error(ERROR.UNKNOWN_JSONRPC_METHOD.format().message)
throw new Error(getSdkError('INVALID_METHOD').message)
}
}
export function rejectEIP155Request(request: SignClientTypes.EventArguments['session_request']) {
const { id } = request
return formatJsonRpcError(id, ERROR.JSONRPC_REQUEST_METHOD_REJECTED.format().message)
return formatJsonRpcError(id, getSdkError('USER_REJECTED_METHODS').message)
}

View File

@ -3,7 +3,7 @@ import { getWalletAddressFromParams } from '@/utils/HelperUtil'
import { solanaAddresses, solanaWallets } from '@/utils/SolanaWalletUtil'
import { formatJsonRpcError, formatJsonRpcResult } from '@json-rpc-tools/utils'
import { SignClientTypes } from '@walletconnect/types'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
export async function approveSolanaRequest(
requestEvent: SignClientTypes.EventArguments['session_request']
@ -27,12 +27,12 @@ export async function approveSolanaRequest(
return formatJsonRpcResult(id, signedTransaction)
default:
throw new Error(ERROR.UNKNOWN_JSONRPC_METHOD.format().message)
throw new Error(getSdkError('INVALID_METHOD').message)
}
}
export function rejectSolanaRequest(request: SignClientTypes.EventArguments['session_request']) {
const { id } = request
return formatJsonRpcError(id, ERROR.JSONRPC_REQUEST_METHOD_REJECTED.format().message)
return formatJsonRpcError(id, getSdkError('USER_REJECTED_METHODS').message)
}

View File

@ -10,7 +10,7 @@ import { solanaAddresses } from '@/utils/SolanaWalletUtil'
import { signClient } from '@/utils/WalletConnectUtil'
import { Button, Divider, Modal, Text } from '@nextui-org/react'
import { SessionTypes } from '@walletconnect/types'
import { ERROR } from '@walletconnect/utils'
import { getSdkError } from '@walletconnect/utils'
import { Fragment, useState } from 'react'
export default function SessionProposalModal() {
@ -77,7 +77,7 @@ export default function SessionProposalModal() {
if (proposal) {
await signClient.reject({
id,
reason: ERROR.JSONRPC_REQUEST_METHOD_REJECTED.format()
reason: getSdkError('USER_REJECTED_METHODS')
})
}
ModalStore.close()

View File

@ -1738,6 +1738,15 @@
resolved "https://registry.yarnpkg.com/@stablelib/constant-time/-/constant-time-1.0.1.tgz#bde361465e1cf7b9753061b77e376b0ca4c77e35"
integrity sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg==
"@stablelib/ed25519@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@stablelib/ed25519/-/ed25519-1.0.2.tgz#937a88a2f73a71d9bdc3ea276efe8954776ae0f4"
integrity sha512-FtnvUwvKbp6l1dNcg4CswMAVFVu/nzLK3oC7/PRtjYyHbWsIkD8j+5cjXHmwcCpdCpRCaTGACkEhhMQ1RcdSOQ==
dependencies:
"@stablelib/random" "^1.0.1"
"@stablelib/sha512" "^1.0.1"
"@stablelib/wipe" "^1.0.1"
"@stablelib/hash@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@stablelib/hash/-/hash-1.0.1.tgz#3c944403ff2239fad8ebb9015e33e98444058bc5"
@ -1798,6 +1807,15 @@
"@stablelib/hash" "^1.0.1"
"@stablelib/wipe" "^1.0.1"
"@stablelib/sha512@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@stablelib/sha512/-/sha512-1.0.1.tgz#6da700c901c2c0ceacbd3ae122a38ac57c72145f"
integrity sha512-13gl/iawHV9zvDKciLo1fQ8Bgn2Pvf7OV6amaRVKiq3pjQ3UmEpXxWiAfV8tYjUpeZroBxtyrwtdooQT/i3hzw==
dependencies:
"@stablelib/binary" "^1.0.1"
"@stablelib/hash" "^1.0.1"
"@stablelib/wipe" "^1.0.1"
"@stablelib/wipe@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@stablelib/wipe/-/wipe-1.0.1.tgz#d21401f1d59ade56a62e139462a97f104ed19a36"
@ -1953,34 +1971,26 @@
"@typescript-eslint/types" "5.26.0"
eslint-visitor-keys "^3.3.0"
"@walletconnect/core@^2.0.0-beta.101":
version "2.0.0-beta.101"
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.0.0-beta.101.tgz#bc710359b7b5cdcee8270db483dc7dab3ae79346"
integrity sha512-y/EXJvBOJi0Lu3meyCKGyNVxb0p6DbbKdCcdHMZCVEZ3Efr17mEeSg6JB19OA6qMah/QRqc7Sa75iY1lbUJhRQ==
"@walletconnect/core@^2.0.0-beta.102":
version "2.0.0-beta.102"
resolved "https://registry.yarnpkg.com/@walletconnect/core/-/core-2.0.0-beta.102.tgz#e05aa2b2bef6c171b7e373a1b08c2219c9c7a3e5"
integrity sha512-DerQjetds8Z7saseBeN5BYCeQ3LWFszsFkIEGFPxlZlpyQ7iOgnchXF2pHGb/apAlFmiu/vTIGT28JUiiwZBUQ==
dependencies:
"@walletconnect/encoding" "^1.0.1"
"@walletconnect/events" "^1.0.0"
"@walletconnect/heartbeat" "^1.0.0"
"@walletconnect/jsonrpc-provider" "^1.0.3"
"@walletconnect/jsonrpc-utils" "^1.0.1"
"@walletconnect/jsonrpc-utils" "1.0.3"
"@walletconnect/jsonrpc-ws-connection" "^1.0.0"
"@walletconnect/keyvaluestorage" "^1.0.0"
"@walletconnect/logger" "^1.0.0"
"@walletconnect/relay-api" "^1.0.2"
"@walletconnect/relay-api" "^1.0.5"
"@walletconnect/relay-auth" "^1.0.3"
"@walletconnect/safe-json" "^1.0.0"
"@walletconnect/time" "^1.0.1"
"@walletconnect/types" "^2.0.0-beta.101"
"@walletconnect/utils" "^2.0.0-beta.101"
"@walletconnect/types" "^2.0.0-beta.102"
"@walletconnect/utils" "^2.0.0-beta.102"
ws "^8.3.0"
"@walletconnect/encoding@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@walletconnect/encoding/-/encoding-1.0.1.tgz#93c18ce9478c3d5283dbb88c41eb2864b575269a"
integrity sha512-8opL2rs6N6E3tJfsqwS82aZQDL3gmupWUgmvuZ3CGU7z/InZs3R9jkzH8wmYtpbq0sFK3WkJkQRZFFk4BkrmFA==
dependencies:
is-typedarray "1.0.0"
typedarray-to-buffer "3.1.5"
"@walletconnect/environment@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@walletconnect/environment/-/environment-1.0.0.tgz#c4545869fa9c389ec88c364e1a5f8178e8ab5034"
@ -2009,6 +2019,13 @@
"@walletconnect/jsonrpc-utils" "^1.0.0"
"@walletconnect/safe-json" "^1.0.0"
"@walletconnect/jsonrpc-types@1.0.1", "@walletconnect/jsonrpc-types@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.1.tgz#a96b4bb2bcc8838a70e06f15c1b5ab11c47d8e95"
integrity sha512-+6coTtOuChCqM+AoYyi4Q83p9l/laI6NvuM2/AHaZFuf0gT0NjW7IX2+86qGyizn7Ptq4AYZmfxurAxTnhefuw==
dependencies:
keyvaluestorage-interface "^1.0.0"
"@walletconnect/jsonrpc-types@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.0.tgz#fa75ad5e8f106a2e33287b1e6833e22ed0225055"
@ -2016,12 +2033,13 @@
dependencies:
keyvaluestorage-interface "^1.0.0"
"@walletconnect/jsonrpc-types@^1.0.1":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-types/-/jsonrpc-types-1.0.1.tgz#a96b4bb2bcc8838a70e06f15c1b5ab11c47d8e95"
integrity sha512-+6coTtOuChCqM+AoYyi4Q83p9l/laI6NvuM2/AHaZFuf0gT0NjW7IX2+86qGyizn7Ptq4AYZmfxurAxTnhefuw==
"@walletconnect/jsonrpc-utils@1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.3.tgz#5bd49865eef0eae48e8b45a06731dc18691cf8c7"
integrity sha512-3yb49bPk16MNLk6uIIHPSHQCpD6UAo1OMOx1rM8cW/MPEAYAzrSW5hkhG7NEUwX9SokRIgnZK3QuQkiyNzBMhQ==
dependencies:
keyvaluestorage-interface "^1.0.0"
"@walletconnect/environment" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.1"
"@walletconnect/jsonrpc-utils@^1.0.0":
version "1.0.0"
@ -2031,14 +2049,6 @@
"@walletconnect/environment" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.0"
"@walletconnect/jsonrpc-utils@^1.0.1":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-utils/-/jsonrpc-utils-1.0.3.tgz#5bd49865eef0eae48e8b45a06731dc18691cf8c7"
integrity sha512-3yb49bPk16MNLk6uIIHPSHQCpD6UAo1OMOx1rM8cW/MPEAYAzrSW5hkhG7NEUwX9SokRIgnZK3QuQkiyNzBMhQ==
dependencies:
"@walletconnect/environment" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.1"
"@walletconnect/jsonrpc-ws-connection@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@walletconnect/jsonrpc-ws-connection/-/jsonrpc-ws-connection-1.0.0.tgz#e0248542b30971338a84884ecea49ae9c0837f3e"
@ -2063,37 +2073,47 @@
dependencies:
pino "^6.7.0"
"@walletconnect/relay-api@^1.0.2":
version "1.0.2"
resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.2.tgz#a6d93c5292c2f9f9424f86de09854e4f0bd2fbae"
integrity sha512-6FZP6pAQwQttncuWAKC0lGvNm0SCiBEfpkdzURMoGIk4H3u5PpiUHNt9wekPzDl5CYIdVhN2RheH6uS8SuDAZw==
"@walletconnect/relay-api@^1.0.5":
version "1.0.5"
resolved "https://registry.yarnpkg.com/@walletconnect/relay-api/-/relay-api-1.0.5.tgz#146d6daeb27306b7f659c8ed46396be78a773929"
integrity sha512-NB+QkRh2sAxbPuT/3A8fPGsCb5C07WOfAoU2S3hY9m1wi/sRZoN9c4gVudT8ptixuZZ3Qb8/BiqNEqnlaMIAGg==
dependencies:
"@walletconnect/jsonrpc-types" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.1"
"@walletconnect/relay-auth@^1.0.3":
version "1.0.3"
resolved "https://registry.yarnpkg.com/@walletconnect/relay-auth/-/relay-auth-1.0.3.tgz#5a20fa0a95b0678fb26d7e96dc0e3f780867deec"
integrity sha512-73BHB4oTftTGveNIFO0g73KjAl9dSPKUZ/3hgEo4FRs7SzXORUQKjeDsZnOWFYWaDeiozH2ckaJv5GJtORI79Q==
dependencies:
"@stablelib/ed25519" "^1.0.2"
"@stablelib/random" "^1.0.1"
"@walletconnect/safe-json" "^1.0.0"
"@walletconnect/time" "^1.0.1"
uint8arrays "^3.0.0"
"@walletconnect/safe-json@^1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@walletconnect/safe-json/-/safe-json-1.0.0.tgz#12eeb11d43795199c045fafde97e3c91646683b2"
integrity sha512-QJzp/S/86sUAgWY6eh5MKYmSfZaRpIlmCJdi5uG4DJlKkZrHEF7ye7gA+VtbVzvTtpM/gRwO2plQuiooIeXjfg==
"@walletconnect/sign-client@2.0.0-beta.101":
version "2.0.0-beta.101"
resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.0.0-beta.101.tgz#1f59d8b795f6d8761745cd2c4c2a315ebfdf6772"
integrity sha512-t6aPEUpW3RQyzrSCOQ0VLzfr3dBOwF4bKP8K/cmo5S//VgV7ssNu8O1+tCHQ/837hYqiX+hGT8ZsOp2UL6clQQ==
"@walletconnect/sign-client@2.0.0-beta.102":
version "2.0.0-beta.102"
resolved "https://registry.yarnpkg.com/@walletconnect/sign-client/-/sign-client-2.0.0-beta.102.tgz#2a22554c5b68e1844f718e2d6dd20bd9dc4b628b"
integrity sha512-XjJLyJyB3tgC3n0mhXqSu1lJKWqohZ8vtVu/MQ1FX3Agi9NpZn0jW8skl9cVlnv6PYpxEKiCgdW/WUFaNxaXqQ==
dependencies:
"@walletconnect/core" "^2.0.0-beta.101"
"@walletconnect/encoding" "^1.0.1"
"@walletconnect/core" "^2.0.0-beta.102"
"@walletconnect/events" "^1.0.0"
"@walletconnect/heartbeat" "^1.0.0"
"@walletconnect/jsonrpc-provider" "^1.0.3"
"@walletconnect/jsonrpc-utils" "^1.0.1"
"@walletconnect/jsonrpc-utils" "1.0.3"
"@walletconnect/jsonrpc-ws-connection" "^1.0.0"
"@walletconnect/keyvaluestorage" "^1.0.0"
"@walletconnect/logger" "^1.0.0"
"@walletconnect/relay-api" "^1.0.2"
"@walletconnect/relay-api" "^1.0.5"
"@walletconnect/safe-json" "^1.0.0"
"@walletconnect/time" "^1.0.1"
"@walletconnect/types" "^2.0.0-beta.101"
"@walletconnect/utils" "^2.0.0-beta.101"
"@walletconnect/types" "^2.0.0-beta.102"
"@walletconnect/utils" "^2.0.0-beta.102"
ws "^8.3.0"
"@walletconnect/time@^1.0.1":
@ -2101,34 +2121,34 @@
resolved "https://registry.yarnpkg.com/@walletconnect/time/-/time-1.0.1.tgz#645f596887e67c56522edbc2b170d46a97c87ce0"
integrity sha512-LtNtHupTNranehLMh8Z/JN6xVySysSoJNjNCQ0ML+hOUkim5QX/VdvfovSpaX9qA2b95u7bIuTcq0O3UBk7Iyw==
"@walletconnect/types@2.0.0-beta.101", "@walletconnect/types@^2.0.0-beta.101":
version "2.0.0-beta.101"
resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.0.0-beta.101.tgz#e5d8a51b03bd0df54e8123283bfb4bae89cfdc57"
integrity sha512-GjSH8YDMD4FuBrtmKRa/BsvdMplPOXVeAM317vabV9tN7BU85aFDI9Y83ohfr6M9hjpBy+eMVpZ17yyt2NND9w==
"@walletconnect/types@2.0.0-beta.102", "@walletconnect/types@^2.0.0-beta.102":
version "2.0.0-beta.102"
resolved "https://registry.yarnpkg.com/@walletconnect/types/-/types-2.0.0-beta.102.tgz#d47bc11446b009861d609ee89afa0f2bf51b4eb0"
integrity sha512-hTbxCjmqDlxzwODkbh5/KUL9seN8IKTGIOzFwKEYlhjT8r0isxkqEoM7tmzJipfmKoUANRJMuf4LM2T45KopYg==
dependencies:
"@walletconnect/events" "^1.0.0"
"@walletconnect/heartbeat" "^1.0.0"
"@walletconnect/jsonrpc-types" "^1.0.0"
"@walletconnect/jsonrpc-types" "1.0.1"
"@walletconnect/keyvaluestorage" "^1.0.0"
pino "^6.7.0"
pino-pretty "^4.3.0"
"@walletconnect/utils@2.0.0-beta.101", "@walletconnect/utils@^2.0.0-beta.101":
version "2.0.0-beta.101"
resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.0.0-beta.101.tgz#d93606011ae7d398d89a0b7f5bbd7c39c8e0caac"
integrity sha512-7R0D1EChRpIhr/O4Gqgho3RWqx9s+mgz4C+dGBEP3XzWy7k7WdM0tv9J5mKxFLXDffqbWgSBuRLBXNovIZZkJA==
"@walletconnect/utils@2.0.0-beta.102", "@walletconnect/utils@^2.0.0-beta.102":
version "2.0.0-beta.102"
resolved "https://registry.yarnpkg.com/@walletconnect/utils/-/utils-2.0.0-beta.102.tgz#a2ec4c4c95a60c3d72341e8e398a6c86219be446"
integrity sha512-m0drHK7fQr2PGoD4k4cDqgZ2P40noEg4efuGMtlvE2XGVVZJOSZpEavBH/kjDeWTWoVH7yGxSbj9VCQtrPyoQw==
dependencies:
"@stablelib/chacha20poly1305" "^1.0.1"
"@stablelib/hkdf" "^1.0.1"
"@stablelib/random" "^1.0.1"
"@stablelib/sha256" "^1.0.1"
"@stablelib/x25519" "^1.0.2"
"@walletconnect/jsonrpc-utils" "^1.0.1"
"@walletconnect/jsonrpc-utils" "1.0.3"
"@walletconnect/logger" "^1.0.0"
"@walletconnect/relay-api" "^1.0.2"
"@walletconnect/relay-api" "^1.0.5"
"@walletconnect/safe-json" "^1.0.0"
"@walletconnect/time" "^1.0.1"
"@walletconnect/types" "^2.0.0-beta.101"
"@walletconnect/types" "^2.0.0-beta.102"
"@walletconnect/window-getters" "^1.0.0"
"@walletconnect/window-metadata" "^1.0.0"
lodash.isequal "4.5.0"