-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: revived @taquiot/wallet-connect-2 package
- Loading branch information
1 parent
903169d
commit e0cb854
Showing
14 changed files
with
2,968 additions
and
127 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
{ | ||
"name": "@taquito/wallet-connect-2", | ||
"version": "20.0.1", | ||
"description": "Wallet connect 2 provider", | ||
"keywords": [ | ||
"tezos", | ||
"blockchain", | ||
"websocket" | ||
], | ||
"main": "dist/taquito-wallet-connect-2.umd.js", | ||
"module": "dist/taquito-wallet-connect-2.es6.js", | ||
"typings": "dist/types/taquito-wallet-connect-2.d.ts", | ||
"files": [ | ||
"signature.json", | ||
"dist" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"author": "Roxane Letourneau <[email protected]>", | ||
"repository": { | ||
"type": "git", | ||
"url": "" | ||
}, | ||
"license": "Apache-2.0", | ||
"engines": { | ||
"node": ">=20" | ||
}, | ||
"scripts": { | ||
"test": "jest --coverage", | ||
"test:watch": "jest --coverage --watch", | ||
"test:prod": "npm run lint && npm run test -- --no-cache", | ||
"lint": "eslint --ext .js,.ts .", | ||
"precommit": "lint-staged", | ||
"prebuild": "rimraf dist", | ||
"version-stamp": "node ../taquito/version-stamping.js", | ||
"build": "tsc --project ./tsconfig.prod.json --module commonjs && rollup -c rollup.config.ts --bundleConfigAsCjs", | ||
"start": "rollup -c rollup.config.ts --bundleConfigAsCjs -w" | ||
}, | ||
"lint-staged": { | ||
"{src,test}/**/*.ts": [ | ||
"prettier --write", | ||
"eslint --fix" | ||
] | ||
}, | ||
"jest": { | ||
"transform": { | ||
".(ts|tsx)": "ts-jest" | ||
}, | ||
"testEnvironment": "node", | ||
"testRegex": "(/__tests__/.*|\\.(test|spec))\\.(ts|tsx|js)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js" | ||
], | ||
"moduleNameMapper": { | ||
"^@taquito/taquito$": "<rootDir>/../taquito/src/taquito.ts" | ||
}, | ||
"coveragePathIgnorePatterns": [ | ||
"/node_modules/", | ||
"/test/" | ||
], | ||
"collectCoverageFrom": [ | ||
"src/**/*.{js,ts}" | ||
] | ||
}, | ||
"dependencies": { | ||
"@taquito/taquito": "^20.0.1", | ||
"@walletconnect/legacy-modal": "^2.0.0", | ||
"@walletconnect/sign-client": "^2.16.1", | ||
"@walletconnect/types": "^2.16.1", | ||
"@walletconnect/utils": "^2.16.1" | ||
}, | ||
"devDependencies": { | ||
"@types/bluebird": "^3.5.42", | ||
"@types/chrome": "0.0.171", | ||
"@types/jest": "^29.5.12", | ||
"@types/node": "^22", | ||
"@types/pino": "^7.0.5", | ||
"@types/ws": "^8.5.12", | ||
"@typescript-eslint/eslint-plugin": "^6.21.0", | ||
"@typescript-eslint/parser": "^6.21.0", | ||
"colors": "^1.4.0", | ||
"coveralls": "^3.1.1", | ||
"cross-env": "^7.0.3", | ||
"eslint": "^8.57.0", | ||
"jest": "^29.7.0", | ||
"jest-config": "^29.7.0", | ||
"lint-staged": "^15.2.7", | ||
"lodash.camelcase": "^4.3.0", | ||
"prettier": "^3.3.3", | ||
"prompt": "^1.3.0", | ||
"replace-in-file": "^8.1.0", | ||
"rimraf": "^6.0.1", | ||
"rollup": "^4.19.1", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-typescript2": "^0.36.0", | ||
"shelljs": "^0.8.5", | ||
"ts-jest": "^29.2.3", | ||
"ts-node": "^10.9.2", | ||
"ts-toolbelt": "^9.6.0", | ||
"typescript": "~5.5.4" | ||
}, | ||
"gitHead": "551e35aeff7d6dcde1c72284238c0ed3c3aae77e" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// import sourceMaps from 'rollup-plugin-sourcemaps'; | ||
import camelCase from 'lodash.camelcase'; | ||
import typescript from 'rollup-plugin-typescript2'; | ||
import json from 'rollup-plugin-json'; | ||
|
||
const pkg = require('./package.json'); | ||
|
||
const libraryName = 'taquito-wallet-connect-2'; | ||
|
||
export default { | ||
input: `src/${libraryName}.ts`, | ||
output: [ | ||
{ file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true }, | ||
{ file: pkg.module, format: 'es', sourcemap: true }, | ||
], | ||
// external: [], | ||
watch: { | ||
include: 'src/**', | ||
}, | ||
plugins: [ | ||
// Allow json resolution | ||
json(), | ||
// Compile TypeScript files | ||
typescript({ tsconfig: './tsconfig.prod.json', useTsconfigDeclarationDir: true }), | ||
|
||
// Resolve source maps to the original source | ||
// sourceMaps(), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
import { PermissionScopeMethods } from './types'; | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates missing required permission scopes | ||
*/ | ||
export class MissingRequiredScope extends Error { | ||
name = 'MissingRequiredScope'; | ||
|
||
constructor(public requiredScopes: PermissionScopeMethods | string) { | ||
super(`Required permission scope were not granted for "${requiredScopes}"`); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the wallet returned an invalid namespace | ||
*/ | ||
export class InvalidReceivedSessionNamespace extends Error { | ||
name = 'InvalidReceivedSessionNamespace'; | ||
|
||
constructor( | ||
public messageWc: string, | ||
public codeWc: number, | ||
type: 'invalid' | 'incomplete', | ||
public data?: string | string[] | ||
) { | ||
super(); | ||
const baseMessage = `${codeWc}: ${messageWc}.`; | ||
this.message = data | ||
? type === 'incomplete' | ||
? ` ${baseMessage} "${data}" is missing in the session namespace.` | ||
: ` ${baseMessage} "${data}" is invalid.` | ||
: baseMessage; | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates an invalid session key being passed | ||
*/ | ||
export class InvalidSessionKey extends Error { | ||
name = 'InvalidSessionKey'; | ||
|
||
constructor(public key: string) { | ||
super(`Invalid session key "${key}"`); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the pkh is not part of the active accounts in the session | ||
*/ | ||
export class InvalidAccount extends Error { | ||
name = 'InvalidAccount'; | ||
|
||
constructor(public pkh: string) { | ||
super(`Invalid pkh "${pkh}"`); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the network is not part of the active networks in the session | ||
*/ | ||
export class InvalidNetwork extends Error { | ||
name = 'InvalidNetwork'; | ||
|
||
constructor(public network: string) { | ||
super(`Invalid network "${network}"`); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the combinaison pkh-network is not part of the active session | ||
*/ | ||
export class InvalidNetworkOrAccount extends Error { | ||
name = 'InvalidNetworkOrAccount'; | ||
|
||
constructor( | ||
public network: string, | ||
public pkh: string | ||
) { | ||
super( | ||
`No permission. The combinaison "${network}" and "${pkh}" is not part of the active session.` | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the connection could not be established | ||
*/ | ||
export class ConnectionFailed extends Error { | ||
name = 'ConnectionFailed'; | ||
|
||
constructor(public originalError: any) { | ||
super(`Unable to connect`); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates there is no active session | ||
*/ | ||
export class NotConnected extends Error { | ||
name = 'NotConnected'; | ||
|
||
constructor() { | ||
super('Not connected, no active session'); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the active account is not specified | ||
*/ | ||
export class ActiveAccountUnspecified extends Error { | ||
name = 'ActiveAccountUnspecified'; | ||
|
||
constructor() { | ||
super('Please specify the active account using the "setActiveAccount" method.'); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the active network is not specified | ||
*/ | ||
export class ActiveNetworkUnspecified extends Error { | ||
name = 'ActiveNetworkUnspecified'; | ||
|
||
constructor() { | ||
super('Please specify the active network using the "setActiveNetwork" method.'); | ||
} | ||
} | ||
|
||
/** | ||
* @category Error | ||
* @description Error that indicates the session is invalid | ||
*/ | ||
export class InvalidSession extends Error { | ||
name = 'InvalidSession'; | ||
|
||
constructor(message: string) { | ||
super(message); | ||
} | ||
} |
Oops, something went wrong.