viem 0.2.0-jxom-local-accounts.20230321T212822 → 0.2.0-main.20230323T084936
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/abi.d.ts +3 -3
- package/dist/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/{chain-75b0942e.d.ts → chain-1b53ef88.d.ts} +48 -53
- package/dist/{chain-f8db473f.d.ts → chain-ec8c485d.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-NJSAEA2H.js → chunk-BHAAXXGO.js} +154 -461
- package/dist/chunk-BHAAXXGO.js.map +1 -0
- package/dist/{chunk-IVRML3IK.mjs → chunk-FOJL5WVL.mjs} +85 -392
- package/dist/chunk-FOJL5WVL.mjs.map +1 -0
- package/dist/{chunk-6UKHPIXX.mjs → chunk-R7WEI5MQ.mjs} +2 -2
- package/dist/chunk-R7WEI5MQ.mjs.map +1 -0
- package/dist/{chunk-LYQKHD7R.js → chunk-ZIT7BMZO.js} +19 -19
- package/dist/{chunk-LYQKHD7R.js.map → chunk-ZIT7BMZO.js.map} +1 -1
- package/dist/contract.d.ts +7 -9
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/{createClient-f87255c1.d.ts → createClient-a28317a9.d.ts} +6 -6
- package/dist/{createPublicClient-d2c37c92.d.ts → createPublicClient-75540130.d.ts} +206 -160
- package/dist/{eip1193-ae706fd8.d.ts → eip1193-4f4e240c.d.ts} +1 -1
- package/dist/{encodeFunctionResult-4792a6a3.d.ts → encodeFunctionResult-1f324375.d.ts} +1 -1
- package/dist/{encodePacked-3fcdd54b.d.ts → encodePacked-d5d5264a.d.ts} +1 -1
- package/dist/ens.d.ts +4 -6
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.d.ts +6 -5
- package/dist/ethers.js +5 -7
- package/dist/ethers.js.map +1 -1
- package/dist/ethers.mjs +5 -7
- package/dist/ethers.mjs.map +1 -1
- package/dist/{formatAbiItem-765ebc53.d.ts → formatAbiItem-15e8817d.d.ts} +1 -1
- package/dist/{getAbiItem-693e6e1b.d.ts → getAbiItem-3e809ff9.d.ts} +1 -1
- package/dist/index.d.ts +13 -15
- package/dist/index.js +91 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -13
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-377678bc.d.ts → parseGwei-6fff7cbe.d.ts} +13 -49
- package/dist/public.d.ts +4 -6
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/{test-98c0b642.d.ts → test-2bd23d7e.d.ts} +32 -33
- package/dist/test.d.ts +10 -10
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.d.ts +18 -30
- package/dist/utils/index.js +2 -10
- package/dist/utils/index.mjs +5 -13
- package/dist/wallet.d.ts +4 -6
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/dist/window.d.ts +2 -2
- package/package.json +1 -9
- package/accounts/package.json +0 -4
- package/dist/accounts/index.d.ts +0 -33
- package/dist/accounts/index.js +0 -89
- package/dist/accounts/index.js.map +0 -1
- package/dist/accounts/index.mjs +0 -89
- package/dist/accounts/index.mjs.map +0 -1
- package/dist/chunk-6UKHPIXX.mjs.map +0 -1
- package/dist/chunk-FNVFGFWN.mjs +0 -31
- package/dist/chunk-FNVFGFWN.mjs.map +0 -1
- package/dist/chunk-FQM5MF6U.js +0 -31
- package/dist/chunk-FQM5MF6U.js.map +0 -1
- package/dist/chunk-IVRML3IK.mjs.map +0 -1
- package/dist/chunk-NJSAEA2H.js.map +0 -1
- package/dist/parseAccount-2d7ea01d.d.ts +0 -6
- package/dist/typedData-ade018d6.d.ts +0 -93
package/dist/utils/index.js
CHANGED
@@ -105,11 +105,11 @@
|
|
105
105
|
|
106
106
|
|
107
107
|
|
108
|
+
var _chunkBHAAXXGOjs = require('../chunk-BHAAXXGO.js');
|
108
109
|
|
109
110
|
|
110
111
|
|
111
112
|
|
112
|
-
var _chunkNJSAEA2Hjs = require('../chunk-NJSAEA2H.js');
|
113
113
|
|
114
114
|
|
115
115
|
|
@@ -213,13 +213,5 @@ var _chunkNJSAEA2Hjs = require('../chunk-NJSAEA2H.js');
|
|
213
213
|
|
214
214
|
|
215
215
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
exports.arrayRegex = _chunkNJSAEA2Hjs.arrayRegex; exports.assertRequest = _chunkNJSAEA2Hjs.assertRequest; exports.boolToBytes = _chunkNJSAEA2Hjs.boolToBytes; exports.boolToHex = _chunkNJSAEA2Hjs.boolToHex; exports.buildRequest = _chunkNJSAEA2Hjs.buildRequest; exports.bytesRegex = _chunkNJSAEA2Hjs.bytesRegex; exports.bytesToBigint = _chunkNJSAEA2Hjs.bytesToBigint; exports.bytesToBool = _chunkNJSAEA2Hjs.bytesToBool; exports.bytesToHex = _chunkNJSAEA2Hjs.bytesToHex; exports.bytesToNumber = _chunkNJSAEA2Hjs.bytesToNumber; exports.bytesToString = _chunkNJSAEA2Hjs.bytesToString; exports.concat = _chunkNJSAEA2Hjs.concat; exports.concatBytes = _chunkNJSAEA2Hjs.concatBytes; exports.concatHex = _chunkNJSAEA2Hjs.concatHex; exports.containsNodeError = _chunkNJSAEA2Hjs.containsNodeError; exports.decodeAbiParameters = _chunkNJSAEA2Hjs.decodeAbiParameters; exports.decodeErrorResult = _chunkNJSAEA2Hjs.decodeErrorResult; exports.decodeEventLog = _chunkNJSAEA2Hjs.decodeEventLog; exports.decodeFunctionData = _chunkNJSAEA2Hjs.decodeFunctionData; exports.decodeFunctionResult = _chunkNJSAEA2Hjs.decodeFunctionResult; exports.defineBlock = _chunkNJSAEA2Hjs.defineBlock; exports.defineChain = _chunkNJSAEA2Hjs.defineChain; exports.defineFormatter = _chunkNJSAEA2Hjs.defineFormatter; exports.defineTransaction = _chunkNJSAEA2Hjs.defineTransaction; exports.defineTransactionReceipt = _chunkNJSAEA2Hjs.defineTransactionReceipt; exports.defineTransactionRequest = _chunkNJSAEA2Hjs.defineTransactionRequest; exports.encodeAbiParameters = _chunkNJSAEA2Hjs.encodeAbiParameters; exports.encodeDeployData = _chunkNJSAEA2Hjs.encodeDeployData; exports.encodeErrorResult = _chunkNJSAEA2Hjs.encodeErrorResult; exports.encodeEventTopics = _chunkNJSAEA2Hjs.encodeEventTopics; exports.encodeFunctionData = _chunkNJSAEA2Hjs.encodeFunctionData; exports.encodeFunctionResult = _chunkNJSAEA2Hjs.encodeFunctionResult; exports.encodePacked = _chunkNJSAEA2Hjs.encodePacked; exports.extract = _chunkNJSAEA2Hjs.extract; exports.extractFunctionName = _chunkNJSAEA2Hjs.extractFunctionName; exports.extractFunctionParams = _chunkNJSAEA2Hjs.extractFunctionParams; exports.extractFunctionParts = _chunkNJSAEA2Hjs.extractFunctionParts; exports.extractFunctionType = _chunkNJSAEA2Hjs.extractFunctionType; exports.format = _chunkNJSAEA2Hjs.format; exports.formatAbiItem = _chunkNJSAEA2Hjs.formatAbiItem; exports.formatAbiItemWithArgs = _chunkNJSAEA2Hjs.formatAbiItemWithArgs; exports.formatBlock = _chunkNJSAEA2Hjs.formatBlock; exports.formatEther = _chunkNJSAEA2Hjs.formatEther; exports.formatGwei = _chunkNJSAEA2Hjs.formatGwei; exports.formatTransaction = _chunkNJSAEA2Hjs.formatTransaction; exports.formatTransactionRequest = _chunkNJSAEA2Hjs.formatTransactionRequest; exports.formatUnits = _chunkNJSAEA2Hjs.formatUnits; exports.fromBytes = _chunkNJSAEA2Hjs.fromBytes; exports.fromHex = _chunkNJSAEA2Hjs.fromHex; exports.fromRlp = _chunkNJSAEA2Hjs.fromRlp; exports.getAbiItem = _chunkNJSAEA2Hjs.getAbiItem; exports.getAddress = _chunkNJSAEA2Hjs.getAddress; exports.getCallError = _chunkNJSAEA2Hjs.getCallError; exports.getChainContractAddress = _chunkNJSAEA2Hjs.getChainContractAddress; exports.getContractAddress = _chunkNJSAEA2Hjs.getContractAddress; exports.getContractError = _chunkNJSAEA2Hjs.getContractError; exports.getCreate2Address = _chunkNJSAEA2Hjs.getCreate2Address; exports.getCreateAddress = _chunkNJSAEA2Hjs.getCreateAddress; exports.getEstimateGasError = _chunkNJSAEA2Hjs.getEstimateGasError; exports.getEventSelector = _chunkNJSAEA2Hjs.getEventSelector; exports.getFunctionSelector = _chunkNJSAEA2Hjs.getFunctionSelector; exports.getNodeError = _chunkNJSAEA2Hjs.getNodeError; exports.getSocket = _chunkNJSAEA2Hjs.getSocket; exports.getTransactionError = _chunkNJSAEA2Hjs.getTransactionError; exports.hashMessage = _chunkNJSAEA2Hjs.hashMessage; exports.hashTypedData = _chunkNJSAEA2Hjs.hashTypedData; exports.hexToBigInt = _chunkNJSAEA2Hjs.hexToBigInt; exports.hexToBool = _chunkNJSAEA2Hjs.hexToBool; exports.hexToBytes = _chunkNJSAEA2Hjs.hexToBytes; exports.hexToNumber = _chunkNJSAEA2Hjs.hexToNumber; exports.hexToString = _chunkNJSAEA2Hjs.hexToString; exports.integerRegex = _chunkNJSAEA2Hjs.integerRegex; exports.isAddress = _chunkNJSAEA2Hjs.isAddress; exports.isAddressEqual = _chunkNJSAEA2Hjs.isAddressEqual; exports.isBytes = _chunkNJSAEA2Hjs.isBytes; exports.isHex = _chunkNJSAEA2Hjs.isHex; exports.keccak256 = _chunkNJSAEA2Hjs.keccak256; exports.numberToBytes = _chunkNJSAEA2Hjs.numberToBytes; exports.numberToHex = _chunkNJSAEA2Hjs.numberToHex; exports.pad = _chunkNJSAEA2Hjs.pad; exports.padBytes = _chunkNJSAEA2Hjs.padBytes; exports.padHex = _chunkNJSAEA2Hjs.padHex; exports.parseAbi = _chunkNJSAEA2Hjs.parseAbi; exports.parseAbiItem = _chunkNJSAEA2Hjs.parseAbiItem; exports.parseAbiParameter = _chunkNJSAEA2Hjs.parseAbiParameter; exports.parseAbiParameters = _chunkNJSAEA2Hjs.parseAbiParameters; exports.parseAccount = _chunkNJSAEA2Hjs.parseAccount; exports.parseEther = _chunkNJSAEA2Hjs.parseEther; exports.parseGwei = _chunkNJSAEA2Hjs.parseGwei; exports.parseUnits = _chunkNJSAEA2Hjs.parseUnits; exports.prepareRequest = _chunkNJSAEA2Hjs.prepareRequest; exports.recoverAddress = _chunkNJSAEA2Hjs.recoverAddress; exports.recoverMessageAddress = _chunkNJSAEA2Hjs.recoverMessageAddress; exports.recoverTypedDataAddress = _chunkNJSAEA2Hjs.recoverTypedDataAddress; exports.rpc = _chunkNJSAEA2Hjs.rpc; exports.size = _chunkNJSAEA2Hjs.size; exports.slice = _chunkNJSAEA2Hjs.slice; exports.sliceBytes = _chunkNJSAEA2Hjs.sliceBytes; exports.sliceHex = _chunkNJSAEA2Hjs.sliceHex; exports.stringToBytes = _chunkNJSAEA2Hjs.stringToBytes; exports.stringToHex = _chunkNJSAEA2Hjs.stringToHex; exports.stringify = _chunkNJSAEA2Hjs.stringify; exports.toBytes = _chunkNJSAEA2Hjs.toBytes; exports.toHex = _chunkNJSAEA2Hjs.toHex; exports.toRlp = _chunkNJSAEA2Hjs.toRlp; exports.transactionType = _chunkNJSAEA2Hjs.transactionType; exports.trim = _chunkNJSAEA2Hjs.trim; exports.validateTypedData = _chunkNJSAEA2Hjs.validateTypedData; exports.verifyMessage = _chunkNJSAEA2Hjs.verifyMessage; exports.verifyTypedData = _chunkNJSAEA2Hjs.verifyTypedData;
|
216
|
+
exports.arrayRegex = _chunkBHAAXXGOjs.arrayRegex; exports.assertRequest = _chunkBHAAXXGOjs.assertRequest; exports.boolToBytes = _chunkBHAAXXGOjs.boolToBytes; exports.boolToHex = _chunkBHAAXXGOjs.boolToHex; exports.buildRequest = _chunkBHAAXXGOjs.buildRequest; exports.bytesRegex = _chunkBHAAXXGOjs.bytesRegex; exports.bytesToBigint = _chunkBHAAXXGOjs.bytesToBigint; exports.bytesToBool = _chunkBHAAXXGOjs.bytesToBool; exports.bytesToHex = _chunkBHAAXXGOjs.bytesToHex; exports.bytesToNumber = _chunkBHAAXXGOjs.bytesToNumber; exports.bytesToString = _chunkBHAAXXGOjs.bytesToString; exports.concat = _chunkBHAAXXGOjs.concat; exports.concatBytes = _chunkBHAAXXGOjs.concatBytes; exports.concatHex = _chunkBHAAXXGOjs.concatHex; exports.containsNodeError = _chunkBHAAXXGOjs.containsNodeError; exports.decodeAbiParameters = _chunkBHAAXXGOjs.decodeAbiParameters; exports.decodeErrorResult = _chunkBHAAXXGOjs.decodeErrorResult; exports.decodeEventLog = _chunkBHAAXXGOjs.decodeEventLog; exports.decodeFunctionData = _chunkBHAAXXGOjs.decodeFunctionData; exports.decodeFunctionResult = _chunkBHAAXXGOjs.decodeFunctionResult; exports.defineBlock = _chunkBHAAXXGOjs.defineBlock; exports.defineChain = _chunkBHAAXXGOjs.defineChain; exports.defineFormatter = _chunkBHAAXXGOjs.defineFormatter; exports.defineTransaction = _chunkBHAAXXGOjs.defineTransaction; exports.defineTransactionReceipt = _chunkBHAAXXGOjs.defineTransactionReceipt; exports.defineTransactionRequest = _chunkBHAAXXGOjs.defineTransactionRequest; exports.encodeAbiParameters = _chunkBHAAXXGOjs.encodeAbiParameters; exports.encodeDeployData = _chunkBHAAXXGOjs.encodeDeployData; exports.encodeErrorResult = _chunkBHAAXXGOjs.encodeErrorResult; exports.encodeEventTopics = _chunkBHAAXXGOjs.encodeEventTopics; exports.encodeFunctionData = _chunkBHAAXXGOjs.encodeFunctionData; exports.encodeFunctionResult = _chunkBHAAXXGOjs.encodeFunctionResult; exports.encodePacked = _chunkBHAAXXGOjs.encodePacked; exports.extract = _chunkBHAAXXGOjs.extract; exports.extractFunctionName = _chunkBHAAXXGOjs.extractFunctionName; exports.extractFunctionParams = _chunkBHAAXXGOjs.extractFunctionParams; exports.extractFunctionParts = _chunkBHAAXXGOjs.extractFunctionParts; exports.extractFunctionType = _chunkBHAAXXGOjs.extractFunctionType; exports.format = _chunkBHAAXXGOjs.format; exports.formatAbiItem = _chunkBHAAXXGOjs.formatAbiItem; exports.formatAbiItemWithArgs = _chunkBHAAXXGOjs.formatAbiItemWithArgs; exports.formatBlock = _chunkBHAAXXGOjs.formatBlock; exports.formatEther = _chunkBHAAXXGOjs.formatEther; exports.formatGwei = _chunkBHAAXXGOjs.formatGwei; exports.formatTransaction = _chunkBHAAXXGOjs.formatTransaction; exports.formatTransactionRequest = _chunkBHAAXXGOjs.formatTransactionRequest; exports.formatUnits = _chunkBHAAXXGOjs.formatUnits; exports.fromBytes = _chunkBHAAXXGOjs.fromBytes; exports.fromHex = _chunkBHAAXXGOjs.fromHex; exports.fromRlp = _chunkBHAAXXGOjs.fromRlp; exports.getAbiItem = _chunkBHAAXXGOjs.getAbiItem; exports.getAccount = _chunkBHAAXXGOjs.getAccount; exports.getAddress = _chunkBHAAXXGOjs.getAddress; exports.getCallError = _chunkBHAAXXGOjs.getCallError; exports.getChainContractAddress = _chunkBHAAXXGOjs.getChainContractAddress; exports.getContractAddress = _chunkBHAAXXGOjs.getContractAddress; exports.getContractError = _chunkBHAAXXGOjs.getContractError; exports.getCreate2Address = _chunkBHAAXXGOjs.getCreate2Address; exports.getCreateAddress = _chunkBHAAXXGOjs.getCreateAddress; exports.getEstimateGasError = _chunkBHAAXXGOjs.getEstimateGasError; exports.getEventSelector = _chunkBHAAXXGOjs.getEventSelector; exports.getFunctionSelector = _chunkBHAAXXGOjs.getFunctionSelector; exports.getNodeError = _chunkBHAAXXGOjs.getNodeError; exports.getSocket = _chunkBHAAXXGOjs.getSocket; exports.getTransactionError = _chunkBHAAXXGOjs.getTransactionError; exports.hashMessage = _chunkBHAAXXGOjs.hashMessage; exports.hexToBigInt = _chunkBHAAXXGOjs.hexToBigInt; exports.hexToBool = _chunkBHAAXXGOjs.hexToBool; exports.hexToBytes = _chunkBHAAXXGOjs.hexToBytes; exports.hexToNumber = _chunkBHAAXXGOjs.hexToNumber; exports.hexToString = _chunkBHAAXXGOjs.hexToString; exports.integerRegex = _chunkBHAAXXGOjs.integerRegex; exports.isAddress = _chunkBHAAXXGOjs.isAddress; exports.isAddressEqual = _chunkBHAAXXGOjs.isAddressEqual; exports.isBytes = _chunkBHAAXXGOjs.isBytes; exports.isHex = _chunkBHAAXXGOjs.isHex; exports.keccak256 = _chunkBHAAXXGOjs.keccak256; exports.numberToBytes = _chunkBHAAXXGOjs.numberToBytes; exports.numberToHex = _chunkBHAAXXGOjs.numberToHex; exports.pad = _chunkBHAAXXGOjs.pad; exports.padBytes = _chunkBHAAXXGOjs.padBytes; exports.padHex = _chunkBHAAXXGOjs.padHex; exports.parseAbi = _chunkBHAAXXGOjs.parseAbi; exports.parseAbiItem = _chunkBHAAXXGOjs.parseAbiItem; exports.parseAbiParameter = _chunkBHAAXXGOjs.parseAbiParameter; exports.parseAbiParameters = _chunkBHAAXXGOjs.parseAbiParameters; exports.parseEther = _chunkBHAAXXGOjs.parseEther; exports.parseGwei = _chunkBHAAXXGOjs.parseGwei; exports.parseUnits = _chunkBHAAXXGOjs.parseUnits; exports.prepareRequest = _chunkBHAAXXGOjs.prepareRequest; exports.recoverAddress = _chunkBHAAXXGOjs.recoverAddress; exports.recoverMessageAddress = _chunkBHAAXXGOjs.recoverMessageAddress; exports.rpc = _chunkBHAAXXGOjs.rpc; exports.size = _chunkBHAAXXGOjs.size; exports.slice = _chunkBHAAXXGOjs.slice; exports.sliceBytes = _chunkBHAAXXGOjs.sliceBytes; exports.sliceHex = _chunkBHAAXXGOjs.sliceHex; exports.stringToBytes = _chunkBHAAXXGOjs.stringToBytes; exports.stringToHex = _chunkBHAAXXGOjs.stringToHex; exports.stringify = _chunkBHAAXXGOjs.stringify; exports.toBytes = _chunkBHAAXXGOjs.toBytes; exports.toHex = _chunkBHAAXXGOjs.toHex; exports.toRlp = _chunkBHAAXXGOjs.toRlp; exports.transactionType = _chunkBHAAXXGOjs.transactionType; exports.trim = _chunkBHAAXXGOjs.trim; exports.verifyMessage = _chunkBHAAXXGOjs.verifyMessage;
|
225
217
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.mjs
CHANGED
@@ -50,6 +50,7 @@ import {
|
|
50
50
|
fromHex,
|
51
51
|
fromRlp,
|
52
52
|
getAbiItem,
|
53
|
+
getAccount,
|
53
54
|
getAddress,
|
54
55
|
getCallError,
|
55
56
|
getChainContractAddress,
|
@@ -64,7 +65,6 @@ import {
|
|
64
65
|
getSocket,
|
65
66
|
getTransactionError,
|
66
67
|
hashMessage,
|
67
|
-
hashTypedData,
|
68
68
|
hexToBigInt,
|
69
69
|
hexToBool,
|
70
70
|
hexToBytes,
|
@@ -85,14 +85,12 @@ import {
|
|
85
85
|
parseAbiItem,
|
86
86
|
parseAbiParameter,
|
87
87
|
parseAbiParameters,
|
88
|
-
parseAccount,
|
89
88
|
parseEther,
|
90
89
|
parseGwei,
|
91
90
|
parseUnits,
|
92
91
|
prepareRequest,
|
93
92
|
recoverAddress,
|
94
93
|
recoverMessageAddress,
|
95
|
-
recoverTypedDataAddress,
|
96
94
|
rpc,
|
97
95
|
size,
|
98
96
|
slice,
|
@@ -106,10 +104,8 @@ import {
|
|
106
104
|
toRlp,
|
107
105
|
transactionType,
|
108
106
|
trim,
|
109
|
-
|
110
|
-
|
111
|
-
verifyTypedData
|
112
|
-
} from "../chunk-IVRML3IK.mjs";
|
107
|
+
verifyMessage
|
108
|
+
} from "../chunk-FOJL5WVL.mjs";
|
113
109
|
export {
|
114
110
|
arrayRegex,
|
115
111
|
assertRequest,
|
@@ -162,6 +158,7 @@ export {
|
|
162
158
|
fromHex,
|
163
159
|
fromRlp,
|
164
160
|
getAbiItem,
|
161
|
+
getAccount,
|
165
162
|
getAddress,
|
166
163
|
getCallError,
|
167
164
|
getChainContractAddress,
|
@@ -176,7 +173,6 @@ export {
|
|
176
173
|
getSocket,
|
177
174
|
getTransactionError,
|
178
175
|
hashMessage,
|
179
|
-
hashTypedData,
|
180
176
|
hexToBigInt,
|
181
177
|
hexToBool,
|
182
178
|
hexToBytes,
|
@@ -197,14 +193,12 @@ export {
|
|
197
193
|
parseAbiItem,
|
198
194
|
parseAbiParameter,
|
199
195
|
parseAbiParameters,
|
200
|
-
parseAccount,
|
201
196
|
parseEther,
|
202
197
|
parseGwei,
|
203
198
|
parseUnits,
|
204
199
|
prepareRequest,
|
205
200
|
recoverAddress,
|
206
201
|
recoverMessageAddress,
|
207
|
-
recoverTypedDataAddress,
|
208
202
|
rpc,
|
209
203
|
size,
|
210
204
|
slice,
|
@@ -218,8 +212,6 @@ export {
|
|
218
212
|
toRlp,
|
219
213
|
transactionType,
|
220
214
|
trim,
|
221
|
-
|
222
|
-
verifyMessage,
|
223
|
-
verifyTypedData
|
215
|
+
verifyMessage
|
224
216
|
};
|
225
217
|
//# sourceMappingURL=index.mjs.map
|
package/dist/wallet.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
|
-
export {
|
2
|
-
import './eip1193-
|
1
|
+
export { bk as AddChainParameters, bl as FormattedTransactionRequest, bn as GetAddressesReturnType, bm as GetPermissionsReturnType, bo as RequestAddressesReturnType, bp as RequestPermissionsReturnType, S as SendTransactionParameters, bq as SendTransactionReturnType, br as SignMessageParameters, bs as SignMessageReturnType, bt as SignTypedDataParameters, bu as SignTypedDataReturnType, bv as SwitchChainParameters, bw as WatchAssetParameters, bx as WatchAssetReturnType, ba as addChain, bb as getAddresses, bc as getPermissions, bd as requestAddresses, be as requestPermissions, bf as sendTransaction, bg as signMessage, bh as signTypedData, bi as switchChain, bj as watchAsset } from './createPublicClient-75540130.js';
|
2
|
+
import './eip1193-4f4e240c.js';
|
3
3
|
import 'abitype';
|
4
|
-
import './chain-
|
4
|
+
import './chain-1b53ef88.js';
|
5
5
|
import '@wagmi/chains';
|
6
|
-
import './createClient-
|
7
|
-
import './typedData-ade018d6.js';
|
8
|
-
import '@scure/bip32';
|
6
|
+
import './createClient-a28317a9.js';
|
package/dist/wallet.js
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
-
var
|
12
|
+
var _chunkBHAAXXGOjs = require('./chunk-BHAAXXGO.js');
|
13
13
|
|
14
14
|
|
15
15
|
|
@@ -21,5 +21,5 @@ var _chunkNJSAEA2Hjs = require('./chunk-NJSAEA2H.js');
|
|
21
21
|
|
22
22
|
|
23
23
|
|
24
|
-
exports.addChain =
|
24
|
+
exports.addChain = _chunkBHAAXXGOjs.addChain; exports.getAddresses = _chunkBHAAXXGOjs.getAddresses; exports.getPermissions = _chunkBHAAXXGOjs.getPermissions; exports.requestAddresses = _chunkBHAAXXGOjs.requestAddresses; exports.requestPermissions = _chunkBHAAXXGOjs.requestPermissions; exports.sendTransaction = _chunkBHAAXXGOjs.sendTransaction; exports.signMessage = _chunkBHAAXXGOjs.signMessage; exports.signTypedData = _chunkBHAAXXGOjs.signTypedData; exports.switchChain = _chunkBHAAXXGOjs.switchChain; exports.watchAsset = _chunkBHAAXXGOjs.watchAsset;
|
25
25
|
//# sourceMappingURL=wallet.js.map
|
package/dist/wallet.mjs
CHANGED
package/dist/window.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
import { R as Requests, E as Events } from './eip1193-
|
1
|
+
import { R as Requests, E as Events } from './eip1193-4f4e240c.js';
|
2
2
|
import 'abitype';
|
3
|
-
import './chain-
|
3
|
+
import './chain-1b53ef88.js';
|
4
4
|
import '@wagmi/chains';
|
5
5
|
|
6
6
|
type WindowProvider = Requests & Events;
|
package/package.json
CHANGED
@@ -4,18 +4,15 @@
|
|
4
4
|
"dependencies": {
|
5
5
|
"@noble/hashes": "^1.1.2",
|
6
6
|
"@noble/secp256k1": "^1.7.1",
|
7
|
-
"@scure/bip32": "^1.2.0",
|
8
|
-
"@scure/bip39": "^1.1.1",
|
9
7
|
"@wagmi/chains": "~0.2.11",
|
10
8
|
"abitype": "~0.7.1",
|
11
9
|
"idna-uts46-hx": "^4.1.2",
|
12
10
|
"isomorphic-ws": "^5.0.0",
|
13
11
|
"ws": "^8.12.0"
|
14
12
|
},
|
15
|
-
"version": "0.2.0-
|
13
|
+
"version": "0.2.0-main.20230323T084936",
|
16
14
|
"files": [
|
17
15
|
"/abi",
|
18
|
-
"/accounts",
|
19
16
|
"/dist",
|
20
17
|
"/chains",
|
21
18
|
"/contract",
|
@@ -38,11 +35,6 @@
|
|
38
35
|
"module": "./dist/abi.mjs",
|
39
36
|
"default": "./dist/abi.js"
|
40
37
|
},
|
41
|
-
"./accounts": {
|
42
|
-
"types": "./dist/accounts/index.d.ts",
|
43
|
-
"module": "./dist/accounts/index.mjs",
|
44
|
-
"default": "./dist/accounts/index.js"
|
45
|
-
},
|
46
38
|
"./chains": {
|
47
39
|
"types": "./dist/chains.d.ts",
|
48
40
|
"module": "./dist/chains.mjs",
|
package/accounts/package.json
DELETED
package/dist/accounts/index.d.ts
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
export { HDKey } from '@scure/bip32';
|
2
|
-
import { P as PrivateKeyAccount, a as AccountSource, J as JsonRpcAccount, C as CustomSource, L as LocalAccount, T as TypedDataDefinition } from '../typedData-ade018d6.js';
|
3
|
-
export { A as Account, a as AccountSource, C as CustomSource, H as HDAccount, b as HDOptions, J as JsonRpcAccount, L as LocalAccount, P as PrivateKeyAccount } from '../typedData-ade018d6.js';
|
4
|
-
import { H as Hex } from '../chain-75b0942e.js';
|
5
|
-
import { Address, TypedData } from 'abitype';
|
6
|
-
export { p as parseAccount } from '../parseAccount-2d7ea01d.js';
|
7
|
-
import '@wagmi/chains';
|
8
|
-
|
9
|
-
declare function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount;
|
10
|
-
|
11
|
-
type GetAccountReturnType<TAccountSource extends AccountSource> = (TAccountSource extends Address ? JsonRpcAccount : never) | (TAccountSource extends CustomSource ? LocalAccount : never);
|
12
|
-
declare function toAccount<TAccountSource extends AccountSource>(source: TAccountSource): GetAccountReturnType<TAccountSource>;
|
13
|
-
|
14
|
-
declare function publicKeyToAddress(publicKey: Hex): Address;
|
15
|
-
|
16
|
-
type SignMessageParameters = {
|
17
|
-
message: string;
|
18
|
-
privateKey: Hex;
|
19
|
-
};
|
20
|
-
type SignMessageReturnType = Hex;
|
21
|
-
declare function signMessage({ message, privateKey, }: SignMessageParameters): Promise<SignMessageReturnType>;
|
22
|
-
|
23
|
-
type SignTypedDataParameters<TTypedData extends TypedData | {
|
24
|
-
[key: string]: unknown;
|
25
|
-
} = TypedData, TPrimaryType extends string = string> = TypedDataDefinition<TTypedData, TPrimaryType> & {
|
26
|
-
privateKey: Hex;
|
27
|
-
};
|
28
|
-
type SignTypedDataReturnType = Hex;
|
29
|
-
declare function signTypedData<TTypedData extends TypedData | {
|
30
|
-
[key: string]: unknown;
|
31
|
-
}, TPrimaryType extends string = string>({ privateKey, ...typedData }: SignTypedDataParameters<TTypedData, TPrimaryType>): Promise<SignTypedDataReturnType>;
|
32
|
-
|
33
|
-
export { SignMessageParameters, SignMessageReturnType, SignTypedDataParameters, SignTypedDataReturnType, privateKeyToAccount, publicKeyToAddress, signMessage, signTypedData, toAccount };
|
package/dist/accounts/index.js
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
2
|
-
|
3
|
-
var _chunkFQM5MF6Ujs = require('../chunk-FQM5MF6U.js');
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
var _chunkNJSAEA2Hjs = require('../chunk-NJSAEA2H.js');
|
12
|
-
|
13
|
-
// src/accounts/index.ts
|
14
|
-
var _bip32 = require('@scure/bip32');
|
15
|
-
|
16
|
-
// src/accounts/privateKeyToAccount.ts
|
17
|
-
var _secp256k1 = require('@noble/secp256k1');
|
18
|
-
|
19
|
-
// src/accounts/utils/publicKeyToAddress.ts
|
20
|
-
function publicKeyToAddress(publicKey) {
|
21
|
-
const address = _chunkNJSAEA2Hjs.keccak256.call(void 0, `0x${publicKey.substring(4)}`).substring(26);
|
22
|
-
return _chunkNJSAEA2Hjs.checksumAddress.call(void 0, `0x${address}`);
|
23
|
-
}
|
24
|
-
|
25
|
-
// src/accounts/utils/sign.ts
|
26
|
-
|
27
|
-
async function sign({
|
28
|
-
hash,
|
29
|
-
privateKey
|
30
|
-
}) {
|
31
|
-
const [signature, recId] = await _secp256k1.sign.call(void 0, hash.slice(2), privateKey.slice(2), {
|
32
|
-
canonical: true,
|
33
|
-
recovered: true
|
34
|
-
});
|
35
|
-
return `0x${_secp256k1.Signature.fromHex(signature).toCompactHex()}${recId ? "1c" : "1b"}`;
|
36
|
-
}
|
37
|
-
|
38
|
-
// src/accounts/utils/signMessage.ts
|
39
|
-
async function signMessage({
|
40
|
-
message,
|
41
|
-
privateKey
|
42
|
-
}) {
|
43
|
-
return sign({ hash: _chunkNJSAEA2Hjs.hashMessage.call(void 0, message), privateKey });
|
44
|
-
}
|
45
|
-
|
46
|
-
// src/accounts/utils/signTypedData.ts
|
47
|
-
async function signTypedData({
|
48
|
-
privateKey,
|
49
|
-
...typedData
|
50
|
-
}) {
|
51
|
-
return sign({
|
52
|
-
hash: _chunkNJSAEA2Hjs.hashTypedData.call(void 0, typedData),
|
53
|
-
privateKey
|
54
|
-
});
|
55
|
-
}
|
56
|
-
|
57
|
-
// src/accounts/privateKeyToAccount.ts
|
58
|
-
function privateKeyToAccount(privateKey) {
|
59
|
-
const publicKey = _chunkNJSAEA2Hjs.toHex.call(void 0, _secp256k1.getPublicKey.call(void 0, privateKey.slice(2)));
|
60
|
-
const address = publicKeyToAddress(publicKey);
|
61
|
-
const account = _chunkFQM5MF6Ujs.toAccount.call(void 0, {
|
62
|
-
address,
|
63
|
-
async signMessage({ message }) {
|
64
|
-
return signMessage({ message, privateKey });
|
65
|
-
},
|
66
|
-
async signTransaction(_transaction) {
|
67
|
-
return "0x";
|
68
|
-
},
|
69
|
-
async signTypedData(typedData) {
|
70
|
-
return signTypedData({ ...typedData, privateKey });
|
71
|
-
}
|
72
|
-
});
|
73
|
-
return {
|
74
|
-
...account,
|
75
|
-
getPrivateKey: () => privateKey,
|
76
|
-
publicKey,
|
77
|
-
source: "privateKey"
|
78
|
-
};
|
79
|
-
}
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
exports.HDKey = _bip32.HDKey; exports.parseAccount = _chunkNJSAEA2Hjs.parseAccount; exports.privateKeyToAccount = privateKeyToAccount; exports.publicKeyToAddress = publicKeyToAddress; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.toAccount = _chunkFQM5MF6Ujs.toAccount;
|
89
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/publicKeyToAddress.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTypedData.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,SAAS,aAAa;;;ACAtB,SAAS,oBAAoB;;;ACItB,SAAS,mBAAmB,WAAyB;AAC1D,QAAM,UAAU,UAAU,KAAK,UAAU,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE;AACrE,SAAO,gBAAgB,KAAK,SAAS;AACvC;;;ACPA,SAAS,QAAQ,OAAO,iBAAiB;AAUzC,eAAsB,KAAK;AAAA,EACzB;AAAA,EACA;AACF,GAA4C;AAC1C,QAAM,CAAC,WAAW,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,CAAC,GAAG,WAAW,MAAM,CAAC,GAAG;AAAA,IACzE,WAAW;AAAA,IACX,WAAW;AAAA,EACb,CAAC;AACD,SAAO,KAAK,UAAU,QAAQ,SAAS,EAAE,aAAa,IACpD,QAAQ,OAAO;AAEnB;;;ACXA,eAAsB,YAAY;AAAA,EAChC;AAAA,EACA;AACF,GAA0D;AACxD,SAAO,KAAK,EAAE,MAAM,YAAY,OAAO,GAAG,WAAW,CAAC;AACxD;;;ACAA,eAAsB,cAGpB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAGqC;AACnC,SAAO,KAAK;AAAA,IACV,MAAM,cAAc,SAAoC;AAAA,IACxD;AAAA,EACF,CAAC;AACH;;;AJrBO,SAAS,oBAAoB,YAAoC;AACtE,QAAM,YAAY,MAAM,aAAa,WAAW,MAAM,CAAC,CAAC,CAAC;AACzD,QAAM,UAAU,mBAAmB,SAAS;AAE5C,QAAM,UAAU,UAAU;AAAA,IACxB;AAAA,IACA,MAAM,YAAY,EAAE,QAAQ,GAAG;AAC7B,aAAO,YAAY,EAAE,SAAS,WAAW,CAAC;AAAA,IAC5C;AAAA,IACA,MAAM,gBAAgB,cAAc;AAElC,aAAO;AAAA,IACT;AAAA,IACA,MAAM,cAAc,WAAW;AAC7B,aAAO,cAAc,EAAE,GAAG,WAAW,WAAW,CAAC;AAAA,IACnD;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,eAAe,MAAM;AAAA,IACrB;AAAA,IACA,QAAQ;AAAA,EACV;AACF","sourcesContent":["import { HDKey } from '@scure/bip32'\n\nexport { HDKey }\n\nexport { privateKeyToAccount } from './privateKeyToAccount'\n\nexport { toAccount } from './toAccount'\n\nexport type {\n Account,\n AccountSource,\n CustomSource,\n HDOptions,\n JsonRpcAccount,\n LocalAccount,\n HDAccount,\n PrivateKeyAccount,\n} from './types'\n\nexport type {\n SignMessageParameters,\n SignMessageReturnType,\n SignTypedDataParameters,\n SignTypedDataReturnType,\n} from './utils'\nexport {\n parseAccount,\n publicKeyToAddress,\n signMessage,\n signTypedData,\n} from './utils'\n","import { getPublicKey } from '@noble/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport { publicKeyToAddress, signMessage, signTypedData } from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(getPublicKey(privateKey.slice(2)))\n const address = publicKeyToAddress(publicKey)\n\n const account = toAccount({\n address,\n async signMessage({ message }) {\n return signMessage({ message, privateKey })\n },\n async signTransaction(_transaction) {\n // TODO\n return '0x'\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n getPrivateKey: () => privateKey,\n publicKey,\n source: 'privateKey',\n }\n}\n","import type { Address, Hex } from '../../types'\nimport { keccak256 } from '../../utils'\nimport { checksumAddress } from '../../utils/address'\n\nexport function publicKeyToAddress(publicKey: Hex): Address {\n const address = keccak256(`0x${publicKey.substring(4)}`).substring(26)\n return checksumAddress(`0x${address}`) as Address\n}\n","import { sign as sign_, Signature } from '@noble/secp256k1'\n\nimport type { Hex } from '../../types'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Hex\n\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const [signature, recId] = await sign_(hash.slice(2), privateKey.slice(2), {\n canonical: true,\n recovered: true,\n })\n return `0x${Signature.fromHex(signature).toCompactHex()}${\n recId ? '1c' : '1b'\n }`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\n\nexport type SignMessageParameters = {\n message: string\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n return sign({ hash: hashMessage(message), privateKey })\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\nexport async function signTypedData<\n TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n>({\n privateKey,\n ...typedData\n}: SignTypedDataParameters<\n TTypedData,\n TPrimaryType\n>): Promise<SignTypedDataReturnType> {\n return sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n}\n"]}
|
package/dist/accounts/index.mjs
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
toAccount
|
3
|
-
} from "../chunk-FNVFGFWN.mjs";
|
4
|
-
import {
|
5
|
-
checksumAddress,
|
6
|
-
hashMessage,
|
7
|
-
hashTypedData,
|
8
|
-
keccak256,
|
9
|
-
parseAccount,
|
10
|
-
toHex
|
11
|
-
} from "../chunk-IVRML3IK.mjs";
|
12
|
-
|
13
|
-
// src/accounts/index.ts
|
14
|
-
import { HDKey } from "@scure/bip32";
|
15
|
-
|
16
|
-
// src/accounts/privateKeyToAccount.ts
|
17
|
-
import { getPublicKey } from "@noble/secp256k1";
|
18
|
-
|
19
|
-
// src/accounts/utils/publicKeyToAddress.ts
|
20
|
-
function publicKeyToAddress(publicKey) {
|
21
|
-
const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
|
22
|
-
return checksumAddress(`0x${address}`);
|
23
|
-
}
|
24
|
-
|
25
|
-
// src/accounts/utils/sign.ts
|
26
|
-
import { sign as sign_, Signature } from "@noble/secp256k1";
|
27
|
-
async function sign({
|
28
|
-
hash,
|
29
|
-
privateKey
|
30
|
-
}) {
|
31
|
-
const [signature, recId] = await sign_(hash.slice(2), privateKey.slice(2), {
|
32
|
-
canonical: true,
|
33
|
-
recovered: true
|
34
|
-
});
|
35
|
-
return `0x${Signature.fromHex(signature).toCompactHex()}${recId ? "1c" : "1b"}`;
|
36
|
-
}
|
37
|
-
|
38
|
-
// src/accounts/utils/signMessage.ts
|
39
|
-
async function signMessage({
|
40
|
-
message,
|
41
|
-
privateKey
|
42
|
-
}) {
|
43
|
-
return sign({ hash: hashMessage(message), privateKey });
|
44
|
-
}
|
45
|
-
|
46
|
-
// src/accounts/utils/signTypedData.ts
|
47
|
-
async function signTypedData({
|
48
|
-
privateKey,
|
49
|
-
...typedData
|
50
|
-
}) {
|
51
|
-
return sign({
|
52
|
-
hash: hashTypedData(typedData),
|
53
|
-
privateKey
|
54
|
-
});
|
55
|
-
}
|
56
|
-
|
57
|
-
// src/accounts/privateKeyToAccount.ts
|
58
|
-
function privateKeyToAccount(privateKey) {
|
59
|
-
const publicKey = toHex(getPublicKey(privateKey.slice(2)));
|
60
|
-
const address = publicKeyToAddress(publicKey);
|
61
|
-
const account = toAccount({
|
62
|
-
address,
|
63
|
-
async signMessage({ message }) {
|
64
|
-
return signMessage({ message, privateKey });
|
65
|
-
},
|
66
|
-
async signTransaction(_transaction) {
|
67
|
-
return "0x";
|
68
|
-
},
|
69
|
-
async signTypedData(typedData) {
|
70
|
-
return signTypedData({ ...typedData, privateKey });
|
71
|
-
}
|
72
|
-
});
|
73
|
-
return {
|
74
|
-
...account,
|
75
|
-
getPrivateKey: () => privateKey,
|
76
|
-
publicKey,
|
77
|
-
source: "privateKey"
|
78
|
-
};
|
79
|
-
}
|
80
|
-
export {
|
81
|
-
HDKey,
|
82
|
-
parseAccount,
|
83
|
-
privateKeyToAccount,
|
84
|
-
publicKeyToAddress,
|
85
|
-
signMessage,
|
86
|
-
signTypedData,
|
87
|
-
toAccount
|
88
|
-
};
|
89
|
-
//# sourceMappingURL=index.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/publicKeyToAddress.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTypedData.ts"],"sourcesContent":["import { HDKey } from '@scure/bip32'\n\nexport { HDKey }\n\nexport { privateKeyToAccount } from './privateKeyToAccount'\n\nexport { toAccount } from './toAccount'\n\nexport type {\n Account,\n AccountSource,\n CustomSource,\n HDOptions,\n JsonRpcAccount,\n LocalAccount,\n HDAccount,\n PrivateKeyAccount,\n} from './types'\n\nexport type {\n SignMessageParameters,\n SignMessageReturnType,\n SignTypedDataParameters,\n SignTypedDataReturnType,\n} from './utils'\nexport {\n parseAccount,\n publicKeyToAddress,\n signMessage,\n signTypedData,\n} from './utils'\n","import { getPublicKey } from '@noble/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport { publicKeyToAddress, signMessage, signTypedData } from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(getPublicKey(privateKey.slice(2)))\n const address = publicKeyToAddress(publicKey)\n\n const account = toAccount({\n address,\n async signMessage({ message }) {\n return signMessage({ message, privateKey })\n },\n async signTransaction(_transaction) {\n // TODO\n return '0x'\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n getPrivateKey: () => privateKey,\n publicKey,\n source: 'privateKey',\n }\n}\n","import type { Address, Hex } from '../../types'\nimport { keccak256 } from '../../utils'\nimport { checksumAddress } from '../../utils/address'\n\nexport function publicKeyToAddress(publicKey: Hex): Address {\n const address = keccak256(`0x${publicKey.substring(4)}`).substring(26)\n return checksumAddress(`0x${address}`) as Address\n}\n","import { sign as sign_, Signature } from '@noble/secp256k1'\n\nimport type { Hex } from '../../types'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Hex\n\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const [signature, recId] = await sign_(hash.slice(2), privateKey.slice(2), {\n canonical: true,\n recovered: true,\n })\n return `0x${Signature.fromHex(signature).toCompactHex()}${\n recId ? '1c' : '1b'\n }`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\n\nexport type SignMessageParameters = {\n message: string\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n return sign({ hash: hashMessage(message), privateKey })\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\nexport async function signTypedData<\n TTypedData extends TypedData | { [key: string]: unknown },\n TPrimaryType extends string = string,\n>({\n privateKey,\n ...typedData\n}: SignTypedDataParameters<\n TTypedData,\n TPrimaryType\n>): Promise<SignTypedDataReturnType> {\n return sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,aAAa;;;ACAtB,SAAS,oBAAoB;;;ACItB,SAAS,mBAAmB,WAAyB;AAC1D,QAAM,UAAU,UAAU,KAAK,UAAU,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE;AACrE,SAAO,gBAAgB,KAAK,SAAS;AACvC;;;ACPA,SAAS,QAAQ,OAAO,iBAAiB;AAUzC,eAAsB,KAAK;AAAA,EACzB;AAAA,EACA;AACF,GAA4C;AAC1C,QAAM,CAAC,WAAW,KAAK,IAAI,MAAM,MAAM,KAAK,MAAM,CAAC,GAAG,WAAW,MAAM,CAAC,GAAG;AAAA,IACzE,WAAW;AAAA,IACX,WAAW;AAAA,EACb,CAAC;AACD,SAAO,KAAK,UAAU,QAAQ,SAAS,EAAE,aAAa,IACpD,QAAQ,OAAO;AAEnB;;;ACXA,eAAsB,YAAY;AAAA,EAChC;AAAA,EACA;AACF,GAA0D;AACxD,SAAO,KAAK,EAAE,MAAM,YAAY,OAAO,GAAG,WAAW,CAAC;AACxD;;;ACAA,eAAsB,cAGpB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAGqC;AACnC,SAAO,KAAK;AAAA,IACV,MAAM,cAAc,SAAoC;AAAA,IACxD;AAAA,EACF,CAAC;AACH;;;AJrBO,SAAS,oBAAoB,YAAoC;AACtE,QAAM,YAAY,MAAM,aAAa,WAAW,MAAM,CAAC,CAAC,CAAC;AACzD,QAAM,UAAU,mBAAmB,SAAS;AAE5C,QAAM,UAAU,UAAU;AAAA,IACxB;AAAA,IACA,MAAM,YAAY,EAAE,QAAQ,GAAG;AAC7B,aAAO,YAAY,EAAE,SAAS,WAAW,CAAC;AAAA,IAC5C;AAAA,IACA,MAAM,gBAAgB,cAAc;AAElC,aAAO;AAAA,IACT;AAAA,IACA,MAAM,cAAc,WAAW;AAC7B,aAAO,cAAc,EAAE,GAAG,WAAW,WAAW,CAAC;AAAA,IACnD;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,GAAG;AAAA,IACH,eAAe,MAAM;AAAA,IACrB;AAAA,IACA,QAAQ;AAAA,EACV;AACF;","names":[]}
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/utils/ens/labelhash.ts","../src/utils/ens/namehash.ts","../src/utils/ens/packetToBytes.ts","../src/actions/ens/getEnsAddress.ts","../src/actions/ens/getEnsName.ts"],"sourcesContent":["import { bytesToHex, stringToBytes } from '../encoding'\nimport { keccak256 } from '../hash'\n\n/**\n * @description Hashes ENS label\n *\n * - Since ENS labels prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS labels](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `labelhash`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.\n *\n * @example\n * labelhash('eth')\n * '0x4f5b812789fc606be1b3b16908db13fc7a9adf7ca72641f84d75b47069d3d7f0'\n */\nexport function labelhash(label: string) {\n let result = new Uint8Array(32).fill(0)\n if (!label) return bytesToHex(result)\n return keccak256(stringToBytes(label))\n}\n","import { concat } from '../data'\nimport { bytesToHex, stringToBytes } from '../encoding'\nimport { keccak256 } from '../hash'\n\n/**\n * @description Hashes ENS name\n *\n * - Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `namehash`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.\n *\n * @example\n * namehash('wagmi-dev.eth')\n * '0xf246651c1b9a6b141d19c2604e9a58f567973833990f830d882534a747801359'\n *\n * @link https://eips.ethereum.org/EIPS/eip-137\n */\nexport function namehash(name: string) {\n let result = new Uint8Array(32).fill(0)\n if (!name) return bytesToHex(result)\n\n const labels = name.split('.')\n // Iterate in reverse order building up hash\n for (let i = labels.length - 1; i >= 0; i -= 1) {\n const hashed = keccak256(stringToBytes(labels[i]), 'bytes')\n result = keccak256(concat([result, hashed]), 'bytes')\n }\n\n return bytesToHex(result)\n}\n","// Adapted from https://github.com/mafintosh/dns-packet\nimport type { ByteArray } from '../../types'\nimport { toBytes } from '../encoding'\n\n/*\n * @description Encodes a DNS packet into a ByteArray containing a UDP payload.\n */\nexport function packetToBytes(packet: string): ByteArray {\n function length(value: string) {\n if (value === '.' || value === '..') return 1\n return toBytes(value.replace(/^\\.|\\.$/gm, '')).length + 2\n }\n\n const bytes = new Uint8Array(length(packet))\n // strip leading and trailing `.`\n const value = packet.replace(/^\\.|\\.$/gm, '')\n if (!value.length) return bytes\n\n let offset = 0\n const list = value.split('.')\n for (let i = 0; i < list.length; i++) {\n const encoded = toBytes(list[i])\n bytes[offset] = encoded.length\n bytes.set(encoded, offset + 1)\n offset += encoded.length + 1\n }\n\n return bytes\n}\n","import type { PublicClientArg } from '../../clients'\nimport type { Address, Prettify } from '../../types'\nimport {\n decodeFunctionResult,\n encodeFunctionData,\n getChainContractAddress,\n toHex,\n} from '../../utils'\nimport { namehash, packetToBytes } from '../../utils/ens'\nimport { readContract, ReadContractParameters } from '../public'\n\nexport type GetEnsAddressParameters = Prettify<\n Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {\n /** ENS name to get address. */\n name: string\n /** Address of ENS Universal Resolver Contract */\n universalResolverAddress?: Address\n }\n>\n\nexport type GetEnsAddressReturnType = Address\n\n/**\n * @description Gets address for ENS name.\n *\n * - Calls `resolve(bytes, bytes)` on ENS Universal Resolver Contract.\n * - Since ENS names prohibit certain forbidden characters (e.g. underscore) and have other validation rules, you likely want to [normalize ENS names](https://docs.ens.domains/contract-api-reference/name-processing#normalising-names) with [UTS-46 normalization](https://unicode.org/reports/tr46) before passing them to `getEnsAddress`. You can use the built-in [`normalize`](https://viem.sh/docs/ens/utilities/normalize.html) function for this.\n *\n * @example\n * import { normalize } from 'viem/ens'\n *\n * const ensAddress = await getEnsAddress(publicClient, {\n * name: normalize('wagmi-dev.eth'),\n * })\n * // '0xd2135CfB216b74109775236E36d4b433F1DF507B'\n */\nexport async function getEnsAddress(\n client: PublicClientArg,\n {\n blockNumber,\n blockTag,\n name,\n universalResolverAddress: universalResolverAddress_,\n }: GetEnsAddressParameters,\n): Promise<GetEnsAddressReturnType> {\n let universalResolverAddress = universalResolverAddress_\n if (!universalResolverAddress) {\n if (!client.chain)\n throw new Error(\n 'client chain not configured. universalResolverAddress is required.',\n )\n\n universalResolverAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'ensUniversalResolver',\n })\n }\n\n const res = await readContract(client, {\n address: universalResolverAddress,\n abi: [\n {\n name: 'resolve',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'name', type: 'bytes' },\n { name: 'data', type: 'bytes' },\n ],\n outputs: [\n { name: '', type: 'bytes' },\n { name: 'address', type: 'address' },\n ],\n },\n ],\n functionName: 'resolve',\n args: [\n toHex(packetToBytes(name)),\n encodeFunctionData({\n abi: [\n {\n name: 'addr',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'name', type: 'bytes32' }],\n outputs: [],\n },\n ],\n functionName: 'addr',\n args: [namehash(name)],\n }),\n ],\n blockNumber,\n blockTag,\n })\n return decodeFunctionResult({\n abi: [\n {\n name: 'addr',\n type: 'function',\n stateMutability: 'view',\n inputs: [],\n outputs: [{ name: 'name', type: 'address' }],\n },\n ],\n functionName: 'addr',\n data: res[0],\n })\n}\n","import type { PublicClientArg } from '../../clients'\nimport { panicReasons } from '../../constants'\nimport {\n ContractFunctionExecutionError,\n ContractFunctionRevertedError,\n} from '../../errors'\nimport type { Address, Prettify } from '../../types'\nimport { getChainContractAddress, toHex } from '../../utils'\nimport { packetToBytes } from '../../utils/ens'\nimport { readContract, ReadContractParameters } from '../public'\n\nexport type GetEnsNameParameters = Prettify<\n Pick<ReadContractParameters, 'blockNumber' | 'blockTag'> & {\n /** Address to get ENS name for. */\n address: Address\n /** Address of ENS Universal Resolver Contract. */\n universalResolverAddress?: Address\n }\n>\n\nexport type GetEnsNameReturnType = string | null\n\n/**\n * @description Gets primary name for specified address.\n *\n * - Calls `reverse(bytes)` on ENS Universal Resolver Contract.\n *\n * @example\n * const ensName = await getEnsName(publicClient, {\n * address: '0xd2135CfB216b74109775236E36d4b433F1DF507B',\n * })\n * // 'wagmi-dev.eth'\n */\nexport async function getEnsName(\n client: PublicClientArg,\n {\n address,\n blockNumber,\n blockTag,\n universalResolverAddress: universalResolverAddress_,\n }: GetEnsNameParameters,\n): Promise<GetEnsNameReturnType> {\n let universalResolverAddress = universalResolverAddress_\n if (!universalResolverAddress) {\n if (!client.chain)\n throw new Error(\n 'client chain not configured. universalResolverAddress is required.',\n )\n\n universalResolverAddress = getChainContractAddress({\n blockNumber,\n chain: client.chain,\n contract: 'ensUniversalResolver',\n })\n }\n\n const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`\n try {\n const res = await readContract(client, {\n address: universalResolverAddress,\n abi: [\n {\n name: 'reverse',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ type: 'bytes', name: 'reverseName' }],\n outputs: [\n { type: 'string', name: 'resolvedName' },\n { type: 'address', name: 'resolvedAddress' },\n { type: 'address', name: 'reverseResolver' },\n { type: 'address', name: 'resolver' },\n ],\n },\n ],\n functionName: 'reverse',\n args: [toHex(packetToBytes(reverseNode))],\n blockNumber,\n blockTag,\n })\n return res[0]\n } catch (error) {\n if (\n error instanceof ContractFunctionExecutionError &&\n (error.cause as ContractFunctionRevertedError).reason === panicReasons[50]\n )\n // No primary name set for address.\n return null\n throw error\n }\n}\n"],"mappings":"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","names":["value"]}
|
package/dist/chunk-FNVFGFWN.mjs
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
InvalidAddressError,
|
3
|
-
isAddress
|
4
|
-
} from "./chunk-IVRML3IK.mjs";
|
5
|
-
|
6
|
-
// src/accounts/toAccount.ts
|
7
|
-
function toAccount(source) {
|
8
|
-
if (typeof source === "string") {
|
9
|
-
if (!isAddress(source))
|
10
|
-
throw new InvalidAddressError({ address: source });
|
11
|
-
return {
|
12
|
-
address: source,
|
13
|
-
type: "json-rpc"
|
14
|
-
};
|
15
|
-
}
|
16
|
-
if (!isAddress(source.address))
|
17
|
-
throw new InvalidAddressError({ address: source.address });
|
18
|
-
return {
|
19
|
-
address: source.address,
|
20
|
-
signMessage: source.signMessage,
|
21
|
-
signTransaction: source.signTransaction,
|
22
|
-
signTypedData: source.signTypedData,
|
23
|
-
source: "custom",
|
24
|
-
type: "local"
|
25
|
-
};
|
26
|
-
}
|
27
|
-
|
28
|
-
export {
|
29
|
-
toAccount
|
30
|
-
};
|
31
|
-
//# sourceMappingURL=chunk-FNVFGFWN.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/accounts/toAccount.ts"],"sourcesContent":["import { InvalidAddressError } from '../errors'\nimport type { Address } from '../types'\nimport { isAddress } from '../utils'\nimport type {\n AccountSource,\n CustomSource,\n JsonRpcAccount,\n LocalAccount,\n} from './types'\n\ntype GetAccountReturnType<TAccountSource extends AccountSource> =\n | (TAccountSource extends Address ? JsonRpcAccount : never)\n | (TAccountSource extends CustomSource ? LocalAccount : never)\n\nexport function toAccount<TAccountSource extends AccountSource>(\n source: TAccountSource,\n): GetAccountReturnType<TAccountSource> {\n if (typeof source === 'string') {\n if (!isAddress(source)) throw new InvalidAddressError({ address: source })\n return {\n address: source,\n type: 'json-rpc',\n } as GetAccountReturnType<TAccountSource>\n }\n\n if (!isAddress(source.address))\n throw new InvalidAddressError({ address: source.address })\n return {\n address: source.address,\n signMessage: source.signMessage,\n signTransaction: source.signTransaction,\n signTypedData: source.signTypedData,\n source: 'custom',\n type: 'local',\n } as GetAccountReturnType<TAccountSource>\n}\n"],"mappings":";;;;;;AAcO,SAAS,UACd,QACsC;AACtC,MAAI,OAAO,WAAW,UAAU;AAC9B,QAAI,CAAC,UAAU,MAAM;AAAG,YAAM,IAAI,oBAAoB,EAAE,SAAS,OAAO,CAAC;AACzE,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAEA,MAAI,CAAC,UAAU,OAAO,OAAO;AAC3B,UAAM,IAAI,oBAAoB,EAAE,SAAS,OAAO,QAAQ,CAAC;AAC3D,SAAO;AAAA,IACL,SAAS,OAAO;AAAA,IAChB,aAAa,OAAO;AAAA,IACpB,iBAAiB,OAAO;AAAA,IACxB,eAAe,OAAO;AAAA,IACtB,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF;","names":[]}
|
package/dist/chunk-FQM5MF6U.js
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
2
|
-
|
3
|
-
|
4
|
-
var _chunkNJSAEA2Hjs = require('./chunk-NJSAEA2H.js');
|
5
|
-
|
6
|
-
// src/accounts/toAccount.ts
|
7
|
-
function toAccount(source) {
|
8
|
-
if (typeof source === "string") {
|
9
|
-
if (!_chunkNJSAEA2Hjs.isAddress.call(void 0, source))
|
10
|
-
throw new (0, _chunkNJSAEA2Hjs.InvalidAddressError)({ address: source });
|
11
|
-
return {
|
12
|
-
address: source,
|
13
|
-
type: "json-rpc"
|
14
|
-
};
|
15
|
-
}
|
16
|
-
if (!_chunkNJSAEA2Hjs.isAddress.call(void 0, source.address))
|
17
|
-
throw new (0, _chunkNJSAEA2Hjs.InvalidAddressError)({ address: source.address });
|
18
|
-
return {
|
19
|
-
address: source.address,
|
20
|
-
signMessage: source.signMessage,
|
21
|
-
signTransaction: source.signTransaction,
|
22
|
-
signTypedData: source.signTypedData,
|
23
|
-
source: "custom",
|
24
|
-
type: "local"
|
25
|
-
};
|
26
|
-
}
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
exports.toAccount = toAccount;
|
31
|
-
//# sourceMappingURL=chunk-FQM5MF6U.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/accounts/toAccount.ts"],"names":[],"mappings":";;;;;;AAcO,SAAS,UACd,QACsC;AACtC,MAAI,OAAO,WAAW,UAAU;AAC9B,QAAI,CAAC,UAAU,MAAM;AAAG,YAAM,IAAI,oBAAoB,EAAE,SAAS,OAAO,CAAC;AACzE,WAAO;AAAA,MACL,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AAEA,MAAI,CAAC,UAAU,OAAO,OAAO;AAC3B,UAAM,IAAI,oBAAoB,EAAE,SAAS,OAAO,QAAQ,CAAC;AAC3D,SAAO;AAAA,IACL,SAAS,OAAO;AAAA,IAChB,aAAa,OAAO;AAAA,IACpB,iBAAiB,OAAO;AAAA,IACxB,eAAe,OAAO;AAAA,IACtB,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AACF","sourcesContent":["import { InvalidAddressError } from '../errors'\nimport type { Address } from '../types'\nimport { isAddress } from '../utils'\nimport type {\n AccountSource,\n CustomSource,\n JsonRpcAccount,\n LocalAccount,\n} from './types'\n\ntype GetAccountReturnType<TAccountSource extends AccountSource> =\n | (TAccountSource extends Address ? JsonRpcAccount : never)\n | (TAccountSource extends CustomSource ? LocalAccount : never)\n\nexport function toAccount<TAccountSource extends AccountSource>(\n source: TAccountSource,\n): GetAccountReturnType<TAccountSource> {\n if (typeof source === 'string') {\n if (!isAddress(source)) throw new InvalidAddressError({ address: source })\n return {\n address: source,\n type: 'json-rpc',\n } as GetAccountReturnType<TAccountSource>\n }\n\n if (!isAddress(source.address))\n throw new InvalidAddressError({ address: source.address })\n return {\n address: source.address,\n signMessage: source.signMessage,\n signTransaction: source.signTransaction,\n signTypedData: source.signTypedData,\n source: 'custom',\n type: 'local',\n } as GetAccountReturnType<TAccountSource>\n}\n"]}
|