@taquito/wallet-connect 20.2.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"taquito-wallet-connect.umd.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,103 @@
1
+ import { PermissionScopeMethods } from './types';
2
+ /**
3
+ * @category Error
4
+ * @description Error that indicates missing required permission scopes
5
+ */
6
+ export declare class MissingRequiredScope extends Error {
7
+ requiredScopes: PermissionScopeMethods | string;
8
+ name: string;
9
+ constructor(requiredScopes: PermissionScopeMethods | string);
10
+ }
11
+ /**
12
+ * @category Error
13
+ * @description Error that indicates the wallet returned an invalid namespace
14
+ */
15
+ export declare class InvalidReceivedSessionNamespace extends Error {
16
+ messageWc: string;
17
+ codeWc: number;
18
+ data?: (string | string[]) | undefined;
19
+ name: string;
20
+ constructor(messageWc: string, codeWc: number, type: 'invalid' | 'incomplete', data?: (string | string[]) | undefined);
21
+ }
22
+ /**
23
+ * @category Error
24
+ * @description Error that indicates an invalid session key being passed
25
+ */
26
+ export declare class InvalidSessionKey extends Error {
27
+ key: string;
28
+ name: string;
29
+ constructor(key: string);
30
+ }
31
+ /**
32
+ * @category Error
33
+ * @description Error that indicates the pkh is not part of the active accounts in the session
34
+ */
35
+ export declare class InvalidAccount extends Error {
36
+ pkh: string;
37
+ name: string;
38
+ constructor(pkh: string);
39
+ }
40
+ /**
41
+ * @category Error
42
+ * @description Error that indicates the network is not part of the active networks in the session
43
+ */
44
+ export declare class InvalidNetwork extends Error {
45
+ network: string;
46
+ name: string;
47
+ constructor(network: string);
48
+ }
49
+ /**
50
+ * @category Error
51
+ * @description Error that indicates the combinaison pkh-network is not part of the active session
52
+ */
53
+ export declare class InvalidNetworkOrAccount extends Error {
54
+ network: string;
55
+ pkh: string;
56
+ name: string;
57
+ constructor(network: string, pkh: string);
58
+ }
59
+ /**
60
+ * @category Error
61
+ * @description Error that indicates the connection could not be established
62
+ */
63
+ export declare class ConnectionFailed extends Error {
64
+ originalError: any;
65
+ name: string;
66
+ constructor(originalError: any);
67
+ }
68
+ /**
69
+ * @category Error
70
+ * @description Error that indicates there is no active session
71
+ */
72
+ export declare class NotConnected extends Error {
73
+ name: string;
74
+ constructor();
75
+ }
76
+ /**
77
+ * @category Error
78
+ * @description Error that indicates the active account is not specified
79
+ */
80
+ export declare class ActiveAccountUnspecified extends Error {
81
+ name: string;
82
+ constructor();
83
+ }
84
+ /**
85
+ * @category Error
86
+ * @description Error that indicates the active network is not specified
87
+ */
88
+ export declare class ActiveNetworkUnspecified extends Error {
89
+ name: string;
90
+ constructor();
91
+ }
92
+ /**
93
+ * @category Error
94
+ * @description Error that indicates the session is invalid
95
+ */
96
+ export declare class InvalidSession extends Error {
97
+ name: string;
98
+ constructor(message: string);
99
+ }
100
+ export declare class PublicKeyRetrievalError extends Error {
101
+ name: string;
102
+ constructor();
103
+ }
@@ -0,0 +1,147 @@
1
+ /**
2
+ * @packageDocumentation
3
+ * @module @taquito/wallet-connect
4
+ */
5
+ import Client from '@walletconnect/sign-client';
6
+ import { SignClientTypes, SessionTypes, PairingTypes } from '@walletconnect/types';
7
+ import { RPCDelegateOperation, RPCOriginationOperation, RPCTransferOperation, RPCTransferTicketOperation, RPCIncreasePaidStorageOperation, WalletDelegateParams, WalletOriginateParams, WalletProvider, WalletTransferParams, WalletTransferTicketParams, WalletStakeParams, WalletUnstakeParams, WalletFinalizeUnstakeParams, WalletIncreasePaidStorageParams } from '@taquito/taquito';
8
+ import { NetworkType, OperationParams, PermissionScopeParam } from './types';
9
+ export { SignClientTypes, PairingTypes };
10
+ export * from './errors';
11
+ export * from './types';
12
+ /**
13
+ * @description The `WalletConnect` class implements the `WalletProvider` interface, providing an alternative to `BeaconWallet`.
14
+ * This package enables dapps built with Taquito to connect to wallets via the WalletConnect/Reown protocol.
15
+ * @note Currently, a QR code is displayed to establish a connection with a wallet. As more Tezos wallets integrate with WalletConnect,
16
+ * we plan showing a list of available wallets alongside the QR code.
17
+ */
18
+ export declare class WalletConnect implements WalletProvider {
19
+ signClient: Client;
20
+ private session;
21
+ private activeAccount;
22
+ private activeNetwork;
23
+ constructor(signClient: Client);
24
+ /**
25
+ * @description Initialize a WalletConnect provider
26
+ * (Initialize a WalletConnect client with persisted storage and a network connection)
27
+ *
28
+ * @example
29
+ * ```
30
+ * await WalletConnect.init({
31
+ * projectId: "YOUR_PROJECT_ID", // can get YOUR_PROJECT_ID from [Reown Cloud](https://cloud.reown.com)
32
+ * metadata: {
33
+ * name: "YOUR_DAPP_NAME",
34
+ * description: "YOUR_DAPP_DESCRIPTION",
35
+ * icons: ["ICON_URL"],
36
+ * url: "DAPP_URL",
37
+ * },
38
+ * });
39
+ * ```
40
+ */
41
+ static init(initParams: SignClientTypes.Options): Promise<WalletConnect>;
42
+ /**
43
+ * @description Request permission for a new session and establish a connection.
44
+ *
45
+ * @param connectParams.permissionScope The networks, methods, and events that will be granted permission
46
+ * @param connectParams.pairingTopic Option to connect to an existing active pairing. If pairingTopic is defined, a prompt will appear in the corresponding wallet to accept or decline the session proposal. If no pairingTopic, a QR code modal will open in the dapp, allowing to connect to a wallet.
47
+ * @param connectParams.registryUrl Optional registry of wallet deep links to show in the Modal
48
+ * @error ConnectionFailed is thrown if no connection can be established with a wallet
49
+ */
50
+ requestPermissions(connectParams: {
51
+ permissionScope: PermissionScopeParam;
52
+ pairingTopic?: string;
53
+ registryUrl?: string;
54
+ }): Promise<void>;
55
+ /**
56
+ * @description Access all existing active pairings
57
+ */
58
+ getAvailablePairing(): PairingTypes.Struct[];
59
+ /**
60
+ * @description Access all existing sessions
61
+ * @return an array of strings which represent the session keys
62
+ */
63
+ getAllExistingSessionKeys(): string[];
64
+ /**
65
+ * @description Configure the Client with an existing session.
66
+ * The session is immediately restored without a prompt on the wallet to accept/decline it.
67
+ * @error InvalidSessionKey is thrown if the provided session key doesn't exist
68
+ */
69
+ configureWithExistingSessionKey(key: string): void;
70
+ disconnect(): Promise<void>;
71
+ getPeerMetadata(): import("@walletconnect/types").CoreTypes.Metadata;
72
+ /**
73
+ * @description Once the session is establish, send Tezos operations to be approved, signed and inject by the wallet.
74
+ * @error MissingRequiredScope is thrown if permission to send operation was not granted
75
+ */
76
+ sendOperations(params: OperationParams[]): Promise<string>;
77
+ /**
78
+ * @description Once the session is establish, send payload to be signed by the wallet.
79
+ * @error MissingRequiredScope is thrown if permission to sign payload was not granted
80
+ */
81
+ sign(bytes: string, watermark?: Uint8Array): Promise<string>;
82
+ /**
83
+ * @description Return all connected accounts from the active session
84
+ * @error NotConnected if no active session
85
+ */
86
+ getAccounts(): string[];
87
+ /**
88
+ * @description Set the active account.
89
+ * Must be called if there are multiple accounts in the session and every time the active account is switched
90
+ * @param pkh public key hash of the selected account
91
+ * @error InvalidAccount thrown if the pkh is not part of the active accounts in the session
92
+ */
93
+ setActiveAccount(pkh: string): void;
94
+ /**
95
+ * @description Access the public key hash of the active account
96
+ * @error ActiveAccountUnspecified thrown when there are multiple Tezos account in the session and none is set as the active one
97
+ */
98
+ getPKH(): Promise<string>;
99
+ /**
100
+ * @description Access the public key of the active account
101
+ * @error ActiveAccountUnspecified thrown when there are multiple Tezos account in the session and none is set as the active one
102
+ * @error MissingRequiredScope is thrown if permission to get accounts was not granted
103
+ * @error PublicKeyRetrievalError is thrown if the public key is not found
104
+ */
105
+ getPK(): Promise<string>;
106
+ /**
107
+ * @description Return all networks from the namespace of the active session
108
+ * @error NotConnected if no active session
109
+ */
110
+ getNetworks(): string[];
111
+ /**
112
+ * @description Set the active network.
113
+ * Must be called if there are multiple network in the session and every time the active network is switched
114
+ * @param network selected network
115
+ * @error InvalidNetwork thrown if the network is not part of the active networks in the session
116
+ */
117
+ setActiveNetwork(network: NetworkType): void;
118
+ /**
119
+ * @description Access the active network
120
+ * @error ActiveNetworkUnspecified thorwn when there are multiple Tezos netwroks in the session and none is set as the active one
121
+ */
122
+ getActiveNetwork(): string;
123
+ private setDefaultAccountAndNetwork;
124
+ private clearState;
125
+ getSession(): SessionTypes.Struct;
126
+ isActiveSession(): boolean;
127
+ ping(): void;
128
+ private validateReceivedNamespace;
129
+ private validateMethods;
130
+ private validateEvents;
131
+ private validateAccounts;
132
+ private getTezosNamespace;
133
+ private getTezosRequiredNamespace;
134
+ private validateNetworkAndAccount;
135
+ private getPermittedMethods;
136
+ private getPermittedNetwork;
137
+ private formatParameters;
138
+ private removeDefaultLimits;
139
+ mapTransferParamsToWalletParams(params: () => Promise<WalletTransferParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
140
+ mapTransferTicketParamsToWalletParams(params: () => Promise<WalletTransferTicketParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
141
+ mapStakeParamsToWalletParams(params: () => Promise<WalletStakeParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
142
+ mapUnstakeParamsToWalletParams(params: () => Promise<WalletUnstakeParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
143
+ mapFinalizeUnstakeParamsToWalletParams(params: () => Promise<WalletFinalizeUnstakeParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
144
+ mapOriginateParamsToWalletParams(params: () => Promise<WalletOriginateParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
145
+ mapDelegateParamsToWalletParams(params: () => Promise<WalletDelegateParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
146
+ mapIncreasePaidStorageWalletParams(params: () => Promise<WalletIncreasePaidStorageParams>): Promise<Partial<RPCTransferOperation> | Partial<RPCTransferTicketOperation> | Partial<RPCOriginationOperation> | Partial<RPCDelegateOperation> | Partial<RPCIncreasePaidStorageOperation>>;
147
+ }
@@ -0,0 +1,63 @@
1
+ import { RPCDelegateOperation, RPCRegisterGlobalConstantOperation, RPCOriginationOperation, RPCRevealOperation, RPCTransferOperation, RPCTransferTicketOperation, RPCIncreasePaidStorageOperation, RPCBallotOperation, RPCUpdateConsensusKeyOperation, RPCDrainDelegateOperation, RPCProposalsOperation, RPCSmartRollupAddMessagesOperation, RPCSmartRollupOriginateOperation, RPCSmartRollupOutboxMessageOperation, RPCFailingNoopOperation } from '@taquito/taquito';
2
+ export declare enum NetworkType {
3
+ MAINNET = "mainnet",
4
+ GHOSTNET = "ghostnet",
5
+ WEEKLYNET = "weeklynet",
6
+ OXFORDNET = "oxfordnet",
7
+ PARISNET = "parisnet"
8
+ }
9
+ export interface PermissionScopeParam {
10
+ networks: NetworkType[];
11
+ methods: PermissionScopeMethods[];
12
+ events?: PermissionScopeEvents[];
13
+ }
14
+ export declare enum PermissionScopeMethods {
15
+ TEZOS_GET_ACCOUNTS = "tezos_getAccounts",
16
+ TEZOS_SEND = "tezos_send",
17
+ TEZOS_SIGN = "tezos_sign"
18
+ }
19
+ export declare enum PermissionScopeEvents {
20
+ CHAIN_CHANGED = "chainChanged",
21
+ ACCOUNTS_CHANGED = "accountsChanged"
22
+ }
23
+ export declare enum SigningType {
24
+ RAW = "raw",
25
+ OPERATION = "operation",
26
+ MICHELINE = "micheline"
27
+ }
28
+ export interface TezosAccount {
29
+ algo: string;
30
+ address: string;
31
+ pubkey: string;
32
+ }
33
+ type WalletDefinedFields = 'source' | 'gas_limit' | 'storage_limit' | 'fee';
34
+ interface WalletOptionalFields {
35
+ gas_limit?: string;
36
+ storage_limit?: string;
37
+ fee?: string;
38
+ }
39
+ export interface TransferParams extends Omit<RPCTransferOperation, WalletDefinedFields>, WalletOptionalFields {
40
+ }
41
+ export interface OriginateParams extends Omit<RPCOriginationOperation, WalletDefinedFields>, WalletOptionalFields {
42
+ }
43
+ export interface RevealParams extends Omit<RPCRevealOperation, WalletDefinedFields>, WalletOptionalFields {
44
+ }
45
+ export interface DelegateParams extends Omit<RPCDelegateOperation, WalletDefinedFields>, WalletOptionalFields {
46
+ }
47
+ export interface RegisterGlobalConstantParams extends Omit<RPCRegisterGlobalConstantOperation, WalletDefinedFields>, WalletOptionalFields {
48
+ }
49
+ export interface TransferTicketParams extends Omit<RPCTransferTicketOperation, WalletDefinedFields>, WalletOptionalFields {
50
+ }
51
+ export interface IncreasePaidStorageParams extends Omit<RPCIncreasePaidStorageOperation, WalletDefinedFields>, WalletOptionalFields {
52
+ }
53
+ export interface UpdateConsensusKeyParams extends Omit<RPCUpdateConsensusKeyOperation, WalletDefinedFields>, WalletOptionalFields {
54
+ }
55
+ export type BallotParams = Omit<RPCBallotOperation, WalletDefinedFields>;
56
+ export type DrainDelegateParams = Omit<RPCDrainDelegateOperation, WalletDefinedFields>;
57
+ export type ProposalsParams = Omit<RPCProposalsOperation, WalletDefinedFields>;
58
+ export type SmartRollupAddMessagesParams = Omit<RPCSmartRollupAddMessagesOperation, WalletDefinedFields>;
59
+ export type SmartRollupOriginateParams = Omit<RPCSmartRollupOriginateOperation, WalletDefinedFields>;
60
+ export type SmartRollupExecuteOutboxMessageParams = Omit<RPCSmartRollupOutboxMessageOperation, WalletDefinedFields>;
61
+ export type FailingNoopParams = Omit<RPCFailingNoopOperation, WalletDefinedFields>;
62
+ export type OperationParams = TransferParams | BallotParams | IncreasePaidStorageParams | UpdateConsensusKeyParams | OriginateParams | RevealParams | DelegateParams | RegisterGlobalConstantParams | DrainDelegateParams | ProposalsParams | SmartRollupAddMessagesParams | SmartRollupOriginateParams | SmartRollupExecuteOutboxMessageParams | FailingNoopParams | TransferTicketParams;
63
+ export {};
@@ -0,0 +1,4 @@
1
+ export declare const VERSION: {
2
+ commitHash: string;
3
+ version: string;
4
+ };
package/package.json ADDED
@@ -0,0 +1,106 @@
1
+ {
2
+ "name": "@taquito/wallet-connect",
3
+ "version": "20.2.0-beta.0",
4
+ "description": "Walletconnect provider",
5
+ "keywords": [
6
+ "tezos",
7
+ "blockchain",
8
+ "websocket"
9
+ ],
10
+ "main": "dist/taquito-wallet-connect.umd.js",
11
+ "module": "dist/taquito-wallet-connect.es6.js",
12
+ "typings": "dist/types/taquito-wallet-connect.d.ts",
13
+ "files": [
14
+ "signature.json",
15
+ "dist"
16
+ ],
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "author": "Roxane Letourneau <roxane@ecadlabs.com>",
21
+ "repository": {
22
+ "type": "git",
23
+ "url": ""
24
+ },
25
+ "license": "Apache-2.0",
26
+ "engines": {
27
+ "node": ">=20"
28
+ },
29
+ "scripts": {
30
+ "test": "jest --coverage",
31
+ "test:watch": "jest --coverage --watch",
32
+ "test:prod": "npm run lint && npm run test -- --no-cache",
33
+ "lint": "eslint --ext .js,.ts .",
34
+ "precommit": "lint-staged",
35
+ "prebuild": "rimraf dist",
36
+ "version-stamp": "node ../taquito/version-stamping.js",
37
+ "build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts --bundleConfigAsCjs",
38
+ "start": "rollup -c rollup.config.ts --bundleConfigAsCjs -w"
39
+ },
40
+ "lint-staged": {
41
+ "{src,test}/**/*.ts": [
42
+ "prettier --write",
43
+ "eslint --fix"
44
+ ]
45
+ },
46
+ "jest": {
47
+ "transform": {
48
+ ".(ts|tsx)": "ts-jest"
49
+ },
50
+ "testEnvironment": "node",
51
+ "testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$",
52
+ "moduleFileExtensions": [
53
+ "ts",
54
+ "tsx",
55
+ "js"
56
+ ],
57
+ "moduleNameMapper": {
58
+ "^@taquito/taquito$": "<rootDir>/../taquito/src/taquito.ts"
59
+ },
60
+ "coveragePathIgnorePatterns": [
61
+ "/node_modules/",
62
+ "/test/"
63
+ ],
64
+ "collectCoverageFrom": [
65
+ "src/**/*.{js,ts}"
66
+ ]
67
+ },
68
+ "dependencies": {
69
+ "@taquito/taquito": "^20.2.0-beta.0",
70
+ "@walletconnect/legacy-modal": "^2.0.0",
71
+ "@walletconnect/sign-client": "^2.16.2",
72
+ "@walletconnect/types": "^2.16.2",
73
+ "@walletconnect/utils": "^2.16.2"
74
+ },
75
+ "devDependencies": {
76
+ "@types/bluebird": "^3.5.42",
77
+ "@types/chrome": "0.0.171",
78
+ "@types/jest": "^29.5.12",
79
+ "@types/node": "^22",
80
+ "@types/pino": "^7.0.5",
81
+ "@types/ws": "^8.5.12",
82
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
83
+ "@typescript-eslint/parser": "^6.21.0",
84
+ "colors": "^1.4.0",
85
+ "coveralls": "^3.1.1",
86
+ "cross-env": "^7.0.3",
87
+ "eslint": "^8.57.0",
88
+ "jest": "^29.7.0",
89
+ "jest-config": "^29.7.0",
90
+ "lint-staged": "^15.2.7",
91
+ "lodash.camelcase": "^4.3.0",
92
+ "prettier": "^3.3.3",
93
+ "prompt": "^1.3.0",
94
+ "replace-in-file": "^8.1.0",
95
+ "rimraf": "^6.0.1",
96
+ "rollup": "^4.19.1",
97
+ "rollup-plugin-json": "^4.0.0",
98
+ "rollup-plugin-typescript2": "^0.36.0",
99
+ "shelljs": "^0.8.5",
100
+ "ts-jest": "^29.2.3",
101
+ "ts-node": "^10.9.2",
102
+ "ts-toolbelt": "^9.6.0",
103
+ "typescript": "~5.5.4"
104
+ },
105
+ "gitHead": "de49571826b30682dd74d3ebc17a0e191128c617"
106
+ }