From 9bf2b02602da8af25983cafe06234f2522c82869 Mon Sep 17 00:00:00 2001 From: AndreasGassmann Date: Fri, 31 Mar 2023 10:35:53 +0200 Subject: [PATCH] Add Tezos Support (#127) * feat(): add tezos * feat(dapp): add tezos support * feat(): remove unused project * feat(): update logo * feat(): add tezos sign modal * feat(): remove unimplemented method * feat(tezos): add send and sign support * feat(tezos): add rpc * Update wallets/react-wallet-v2/src/views/SessionProposalModal.tsx Co-authored-by: Ben Kremer * feat(): share all accounts --------- Co-authored-by: Ben Kremer Co-authored-by: Ben Kremer --- dapps/react-dapp-v2/public/assets/tezos.svg | 22 ++ dapps/react-dapp-v2/src/chains/index.ts | 5 + dapps/react-dapp-v2/src/chains/tezos.ts | 64 ++++++ dapps/react-dapp-v2/src/constants/default.ts | 13 ++ .../src/contexts/ChainDataContext.tsx | 4 + .../src/contexts/JsonRpcContext.tsx | 104 ++++++++++ dapps/react-dapp-v2/src/helpers/namespaces.ts | 6 + dapps/react-dapp-v2/src/pages/index.tsx | 33 +++ wallets/react-wallet-v2/.env.local.example | 1 - wallets/react-wallet-v2/package.json | 2 + .../public/chain-logos/tezos.svg | 22 ++ .../src/components/AccountPicker.tsx | 2 + .../react-wallet-v2/src/components/Modal.tsx | 2 + wallets/react-wallet-v2/src/data/TezosData.ts | 46 +++++ .../src/hooks/useInitialization.ts | 3 + .../hooks/useWalletConnectEventsManager.ts | 5 + wallets/react-wallet-v2/src/lib/TezosLib.ts | 109 ++++++++++ wallets/react-wallet-v2/src/pages/index.tsx | 10 +- .../react-wallet-v2/src/pages/settings.tsx | 20 +- .../react-wallet-v2/src/store/ModalStore.ts | 1 + .../src/store/SettingsStore.ts | 6 + .../react-wallet-v2/src/utils/HelperUtil.ts | 9 +- .../src/utils/TezosRequestHandlerUtil.ts | 46 +++++ .../src/utils/TezosWalletUtil.ts | 50 +++++ .../src/views/SessionProposalModal.tsx | 13 +- .../src/views/SessionSignTezosModal.tsx | 78 +++++++ wallets/react-wallet-v2/yarn.lock | 195 +++++++++++++++++- 27 files changed, 857 insertions(+), 14 deletions(-) create mode 100644 dapps/react-dapp-v2/public/assets/tezos.svg create mode 100644 dapps/react-dapp-v2/src/chains/tezos.ts create mode 100644 wallets/react-wallet-v2/public/chain-logos/tezos.svg create mode 100644 wallets/react-wallet-v2/src/data/TezosData.ts create mode 100644 wallets/react-wallet-v2/src/lib/TezosLib.ts create mode 100644 wallets/react-wallet-v2/src/utils/TezosRequestHandlerUtil.ts create mode 100644 wallets/react-wallet-v2/src/utils/TezosWalletUtil.ts create mode 100644 wallets/react-wallet-v2/src/views/SessionSignTezosModal.tsx diff --git a/dapps/react-dapp-v2/public/assets/tezos.svg b/dapps/react-dapp-v2/public/assets/tezos.svg new file mode 100644 index 0000000..90b2d46 --- /dev/null +++ b/dapps/react-dapp-v2/public/assets/tezos.svg @@ -0,0 +1,22 @@ + + + + + + + diff --git a/dapps/react-dapp-v2/src/chains/index.ts b/dapps/react-dapp-v2/src/chains/index.ts index a49c852..d97c3a3 100644 --- a/dapps/react-dapp-v2/src/chains/index.ts +++ b/dapps/react-dapp-v2/src/chains/index.ts @@ -7,6 +7,7 @@ import * as solana from "./solana"; import * as near from "./near"; import * as elrond from "./elrond"; import * as tron from "./tron"; +import * as tezos from "./tezos"; import { ChainMetadata, ChainRequestRender } from "../helpers"; @@ -27,6 +28,8 @@ export function getChainMetadata(chainId: string): ChainMetadata { return elrond.getChainMetadata(chainId); case "tron": return tron.getChainMetadata(chainId); + case "tezos": + return tezos.getChainMetadata(chainId); default: throw new Error(`No metadata handler for namespace ${namespace}`); } @@ -46,6 +49,8 @@ export function getChainRequestRender( return polkadot.getChainRequestRender(request); case "near": return near.getChainRequestRender(request); + case "tezos": + return tezos.getChainRequestRender(request); default: throw new Error(`No render handler for namespace ${namespace}`); } diff --git a/dapps/react-dapp-v2/src/chains/tezos.ts b/dapps/react-dapp-v2/src/chains/tezos.ts new file mode 100644 index 0000000..693b5fd --- /dev/null +++ b/dapps/react-dapp-v2/src/chains/tezos.ts @@ -0,0 +1,64 @@ +import { JsonRpcRequest } from "@walletconnect/jsonrpc-utils"; + +import { + NamespaceMetadata, + ChainMetadata, + ChainRequestRender, + ChainsMap, +} from "../helpers"; + +export const TezosMetadata: NamespaceMetadata = { + mainnet: { + logo: "/assets/tezos.svg", + rgb: "44, 125, 247", + }, + testnet: { + logo: "/assets/tezos.svg", + rgb: "44, 125, 247", + }, +}; + +export const TezosChainData: ChainsMap = { + mainnet: { + name: "Tezos", + id: "tezos:mainnet", + rpc: ["https://mainnet.api.tez.ie"], + slip44: 1729, + testnet: false, + }, + testnet: { + name: "Tezos Testnet", + id: "tezos:testnet", + rpc: ["https://ghostnet.ecadinfra.com"], + slip44: 1729, + testnet: true, + }, +}; + +export function getChainMetadata(chainId: string): ChainMetadata { + const reference = chainId.split(":")[1]; + const metadata = TezosMetadata[reference]; + if (typeof metadata === "undefined") { + throw new Error(`No chain metadata found for chainId: ${chainId}`); + } + return metadata; +} + +export function getChainRequestRender( + request: JsonRpcRequest +): ChainRequestRender[] { + let params = [{ label: "Method", value: request.method }]; + + switch (request.method) { + default: + params = [ + ...params, + { + label: "params", + value: JSON.stringify(request.params, null, "\t"), + }, + ]; + break; + } + return params; +} diff --git a/dapps/react-dapp-v2/src/constants/default.ts b/dapps/react-dapp-v2/src/constants/default.ts index cc6fc60..b5ce2b1 100644 --- a/dapps/react-dapp-v2/src/constants/default.ts +++ b/dapps/react-dapp-v2/src/constants/default.ts @@ -14,6 +14,7 @@ export const DEFAULT_MAIN_CHAINS = [ "polkadot:91b171bb158e2d3848fa23a9f1c25182", "elrond:1", "tron:0x2b6653dc", + "tezos:mainnet", ]; export const DEFAULT_TEST_CHAINS = [ @@ -28,6 +29,7 @@ export const DEFAULT_TEST_CHAINS = [ "near:testnet", "elrond:D", "tron:0xcd8690dc", + "tezos:testnet", ]; export const DEFAULT_CHAINS = [...DEFAULT_MAIN_CHAINS, ...DEFAULT_TEST_CHAINS]; @@ -125,6 +127,17 @@ export enum DEFAULT_TRON_METHODS { export enum DEFAULT_TRON_EVENTS {} +/** + * TEZOS + */ +export enum DEFAULT_TEZOS_METHODS { + TEZOS_GET_ACCOUNTS = "tezos_getAccounts", + TEZOS_SEND = "tezos_send", + TEZOS_SIGN = "tezos_sign", +} + +export enum DEFAULT_TEZOS_EVENTS {} + export const DEFAULT_GITHUB_REPO_URL = "https://github.com/WalletConnect/web-examples/tree/main/dapps/react-dapp-v2"; diff --git a/dapps/react-dapp-v2/src/contexts/ChainDataContext.tsx b/dapps/react-dapp-v2/src/contexts/ChainDataContext.tsx index 9f06702..f7ba521 100644 --- a/dapps/react-dapp-v2/src/contexts/ChainDataContext.tsx +++ b/dapps/react-dapp-v2/src/contexts/ChainDataContext.tsx @@ -14,6 +14,7 @@ import { ChainNamespaces, ChainsMap, getAllChainNamespaces } from "../helpers"; import { NearChainData } from "../chains/near"; import { CosmosChainData } from "../chains/cosmos"; import { EIP155ChainData } from "../chains/eip155"; +import { TezosChainData } from "../chains/tezos"; /** * Types @@ -65,6 +66,9 @@ export function ChainDataContextProvider({ case "eip155": chains = EIP155ChainData; break; + case "tezos": + chains = TezosChainData; + break; default: console.error("Unknown chain namespace: ", namespace); } diff --git a/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx b/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx index 267210b..fa535ee 100644 --- a/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx +++ b/dapps/react-dapp-v2/src/contexts/JsonRpcContext.tsx @@ -35,6 +35,7 @@ import { DEFAULT_NEAR_METHODS, DEFAULT_ELROND_METHODS, DEFAULT_TRON_METHODS, + DEFAULT_TEZOS_METHODS, } from "../constants"; import { useChainData } from "./ChainDataContext"; import { signatureVerify, cryptoWaitReady } from "@polkadot/util-crypto"; @@ -97,6 +98,11 @@ interface IContext { testSignMessage: TRpcRequestCallback; testSignTransaction: TRpcRequestCallback; }; + tezosRpc: { + testGetAccounts: TRpcRequestCallback; + testSignMessage: TRpcRequestCallback; + testSignTransaction: TRpcRequestCallback; + }; rpcResult?: IFormattedRpcResponse | null; isRpcRequestPending: boolean; isTestnet: boolean; @@ -1154,6 +1160,103 @@ export function JsonRpcContextProvider({ ), }; + // -------- TEZOS RPC METHODS -------- + + const tezosRpc = { + testGetAccounts: _createJsonRpcRequestHandler( + async ( + chainId: string, + address: string + ): Promise => { + try { + const result = await client!.request<{ signature: string }>({ + chainId, + topic: session!.topic, + request: { + method: DEFAULT_TEZOS_METHODS.TEZOS_GET_ACCOUNTS, + params: {}, + }, + }); + + return { + method: DEFAULT_TEZOS_METHODS.TEZOS_GET_ACCOUNTS, + address, + valid: true, + result: JSON.stringify(result, null, 2), + }; + } catch (error: any) { + throw new Error(error.message); + } + } + ), + testSignTransaction: _createJsonRpcRequestHandler( + async ( + chainId: string, + address: string + ): Promise => { + try { + const result = await client!.request<{ hash: string }>({ + chainId, + topic: session!.topic, + request: { + method: DEFAULT_TEZOS_METHODS.TEZOS_SEND, + params: { + account: address, + operations: [ + { + kind: "transaction", + amount: "1", // 1 mutez, smallest unit + destination: address, // send to ourselves + }, + ], + }, + }, + }); + + return { + method: DEFAULT_TEZOS_METHODS.TEZOS_SEND, + address, + valid: true, + result: result.hash, + }; + } catch (error: any) { + throw new Error(error.message); + } + } + ), + testSignMessage: _createJsonRpcRequestHandler( + async ( + chainId: string, + address: string + ): Promise => { + const payload = "05010000004254"; + + try { + const result = await client!.request<{ signature: string }>({ + chainId, + topic: session!.topic, + request: { + method: DEFAULT_TEZOS_METHODS.TEZOS_SIGN, + params: { + account: address, + payload, + }, + }, + }); + + return { + method: DEFAULT_TEZOS_METHODS.TEZOS_SIGN, + address, + valid: true, + result: result.signature, + }; + } catch (error: any) { + throw new Error(error.message); + } + } + ), + }; + return ( { @@ -44,6 +46,8 @@ export const getSupportedMethodsByNamespace = (namespace: string) => { return Object.values(DEFAULT_ELROND_METHODS); case "tron": return Object.values(DEFAULT_TRON_METHODS); + case "tezos": + return Object.values(DEFAULT_TEZOS_METHODS); default: throw new Error(`No default methods for namespace: ${namespace}`); } @@ -65,6 +69,8 @@ export const getSupportedEventsByNamespace = (namespace: string) => { return Object.values(DEFAULT_ELROND_EVENTS); case "tron": return Object.values(DEFAULT_TRON_EVENTS); + case "tezos": + return Object.values(DEFAULT_TEZOS_EVENTS); default: throw new Error(`No default events for namespace: ${namespace}`); } diff --git a/dapps/react-dapp-v2/src/pages/index.tsx b/dapps/react-dapp-v2/src/pages/index.tsx index 581e7f4..5286874 100644 --- a/dapps/react-dapp-v2/src/pages/index.tsx +++ b/dapps/react-dapp-v2/src/pages/index.tsx @@ -17,6 +17,7 @@ import { DEFAULT_TEST_CHAINS, DEFAULT_NEAR_METHODS, DEFAULT_TRON_METHODS, + DEFAULT_TEZOS_METHODS, } from "../constants"; import { AccountAction, setLocaleStorageTestnetFlag } from "../helpers"; import Toggle from "../components/Toggle"; @@ -75,6 +76,7 @@ const Home: NextPage = () => { nearRpc, elrondRpc, tronRpc, + tezosRpc, isRpcRequestPending, rpcResult, isTestnet, @@ -306,6 +308,35 @@ const Home: NextPage = () => { ]; }; + const getTezosActions = (): AccountAction[] => { + const onGetAccounts = async (chainId: string, address: string) => { + openRequestModal(); + await tezosRpc.testGetAccounts(chainId, address); + }; + const onSignTransaction = async (chainId: string, address: string) => { + openRequestModal(); + await tezosRpc.testSignTransaction(chainId, address); + }; + const onSignMessage = async (chainId: string, address: string) => { + openRequestModal(); + await tezosRpc.testSignMessage(chainId, address); + }; + return [ + { + method: DEFAULT_TEZOS_METHODS.TEZOS_GET_ACCOUNTS, + callback: onGetAccounts, + }, + { + method: DEFAULT_TEZOS_METHODS.TEZOS_SEND, + callback: onSignTransaction, + }, + { + method: DEFAULT_TEZOS_METHODS.TEZOS_SIGN, + callback: onSignMessage, + }, + ]; + }; + const getBlockchainActions = (chainId: string) => { const [namespace] = chainId.split(":"); switch (namespace) { @@ -323,6 +354,8 @@ const Home: NextPage = () => { return getElrondActions(); case "tron": return getTronActions(); + case "tezos": + return getTezosActions(); default: break; } diff --git a/wallets/react-wallet-v2/.env.local.example b/wallets/react-wallet-v2/.env.local.example index 857da45..35a2fe0 100644 --- a/wallets/react-wallet-v2/.env.local.example +++ b/wallets/react-wallet-v2/.env.local.example @@ -1,3 +1,2 @@ NEXT_PUBLIC_PROJECT_ID=... NEXT_PUBLIC_RELAY_URL=wss://relay.walletconnect.com - diff --git a/wallets/react-wallet-v2/package.json b/wallets/react-wallet-v2/package.json index d96e895..87f59e1 100644 --- a/wallets/react-wallet-v2/package.json +++ b/wallets/react-wallet-v2/package.json @@ -20,6 +20,8 @@ "@polkadot/keyring": "^10.1.2", "@polkadot/types": "^9.3.3", "@solana/web3.js": "1.43.0", + "@taquito/signer": "^15.1.0", + "@taquito/taquito": "^15.1.0", "@walletconnect/client": "1.8.0", "@walletconnect/legacy-types": "^2.0.0-rc.0", "@walletconnect/sign-client": "2.4.10", diff --git a/wallets/react-wallet-v2/public/chain-logos/tezos.svg b/wallets/react-wallet-v2/public/chain-logos/tezos.svg new file mode 100644 index 0000000..90b2d46 --- /dev/null +++ b/wallets/react-wallet-v2/public/chain-logos/tezos.svg @@ -0,0 +1,22 @@ + + + + + + + diff --git a/wallets/react-wallet-v2/src/components/AccountPicker.tsx b/wallets/react-wallet-v2/src/components/AccountPicker.tsx index e90b91c..91299ee 100644 --- a/wallets/react-wallet-v2/src/components/AccountPicker.tsx +++ b/wallets/react-wallet-v2/src/components/AccountPicker.tsx @@ -5,6 +5,7 @@ import { nearAddresses } from '@/utils/NearWalletUtil' import { solanaAddresses } from '@/utils/SolanaWalletUtil' import { elrondAddresses } from '@/utils/ElrondWalletUtil' import { tronAddresses } from '@/utils/TronWalletUtil' +import { tezosAddresses } from '@/utils/TezosWalletUtil' import { useSnapshot } from 'valtio' export default function AccountPicker() { @@ -19,6 +20,7 @@ export default function AccountPicker() { SettingsStore.setNearAddress(nearAddresses[account]) SettingsStore.setElrondAddress(elrondAddresses[account]) SettingsStore.setTronAddress(tronAddresses[account]) + SettingsStore.setTezosAddress(tezosAddresses[account]) } return ( diff --git a/wallets/react-wallet-v2/src/components/Modal.tsx b/wallets/react-wallet-v2/src/components/Modal.tsx index 5f4b88d..a8a3bd1 100644 --- a/wallets/react-wallet-v2/src/components/Modal.tsx +++ b/wallets/react-wallet-v2/src/components/Modal.tsx @@ -8,6 +8,7 @@ import SessionSignPolkadotModal from '@/views/SessionSignPolkadotModal' import SessionSignSolanaModal from '@/views/SessionSignSolanaModal' import SessionSignElrondModal from '@/views/SessionSignElrondModal' import SessionSignTronModal from '@/views/SessionSignTronModal' +import SessionSignTezosModal from '@/views/SessionSignTezosModal' import SessionSignTypedDataModal from '@/views/SessionSignTypedDataModal' import SessionUnsuportedMethodModal from '@/views/SessionUnsuportedMethodModal' import LegacySessionProposalModal from '@/views/LegacySessionProposalModal' @@ -33,6 +34,7 @@ export default function Modal() { {view === 'SessionSignNearModal' && } {view === 'SessionSignElrondModal' && } {view === 'SessionSignTronModal' && } + {view === 'SessionSignTezosModal' && } {view === 'LegacySessionProposalModal' && } {view === 'LegacySessionSignModal' && } {view === 'LegacySessionSignTypedDataModal' && } diff --git a/wallets/react-wallet-v2/src/data/TezosData.ts b/wallets/react-wallet-v2/src/data/TezosData.ts new file mode 100644 index 0000000..e49dfe7 --- /dev/null +++ b/wallets/react-wallet-v2/src/data/TezosData.ts @@ -0,0 +1,46 @@ +type ChainMetadata = { + chainId: string + name: string + logo: string + rgb: string + rpc: string +} + +/** + * Types + */ +export type TTezosChain = keyof typeof TEZOS_MAINNET_CHAINS + +/** + * Chains + */ +export const TEZOS_MAINNET_CHAINS: Record = { + 'tezos:mainnet': { + chainId: 'mainnet', + name: 'Tezos', + logo: '/chain-logos/tezos.svg', + rgb: '44, 125, 247', + rpc: 'https://mainnet.api.tez.ie' + } +} + +export const TEZOS_TEST_CHAINS: Record = { + 'tezos:testnet': { + chainId: 'testnet', + name: 'Tezos Testnet', + logo: '/chain-logos/tezos.svg', + rgb: '44, 125, 247', + rpc: 'https://ghostnet.ecadinfra.com' + } +} + +export const TEZOS_CHAINS = { ...TEZOS_MAINNET_CHAINS, ...TEZOS_TEST_CHAINS } + +/** + * Methods + */ +export const TEZOS_SIGNING_METHODS = { + TEZOS_GET_ACCOUNTS: 'tezos_getAccounts', + TEZOS_SEND: 'tezos_send', + TEZOS_SIGN: 'tezos_sign' +} diff --git a/wallets/react-wallet-v2/src/hooks/useInitialization.ts b/wallets/react-wallet-v2/src/hooks/useInitialization.ts index 6798f06..d2e1799 100644 --- a/wallets/react-wallet-v2/src/hooks/useInitialization.ts +++ b/wallets/react-wallet-v2/src/hooks/useInitialization.ts @@ -5,6 +5,7 @@ import { createOrRestoreSolanaWallet } from '@/utils/SolanaWalletUtil' import { createOrRestorePolkadotWallet } from '@/utils/PolkadotWalletUtil' import { createOrRestoreElrondWallet } from '@/utils/ElrondWalletUtil' import { createOrRestoreTronWallet } from '@/utils/TronWalletUtil' +import { createOrRestoreTezosWallet } from '@/utils/TezosWalletUtil' import { createSignClient } from '@/utils/WalletConnectUtil' import { useCallback, useEffect, useRef, useState } from 'react' import { useSnapshot } from 'valtio' @@ -25,6 +26,7 @@ export default function useInitialization() { const { nearAddresses } = await createOrRestoreNearWallet() const { elrondAddresses } = await createOrRestoreElrondWallet() const { tronAddresses } = await createOrRestoreTronWallet() + const { tezosAddresses } = await createOrRestoreTezosWallet() SettingsStore.setEIP155Address(eip155Addresses[0]) SettingsStore.setCosmosAddress(cosmosAddresses[0]) @@ -33,6 +35,7 @@ export default function useInitialization() { SettingsStore.setNearAddress(nearAddresses[0]) SettingsStore.setElrondAddress(elrondAddresses[0]) SettingsStore.setTronAddress(tronAddresses[0]) + SettingsStore.setTezosAddress(tezosAddresses[0]) await createSignClient(relayerRegionURL) prevRelayerURLValue.current = relayerRegionURL diff --git a/wallets/react-wallet-v2/src/hooks/useWalletConnectEventsManager.ts b/wallets/react-wallet-v2/src/hooks/useWalletConnectEventsManager.ts index ca95c62..4721f2d 100644 --- a/wallets/react-wallet-v2/src/hooks/useWalletConnectEventsManager.ts +++ b/wallets/react-wallet-v2/src/hooks/useWalletConnectEventsManager.ts @@ -10,6 +10,7 @@ import { SignClientTypes } from '@walletconnect/types' import { useCallback, useEffect } from 'react' import { NEAR_SIGNING_METHODS } from '@/data/NEARData' import { approveNearRequest } from '@/utils/NearRequestHandlerUtil' +import { TEZOS_SIGNING_METHODS } from '@/data/TezosData' export default function useWalletConnectEventsManager(initialized: boolean) { /****************************************************************************** @@ -81,6 +82,10 @@ export default function useWalletConnectEventsManager(initialized: boolean) { case TRON_SIGNING_METHODS.TRON_SIGN_MESSAGE: case TRON_SIGNING_METHODS.TRON_SIGN_TRANSACTION: return ModalStore.open('SessionSignTronModal', { requestEvent, requestSession }) + case TEZOS_SIGNING_METHODS.TEZOS_GET_ACCOUNTS: + case TEZOS_SIGNING_METHODS.TEZOS_SEND: + case TEZOS_SIGNING_METHODS.TEZOS_SIGN: + return ModalStore.open('SessionSignTezosModal', { requestEvent, requestSession }) default: return ModalStore.open('SessionUnsuportedMethodModal', { requestEvent, requestSession }) } diff --git a/wallets/react-wallet-v2/src/lib/TezosLib.ts b/wallets/react-wallet-v2/src/lib/TezosLib.ts new file mode 100644 index 0000000..0e0515b --- /dev/null +++ b/wallets/react-wallet-v2/src/lib/TezosLib.ts @@ -0,0 +1,109 @@ +import { TezosToolkit } from '@taquito/taquito' +import { InMemorySigner } from '@taquito/signer' +import { localForger } from '@taquito/local-forging' +import Keyring from 'mnemonic-keyring' + +/** + * Constants + */ +const DEFAULT_PATH = "m/44'/1729'/0'/0'" +const DEFAULT_CURVE = 'ed25519' + +/** + * Types + */ +interface IInitArguments { + mnemonic?: string + path?: string + curve?: 'ed25519' | 'secp256k1' +} + +/** + * Library + */ +export default class TezosLib { + tezos: TezosToolkit + signer: InMemorySigner + mnemonic: string + secretKey: string + publicKey: string + address: string + curve: 'ed25519' | 'secp256k1' + + constructor( + tezos: TezosToolkit, + mnemonic: string, + signer: InMemorySigner, + secretKey: string, + publicKey: string, + address: string, + curve: 'ed25519' | 'secp256k1' + ) { + this.tezos = tezos + this.mnemonic = mnemonic + this.signer = signer + this.secretKey = secretKey + this.publicKey = publicKey + this.address = address + this.curve = curve + } + + static async init({ mnemonic, path, curve }: IInitArguments) { + const params = { + mnemonic: mnemonic ?? Keyring.generateMnemonic(), + derivationPath: path ?? DEFAULT_PATH, + curve: curve ?? DEFAULT_CURVE + } + + const Tezos = new TezosToolkit('https://mainnet.api.tez.ie') + + const signer = InMemorySigner.fromMnemonic(params) + + Tezos.setSignerProvider(signer) + + const secretKey = await signer.secretKey() + const publicKey = await signer.publicKey() + const address = await signer.publicKeyHash() + + return new TezosLib(Tezos, params.mnemonic, signer, secretKey, publicKey, address, params.curve) + } + + public getMnemonic() { + return this.mnemonic + } + + public getPublicKey() { + return this.publicKey + } + + public getCurve() { + return this.curve + } + + public getAddress() { + return this.address + } + + public async signTransaction(transaction: any) { + const prepared = await this.tezos.prepare.batch( + transaction.map((tx: any) => ({ + amount: tx.amount, + to: tx.destination, + kind: tx.kind, + mutez: true + })) + ) + + const forged = await localForger.forge(prepared.opOb) + + const tx = await this.signer.sign(forged, new Uint8Array([3])) + + const hash = await this.tezos.rpc.injectOperation(tx.sbytes) + + return hash + } + + public async signPayload(payload: any) { + return await this.signer.sign(payload) + } +} diff --git a/wallets/react-wallet-v2/src/pages/index.tsx b/wallets/react-wallet-v2/src/pages/index.tsx index ca85fea..736e812 100644 --- a/wallets/react-wallet-v2/src/pages/index.tsx +++ b/wallets/react-wallet-v2/src/pages/index.tsx @@ -12,6 +12,7 @@ import { Text } from '@nextui-org/react' import { Fragment } from 'react' import { useSnapshot } from 'valtio' import { NEAR_TEST_CHAINS } from '@/data/NEARData' +import { TEZOS_MAINNET_CHAINS, TEZOS_TEST_CHAINS } from '@/data/TezosData' export default function HomePage() { const { @@ -22,7 +23,8 @@ export default function HomePage() { polkadotAddress, nearAddress, elrondAddress, - tronAddress + tronAddress, + tezosAddress } = useSnapshot(SettingsStore.state) return ( @@ -51,6 +53,9 @@ export default function HomePage() { {Object.values(TRON_MAINNET_CHAINS).map(({ name, logo, rgb }) => ( ))} + {Object.values(TEZOS_MAINNET_CHAINS).map(({ name, logo, rgb }) => ( + + ))} {testNets ? ( @@ -75,6 +80,9 @@ export default function HomePage() { {Object.values(TRON_TEST_CHAINS).map(({ name, logo, rgb }) => ( ))} + {Object.values(TEZOS_TEST_CHAINS).map(({ name, logo, rgb }) => ( + + ))} ) : null} diff --git a/wallets/react-wallet-v2/src/pages/settings.tsx b/wallets/react-wallet-v2/src/pages/settings.tsx index 2e514e8..78746c8 100644 --- a/wallets/react-wallet-v2/src/pages/settings.tsx +++ b/wallets/react-wallet-v2/src/pages/settings.tsx @@ -10,11 +10,18 @@ import { Card, Divider, Row, Switch, Text } from '@nextui-org/react' import { Fragment } from 'react' import { useSnapshot } from 'valtio' import packageJSON from '../../package.json' +import { tezosWallets } from '@/utils/TezosWalletUtil' export default function SettingsPage() { - const { testNets, eip155Address, cosmosAddress, solanaAddress, elrondAddress, tronAddress } = useSnapshot( - SettingsStore.state - ) + const { + testNets, + eip155Address, + cosmosAddress, + solanaAddress, + elrondAddress, + tronAddress, + tezosAddress + } = useSnapshot(SettingsStore.state) return ( @@ -96,6 +103,13 @@ export default function SettingsPage() { {tronWallets[tronAddress].privateKey} + + + Tezos Mnemonic + + + {tezosWallets[tezosAddress].getMnemonic()} + ) } diff --git a/wallets/react-wallet-v2/src/store/ModalStore.ts b/wallets/react-wallet-v2/src/store/ModalStore.ts index 826b962..89ac6a6 100644 --- a/wallets/react-wallet-v2/src/store/ModalStore.ts +++ b/wallets/react-wallet-v2/src/store/ModalStore.ts @@ -31,6 +31,7 @@ interface State { | 'SessionSignNearModal' | 'SessionSignElrondModal' | 'SessionSignTronModal' + | 'SessionSignTezosModal' | 'LegacySessionProposalModal' | 'LegacySessionSignModal' | 'LegacySessionSignTypedDataModal' diff --git a/wallets/react-wallet-v2/src/store/SettingsStore.ts b/wallets/react-wallet-v2/src/store/SettingsStore.ts index a968268..1bf0bee 100644 --- a/wallets/react-wallet-v2/src/store/SettingsStore.ts +++ b/wallets/react-wallet-v2/src/store/SettingsStore.ts @@ -13,6 +13,7 @@ interface State { nearAddress: string elrondAddress: string tronAddress: string + tezosAddress: string relayerRegionURL: string } @@ -29,6 +30,7 @@ const state = proxy({ nearAddress: '', elrondAddress: '', tronAddress: '', + tezosAddress: '', relayerRegionURL: '' }) @@ -72,6 +74,10 @@ const SettingsStore = { state.tronAddress = tronAddress }, + setTezosAddress(tezosAddress: string) { + state.tezosAddress = tezosAddress + }, + toggleTestNets() { state.testNets = !state.testNets if (state.testNets) { diff --git a/wallets/react-wallet-v2/src/utils/HelperUtil.ts b/wallets/react-wallet-v2/src/utils/HelperUtil.ts index cbf03ec..868858a 100644 --- a/wallets/react-wallet-v2/src/utils/HelperUtil.ts +++ b/wallets/react-wallet-v2/src/utils/HelperUtil.ts @@ -121,10 +121,17 @@ export function isElrondChain(chain: string) { /** * Check if chain is part of TRON standard */ - export function isTronChain(chain: string) { +export function isTronChain(chain: string) { return chain.includes('tron') } +/** + * Check if chain is part of Tezos standard + */ +export function isTezosChain(chain: string) { + return chain.includes('tezos') +} + /** * Formats chainId to its name */ diff --git a/wallets/react-wallet-v2/src/utils/TezosRequestHandlerUtil.ts b/wallets/react-wallet-v2/src/utils/TezosRequestHandlerUtil.ts new file mode 100644 index 0000000..c96c73b --- /dev/null +++ b/wallets/react-wallet-v2/src/utils/TezosRequestHandlerUtil.ts @@ -0,0 +1,46 @@ +import { TEZOS_SIGNING_METHODS } from '@/data/TezosData' +import { tezosWallets } from '@/utils/TezosWalletUtil' +import { formatJsonRpcError, formatJsonRpcResult } from '@json-rpc-tools/utils' +import { SignClientTypes } from '@walletconnect/types' +import { getSdkError } from '@walletconnect/utils' + +export async function approveTezosRequest( + requestEvent: SignClientTypes.EventArguments['session_request'] +) { + const { params, id } = requestEvent + const { request } = params + + const wallet = tezosWallets[request.params.account ?? Object.keys(tezosWallets)[0]] + const allWallets = Object.keys(tezosWallets).map(key => tezosWallets[key]) + + switch (request.method) { + case TEZOS_SIGNING_METHODS.TEZOS_GET_ACCOUNTS: + return formatJsonRpcResult( + id, + allWallets.map(wallet => ({ + algo: wallet.getCurve(), + address: wallet.getAddress(), + pubkey: wallet.getPublicKey() + })) + ) + + case TEZOS_SIGNING_METHODS.TEZOS_SEND: + const sendResponse = await wallet.signTransaction(request.params.operations) + + return formatJsonRpcResult(id, { hash: sendResponse }) + + case TEZOS_SIGNING_METHODS.TEZOS_SIGN: + const signResponse = await wallet.signPayload(request.params.payload) + + return formatJsonRpcResult(id, { signature: signResponse.prefixSig }) + + default: + throw new Error(getSdkError('INVALID_METHOD').message) + } +} + +export function rejectTezosRequest(request: SignClientTypes.EventArguments['session_request']) { + const { id } = request + + return formatJsonRpcError(id, getSdkError('USER_REJECTED_METHODS').message) +} diff --git a/wallets/react-wallet-v2/src/utils/TezosWalletUtil.ts b/wallets/react-wallet-v2/src/utils/TezosWalletUtil.ts new file mode 100644 index 0000000..aaaaf63 --- /dev/null +++ b/wallets/react-wallet-v2/src/utils/TezosWalletUtil.ts @@ -0,0 +1,50 @@ +import TezosLib from '@/lib/TezosLib' + +export let wallet1: TezosLib +export let wallet2: TezosLib +export let tezosWallets: Record +export let tezosAddresses: string[] + +let address1: string +let address2: string + +/** + * Utilities + */ +export function getTezosWallet(address: string) { + let wallet = Object.entries(tezosWallets).find(([walletAddress, _]) => { + return address === walletAddress + }) + return wallet?.[1] +} + +export async function createOrRestoreTezosWallet() { + const mnemonic1 = localStorage.getItem('TEZOS_MNEMONIC_1') + const mnemonic2 = localStorage.getItem('TEZOS_MNEMONIC_2') + + if (mnemonic1 && mnemonic2) { + wallet1 = await TezosLib.init({ mnemonic: mnemonic1 }) + wallet2 = await TezosLib.init({ mnemonic: mnemonic2 }) + } else { + wallet1 = await TezosLib.init({}) + wallet2 = await TezosLib.init({}) + + // Don't store mnemonic in local storage in a production project! + localStorage.setItem('TEZOS_MNEMONIC_1', wallet1.getMnemonic()) + localStorage.setItem('TEZOS_MNEMONIC_2', wallet2.getMnemonic()) + } + + address1 = wallet1.getAddress() + address2 = wallet2.getAddress() + + tezosWallets = { + [address1]: wallet1, + [address2]: wallet2 + } + tezosAddresses = Object.keys(tezosWallets) + + return { + tezosWallets, + tezosAddresses + } +} diff --git a/wallets/react-wallet-v2/src/views/SessionProposalModal.tsx b/wallets/react-wallet-v2/src/views/SessionProposalModal.tsx index d1aefa5..e68ff5e 100644 --- a/wallets/react-wallet-v2/src/views/SessionProposalModal.tsx +++ b/wallets/react-wallet-v2/src/views/SessionProposalModal.tsx @@ -8,6 +8,7 @@ import { eip155Addresses } from '@/utils/EIP155WalletUtil' import { polkadotAddresses } from '@/utils/PolkadotWalletUtil' import { elrondAddresses } from '@/utils/ElrondWalletUtil' import { tronAddresses } from '@/utils/TronWalletUtil' +import { tezosAddresses } from '@/utils/TezosWalletUtil' import { isCosmosChain, isEIP155Chain, @@ -15,7 +16,8 @@ import { isPolkadotChain, isNearChain, isElrondChain, - isTronChain + isTronChain, + isTezosChain } from '@/utils/HelperUtil' import { solanaAddresses } from '@/utils/SolanaWalletUtil' import { signClient } from '@/utils/WalletConnectUtil' @@ -161,6 +163,15 @@ export default function SessionProposalModal() { chain={chain} /> ) + } else if (isTezosChain(chain)) { + return ( + + ) } } diff --git a/wallets/react-wallet-v2/src/views/SessionSignTezosModal.tsx b/wallets/react-wallet-v2/src/views/SessionSignTezosModal.tsx new file mode 100644 index 0000000..f95caae --- /dev/null +++ b/wallets/react-wallet-v2/src/views/SessionSignTezosModal.tsx @@ -0,0 +1,78 @@ +import ProjectInfoCard from '@/components/ProjectInfoCard' +import RequestDataCard from '@/components/RequestDataCard' +import RequesDetailsCard from '@/components/RequestDetalilsCard' +import RequestMethodCard from '@/components/RequestMethodCard' +import RequestModalContainer from '@/components/RequestModalContainer' +import ModalStore from '@/store/ModalStore' +import { approveTezosRequest, rejectTezosRequest } from '@/utils/TezosRequestHandlerUtil' +import { signClient } from '@/utils/WalletConnectUtil' +import { Button, Divider, Modal, Text } from '@nextui-org/react' +import { Fragment } from 'react' + +export default function SessionSignTezosModal() { + // Get request and wallet data from store + const requestEvent = ModalStore.state.data?.requestEvent + const requestSession = ModalStore.state.data?.requestSession + + // Ensure request and wallet are defined + if (!requestEvent || !requestSession) { + return Missing request data + } + + // Get required request data + const { topic, params } = requestEvent + const { request, chainId } = params + + // Handle approve action (logic varies based on request method) + async function onApprove() { + if (requestEvent) { + const response = await approveTezosRequest(requestEvent) + await signClient.respond({ + topic, + response + }) + ModalStore.close() + } + } + + // Handle reject action + async function onReject() { + if (requestEvent) { + const response = rejectTezosRequest(requestEvent) + await signClient.respond({ + topic, + response + }) + ModalStore.close() + } + } + + return ( + + + + + + + + + + + + + + + + + + + + + + + ) +} diff --git a/wallets/react-wallet-v2/yarn.lock b/wallets/react-wallet-v2/yarn.lock index bdb976c..e095fcb 100644 --- a/wallets/react-wallet-v2/yarn.lock +++ b/wallets/react-wallet-v2/yarn.lock @@ -1310,6 +1310,11 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.3.tgz#360afc77610e0a61f3417e497dcf36862e4f8111" integrity sha512-CE0FCR57H2acVI5UOzIGSSIYxZ6v/HOhDR0Ro9VLyhnzLwx0o8W1mmgaqlEUx4049qJDlIBRztv5k+MM8vbO3A== +"@noble/hashes@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.2.0.tgz#a3150eeb09cc7ab207ebf6d7b9ad311a9bdbed12" + integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== + "@noble/secp256k1@1.7.0", "@noble/secp256k1@^1.6.3": version "1.7.0" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.0.tgz#d15357f7c227e751d90aa06b05a0e5cf993ba8c1" @@ -2093,6 +2098,15 @@ dependencies: "@stablelib/int" "^1.0.1" +"@stablelib/blake2b@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/blake2b/-/blake2b-1.0.1.tgz#0045a77e182c4cf3260bc9b533fc4cd5c287f8ea" + integrity sha512-B3KyKoBAjkIFeH7romcF96i+pVFYk7K2SBQ1pZvaxV+epSBXJ+n0C66esUhyz6FF+5FbdQVm77C5fzGFcEZpKA== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/hash" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + "@stablelib/bytes@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/bytes/-/bytes-1.0.1.tgz#0f4aa7b03df3080b878c7dea927d01f42d6a20d8" @@ -2123,7 +2137,7 @@ resolved "https://registry.yarnpkg.com/@stablelib/constant-time/-/constant-time-1.0.1.tgz#bde361465e1cf7b9753061b77e376b0ca4c77e35" integrity sha512-tNOs3uD0vSJcK6z1fvef4Y+buN7DXhzHDPqRLSXUel1UfqMB1PWNsnnAezrKfEwTLpN0cGH2p9NNjs6IqeD0eg== -"@stablelib/ed25519@^1.0.2": +"@stablelib/ed25519@^1.0.2", "@stablelib/ed25519@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@stablelib/ed25519/-/ed25519-1.0.3.tgz#f8fdeb6f77114897c887bb6a3138d659d3f35996" integrity sha512-puIMWaX9QlRsbhxfDc5i+mNPMY+0TmQEskunY1rZEBPi1acBCVQAhnsk/1Hk50DGPtVsZtAWQg4NHGlVaO9Hqg== @@ -2167,6 +2181,27 @@ dependencies: "@stablelib/bytes" "^1.0.1" +"@stablelib/nacl@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@stablelib/nacl/-/nacl-1.0.4.tgz#b63e0a1b87eccb13ad91dd46b2382112acfa417e" + integrity sha512-PJ2U/MrkXSKUM8C4qFs87WeCNxri7KQwR8Cdwm9q2sweGuAtTvOJGuW0F3N+zn+ySLPJA98SYWSSpogMJ1gCmw== + dependencies: + "@stablelib/poly1305" "^1.0.1" + "@stablelib/random" "^1.0.2" + "@stablelib/wipe" "^1.0.1" + "@stablelib/x25519" "^1.0.3" + "@stablelib/xsalsa20" "^1.0.2" + +"@stablelib/pbkdf2@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@stablelib/pbkdf2/-/pbkdf2-1.0.1.tgz#ba4d4379385db3ca46fb48e504ff7933c451be1d" + integrity sha512-d5jwK6jW1DkMyzqY8D1Io+fRXcsUVr95lk5LKX9ghaUdAITTc1ZL0bff+R0IrwSixbHluxhnivG7vDw59AZ/Nw== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/hash" "^1.0.1" + "@stablelib/hmac" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + "@stablelib/poly1305@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/poly1305/-/poly1305-1.0.1.tgz#93bfb836c9384685d33d70080718deae4ddef1dc" @@ -2183,6 +2218,15 @@ "@stablelib/binary" "^1.0.1" "@stablelib/wipe" "^1.0.1" +"@stablelib/salsa20@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@stablelib/salsa20/-/salsa20-1.0.2.tgz#95177331f89a59d1c90f153f53265c925d4de138" + integrity sha512-nfjKzw0KTKrrKBasEP+j7UP4I8Xudom8lVZIBCp0kQNARXq72IlSic0oabg2FC1NU68L4RdHrNJDd8bFwrphYA== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/constant-time" "^1.0.1" + "@stablelib/wipe" "^1.0.1" + "@stablelib/sha256@1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@stablelib/sha256/-/sha256-1.0.1.tgz#77b6675b67f9b0ea081d2e31bda4866297a3ae4f" @@ -2215,6 +2259,15 @@ "@stablelib/random" "^1.0.2" "@stablelib/wipe" "^1.0.1" +"@stablelib/xsalsa20@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@stablelib/xsalsa20/-/xsalsa20-1.0.2.tgz#89efc22a7ba432880ef11d876fdeba13529ccdc4" + integrity sha512-7XdBGbcNgBShmuhDXv1G1WPVCkjZdkb1oPMzSidO7Fve0MHntH6TjFkj5bfLI+aRE+61weO076vYpP/jmaAYog== + dependencies: + "@stablelib/binary" "^1.0.1" + "@stablelib/salsa20" "^1.0.2" + "@stablelib/wipe" "^1.0.1" + "@stitches/react@1.2.7": version "1.2.7" resolved "https://registry.yarnpkg.com/@stitches/react/-/react-1.2.7.tgz#aea2403fac726db66d1740d29557e3910b1a1dc7" @@ -2225,6 +2278,94 @@ resolved "https://registry.yarnpkg.com/@substrate/ss58-registry/-/ss58-registry-1.34.0.tgz#b6faed02343da7a8956444f5db23bc7246dd5fb5" integrity sha512-8Df5usnWvjnw/WRAmKOqHXRPPRfiCd1kIN8ttH4YmBrRTERjVInsdu0xvLdbyUYKyvgK6zKhHWQfYohXqllHhg== +"@taquito/http-utils@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/http-utils/-/http-utils-15.1.0.tgz#66f3ce220c483e33d6b31bca6e0c76b5b895ed9b" + integrity sha512-Uug5hN0XvMlFFN+rxSMW+Y9Z8pw5uqHRDZC83eLOBSijbpMo+ScG/2nKkC8MUUrqLaLeHru1HD4kT5DHc1fI+A== + dependencies: + "@vespaiach/axios-fetch-adapter" "github:ecadlabs/axios-fetch-adapter" + axios "^0.26.0" + +"@taquito/local-forging@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/local-forging/-/local-forging-15.1.0.tgz#11404d4b90d4b1f4f6e3f7aa591e8227bf08e246" + integrity sha512-ib/2RqtxQQC9SjyTB9T5OSc5yUx9GUSdMOA4dmtiiFcN2+AG+aw7ixn6Hjt9Td8ZIOPt9H6HkyTypKrX7+cENw== + dependencies: + "@taquito/utils" "^15.1.0" + bignumber.js "^9.1.0" + +"@taquito/michel-codec@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/michel-codec/-/michel-codec-15.1.0.tgz#b4452757ff02c40b110ec5ecafad1f659e1de4e3" + integrity sha512-wKucIhs7vhaq5H+YSF2f6Qu9+g+QiEL6MPc5ROpxBrXJTeKSwBOEIpfqcKfkfMuecJyHZJW3glNfkpAVTCgkxg== + +"@taquito/michelson-encoder@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/michelson-encoder/-/michelson-encoder-15.1.0.tgz#1b3250445d4cc7e945e6a0ed9f8deaf209e62ada" + integrity sha512-uQMEu3g+8WcYb5ZV6+XGvoWJhKoNxU0F2RqodLJB7UxQ1rI/OMa+VlxSLMt4niIxpKXqnO9j4tD7Y4mPC3ufaA== + dependencies: + "@taquito/rpc" "^15.1.0" + "@taquito/utils" "^15.1.0" + bignumber.js "^9.1.0" + fast-json-stable-stringify "^2.1.0" + +"@taquito/rpc@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/rpc/-/rpc-15.1.0.tgz#47f973d1f7d15cb56a4095c7a2a4d1803c5181c7" + integrity sha512-OeQA8QwT+s6IUmLaF5yeWruPYzWi/DVCA3kl+AaQ8IFfCMzmAW/MszbbNkJSzHpY2p4jPBwdRNxg3qeJdL482A== + dependencies: + "@taquito/http-utils" "^15.1.0" + "@taquito/utils" "^15.1.0" + bignumber.js "^9.1.0" + +"@taquito/signer@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/signer/-/signer-15.1.0.tgz#0cb7bc9612e7f5ffbefc274f0aa6da27f5d755fd" + integrity sha512-VP7hS8cYQ6cMerVkbD5X3AqpoIXvh72xNuv3++R4reEjdl+E3VWs1CZZGnJj6yzlFV21SrdGKSILx8Rl3Ql4DA== + dependencies: + "@stablelib/blake2b" "^1.0.1" + "@stablelib/ed25519" "^1.0.3" + "@stablelib/hmac" "^1.0.1" + "@stablelib/nacl" "^1.0.4" + "@stablelib/pbkdf2" "^1.0.1" + "@stablelib/sha512" "^1.0.1" + "@taquito/taquito" "^15.1.0" + "@taquito/utils" "^15.1.0" + "@types/bn.js" "^5.1.1" + bip39 "^3.0.4" + elliptic "^6.5.4" + pbkdf2 "^3.1.2" + typedarray-to-buffer "^4.0.0" + +"@taquito/taquito@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/taquito/-/taquito-15.1.0.tgz#9a3340a8bcaa8bd6e9567776cea1c1659aafe5e9" + integrity sha512-2AXWeNoXsmMOSkJVXtXjOlJkS+hKXITaSybMA6nJuS1YWY4e7iAr678Y6UgVEHRJxeGohX4R4Ww12Ymr3Sfedg== + dependencies: + "@taquito/http-utils" "^15.1.0" + "@taquito/local-forging" "^15.1.0" + "@taquito/michel-codec" "^15.1.0" + "@taquito/michelson-encoder" "^15.1.0" + "@taquito/rpc" "^15.1.0" + "@taquito/utils" "^15.1.0" + bignumber.js "^9.1.0" + rxjs "^6.6.3" + +"@taquito/utils@^15.1.0": + version "15.1.0" + resolved "https://registry.yarnpkg.com/@taquito/utils/-/utils-15.1.0.tgz#c72f07c4fe369920620809a23808817db4b7a221" + integrity sha512-lqVThoFMmOKPg9jyREr4A63cpeckf5esCwOyOAW3sm+yCxD9s5khnBPtH8s52cRVnChFdwk/eqmADka9gat5hw== + dependencies: + "@stablelib/blake2b" "^1.0.1" + "@stablelib/ed25519" "^1.0.3" + "@types/bs58check" "^2.1.0" + bignumber.js "^9.1.0" + blakejs "^1.2.1" + bs58check "^2.1.2" + buffer "^6.0.3" + elliptic "^6.5.4" + typedarray-to-buffer "^4.0.0" + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -2252,6 +2393,13 @@ dependencies: "@types/node" "*" +"@types/bs58check@^2.1.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@types/bs58check/-/bs58check-2.1.0.tgz#7d25a8b88fe7a9e315d2647335ee3c43c8fdb0c0" + integrity sha512-OxsysnJQh82vy9DRbOcw9m2j/WiyqZLn0YBhKxdQ+aCwoHj+tWzyCgpwAkr79IfDXZKxc6h7k89T9pwS78CqTQ== + dependencies: + "@types/node" "*" + "@types/connect@^3.4.33": version "3.4.35" resolved "https://registry.yarnpkg.com/@types/connect/-/connect-3.4.35.tgz#5fcf6ae445e4021d1fc2219a4873cc73a3bb2ad1" @@ -2369,6 +2517,10 @@ "@typescript-eslint/types" "5.42.1" eslint-visitor-keys "^3.3.0" +"@vespaiach/axios-fetch-adapter@github:ecadlabs/axios-fetch-adapter": + version "0.3.1" + resolved "https://codeload.github.com/ecadlabs/axios-fetch-adapter/tar.gz/05cf8ba547aae387933939850231e8abaf323efe" + "@walletconnect/browser-utils@^1.8.0": version "1.8.0" resolved "https://registry.yarnpkg.com/@walletconnect/browser-utils/-/browser-utils-1.8.0.tgz#33c10e777aa6be86c713095b5206d63d32df0951" @@ -2885,7 +3037,7 @@ axe-core@^4.4.3: resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.5.1.tgz#04d561c11b6d76d096d34e9d14ba2c294fb20cdc" integrity sha512-1exVbW0X1O/HSr/WMwnaweyqcWOgZgLiVxdLG34pvSQk4NlYQr9OUy0JLwuhFfuVNQzzqgH57eYzkFBCb3bIsQ== -axios@^0.26.1: +axios@^0.26.0, axios@^0.26.1: version "0.26.1" resolved "https://registry.yarnpkg.com/axios/-/axios-0.26.1.tgz#1ede41c51fcf51bbbd6fd43669caaa4f0495aaa9" integrity sha512-fPwcX4EvnSHuInCMItEhAGnaSEXRBjtzh9fOtsE6E1G6p7vl7edEeZe11QHf18+6+9gR5PbKV/sGKNaD8YaMeA== @@ -2983,6 +3135,11 @@ bignumber.js@^9.0.1: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.0.tgz#8d340146107fe3a6cb8d40699643c302e8773b62" integrity sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A== +bignumber.js@^9.1.0: + version "9.1.1" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" + integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== + binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -3028,6 +3185,13 @@ bip39@^3.0.2, bip39@^3.0.3: pbkdf2 "^3.0.9" randombytes "^2.0.1" +bip39@^3.0.4: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bip39/-/bip39-3.1.0.tgz#c55a418deaf48826a6ceb34ac55b3ee1577e18a3" + integrity sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A== + dependencies: + "@noble/hashes" "^1.2.0" + bl@^4.0.3: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -3052,6 +3216,11 @@ blake2b@2.1.3: blake2b-wasm "^1.1.0" nanoassert "^1.0.0" +blakejs@^1.2.1: + version "1.2.1" + resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" + integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== + bn.js@4.11.8: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" @@ -3136,7 +3305,7 @@ bs58@^4.0.0, bs58@^4.0.1: dependencies: base-x "^3.0.2" -bs58check@<3.0.0, bs58check@^2.1.1: +bs58check@<3.0.0, bs58check@^2.1.1, bs58check@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/bs58check/-/bs58check-2.1.2.tgz#53b018291228d82a5aa08e7d796fdafda54aebfc" integrity sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA== @@ -3153,7 +3322,7 @@ buffer@6.0.1: base64-js "^1.3.1" ieee754 "^1.2.1" -buffer@6.0.3, buffer@~6.0.3: +buffer@6.0.3, buffer@^6.0.3, buffer@~6.0.3: version "6.0.3" resolved "https://registry.yarnpkg.com/buffer/-/buffer-6.0.3.tgz#2ace578459cc8fbe2a70aaa8f52ee63b6a74c6c6" integrity sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA== @@ -4044,7 +4213,7 @@ fast-glob@^3.2.9: merge2 "^1.3.0" micromatch "^4.0.4" -fast-json-stable-stringify@^2.0.0: +fast-json-stable-stringify@^2.0.0, fast-json-stable-stringify@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== @@ -5319,7 +5488,7 @@ pathval@^1.1.1: resolved "https://registry.yarnpkg.com/pathval/-/pathval-1.1.1.tgz#8534e77a77ce7ac5a2512ea21e0fdb8fcf6c3d8d" integrity sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ== -pbkdf2@^3.0.9: +pbkdf2@^3.0.9, pbkdf2@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== @@ -5740,6 +5909,13 @@ run-parallel@^1.1.9: dependencies: queue-microtask "^1.2.2" +rxjs@^6.6.3: + version "6.6.7" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz#90ac018acabf491bf65044235d5863c4dab804c9" + integrity sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ== + dependencies: + tslib "^1.9.0" + rxjs@^7.5.7: version "7.5.7" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39" @@ -6192,7 +6368,7 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@1.14.1, tslib@^1.8.1: +tslib@1.14.1, tslib@^1.8.1, tslib@^1.9.0: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== @@ -6245,6 +6421,11 @@ typedarray-to-buffer@3.1.5: dependencies: is-typedarray "^1.0.0" +typedarray-to-buffer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-4.0.0.tgz#cdd2933c61dd3f5f02eda5d012d441f95bfeb50a" + integrity sha512-6dOYeZfS3O9RtRD1caom0sMxgK59b27+IwoNy8RDPsmslSGOyU+mpTamlaIW7aNKi90ZQZ9DFaZL3YRoiSCULQ== + typeforce@^1.11.5: version "1.18.0" resolved "https://registry.yarnpkg.com/typeforce/-/typeforce-1.18.0.tgz#d7416a2c5845e085034d70fcc5b6cc4a90edbfdc"