@0xkey-io/eip-1193-provider 0.1.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.
package/dist/utils.js ADDED
@@ -0,0 +1,110 @@
1
+ 'use strict';
2
+
3
+ var viem = require('viem');
4
+ var errors = require('./errors.js');
5
+
6
+ const DEV_ENVS = ["test", "development"];
7
+ const preprocessTransaction = ({ from, ...transaction }) => {
8
+ // Helper function to handle undefined values and conversion
9
+ const convertValue = (value, converter, defaultValue) => (value !== undefined ? converter(value) : defaultValue);
10
+ const typeMapping = {
11
+ "0x0": "legacy",
12
+ "0x1": "eip2930",
13
+ "0x2": "eip1559",
14
+ // TODO: enable these once ready
15
+ // "0x3": "eip4844",
16
+ // "0x4": "eip7702",
17
+ };
18
+ const processedTransaction = {
19
+ ...transaction,
20
+ // @ts-ignore
21
+ chainId: parseInt(transaction.chainId, 16),
22
+ type: (transaction.type && typeMapping[transaction.type]) || "eip1559",
23
+ maxPriorityFeePerGas: convertValue(transaction.maxPriorityFeePerGas, BigInt, 0n),
24
+ maxFeePerGas: convertValue(transaction.maxFeePerGas, BigInt, 0n),
25
+ gasPrice: convertValue(transaction.gasPrice, BigInt, 0n),
26
+ value: convertValue(transaction.value, BigInt, 0n),
27
+ nonce: convertValue(transaction.nonce, (value) => parseInt(value.toString(), 16), 0),
28
+ gas: convertValue(transaction.gas, BigInt, 0n),
29
+ };
30
+ const serializedTransaction = viem.serializeTransaction(processedTransaction);
31
+ return serializedTransaction.replace(/^0x/, "");
32
+ };
33
+ const isValidUrl = (url) => {
34
+ // Allow http URLs in non-production environments, https URLs in production
35
+ const protocolRegex = DEV_ENVS.includes(process.env.NODE_ENV ?? "")
36
+ ? /^https?:\/\//
37
+ : /^https:\/\//;
38
+ return protocolRegex.test(url);
39
+ };
40
+ /**
41
+ * Validates the array of RPC URLs provided in the AddEthereumChainParameter.
42
+ * It checks if the array is not empty and if every URL in the array starts with "https://".
43
+ * Throws an RpcUrlsRequiredError if the array is empty or undefined.
44
+ * Throws an InvalidRpcUrlError if any URL in the array does not start with "https://".
45
+ *
46
+ * @param {AddEthereumChainParameter['rpcUrls']} rpcUrls - The array of RPC URLs to validate.
47
+ * @throws {RpcUrlsRequiredError} If the rpcUrls array is empty or undefined.
48
+ * @throws {InvalidRpcUrlError} If any URL in the rpcUrls array is invalid.
49
+ */
50
+ const validateRpcUrls = (rpcUrls) => {
51
+ if (!rpcUrls || rpcUrls.length === 0) {
52
+ throw new errors.RpcUrlsRequiredError();
53
+ }
54
+ if (!rpcUrls.every(isValidUrl)) {
55
+ throw new errors.InvalidRpcUrlError();
56
+ }
57
+ };
58
+ const validateChain = (chain, addedChains) => {
59
+ const { rpcUrls, blockExplorerUrls, chainId, nativeCurrency } = chain;
60
+ if (addedChains.some((c) => c.chainId === chainId)) {
61
+ // Chain already added; return early
62
+ return;
63
+ }
64
+ let decimalChainId;
65
+ try {
66
+ decimalChainId = parseInt(chainId, 16);
67
+ // Ensure the chain ID is a 0x-prefixed hexadecimal string and can be parsed to an integer
68
+ if (!/^0x[0-9a-fA-F]+$/.test(chainId) || isNaN(decimalChainId)) {
69
+ throw new errors.InvalidChainIdFormatError(chainId);
70
+ }
71
+ }
72
+ catch (error) {
73
+ throw new errors.InvalidChainIdFormatError(chainId);
74
+ }
75
+ // Validate chain ID value is not greater than max safe integer value
76
+ if (decimalChainId > Number.MAX_SAFE_INTEGER) {
77
+ throw new errors.ChainIdValueExceedsError(chainId);
78
+ }
79
+ validateRpcUrls(rpcUrls);
80
+ // Validate RPC URLs
81
+ if (!rpcUrls || rpcUrls.length === 0 || !rpcUrls.every(isValidUrl)) {
82
+ throw new errors.InvalidRpcUrlError();
83
+ }
84
+ // Validate Block Explorer URLs
85
+ if (blockExplorerUrls &&
86
+ (!Array.isArray(blockExplorerUrls) ||
87
+ blockExplorerUrls.length === 0 ||
88
+ !blockExplorerUrls.every(isValidUrl))) {
89
+ throw new errors.BlockExplorerUrlError();
90
+ }
91
+ // Validate native currency symbol length
92
+ if (nativeCurrency &&
93
+ (nativeCurrency.symbol.length < 2 || nativeCurrency.symbol.length > 6)) {
94
+ throw new errors.NativeCurrencySymbolLengthError(nativeCurrency.symbol);
95
+ }
96
+ // Validate native currency symbol does not mismatch for a network the user already has added with the same chainId
97
+ const existingChain = addedChains.find((c) => c.chainId === chainId);
98
+ if (existingChain &&
99
+ existingChain.nativeCurrency &&
100
+ nativeCurrency &&
101
+ existingChain.nativeCurrency.symbol !== nativeCurrency.symbol) {
102
+ throw new errors.NativeCurrencySymbolMismatchError(nativeCurrency.symbol);
103
+ }
104
+ };
105
+
106
+ exports.isValidUrl = isValidUrl;
107
+ exports.preprocessTransaction = preprocessTransaction;
108
+ exports.validateChain = validateChain;
109
+ exports.validateRpcUrls = validateRpcUrls;
110
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":[null],"names":["serializeTransaction","RpcUrlsRequiredError","InvalidRpcUrlError","InvalidChainIdFormatError","ChainIdValueExceedsError","BlockExplorerUrlError","NativeCurrencySymbolLengthError","NativeCurrencySymbolMismatchError"],"mappings":";;;;;AAmBA,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC;AAEjC,MAAM,qBAAqB,GAAG,CAAC,EACpC,IAAI,EACJ,GAAG,WAAW,EACQ,KAAI;;IAE1B,MAAM,YAAY,GAAG,CACnB,KAAkC,EAClC,SAAwC,EACxC,YAAe,MACR,KAAK,KAAK,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC;AAE/D,IAAA,MAAM,WAAW,GAAuC;AACtD,QAAA,KAAK,EAAE,QAAQ;AACf,QAAA,KAAK,EAAE,SAAS;AAChB,QAAA,KAAK,EAAE,SAAS;;;;KAIjB;AAED,IAAA,MAAM,oBAAoB,GAA4B;AACpD,QAAA,GAAG,WAAW;;QAEd,OAAO,EAAE,QAAQ,CAAC,WAAW,CA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AACd,SAAC,cAAc,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EACtE;AACA,QAAA,MAAM,IAAIC,sCAA+B,CAAC,cAAc,CAAC,MAAM,CAAC;IAClE;;AAGA,IAAA,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;AACpE,IAAA,IACE,aAAa;AACb,QAAA,aAAa,CAAC,cAAc;QAC5B,cAAc;QACd,aAAa,CAAC,cAAc,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAC7D;AACA,QAAA,MAAM,IAAIC,wCAAiC,CAAC,cAAc,CAAC,MAAM,CAAC;IACpE;AACF;;;;;;;"}
package/dist/utils.mjs ADDED
@@ -0,0 +1,105 @@
1
+ import { serializeTransaction } from 'viem';
2
+ import { InvalidChainIdFormatError, ChainIdValueExceedsError, InvalidRpcUrlError, BlockExplorerUrlError, NativeCurrencySymbolLengthError, NativeCurrencySymbolMismatchError, RpcUrlsRequiredError } from './errors.mjs';
3
+
4
+ const DEV_ENVS = ["test", "development"];
5
+ const preprocessTransaction = ({ from, ...transaction }) => {
6
+ // Helper function to handle undefined values and conversion
7
+ const convertValue = (value, converter, defaultValue) => (value !== undefined ? converter(value) : defaultValue);
8
+ const typeMapping = {
9
+ "0x0": "legacy",
10
+ "0x1": "eip2930",
11
+ "0x2": "eip1559",
12
+ // TODO: enable these once ready
13
+ // "0x3": "eip4844",
14
+ // "0x4": "eip7702",
15
+ };
16
+ const processedTransaction = {
17
+ ...transaction,
18
+ // @ts-ignore
19
+ chainId: parseInt(transaction.chainId, 16),
20
+ type: (transaction.type && typeMapping[transaction.type]) || "eip1559",
21
+ maxPriorityFeePerGas: convertValue(transaction.maxPriorityFeePerGas, BigInt, 0n),
22
+ maxFeePerGas: convertValue(transaction.maxFeePerGas, BigInt, 0n),
23
+ gasPrice: convertValue(transaction.gasPrice, BigInt, 0n),
24
+ value: convertValue(transaction.value, BigInt, 0n),
25
+ nonce: convertValue(transaction.nonce, (value) => parseInt(value.toString(), 16), 0),
26
+ gas: convertValue(transaction.gas, BigInt, 0n),
27
+ };
28
+ const serializedTransaction = serializeTransaction(processedTransaction);
29
+ return serializedTransaction.replace(/^0x/, "");
30
+ };
31
+ const isValidUrl = (url) => {
32
+ // Allow http URLs in non-production environments, https URLs in production
33
+ const protocolRegex = DEV_ENVS.includes(process.env.NODE_ENV ?? "")
34
+ ? /^https?:\/\//
35
+ : /^https:\/\//;
36
+ return protocolRegex.test(url);
37
+ };
38
+ /**
39
+ * Validates the array of RPC URLs provided in the AddEthereumChainParameter.
40
+ * It checks if the array is not empty and if every URL in the array starts with "https://".
41
+ * Throws an RpcUrlsRequiredError if the array is empty or undefined.
42
+ * Throws an InvalidRpcUrlError if any URL in the array does not start with "https://".
43
+ *
44
+ * @param {AddEthereumChainParameter['rpcUrls']} rpcUrls - The array of RPC URLs to validate.
45
+ * @throws {RpcUrlsRequiredError} If the rpcUrls array is empty or undefined.
46
+ * @throws {InvalidRpcUrlError} If any URL in the rpcUrls array is invalid.
47
+ */
48
+ const validateRpcUrls = (rpcUrls) => {
49
+ if (!rpcUrls || rpcUrls.length === 0) {
50
+ throw new RpcUrlsRequiredError();
51
+ }
52
+ if (!rpcUrls.every(isValidUrl)) {
53
+ throw new InvalidRpcUrlError();
54
+ }
55
+ };
56
+ const validateChain = (chain, addedChains) => {
57
+ const { rpcUrls, blockExplorerUrls, chainId, nativeCurrency } = chain;
58
+ if (addedChains.some((c) => c.chainId === chainId)) {
59
+ // Chain already added; return early
60
+ return;
61
+ }
62
+ let decimalChainId;
63
+ try {
64
+ decimalChainId = parseInt(chainId, 16);
65
+ // Ensure the chain ID is a 0x-prefixed hexadecimal string and can be parsed to an integer
66
+ if (!/^0x[0-9a-fA-F]+$/.test(chainId) || isNaN(decimalChainId)) {
67
+ throw new InvalidChainIdFormatError(chainId);
68
+ }
69
+ }
70
+ catch (error) {
71
+ throw new InvalidChainIdFormatError(chainId);
72
+ }
73
+ // Validate chain ID value is not greater than max safe integer value
74
+ if (decimalChainId > Number.MAX_SAFE_INTEGER) {
75
+ throw new ChainIdValueExceedsError(chainId);
76
+ }
77
+ validateRpcUrls(rpcUrls);
78
+ // Validate RPC URLs
79
+ if (!rpcUrls || rpcUrls.length === 0 || !rpcUrls.every(isValidUrl)) {
80
+ throw new InvalidRpcUrlError();
81
+ }
82
+ // Validate Block Explorer URLs
83
+ if (blockExplorerUrls &&
84
+ (!Array.isArray(blockExplorerUrls) ||
85
+ blockExplorerUrls.length === 0 ||
86
+ !blockExplorerUrls.every(isValidUrl))) {
87
+ throw new BlockExplorerUrlError();
88
+ }
89
+ // Validate native currency symbol length
90
+ if (nativeCurrency &&
91
+ (nativeCurrency.symbol.length < 2 || nativeCurrency.symbol.length > 6)) {
92
+ throw new NativeCurrencySymbolLengthError(nativeCurrency.symbol);
93
+ }
94
+ // Validate native currency symbol does not mismatch for a network the user already has added with the same chainId
95
+ const existingChain = addedChains.find((c) => c.chainId === chainId);
96
+ if (existingChain &&
97
+ existingChain.nativeCurrency &&
98
+ nativeCurrency &&
99
+ existingChain.nativeCurrency.symbol !== nativeCurrency.symbol) {
100
+ throw new NativeCurrencySymbolMismatchError(nativeCurrency.symbol);
101
+ }
102
+ };
103
+
104
+ export { isValidUrl, preprocessTransaction, validateChain, validateRpcUrls };
105
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sources":["../src/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAmBA,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC;AAEjC,MAAM,qBAAqB,GAAG,CAAC,EACpC,IAAI,EACJ,GAAG,WAAW,EACQ,KAAI;;IAE1B,MAAM,YAAY,GAAG,CACnB,KAAkC,EAClC,SAAwC,EACxC,YAAe,MACR,KAAK,KAAK,SAAS,G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,kBAAkB,EAAE;IAChC;;AAGA,IAAA,IACE,iBAAiB;AACjB,SAAC,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;YAChC,iBAAiB,CAAC,MAAM,KAAK,CAAC;YAC9B,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,EACvC;QACA,MAAM,IAAI,qBAAqB,EAAE;IACnC;;AAGA,IAAA,IACE,cAAc;AACd,SAAC,cAAc,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,cAAc,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,EACtE;AACA,QAAA,MAAM,IAAI,+BAA+B,CAAC,cAAc,CAAC,MAAM,CAAC;IAClE;;AAGA,IAAA,MAAM,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,KAAK,OAAO,CAAC;AACpE,IAAA,IACE,aAAa;AACb,QAAA,aAAa,CAAC,cAAc;QAC5B,cAAc;QACd,aAAa,CAAC,cAAc,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,EAC7D;AACA,QAAA,MAAM,IAAI,iCAAiC,CAAC,cAAc,CAAC,MAAM,CAAC;IACpE;AACF;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare const VERSION = "@0xkey-io/eip-1193-provider@3.4.27";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,uCAAuC,CAAC"}
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ const VERSION = "@0xkey-io/eip-1193-provider@3.4.27";
4
+
5
+ exports.VERSION = VERSION;
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sources":["../src/version.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAO,MAAM,OAAO,GAAG;;;;"}
@@ -0,0 +1,4 @@
1
+ const VERSION = "@0xkey-io/eip-1193-provider@3.4.27";
2
+
3
+ export { VERSION };
4
+ //# sourceMappingURL=version.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.mjs","sources":["../src/version.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAO,MAAM,OAAO,GAAG;;;;"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@0xkey-io/eip-1193-provider",
3
+ "version": "0.1.0",
4
+ "main": "./dist/index.js",
5
+ "module": "./dist/index.mjs",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.mjs",
10
+ "require": "./dist/index.js",
11
+ "default": "./dist/index.mjs"
12
+ }
13
+ },
14
+ "types": "./dist/index.d.ts",
15
+ "license": "Apache-2.0",
16
+ "description": "EIP-1193 Provider for 0xkey.",
17
+ "keywords": [
18
+ "0xkey",
19
+ "EIP-1193",
20
+ "Ethereum",
21
+ "Ethereum Provider"
22
+ ],
23
+ "author": {
24
+ "name": "0xkey",
25
+ "url": "https://0xkey.com/"
26
+ },
27
+ "homepage": "https://github.com/0xkey-io/sdk-js/tree/main/packages/eip-1193-provider",
28
+ "bugs": {
29
+ "url": "https://github.com/0xkey-io/sdk-js/issues"
30
+ },
31
+ "repository": {
32
+ "type": "git",
33
+ "url": "git+https://github.com/0xkey-io/sdk-js.git",
34
+ "directory": "packages/eip-1193-provider"
35
+ },
36
+ "files": [
37
+ "dist/",
38
+ "CHANGELOG.md",
39
+ "README.md"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ },
44
+ "dependencies": {
45
+ "viem": "2.7.19",
46
+ "@0xkey-io/api-key-stamper": "0.1.0",
47
+ "@0xkey-io/http": "0.1.0",
48
+ "@0xkey-io/sdk-browser": "0.1.0",
49
+ "@0xkey-io/core": "0.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "hardhat": "^2.22.2",
53
+ "typescript": "5.4.3"
54
+ },
55
+ "scripts": {
56
+ "version": "node -p \"'export const VERSION = ' + JSON.stringify(require('./package.json').name + '@' + require('./package.json').version) + ';'\" > src/version.ts",
57
+ "build": "rollup -c",
58
+ "clean": "rimraf ./dist ./.cache",
59
+ "test": "jest",
60
+ "anvil": "anvil",
61
+ "typecheck": "tsc -p tsconfig.typecheck.json"
62
+ }
63
+ }