viem 0.2.3 → 0.3.0-jxom-refactor-pkgs.20230404T000548
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.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/accounts/index.js +31 -31
- package/dist/accounts/index.js.map +1 -1
- package/dist/accounts/index.mjs +9 -9
- package/dist/accounts/index.mjs.map +1 -1
- package/dist/chains.js +89 -89
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-ZM26BDGF.mjs → chunk-AZCTVIMY.mjs} +16 -16
- package/dist/chunk-AZCTVIMY.mjs.map +1 -0
- package/dist/{chunk-TXGT3ARS.js → chunk-FYDOJUVR.js} +6 -6
- package/dist/{chunk-E6JLGC6W.js → chunk-IDHPAZVJ.js} +16 -16
- package/dist/chunk-IDHPAZVJ.js.map +1 -0
- package/dist/{chunk-FYMFYRJQ.mjs → chunk-TDEQU4WU.mjs} +2 -2
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/ens.js +2 -2
- package/dist/ens.mjs +1 -1
- package/dist/ethers.js +4 -4
- package/dist/ethers.mjs +2 -2
- package/dist/index.js +94 -94
- package/dist/index.mjs +1 -1
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-E6JLGC6W.js.map +0 -1
- package/dist/chunk-ZM26BDGF.mjs.map +0 -1
- /package/dist/{chunk-TXGT3ARS.js.map → chunk-FYDOJUVR.js.map} +0 -0
- /package/dist/{chunk-FYMFYRJQ.mjs.map → chunk-TDEQU4WU.mjs.map} +0 -0
package/dist/abi.js
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
|
10
|
-
var
|
10
|
+
var _chunkIDHPAZVJjs = require('./chunk-IDHPAZVJ.js');
|
11
11
|
|
12
12
|
|
13
13
|
|
@@ -17,5 +17,5 @@ var _chunkE6JLGC6Wjs = require('./chunk-E6JLGC6W.js');
|
|
17
17
|
|
18
18
|
|
19
19
|
|
20
|
-
exports.decodeAbiParameters =
|
20
|
+
exports.decodeAbiParameters = _chunkIDHPAZVJjs.decodeAbiParameters; exports.encodeAbiParameters = _chunkIDHPAZVJjs.encodeAbiParameters; exports.encodePacked = _chunkIDHPAZVJjs.encodePacked; exports.getAbiItem = _chunkIDHPAZVJjs.getAbiItem; exports.parseAbi = _chunkIDHPAZVJjs.parseAbi; exports.parseAbiItem = _chunkIDHPAZVJjs.parseAbiItem; exports.parseAbiParameter = _chunkIDHPAZVJjs.parseAbiParameter; exports.parseAbiParameters = _chunkIDHPAZVJjs.parseAbiParameters;
|
21
21
|
//# sourceMappingURL=abi.js.map
|
package/dist/abi.mjs
CHANGED
package/dist/accounts/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2
2
|
|
3
|
-
var
|
3
|
+
var _chunkFYDOJUVRjs = require('../chunk-FYDOJUVR.js');
|
4
4
|
|
5
5
|
|
6
6
|
|
@@ -10,7 +10,7 @@ var _chunkTXGT3ARSjs = require('../chunk-TXGT3ARS.js');
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
var
|
13
|
+
var _chunkIDHPAZVJjs = require('../chunk-IDHPAZVJ.js');
|
14
14
|
|
15
15
|
// src/accounts/index.ts
|
16
16
|
var _bip32 = require('@scure/bip32');
|
@@ -24,7 +24,7 @@ function generateMnemonic(wordlist) {
|
|
24
24
|
// src/accounts/generatePrivateKey.ts
|
25
25
|
var _secp256k1 = require('@noble/curves/secp256k1');
|
26
26
|
function generatePrivateKey() {
|
27
|
-
return
|
27
|
+
return _chunkIDHPAZVJjs.toHex.call(void 0, _secp256k1.secp256k1.utils.randomPrivateKey());
|
28
28
|
}
|
29
29
|
|
30
30
|
// src/accounts/privateKeyToAccount.ts
|
@@ -38,8 +38,8 @@ async function sign({
|
|
38
38
|
}) {
|
39
39
|
const { r, s, recovery } = _secp256k1.secp256k1.sign(hash.slice(2), privateKey.slice(2));
|
40
40
|
return {
|
41
|
-
r:
|
42
|
-
s:
|
41
|
+
r: _chunkIDHPAZVJjs.toHex.call(void 0, r),
|
42
|
+
s: _chunkIDHPAZVJjs.toHex.call(void 0, s),
|
43
43
|
v: recovery ? 28n : 27n
|
44
44
|
};
|
45
45
|
}
|
@@ -48,9 +48,9 @@ async function sign({
|
|
48
48
|
|
49
49
|
function signatureToHex({ r, s, v }) {
|
50
50
|
return `0x${new _secp256k1.secp256k1.Signature(
|
51
|
-
|
52
|
-
|
53
|
-
).toCompactHex()}${
|
51
|
+
_chunkIDHPAZVJjs.hexToBigInt.call(void 0, r),
|
52
|
+
_chunkIDHPAZVJjs.hexToBigInt.call(void 0, s)
|
53
|
+
).toCompactHex()}${_chunkIDHPAZVJjs.toHex.call(void 0, v).slice(2)}`;
|
54
54
|
}
|
55
55
|
|
56
56
|
// src/accounts/utils/signMessage.ts
|
@@ -58,7 +58,7 @@ async function signMessage({
|
|
58
58
|
message,
|
59
59
|
privateKey
|
60
60
|
}) {
|
61
|
-
const signature = await sign({ hash:
|
61
|
+
const signature = await sign({ hash: _chunkIDHPAZVJjs.hashMessage.call(void 0, message), privateKey });
|
62
62
|
return signatureToHex(signature);
|
63
63
|
}
|
64
64
|
|
@@ -68,10 +68,10 @@ async function signTransaction({
|
|
68
68
|
transaction
|
69
69
|
}) {
|
70
70
|
const signature = await sign({
|
71
|
-
hash:
|
71
|
+
hash: _chunkIDHPAZVJjs.keccak256.call(void 0, _chunkIDHPAZVJjs.serializeTransaction.call(void 0, transaction)),
|
72
72
|
privateKey
|
73
73
|
});
|
74
|
-
return
|
74
|
+
return _chunkIDHPAZVJjs.serializeTransaction.call(void 0, transaction, signature);
|
75
75
|
}
|
76
76
|
|
77
77
|
// src/accounts/utils/signTypedData.ts
|
@@ -80,7 +80,7 @@ async function signTypedData({
|
|
80
80
|
...typedData
|
81
81
|
}) {
|
82
82
|
const signature = await sign({
|
83
|
-
hash:
|
83
|
+
hash: _chunkIDHPAZVJjs.hashTypedData.call(void 0, typedData),
|
84
84
|
privateKey
|
85
85
|
});
|
86
86
|
return signatureToHex(signature);
|
@@ -88,9 +88,9 @@ async function signTypedData({
|
|
88
88
|
|
89
89
|
// src/accounts/privateKeyToAccount.ts
|
90
90
|
function privateKeyToAccount(privateKey) {
|
91
|
-
const publicKey =
|
92
|
-
const address =
|
93
|
-
const account =
|
91
|
+
const publicKey = _chunkIDHPAZVJjs.toHex.call(void 0, _secp256k1.secp256k1.getPublicKey(privateKey.slice(2), false));
|
92
|
+
const address = _chunkIDHPAZVJjs.publicKeyToAddress.call(void 0, publicKey);
|
93
|
+
const account = _chunkFYDOJUVRjs.toAccount.call(void 0, {
|
94
94
|
address,
|
95
95
|
async signMessage({ message }) {
|
96
96
|
return signMessage({ message, privateKey });
|
@@ -114,7 +114,7 @@ function hdKeyToAccount(hdKey_, { accountIndex = 0, addressIndex = 0, changeInde
|
|
114
114
|
const hdKey = hdKey_.derive(
|
115
115
|
path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`
|
116
116
|
);
|
117
|
-
const account = privateKeyToAccount(
|
117
|
+
const account = privateKeyToAccount(_chunkIDHPAZVJjs.toHex.call(void 0, hdKey.privateKey));
|
118
118
|
return {
|
119
119
|
...account,
|
120
120
|
getHdKey: () => hdKey,
|
@@ -139,32 +139,32 @@ var _englishjs = require('@scure/bip39/wordlists/english.js'); var _englishjs2 =
|
|
139
139
|
var english = _englishjs2.default.wordlist;
|
140
140
|
|
141
141
|
// src/accounts/wordlists/french.ts
|
142
|
-
var
|
143
|
-
var french =
|
142
|
+
var _french = require('@scure/bip39/wordlists/french'); var _french2 = _interopRequireDefault(_french);
|
143
|
+
var french = _french2.default.wordlist;
|
144
144
|
|
145
145
|
// src/accounts/wordlists/italian.ts
|
146
|
-
var
|
147
|
-
var italian =
|
146
|
+
var _italian = require('@scure/bip39/wordlists/italian'); var _italian2 = _interopRequireDefault(_italian);
|
147
|
+
var italian = _italian2.default.wordlist;
|
148
148
|
|
149
149
|
// src/accounts/wordlists/japanese.ts
|
150
|
-
var
|
151
|
-
var japanese =
|
150
|
+
var _japanese = require('@scure/bip39/wordlists/japanese'); var _japanese2 = _interopRequireDefault(_japanese);
|
151
|
+
var japanese = _japanese2.default.wordlist;
|
152
152
|
|
153
153
|
// src/accounts/wordlists/korean.ts
|
154
|
-
var
|
155
|
-
var korean =
|
154
|
+
var _korean = require('@scure/bip39/wordlists/korean'); var _korean2 = _interopRequireDefault(_korean);
|
155
|
+
var korean = _korean2.default.wordlist;
|
156
156
|
|
157
157
|
// src/accounts/wordlists/simplifiedChinese.ts
|
158
|
-
var
|
159
|
-
var simplifiedChinese =
|
158
|
+
var _simplifiedchinese = require('@scure/bip39/wordlists/simplified-chinese'); var _simplifiedchinese2 = _interopRequireDefault(_simplifiedchinese);
|
159
|
+
var simplifiedChinese = _simplifiedchinese2.default.wordlist;
|
160
160
|
|
161
161
|
// src/accounts/wordlists/spanish.ts
|
162
|
-
var
|
163
|
-
var spanish =
|
162
|
+
var _spanish = require('@scure/bip39/wordlists/spanish'); var _spanish2 = _interopRequireDefault(_spanish);
|
163
|
+
var spanish = _spanish2.default.wordlist;
|
164
164
|
|
165
165
|
// src/accounts/wordlists/traditionalChinese.ts
|
166
|
-
var
|
167
|
-
var traditionalChinese =
|
166
|
+
var _traditionalchinese = require('@scure/bip39/wordlists/traditional-chinese'); var _traditionalchinese2 = _interopRequireDefault(_traditionalchinese);
|
167
|
+
var traditionalChinese = _traditionalchinese2.default.wordlist;
|
168
168
|
|
169
169
|
|
170
170
|
|
@@ -186,5 +186,5 @@ var traditionalChinese = _traditionalchinesejs2.default.wordlist;
|
|
186
186
|
|
187
187
|
|
188
188
|
|
189
|
-
exports.HDKey = _bip32.HDKey; exports.czech = czech; exports.english = english; exports.french = french; exports.generateMnemonic = generateMnemonic; exports.generatePrivateKey = generatePrivateKey; exports.hdKeyToAccount = hdKeyToAccount; exports.italian = italian; exports.japanese = japanese; exports.korean = korean; exports.mnemonicToAccount = mnemonicToAccount; exports.parseAccount =
|
189
|
+
exports.HDKey = _bip32.HDKey; exports.czech = czech; exports.english = english; exports.french = french; exports.generateMnemonic = generateMnemonic; exports.generatePrivateKey = generatePrivateKey; exports.hdKeyToAccount = hdKeyToAccount; exports.italian = italian; exports.japanese = japanese; exports.korean = korean; exports.mnemonicToAccount = mnemonicToAccount; exports.parseAccount = _chunkIDHPAZVJjs.parseAccount; exports.privateKeyToAccount = privateKeyToAccount; exports.publicKeyToAddress = _chunkIDHPAZVJjs.publicKeyToAddress; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.simplifiedChinese = simplifiedChinese; exports.spanish = spanish; exports.toAccount = _chunkFYDOJUVRjs.toAccount; exports.traditionalChinese = traditionalChinese;
|
190
190
|
//# sourceMappingURL=index.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signatureToHex.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTransaction.ts","../../src/accounts/utils/signTypedData.ts","../../src/accounts/hdKeyToAccount.ts","../../src/accounts/mnemonicToAccount.ts","../../src/accounts/wordlists/czech.ts","../../src/accounts/wordlists/english.ts","../../src/accounts/wordlists/french.ts","../../src/accounts/wordlists/italian.ts","../../src/accounts/wordlists/japanese.ts","../../src/accounts/wordlists/korean.ts","../../src/accounts/wordlists/simplifiedChinese.ts","../../src/accounts/wordlists/spanish.ts","../../src/accounts/wordlists/traditionalChinese.ts"],"names":["HDKey","secp256k1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ACD3B,OAAOA,UAAS;AACT,IAAM,SAASA,KAAI;;;ACD1B,OAAOA,UAAS;AACT,IAAM,UAAUA,KAAI;;;ACD3B,OAAOA,UAAS;AACT,IAAM,WAAWA,KAAI;;;ACD5B,OAAOA,UAAS;AACT,IAAM,SAASA,KAAI;;;ACD1B,OAAOA,UAAS;AACT,IAAM,oBAAoBA,KAAI;;;ACDrC,OAAOA,UAAS;AACT,IAAM,UAAUA,KAAI;;;ACD3B,OAAOA,UAAS;AACT,IAAM,qBAAqBA,KAAI","sourcesContent":["import { HDKey } from '@scure/bip32'\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\n\nexport { hdKeyToAccount } from './hdKeyToAccount'\n\nexport { mnemonicToAccount } from './mnemonicToAccount'\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\nexport { czech } from './wordlists/czech'\nexport { english } from './wordlists/english'\nexport { french } from './wordlists/french'\nexport { italian } from './wordlists/italian'\nexport { japanese } from './wordlists/japanese'\nexport { korean } from './wordlists/korean'\nexport { simplifiedChinese } from './wordlists/simplifiedChinese'\nexport { spanish } from './wordlists/spanish'\nexport { traditionalChinese } from './wordlists/traditionalChinese'\n","import { generateMnemonic as generateMnemonic_ } from '@scure/bip39'\n\n/**\n * @description Generates a random mnemonic phrase with a given wordlist.\n *\n * @param wordlist The wordlist to use for generating the mnemonic phrase.\n *\n * @returns A randomly generated mnemonic phrase.\n */\nexport function generateMnemonic(wordlist: string[]): string {\n return generateMnemonic_(wordlist)\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\n\n/**\n * @description Generates a random private key.\n *\n * @returns A randomly generated private key.\n */\nexport function generatePrivateKey(): Hex {\n return toHex(secp256k1.utils.randomPrivateKey())\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport {\n publicKeyToAddress,\n signMessage,\n signTransaction,\n signTypedData,\n} from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\n/**\n * @description Creates an Account from a private key.\n *\n * @returns A Private Key Account.\n */\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false))\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 return signTransaction({ privateKey, transaction })\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n publicKey,\n source: 'privateKey',\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { toHex } from '../../utils'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Signature\n\n/**\n * @description Signs a hash with a given private key.\n *\n * @param hash The hash to sign.\n * @param privateKey The private key to sign with.\n *\n * @returns The signature.\n */\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2))\n return {\n r: toHex(r),\n s: toHex(s),\n v: recovery ? 28n : 27n,\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { hexToBigInt, toHex } from '../../utils'\n\nexport function signatureToHex({ r, s, v }: Signature): Hex {\n return `0x${new secp256k1.Signature(\n hexToBigInt(r),\n hexToBigInt(s),\n ).toCompactHex()}${toHex(v).slice(2)}`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignMessageParameters = {\n /** The message to sign. */\n message: string\n /** The private key to sign with. */\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\n/**\n * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\n */\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n const signature = await sign({ hash: hashMessage(message), privateKey })\n return signatureToHex(signature)\n}\n","import type {\n Hex,\n TransactionSerializable,\n TransactionSerialized,\n TransactionType,\n} from '../../types'\nimport {\n GetTransactionType,\n keccak256,\n serializeTransaction,\n} from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTransactionArgs<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n> = {\n privateKey: Hex\n transaction: TTransactionSerializable\n}\nexport type SignTransactionReturnType<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n TTransactionType extends TransactionType = GetTransactionType<TTransactionSerializable>,\n> = TransactionSerialized<TTransactionType>\n\nexport async function signTransaction<\n TTransactionSerializable extends TransactionSerializable,\n>({\n privateKey,\n transaction,\n}: SignTransactionArgs<TTransactionSerializable>): Promise<\n SignTransactionReturnType<TTransactionSerializable>\n> {\n const signature = await sign({\n hash: keccak256(serializeTransaction(transaction)),\n privateKey,\n })\n return serializeTransaction(transaction, signature)\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n /** The private key to sign with. */\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\n/**\n * @description Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\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 const signature = await sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n return signatureToHex(signature)\n}\n","import type { HDKey } from '@scure/bip32'\n\nimport { toHex } from '../utils'\nimport { privateKeyToAccount } from './privateKeyToAccount'\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a HD Key.\n *\n * @returns A HD Account.\n */\nexport function hdKeyToAccount(\n hdKey_: HDKey,\n { accountIndex = 0, addressIndex = 0, changeIndex = 0, path }: HDOptions = {},\n): HDAccount {\n const hdKey = hdKey_.derive(\n path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`,\n )\n const account = privateKeyToAccount(toHex(hdKey.privateKey!))\n return {\n ...account,\n getHdKey: () => hdKey,\n source: 'hd',\n }\n}\n","import { HDKey } from '@scure/bip32'\nimport { mnemonicToSeedSync } from '@scure/bip39'\nimport { hdKeyToAccount } from './hdKeyToAccount'\n\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a mnemonic phrase.\n *\n * @returns A HD Account.\n */\nexport function mnemonicToAccount(\n mnemonic: string,\n opts: HDOptions = {},\n): HDAccount {\n const seed = mnemonicToSeedSync(mnemonic)\n return hdKeyToAccount(HDKey.fromMasterSeed(seed), opts)\n}\n","import pkg from '@scure/bip39/wordlists/czech.js'\nexport const czech = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/english.js'\nexport const english = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/french.js'\nexport const french = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/italian.js'\nexport const italian = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/japanese.js'\nexport const japanese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/korean.js'\nexport const korean = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/simplified-chinese.js'\nexport const simplifiedChinese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/spanish.js'\nexport const spanish = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/traditional-chinese.js'\nexport const traditionalChinese = pkg.wordlist\n"]}
|
1
|
+
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signatureToHex.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTransaction.ts","../../src/accounts/utils/signTypedData.ts","../../src/accounts/hdKeyToAccount.ts","../../src/accounts/mnemonicToAccount.ts","../../src/accounts/wordlists/czech.ts","../../src/accounts/wordlists/english.ts","../../src/accounts/wordlists/french.ts","../../src/accounts/wordlists/italian.ts","../../src/accounts/wordlists/japanese.ts","../../src/accounts/wordlists/korean.ts","../../src/accounts/wordlists/simplifiedChinese.ts","../../src/accounts/wordlists/spanish.ts","../../src/accounts/wordlists/traditionalChinese.ts"],"names":["HDKey","secp256k1","pkg"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,SAAAA,cAAa;;;ACAtB,SAAS,oBAAoB,yBAAyB;AAS/C,SAAS,iBAAiB,UAA4B;AAC3D,SAAO,kBAAkB,QAAQ;AACnC;;;ACXA,SAAS,iBAAiB;AAUnB,SAAS,qBAA0B;AACxC,SAAO,MAAM,UAAU,MAAM,iBAAiB,CAAC;AACjD;;;ACZA,SAAS,a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M,UAAUA,KAAI;;;ACD3B,OAAOA,UAAS;AACT,IAAM,qBAAqBA,KAAI","sourcesContent":["import { HDKey } from '@scure/bip32'\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\n\nexport { hdKeyToAccount } from './hdKeyToAccount'\n\nexport { mnemonicToAccount } from './mnemonicToAccount'\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\nexport { czech } from './wordlists/czech'\nexport { english } from './wordlists/english'\nexport { french } from './wordlists/french'\nexport { italian } from './wordlists/italian'\nexport { japanese } from './wordlists/japanese'\nexport { korean } from './wordlists/korean'\nexport { simplifiedChinese } from './wordlists/simplifiedChinese'\nexport { spanish } from './wordlists/spanish'\nexport { traditionalChinese } from './wordlists/traditionalChinese'\n","import { generateMnemonic as generateMnemonic_ } from '@scure/bip39'\n\n/**\n * @description Generates a random mnemonic phrase with a given wordlist.\n *\n * @param wordlist The wordlist to use for generating the mnemonic phrase.\n *\n * @returns A randomly generated mnemonic phrase.\n */\nexport function generateMnemonic(wordlist: string[]): string {\n return generateMnemonic_(wordlist)\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\n\n/**\n * @description Generates a random private key.\n *\n * @returns A randomly generated private key.\n */\nexport function generatePrivateKey(): Hex {\n return toHex(secp256k1.utils.randomPrivateKey())\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport {\n publicKeyToAddress,\n signMessage,\n signTransaction,\n signTypedData,\n} from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\n/**\n * @description Creates an Account from a private key.\n *\n * @returns A Private Key Account.\n */\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false))\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 return signTransaction({ privateKey, transaction })\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n publicKey,\n source: 'privateKey',\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { toHex } from '../../utils'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Signature\n\n/**\n * @description Signs a hash with a given private key.\n *\n * @param hash The hash to sign.\n * @param privateKey The private key to sign with.\n *\n * @returns The signature.\n */\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2))\n return {\n r: toHex(r),\n s: toHex(s),\n v: recovery ? 28n : 27n,\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { hexToBigInt, toHex } from '../../utils'\n\nexport function signatureToHex({ r, s, v }: Signature): Hex {\n return `0x${new secp256k1.Signature(\n hexToBigInt(r),\n hexToBigInt(s),\n ).toCompactHex()}${toHex(v).slice(2)}`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignMessageParameters = {\n /** The message to sign. */\n message: string\n /** The private key to sign with. */\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\n/**\n * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\n */\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n const signature = await sign({ hash: hashMessage(message), privateKey })\n return signatureToHex(signature)\n}\n","import type {\n Hex,\n TransactionSerializable,\n TransactionSerialized,\n TransactionType,\n} from '../../types'\nimport {\n GetTransactionType,\n keccak256,\n serializeTransaction,\n} from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTransactionArgs<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n> = {\n privateKey: Hex\n transaction: TTransactionSerializable\n}\nexport type SignTransactionReturnType<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n TTransactionType extends TransactionType = GetTransactionType<TTransactionSerializable>,\n> = TransactionSerialized<TTransactionType>\n\nexport async function signTransaction<\n TTransactionSerializable extends TransactionSerializable,\n>({\n privateKey,\n transaction,\n}: SignTransactionArgs<TTransactionSerializable>): Promise<\n SignTransactionReturnType<TTransactionSerializable>\n> {\n const signature = await sign({\n hash: keccak256(serializeTransaction(transaction)),\n privateKey,\n })\n return serializeTransaction(transaction, signature)\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n /** The private key to sign with. */\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\n/**\n * @description Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\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 const signature = await sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n return signatureToHex(signature)\n}\n","import type { HDKey } from '@scure/bip32'\n\nimport { toHex } from '../utils'\nimport { privateKeyToAccount } from './privateKeyToAccount'\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a HD Key.\n *\n * @returns A HD Account.\n */\nexport function hdKeyToAccount(\n hdKey_: HDKey,\n { accountIndex = 0, addressIndex = 0, changeIndex = 0, path }: HDOptions = {},\n): HDAccount {\n const hdKey = hdKey_.derive(\n path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`,\n )\n const account = privateKeyToAccount(toHex(hdKey.privateKey!))\n return {\n ...account,\n getHdKey: () => hdKey,\n source: 'hd',\n }\n}\n","import { HDKey } from '@scure/bip32'\nimport { mnemonicToSeedSync } from '@scure/bip39'\nimport { hdKeyToAccount } from './hdKeyToAccount'\n\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a mnemonic phrase.\n *\n * @returns A HD Account.\n */\nexport function mnemonicToAccount(\n mnemonic: string,\n opts: HDOptions = {},\n): HDAccount {\n const seed = mnemonicToSeedSync(mnemonic)\n return hdKeyToAccount(HDKey.fromMasterSeed(seed), opts)\n}\n","import pkg from '@scure/bip39/wordlists/czech.js'\nexport const czech = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/english.js'\nexport const english = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/french'\nexport const french = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/italian'\nexport const italian = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/japanese'\nexport const japanese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/korean'\nexport const korean = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/simplified-chinese'\nexport const simplifiedChinese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/spanish'\nexport const spanish = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/traditional-chinese'\nexport const traditionalChinese = pkg.wordlist\n"]}
|
package/dist/accounts/index.mjs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import {
|
2
2
|
toAccount
|
3
|
-
} from "../chunk-
|
3
|
+
} from "../chunk-TDEQU4WU.mjs";
|
4
4
|
import {
|
5
5
|
hashMessage,
|
6
6
|
hashTypedData,
|
@@ -10,7 +10,7 @@ import {
|
|
10
10
|
publicKeyToAddress,
|
11
11
|
serializeTransaction,
|
12
12
|
toHex
|
13
|
-
} from "../chunk-
|
13
|
+
} from "../chunk-AZCTVIMY.mjs";
|
14
14
|
|
15
15
|
// src/accounts/index.ts
|
16
16
|
import { HDKey as HDKey2 } from "@scure/bip32";
|
@@ -139,31 +139,31 @@ import pkg2 from "@scure/bip39/wordlists/english.js";
|
|
139
139
|
var english = pkg2.wordlist;
|
140
140
|
|
141
141
|
// src/accounts/wordlists/french.ts
|
142
|
-
import pkg3 from "@scure/bip39/wordlists/french
|
142
|
+
import pkg3 from "@scure/bip39/wordlists/french";
|
143
143
|
var french = pkg3.wordlist;
|
144
144
|
|
145
145
|
// src/accounts/wordlists/italian.ts
|
146
|
-
import pkg4 from "@scure/bip39/wordlists/italian
|
146
|
+
import pkg4 from "@scure/bip39/wordlists/italian";
|
147
147
|
var italian = pkg4.wordlist;
|
148
148
|
|
149
149
|
// src/accounts/wordlists/japanese.ts
|
150
|
-
import pkg5 from "@scure/bip39/wordlists/japanese
|
150
|
+
import pkg5 from "@scure/bip39/wordlists/japanese";
|
151
151
|
var japanese = pkg5.wordlist;
|
152
152
|
|
153
153
|
// src/accounts/wordlists/korean.ts
|
154
|
-
import pkg6 from "@scure/bip39/wordlists/korean
|
154
|
+
import pkg6 from "@scure/bip39/wordlists/korean";
|
155
155
|
var korean = pkg6.wordlist;
|
156
156
|
|
157
157
|
// src/accounts/wordlists/simplifiedChinese.ts
|
158
|
-
import pkg7 from "@scure/bip39/wordlists/simplified-chinese
|
158
|
+
import pkg7 from "@scure/bip39/wordlists/simplified-chinese";
|
159
159
|
var simplifiedChinese = pkg7.wordlist;
|
160
160
|
|
161
161
|
// src/accounts/wordlists/spanish.ts
|
162
|
-
import pkg8 from "@scure/bip39/wordlists/spanish
|
162
|
+
import pkg8 from "@scure/bip39/wordlists/spanish";
|
163
163
|
var spanish = pkg8.wordlist;
|
164
164
|
|
165
165
|
// src/accounts/wordlists/traditionalChinese.ts
|
166
|
-
import pkg9 from "@scure/bip39/wordlists/traditional-chinese
|
166
|
+
import pkg9 from "@scure/bip39/wordlists/traditional-chinese";
|
167
167
|
var traditionalChinese = pkg9.wordlist;
|
168
168
|
export {
|
169
169
|
HDKey2 as HDKey,
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signatureToHex.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTransaction.ts","../../src/accounts/utils/signTypedData.ts","../../src/accounts/hdKeyToAccount.ts","../../src/accounts/mnemonicToAccount.ts","../../src/accounts/wordlists/czech.ts","../../src/accounts/wordlists/english.ts","../../src/accounts/wordlists/french.ts","../../src/accounts/wordlists/italian.ts","../../src/accounts/wordlists/japanese.ts","../../src/accounts/wordlists/korean.ts","../../src/accounts/wordlists/simplifiedChinese.ts","../../src/accounts/wordlists/spanish.ts","../../src/accounts/wordlists/traditionalChinese.ts"],"sourcesContent":["import { HDKey } from '@scure/bip32'\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\n\nexport { hdKeyToAccount } from './hdKeyToAccount'\n\nexport { mnemonicToAccount } from './mnemonicToAccount'\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\nexport { czech } from './wordlists/czech'\nexport { english } from './wordlists/english'\nexport { french } from './wordlists/french'\nexport { italian } from './wordlists/italian'\nexport { japanese } from './wordlists/japanese'\nexport { korean } from './wordlists/korean'\nexport { simplifiedChinese } from './wordlists/simplifiedChinese'\nexport { spanish } from './wordlists/spanish'\nexport { traditionalChinese } from './wordlists/traditionalChinese'\n","import { generateMnemonic as generateMnemonic_ } from '@scure/bip39'\n\n/**\n * @description Generates a random mnemonic phrase with a given wordlist.\n *\n * @param wordlist The wordlist to use for generating the mnemonic phrase.\n *\n * @returns A randomly generated mnemonic phrase.\n */\nexport function generateMnemonic(wordlist: string[]): string {\n return generateMnemonic_(wordlist)\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\n\n/**\n * @description Generates a random private key.\n *\n * @returns A randomly generated private key.\n */\nexport function generatePrivateKey(): Hex {\n return toHex(secp256k1.utils.randomPrivateKey())\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport {\n publicKeyToAddress,\n signMessage,\n signTransaction,\n signTypedData,\n} from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\n/**\n * @description Creates an Account from a private key.\n *\n * @returns A Private Key Account.\n */\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false))\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 return signTransaction({ privateKey, transaction })\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n publicKey,\n source: 'privateKey',\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { toHex } from '../../utils'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Signature\n\n/**\n * @description Signs a hash with a given private key.\n *\n * @param hash The hash to sign.\n * @param privateKey The private key to sign with.\n *\n * @returns The signature.\n */\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2))\n return {\n r: toHex(r),\n s: toHex(s),\n v: recovery ? 28n : 27n,\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { hexToBigInt, toHex } from '../../utils'\n\nexport function signatureToHex({ r, s, v }: Signature): Hex {\n return `0x${new secp256k1.Signature(\n hexToBigInt(r),\n hexToBigInt(s),\n ).toCompactHex()}${toHex(v).slice(2)}`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignMessageParameters = {\n /** The message to sign. */\n message: string\n /** The private key to sign with. */\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\n/**\n * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\n */\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n const signature = await sign({ hash: hashMessage(message), privateKey })\n return signatureToHex(signature)\n}\n","import type {\n Hex,\n TransactionSerializable,\n TransactionSerialized,\n TransactionType,\n} from '../../types'\nimport {\n GetTransactionType,\n keccak256,\n serializeTransaction,\n} from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTransactionArgs<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n> = {\n privateKey: Hex\n transaction: TTransactionSerializable\n}\nexport type SignTransactionReturnType<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n TTransactionType extends TransactionType = GetTransactionType<TTransactionSerializable>,\n> = TransactionSerialized<TTransactionType>\n\nexport async function signTransaction<\n TTransactionSerializable extends TransactionSerializable,\n>({\n privateKey,\n transaction,\n}: SignTransactionArgs<TTransactionSerializable>): Promise<\n SignTransactionReturnType<TTransactionSerializable>\n> {\n const signature = await sign({\n hash: keccak256(serializeTransaction(transaction)),\n privateKey,\n })\n return serializeTransaction(transaction, signature)\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n /** The private key to sign with. */\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\n/**\n * @description Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\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 const signature = await sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n return signatureToHex(signature)\n}\n","import type { HDKey } from '@scure/bip32'\n\nimport { toHex } from '../utils'\nimport { privateKeyToAccount } from './privateKeyToAccount'\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a HD Key.\n *\n * @returns A HD Account.\n */\nexport function hdKeyToAccount(\n hdKey_: HDKey,\n { accountIndex = 0, addressIndex = 0, changeIndex = 0, path }: HDOptions = {},\n): HDAccount {\n const hdKey = hdKey_.derive(\n path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`,\n )\n const account = privateKeyToAccount(toHex(hdKey.privateKey!))\n return {\n ...account,\n getHdKey: () => hdKey,\n source: 'hd',\n }\n}\n","import { HDKey } from '@scure/bip32'\nimport { mnemonicToSeedSync } from '@scure/bip39'\nimport { hdKeyToAccount } from './hdKeyToAccount'\n\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a mnemonic phrase.\n *\n * @returns A HD Account.\n */\nexport function mnemonicToAccount(\n mnemonic: string,\n opts: HDOptions = {},\n): HDAccount {\n const seed = mnemonicToSeedSync(mnemonic)\n return hdKeyToAccount(HDKey.fromMasterSeed(seed), opts)\n}\n","import pkg from '@scure/bip39/wordlists/czech.js'\nexport const czech = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/english.js'\nexport const english = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/french.js'\nexport const french = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/italian.js'\nexport const italian = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/japanese.js'\nexport const japanese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/korean.js'\nexport const korean = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/simplified-chinese.js'\nexport const simplifiedChinese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/spanish.js'\nexport const spanish = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/traditional-chinese.js'\nexport const traditionalChinese = pkg.wordlist\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,SAAAA,cA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OAAOC,UAAS;AACT,IAAM,UAAUA,KAAI;;;ACD3B,OAAOC,UAAS;AACT,IAAM,WAAWA,KAAI;;;ACD5B,OAAOC,UAAS;AACT,IAAM,SAASA,KAAI;;;ACD1B,OAAOC,UAAS;AACT,IAAM,oBAAoBA,KAAI;;;ACDrC,OAAOC,UAAS;AACT,IAAM,UAAUA,KAAI;;;ACD3B,OAAOC,UAAS;AACT,IAAM,qBAAqBA,KAAI;","names":["HDKey","secp256k1","secp256k1","secp256k1","secp256k1","secp256k1","secp256k1","pkg","pkg","pkg","pkg","pkg","pkg","pkg","pkg"]}
|
1
|
+
{"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.ts","../../src/accounts/privateKeyToAccount.ts","../../src/accounts/utils/sign.ts","../../src/accounts/utils/signatureToHex.ts","../../src/accounts/utils/signMessage.ts","../../src/accounts/utils/signTransaction.ts","../../src/accounts/utils/signTypedData.ts","../../src/accounts/hdKeyToAccount.ts","../../src/accounts/mnemonicToAccount.ts","../../src/accounts/wordlists/czech.ts","../../src/accounts/wordlists/english.ts","../../src/accounts/wordlists/french.ts","../../src/accounts/wordlists/italian.ts","../../src/accounts/wordlists/japanese.ts","../../src/accounts/wordlists/korean.ts","../../src/accounts/wordlists/simplifiedChinese.ts","../../src/accounts/wordlists/spanish.ts","../../src/accounts/wordlists/traditionalChinese.ts"],"sourcesContent":["import { HDKey } from '@scure/bip32'\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\n\nexport { hdKeyToAccount } from './hdKeyToAccount'\n\nexport { mnemonicToAccount } from './mnemonicToAccount'\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\nexport { czech } from './wordlists/czech'\nexport { english } from './wordlists/english'\nexport { french } from './wordlists/french'\nexport { italian } from './wordlists/italian'\nexport { japanese } from './wordlists/japanese'\nexport { korean } from './wordlists/korean'\nexport { simplifiedChinese } from './wordlists/simplifiedChinese'\nexport { spanish } from './wordlists/spanish'\nexport { traditionalChinese } from './wordlists/traditionalChinese'\n","import { generateMnemonic as generateMnemonic_ } from '@scure/bip39'\n\n/**\n * @description Generates a random mnemonic phrase with a given wordlist.\n *\n * @param wordlist The wordlist to use for generating the mnemonic phrase.\n *\n * @returns A randomly generated mnemonic phrase.\n */\nexport function generateMnemonic(wordlist: string[]): string {\n return generateMnemonic_(wordlist)\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\n\n/**\n * @description Generates a random private key.\n *\n * @returns A randomly generated private key.\n */\nexport function generatePrivateKey(): Hex {\n return toHex(secp256k1.utils.randomPrivateKey())\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex } from '../types'\nimport { toHex } from '../utils'\nimport {\n publicKeyToAddress,\n signMessage,\n signTransaction,\n signTypedData,\n} from './utils'\nimport { toAccount } from './toAccount'\nimport type { PrivateKeyAccount } from './types'\n\n/**\n * @description Creates an Account from a private key.\n *\n * @returns A Private Key Account.\n */\nexport function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount {\n const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false))\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 return signTransaction({ privateKey, transaction })\n },\n async signTypedData(typedData) {\n return signTypedData({ ...typedData, privateKey })\n },\n })\n\n return {\n ...account,\n publicKey,\n source: 'privateKey',\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { toHex } from '../../utils'\n\nexport type SignParameters = {\n hash: Hex\n privateKey: Hex\n}\nexport type SignReturnType = Signature\n\n/**\n * @description Signs a hash with a given private key.\n *\n * @param hash The hash to sign.\n * @param privateKey The private key to sign with.\n *\n * @returns The signature.\n */\nexport async function sign({\n hash,\n privateKey,\n}: SignParameters): Promise<SignReturnType> {\n const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2))\n return {\n r: toHex(r),\n s: toHex(s),\n v: recovery ? 28n : 27n,\n }\n}\n","import { secp256k1 } from '@noble/curves/secp256k1'\n\nimport type { Hex, Signature } from '../../types'\nimport { hexToBigInt, toHex } from '../../utils'\n\nexport function signatureToHex({ r, s, v }: Signature): Hex {\n return `0x${new secp256k1.Signature(\n hexToBigInt(r),\n hexToBigInt(s),\n ).toCompactHex()}${toHex(v).slice(2)}`\n}\n","import type { Hex } from '../../types'\nimport { hashMessage } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignMessageParameters = {\n /** The message to sign. */\n message: string\n /** The private key to sign with. */\n privateKey: Hex\n}\nexport type SignMessageReturnType = Hex\n\n/**\n * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\n */\nexport async function signMessage({\n message,\n privateKey,\n}: SignMessageParameters): Promise<SignMessageReturnType> {\n const signature = await sign({ hash: hashMessage(message), privateKey })\n return signatureToHex(signature)\n}\n","import type {\n Hex,\n TransactionSerializable,\n TransactionSerialized,\n TransactionType,\n} from '../../types'\nimport {\n GetTransactionType,\n keccak256,\n serializeTransaction,\n} from '../../utils'\nimport { sign } from './sign'\n\nexport type SignTransactionArgs<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n> = {\n privateKey: Hex\n transaction: TTransactionSerializable\n}\nexport type SignTransactionReturnType<\n TTransactionSerializable extends TransactionSerializable = TransactionSerializable,\n TTransactionType extends TransactionType = GetTransactionType<TTransactionSerializable>,\n> = TransactionSerialized<TTransactionType>\n\nexport async function signTransaction<\n TTransactionSerializable extends TransactionSerializable,\n>({\n privateKey,\n transaction,\n}: SignTransactionArgs<TTransactionSerializable>): Promise<\n SignTransactionReturnType<TTransactionSerializable>\n> {\n const signature = await sign({\n hash: keccak256(serializeTransaction(transaction)),\n privateKey,\n })\n return serializeTransaction(transaction, signature)\n}\n","import type { TypedData } from 'abitype'\n\nimport type { Hex, TypedDataDefinition } from '../../types'\nimport { HashTypedDataParameters, hashTypedData } from '../../utils'\nimport { sign } from './sign'\nimport { signatureToHex } from './signatureToHex'\n\nexport type SignTypedDataParameters<\n TTypedData extends TypedData | { [key: string]: unknown } = TypedData,\n TPrimaryType extends string = string,\n> = TypedDataDefinition<TTypedData, TPrimaryType> & {\n /** The private key to sign with. */\n privateKey: Hex\n}\n\nexport type SignTypedDataReturnType = Hex\n\n/**\n * @description Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):\n * `keccak256(\"\\x19Ethereum Signed Message:\\n\" + len(message) + message))`.\n *\n * @returns The signature.\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 const signature = await sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n return signatureToHex(signature)\n}\n","import type { HDKey } from '@scure/bip32'\n\nimport { toHex } from '../utils'\nimport { privateKeyToAccount } from './privateKeyToAccount'\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a HD Key.\n *\n * @returns A HD Account.\n */\nexport function hdKeyToAccount(\n hdKey_: HDKey,\n { accountIndex = 0, addressIndex = 0, changeIndex = 0, path }: HDOptions = {},\n): HDAccount {\n const hdKey = hdKey_.derive(\n path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`,\n )\n const account = privateKeyToAccount(toHex(hdKey.privateKey!))\n return {\n ...account,\n getHdKey: () => hdKey,\n source: 'hd',\n }\n}\n","import { HDKey } from '@scure/bip32'\nimport { mnemonicToSeedSync } from '@scure/bip39'\nimport { hdKeyToAccount } from './hdKeyToAccount'\n\nimport type { HDAccount, HDOptions } from './types'\n\n/**\n * @description Creates an Account from a mnemonic phrase.\n *\n * @returns A HD Account.\n */\nexport function mnemonicToAccount(\n mnemonic: string,\n opts: HDOptions = {},\n): HDAccount {\n const seed = mnemonicToSeedSync(mnemonic)\n return hdKeyToAccount(HDKey.fromMasterSeed(seed), opts)\n}\n","import pkg from '@scure/bip39/wordlists/czech.js'\nexport const czech = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/english.js'\nexport const english = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/french'\nexport const french = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/italian'\nexport const italian = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/japanese'\nexport const japanese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/korean'\nexport const korean = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/simplified-chinese'\nexport const simplifiedChinese = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/spanish'\nexport const spanish = pkg.wordlist\n","import pkg from '@scure/bip39/wordlists/traditional-chinese'\nexport const traditionalChinese = pkg.wordlist\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,SAAAA,cAAa;;;ACAtB,SAAS,oBAAoB,yBAAyB;AAS/C,SAAS,iBAAiB,UAA4B;AAC3D,SAAO,kBAAkB,QAAQ;AACnC;;;ACXA,SAAS,iBAAiB;AAUnB,SAAS,qBAA0B;AACxC,SAAO,MAAM,UAAU,MAAM,iBAAiB,CAAC;AACjD;;;ACZA,SAAS,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