viem 0.0.1-alpha.1 → 0.0.1-alpha.11

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.
Files changed (40) hide show
  1. package/actions/package.json +1 -1
  2. package/chains/package.json +1 -1
  3. package/clients/package.json +1 -1
  4. package/dist/actions/index.d.ts +6 -6
  5. package/dist/actions/index.js +125 -123
  6. package/dist/actions/index.mjs +125 -0
  7. package/dist/chains.d.ts +651 -21
  8. package/dist/chains.js +76 -75
  9. package/dist/chains.mjs +134 -0
  10. package/dist/chunk-35OJIFIW.js +2619 -0
  11. package/dist/{chunk-Z6LRV6XI.js → chunk-DY4MSK2M.mjs} +1052 -411
  12. package/dist/chunk-GXCYE2PD.js +258 -0
  13. package/dist/{chunk-LLYFXUSV.js → chunk-JXGK2LUM.mjs} +184 -198
  14. package/dist/chunk-PEAG3TIC.js +1084 -0
  15. package/dist/{chunk-OQTFTQTO.js → chunk-TP542F7H.mjs} +44 -63
  16. package/dist/clients/index.d.ts +5 -6
  17. package/dist/clients/index.js +23 -25
  18. package/dist/clients/index.mjs +23 -0
  19. package/dist/{createWalletClient-915223f3.d.ts → createWalletClient-3f9fa8b6.d.ts} +1 -1
  20. package/dist/{eip1193-8f7c22ce.d.ts → eip1193-c001fcd5.d.ts} +3 -3
  21. package/dist/index.d.ts +341 -10
  22. package/dist/index.js +374 -290
  23. package/dist/index.mjs +374 -0
  24. package/dist/{parseGwei-bbc055e4.d.ts → parseGwei-7c87ff41.d.ts} +70 -118
  25. package/dist/{rpc-3c0e3985.d.ts → rpc-26932bae.d.ts} +1 -38
  26. package/dist/{rpc-655c0ba4.d.ts → rpc-b77c5aee.d.ts} +1 -1
  27. package/dist/transactionRequest-08d30731.d.ts +132 -0
  28. package/dist/utils/index.d.ts +41 -7
  29. package/dist/utils/index.js +148 -154
  30. package/dist/utils/index.mjs +148 -0
  31. package/dist/{watchAsset-04ab8db5.d.ts → watchAsset-43255bfd.d.ts} +17 -16
  32. package/dist/{webSocket-c6e0d26f.d.ts → webSocket-3385e295.d.ts} +4 -9
  33. package/dist/window.d.ts +2 -2
  34. package/dist/window.js +1 -0
  35. package/dist/window.mjs +0 -0
  36. package/package.json +9 -62
  37. package/utils/package.json +1 -1
  38. package/window/package.json +1 -1
  39. package/dist/BaseError-7688f84e.d.ts +0 -18
  40. package/dist/transactionRequest-ade896ac.d.ts +0 -44
package/dist/chains.js CHANGED
@@ -1,31 +1,31 @@
1
- import {
2
- formatBlock,
3
- formatTransaction,
4
- formatTransactionReceipt,
5
- formatTransactionRequest
6
- } from "./chunk-Z6LRV6XI.js";
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+
5
+
6
+ var _chunk35OJIFIWjs = require('./chunk-35OJIFIW.js');
7
7
 
8
8
  // src/chains.ts
9
- import {
10
- arbitrumGoerli as arbitrumGoerli_,
11
- arbitrum as arbitrum_,
12
- avalancheFuji as avalancheFuji_,
13
- avalanche as avalanche_,
14
- bscTestnet as bscTestnet_,
15
- bsc as bsc_,
16
- fantomTestnet as fantomTestnet_,
17
- fantom as fantom_,
18
- foundry as foundry_,
19
- goerli as goerli_,
20
- hardhat as hardhat_,
21
- localhost as localhost_,
22
- mainnet as mainnet_,
23
- optimismGoerli as optimismGoerli_,
24
- optimism as optimism_,
25
- polygonMumbai as polygonMumbai_,
26
- polygon as polygon_,
27
- sepolia as sepolia_
28
- } from "@wagmi/chains";
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+
24
+
25
+
26
+
27
+
28
+ var _chains = require('@wagmi/chains');
29
29
  function defineChain(chain) {
30
30
  return chain;
31
31
  }
@@ -44,30 +44,31 @@ function defineFormatter({
44
44
  }
45
45
  return {
46
46
  ...formatted,
47
- ...formatOverride?.(data)
47
+ ..._optionalChain([formatOverride, 'optionalCall', _ => _(data)])
48
48
  };
49
49
  };
50
50
  }
51
- var defineBlock = defineFormatter({ format: formatBlock });
52
- var defineTransaction = defineFormatter({ format: formatTransaction });
51
+ var defineBlock = defineFormatter({ format: _chunk35OJIFIWjs.formatBlock });
52
+ var defineTransaction = defineFormatter({ format: _chunk35OJIFIWjs.formatTransaction });
53
53
  var defineTransactionRequest = defineFormatter({
54
- format: formatTransactionRequest
54
+ format: _chunk35OJIFIWjs.formatTransactionRequest
55
55
  });
56
56
  var defineTransactionReceipt = defineFormatter({
57
- format: formatTransactionReceipt
57
+ format: _chunk35OJIFIWjs.formatTransactionReceipt
58
58
  });
59
- var arbitrumGoerli = defineChain(arbitrumGoerli_);
60
- var arbitrum = defineChain(arbitrum_);
61
- var avalancheFuji = defineChain(avalancheFuji_);
62
- var avalanche = defineChain(avalanche_);
63
- var bscTestnet = defineChain(bscTestnet_);
64
- var bsc = defineChain(bsc_);
59
+ var arbitrumGoerli = defineChain(_chains.arbitrumGoerli);
60
+ var arbitrum = defineChain(_chains.arbitrum);
61
+ var avalancheFuji = defineChain(_chains.avalancheFuji);
62
+ var avalanche = defineChain(_chains.avalanche);
63
+ var bscTestnet = defineChain(_chains.bscTestnet);
64
+ var bsc = defineChain(_chains.bsc);
65
65
  var celo = defineChain({
66
66
  id: 42220,
67
67
  name: "Celo",
68
68
  network: "celo",
69
69
  nativeCurrency: { name: "Celo", symbol: "CELO", decimals: 18 },
70
70
  rpcUrls: {
71
+ public: { http: ["https://rpc.ankr.com/celo"] },
71
72
  default: { http: ["https://rpc.ankr.com/celo"] }
72
73
  },
73
74
  formatters: {
@@ -93,41 +94,41 @@ var celo = defineChain({
93
94
  })
94
95
  }
95
96
  });
96
- var fantomTestnet = defineChain(fantomTestnet_);
97
- var fantom = defineChain(fantom_);
98
- var foundry = defineChain(foundry_);
99
- var goerli = defineChain(goerli_);
100
- var hardhat = defineChain(hardhat_);
101
- var localhost = defineChain(localhost_);
102
- var mainnet = defineChain(mainnet_);
103
- var optimismGoerli = defineChain(optimismGoerli_);
104
- var optimism = defineChain(optimism_);
105
- var polygonMumbai = defineChain(polygonMumbai_);
106
- var polygon = defineChain(polygon_);
107
- var sepolia = defineChain(sepolia_);
108
- export {
109
- arbitrum,
110
- arbitrumGoerli,
111
- avalanche,
112
- avalancheFuji,
113
- bsc,
114
- bscTestnet,
115
- celo,
116
- defineBlock,
117
- defineChain,
118
- defineTransaction,
119
- defineTransactionReceipt,
120
- defineTransactionRequest,
121
- fantom,
122
- fantomTestnet,
123
- foundry,
124
- goerli,
125
- hardhat,
126
- localhost,
127
- mainnet,
128
- optimism,
129
- optimismGoerli,
130
- polygon,
131
- polygonMumbai,
132
- sepolia
133
- };
97
+ var fantomTestnet = defineChain(_chains.fantomTestnet);
98
+ var fantom = defineChain(_chains.fantom);
99
+ var foundry = defineChain(_chains.foundry);
100
+ var goerli = defineChain(_chains.goerli);
101
+ var hardhat = defineChain(_chains.hardhat);
102
+ var localhost = defineChain(_chains.localhost);
103
+ var mainnet = defineChain(_chains.mainnet);
104
+ var optimismGoerli = defineChain(_chains.optimismGoerli);
105
+ var optimism = defineChain(_chains.optimism);
106
+ var polygonMumbai = defineChain(_chains.polygonMumbai);
107
+ var polygon = defineChain(_chains.polygon);
108
+ var sepolia = defineChain(_chains.sepolia);
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+ exports.arbitrum = arbitrum; exports.arbitrumGoerli = arbitrumGoerli; exports.avalanche = avalanche; exports.avalancheFuji = avalancheFuji; exports.bsc = bsc; exports.bscTestnet = bscTestnet; exports.celo = celo; exports.defineBlock = defineBlock; exports.defineChain = defineChain; exports.defineTransaction = defineTransaction; exports.defineTransactionReceipt = defineTransactionReceipt; exports.defineTransactionRequest = defineTransactionRequest; exports.fantom = fantom; exports.fantomTestnet = fantomTestnet; exports.foundry = foundry; exports.goerli = goerli; exports.hardhat = hardhat; exports.localhost = localhost; exports.mainnet = mainnet; exports.optimism = optimism; exports.optimismGoerli = optimismGoerli; exports.polygon = polygon; exports.polygonMumbai = polygonMumbai; exports.sepolia = sepolia;
@@ -0,0 +1,134 @@
1
+ import {
2
+ formatBlock,
3
+ formatTransaction,
4
+ formatTransactionReceipt,
5
+ formatTransactionRequest
6
+ } from "./chunk-DY4MSK2M.mjs";
7
+
8
+ // src/chains.ts
9
+ import {
10
+ arbitrumGoerli as arbitrumGoerli_,
11
+ arbitrum as arbitrum_,
12
+ avalancheFuji as avalancheFuji_,
13
+ avalanche as avalanche_,
14
+ bscTestnet as bscTestnet_,
15
+ bsc as bsc_,
16
+ fantomTestnet as fantomTestnet_,
17
+ fantom as fantom_,
18
+ foundry as foundry_,
19
+ goerli as goerli_,
20
+ hardhat as hardhat_,
21
+ localhost as localhost_,
22
+ mainnet as mainnet_,
23
+ optimismGoerli as optimismGoerli_,
24
+ optimism as optimism_,
25
+ polygonMumbai as polygonMumbai_,
26
+ polygon as polygon_,
27
+ sepolia as sepolia_
28
+ } from "@wagmi/chains";
29
+ function defineChain(chain) {
30
+ return chain;
31
+ }
32
+ function defineFormatter({
33
+ format
34
+ }) {
35
+ return ({
36
+ exclude,
37
+ format: formatOverride
38
+ }) => (data) => {
39
+ const formatted = format(data);
40
+ if (exclude) {
41
+ for (const key of exclude) {
42
+ delete formatted[key];
43
+ }
44
+ }
45
+ return {
46
+ ...formatted,
47
+ ...formatOverride?.(data)
48
+ };
49
+ };
50
+ }
51
+ var defineBlock = defineFormatter({ format: formatBlock });
52
+ var defineTransaction = defineFormatter({ format: formatTransaction });
53
+ var defineTransactionRequest = defineFormatter({
54
+ format: formatTransactionRequest
55
+ });
56
+ var defineTransactionReceipt = defineFormatter({
57
+ format: formatTransactionReceipt
58
+ });
59
+ var arbitrumGoerli = defineChain(arbitrumGoerli_);
60
+ var arbitrum = defineChain(arbitrum_);
61
+ var avalancheFuji = defineChain(avalancheFuji_);
62
+ var avalanche = defineChain(avalanche_);
63
+ var bscTestnet = defineChain(bscTestnet_);
64
+ var bsc = defineChain(bsc_);
65
+ var celo = defineChain({
66
+ id: 42220,
67
+ name: "Celo",
68
+ network: "celo",
69
+ nativeCurrency: { name: "Celo", symbol: "CELO", decimals: 18 },
70
+ rpcUrls: {
71
+ public: { http: ["https://rpc.ankr.com/celo"] },
72
+ default: { http: ["https://rpc.ankr.com/celo"] }
73
+ },
74
+ formatters: {
75
+ block: defineBlock({
76
+ exclude: ["difficulty", "gasLimit", "mixHash", "nonce", "uncles"],
77
+ format: (block) => ({
78
+ randomness: block.randomness
79
+ })
80
+ }),
81
+ transaction: defineTransaction({
82
+ format: (transaction) => ({
83
+ feeCurrency: transaction.feeCurrency,
84
+ gatewayFee: transaction.gatewayFee ? BigInt(transaction.gatewayFee) : null,
85
+ gatewayFeeRecipient: transaction.gatewayFeeRecipient
86
+ })
87
+ }),
88
+ transactionRequest: defineTransactionRequest({
89
+ format: (transactionRequest) => ({
90
+ feeCurrency: transactionRequest.feeCurrency,
91
+ gatewayFee: transactionRequest.gatewayFee,
92
+ gatewayFeeRecipient: transactionRequest.gatewayFeeRecipient
93
+ })
94
+ })
95
+ }
96
+ });
97
+ var fantomTestnet = defineChain(fantomTestnet_);
98
+ var fantom = defineChain(fantom_);
99
+ var foundry = defineChain(foundry_);
100
+ var goerli = defineChain(goerli_);
101
+ var hardhat = defineChain(hardhat_);
102
+ var localhost = defineChain(localhost_);
103
+ var mainnet = defineChain(mainnet_);
104
+ var optimismGoerli = defineChain(optimismGoerli_);
105
+ var optimism = defineChain(optimism_);
106
+ var polygonMumbai = defineChain(polygonMumbai_);
107
+ var polygon = defineChain(polygon_);
108
+ var sepolia = defineChain(sepolia_);
109
+ export {
110
+ arbitrum,
111
+ arbitrumGoerli,
112
+ avalanche,
113
+ avalancheFuji,
114
+ bsc,
115
+ bscTestnet,
116
+ celo,
117
+ defineBlock,
118
+ defineChain,
119
+ defineTransaction,
120
+ defineTransactionReceipt,
121
+ defineTransactionRequest,
122
+ fantom,
123
+ fantomTestnet,
124
+ foundry,
125
+ goerli,
126
+ hardhat,
127
+ localhost,
128
+ mainnet,
129
+ optimism,
130
+ optimismGoerli,
131
+ polygon,
132
+ polygonMumbai,
133
+ sepolia
134
+ };