viem 0.2.0-jxom-local-accounts.20230321T212822 → 0.2.0-jxom-local-accounts.20230325T211645

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.
@@ -1,33 +1,90 @@
1
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
2
  import { H as Hex } from '../chain-75b0942e.js';
3
+ import { P as PrivateKeyAccount, a as AccountSource, J as JsonRpcAccount, C as CustomSource, L as LocalAccount, T as TypedDataDefinition } from '../typedData-7cfe4bb6.js';
4
+ 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-7cfe4bb6.js';
5
5
  import { Address, TypedData } from 'abitype';
6
- export { p as parseAccount } from '../parseAccount-2d7ea01d.js';
6
+ export { p as parseAccount } from '../parseAccount-b6e8bc40.js';
7
+ export { wordlist as czech } from '@scure/bip39/wordlists/czech';
8
+ export { wordlist as english } from '@scure/bip39/wordlists/english';
9
+ export { wordlist as french } from '@scure/bip39/wordlists/french';
10
+ export { wordlist as italian } from '@scure/bip39/wordlists/italian';
11
+ export { wordlist as japanese } from '@scure/bip39/wordlists/japanese';
12
+ export { wordlist as korean } from '@scure/bip39/wordlists/korean';
13
+ export { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese';
14
+ export { wordlist as spanish } from '@scure/bip39/wordlists/spanish';
15
+ export { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese';
7
16
  import '@wagmi/chains';
8
17
 
18
+ /**
19
+ * @description Generates a random mnemonic phrase with a given wordlist.
20
+ *
21
+ * @param wordlist The wordlist to use for generating the mnemonic phrase.
22
+ *
23
+ * @returns A randomly generated mnemonic phrase.
24
+ */
25
+ declare function generateMnemonic(wordlist: string[]): string;
26
+
27
+ /**
28
+ * @description Generates a random private key.
29
+ *
30
+ * @returns A randomly generated private key.
31
+ */
32
+ declare function generatePrivateKey(): Hex;
33
+
34
+ /**
35
+ * @description Creates an Account from a private key.
36
+ *
37
+ * @returns A Private Key Account.
38
+ */
9
39
  declare function privateKeyToAccount(privateKey: Hex): PrivateKeyAccount;
10
40
 
11
41
  type GetAccountReturnType<TAccountSource extends AccountSource> = (TAccountSource extends Address ? JsonRpcAccount : never) | (TAccountSource extends CustomSource ? LocalAccount : never);
42
+ /**
43
+ * @description Creates an Account from a custom signing implementation.
44
+ *
45
+ * @returns A Local Account.
46
+ */
12
47
  declare function toAccount<TAccountSource extends AccountSource>(source: TAccountSource): GetAccountReturnType<TAccountSource>;
13
48
 
49
+ /**
50
+ * @description Converts an ECDSA public key to an address.
51
+ *
52
+ * @param publicKey The public key to convert.
53
+ *
54
+ * @returns The address.
55
+ */
14
56
  declare function publicKeyToAddress(publicKey: Hex): Address;
15
57
 
16
58
  type SignMessageParameters = {
59
+ /** The message to sign. */
17
60
  message: string;
61
+ /** The private key to sign with. */
18
62
  privateKey: Hex;
19
63
  };
20
64
  type SignMessageReturnType = Hex;
65
+ /**
66
+ * @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):
67
+ * `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
68
+ *
69
+ * @returns The signature.
70
+ */
21
71
  declare function signMessage({ message, privateKey, }: SignMessageParameters): Promise<SignMessageReturnType>;
22
72
 
23
73
  type SignTypedDataParameters<TTypedData extends TypedData | {
24
74
  [key: string]: unknown;
25
75
  } = TypedData, TPrimaryType extends string = string> = TypedDataDefinition<TTypedData, TPrimaryType> & {
76
+ /** The private key to sign with. */
26
77
  privateKey: Hex;
27
78
  };
28
79
  type SignTypedDataReturnType = Hex;
80
+ /**
81
+ * @description Signs typed data and calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):
82
+ * `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
83
+ *
84
+ * @returns The signature.
85
+ */
29
86
  declare function signTypedData<TTypedData extends TypedData | {
30
87
  [key: string]: unknown;
31
88
  }, TPrimaryType extends string = string>({ privateKey, ...typedData }: SignTypedDataParameters<TTypedData, TPrimaryType>): Promise<SignTypedDataReturnType>;
32
89
 
33
- export { SignMessageParameters, SignMessageReturnType, SignTypedDataParameters, SignTypedDataReturnType, privateKeyToAccount, publicKeyToAddress, signMessage, signTypedData, toAccount };
90
+ export { SignMessageParameters, SignMessageReturnType, SignTypedDataParameters, SignTypedDataReturnType, generateMnemonic, generatePrivateKey, privateKeyToAccount, publicKeyToAddress, signMessage, signTypedData, toAccount };
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkFQM5MF6Ujs = require('../chunk-FQM5MF6U.js');
3
+ var _chunk35AQXWIBjs = require('../chunk-35AQXWIB.js');
4
4
 
5
5
 
6
6
 
@@ -13,8 +13,20 @@ var _chunkNJSAEA2Hjs = require('../chunk-NJSAEA2H.js');
13
13
  // src/accounts/index.ts
14
14
  var _bip32 = require('@scure/bip32');
15
15
 
16
- // src/accounts/privateKeyToAccount.ts
16
+ // src/accounts/generateMnemonic.ts
17
+ var _bip39 = require('@scure/bip39');
18
+ function generateMnemonic(wordlist10) {
19
+ return _bip39.generateMnemonic.call(void 0, wordlist10);
20
+ }
21
+
22
+ // src/accounts/generatePrivateKey.ts
17
23
  var _secp256k1 = require('@noble/secp256k1');
24
+ function generatePrivateKey() {
25
+ return _chunkNJSAEA2Hjs.toHex.call(void 0, _secp256k1.utils.randomPrivateKey());
26
+ }
27
+
28
+ // src/accounts/privateKeyToAccount.ts
29
+
18
30
 
19
31
  // src/accounts/utils/publicKeyToAddress.ts
20
32
  function publicKeyToAddress(publicKey) {
@@ -58,7 +70,7 @@ async function signTypedData({
58
70
  function privateKeyToAccount(privateKey) {
59
71
  const publicKey = _chunkNJSAEA2Hjs.toHex.call(void 0, _secp256k1.getPublicKey.call(void 0, privateKey.slice(2)));
60
72
  const address = publicKeyToAddress(publicKey);
61
- const account = _chunkFQM5MF6Ujs.toAccount.call(void 0, {
73
+ const account = _chunk35AQXWIBjs.toAccount.call(void 0, {
62
74
  address,
63
75
  async signMessage({ message }) {
64
76
  return signMessage({ message, privateKey });
@@ -78,6 +90,28 @@ function privateKeyToAccount(privateKey) {
78
90
  };
79
91
  }
80
92
 
93
+ // src/accounts/wordlists.ts
94
+ var _czech = require('@scure/bip39/wordlists/czech');
95
+ var _english = require('@scure/bip39/wordlists/english');
96
+ var _french = require('@scure/bip39/wordlists/french');
97
+ var _italian = require('@scure/bip39/wordlists/italian');
98
+ var _japanese = require('@scure/bip39/wordlists/japanese');
99
+ var _korean = require('@scure/bip39/wordlists/korean');
100
+ var _simplifiedchinese = require('@scure/bip39/wordlists/simplified-chinese');
101
+ var _spanish = require('@scure/bip39/wordlists/spanish');
102
+ var _traditionalchinese = require('@scure/bip39/wordlists/traditional-chinese');
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+
113
+
114
+
81
115
 
82
116
 
83
117
 
@@ -85,5 +119,5 @@ function privateKeyToAccount(privateKey) {
85
119
 
86
120
 
87
121
 
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;
122
+ exports.HDKey = _bip32.HDKey; exports.czech = _czech.wordlist; exports.english = _english.wordlist; exports.french = _french.wordlist; exports.generateMnemonic = generateMnemonic; exports.generatePrivateKey = generatePrivateKey; exports.italian = _italian.wordlist; exports.japanese = _japanese.wordlist; exports.korean = _korean.wordlist; exports.parseAccount = _chunkNJSAEA2Hjs.parseAccount; exports.privateKeyToAccount = privateKeyToAccount; exports.publicKeyToAddress = publicKeyToAddress; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.simplifiedChinese = _simplifiedchinese.wordlist; exports.spanish = _spanish.wordlist; exports.toAccount = _chunk35AQXWIBjs.toAccount; exports.traditionalChinese = _traditionalchinese.wordlist;
89
123
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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"]}
1
+ {"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.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","../../src/accounts/wordlists.ts"],"names":["wordlist"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,aAAa;;;ACAtB,SAAS,oBAAoB,yBAAyB;AAS/C,SAAS,iBAAiBA,YAA4B;AAC3D,SAAO,kBAAkBA,UAAQ;AACnC;;;ACXA,SAAS,aAAa;AAUf,SAAS,qBAA0B;AACxC,SAAO,MAAM,MAAM,iBAAiB,CAAC;AACvC;;;ACZA,SAAS,oBAAoB;;;ACWtB,SAAS,mBAAmB,WAAyB;AAC1D,QAAM,UAAU,UAAU,KAAK,UAAU,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE;AACrE,SAAO,gBAAgB,KAAK,SAAS;AACvC;;;ACdA,SAAS,QAAQ,OAAO,iBAAiB;AAkBzC,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;;;ACDA,eAAsB,cAGpB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAGqC;AACnC,SAAO,KAAK;AAAA,IACV,MAAM,cAAc,SAAoC;AAAA,IACxD;AAAA,EACF,CAAC;AACH;;;AJvBO,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;;;AKrCA,SAAqB,gBAAa;AAClC,SAAqB,YAAZA,iBAA2B;AACpC,SAAqB,YAAZA,iBAA0B;AACnC,SAAqB,YAAZA,iBAA2B;AACpC,SAAqB,YAAZA,iBAA4B;AACrC,SAAqB,YAAZA,iBAA0B;AACnC,SAAqB,YAAZA,iBAAqC;AAC9C,SAAqB,YAAZA,iBAA2B;AACpC,SAAqB,YAAZA,iBAAsC","sourcesContent":["import { HDKey } from '@scure/bip32'\n\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\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 {\n czech,\n english,\n french,\n italian,\n japanese,\n korean,\n simplifiedChinese,\n spanish,\n traditionalChinese,\n} from './wordlists'\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 { utils } from '@noble/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(utils.randomPrivateKey())\n}\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\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(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\n/**\n * @description Converts an ECDSA public key to an address.\n *\n * @param publicKey The public key to convert.\n *\n * @returns The 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\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 [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 /** 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 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 /** 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 return sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n}\n","export { wordlist as czech } from '@scure/bip39/wordlists/czech'\nexport { wordlist as english } from '@scure/bip39/wordlists/english'\nexport { wordlist as french } from '@scure/bip39/wordlists/french'\nexport { wordlist as italian } from '@scure/bip39/wordlists/italian'\nexport { wordlist as japanese } from '@scure/bip39/wordlists/japanese'\nexport { wordlist as korean } from '@scure/bip39/wordlists/korean'\nexport { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese'\nexport { wordlist as spanish } from '@scure/bip39/wordlists/spanish'\nexport { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese'\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toAccount
3
- } from "../chunk-FNVFGFWN.mjs";
3
+ } from "../chunk-ZHKTGT4Q.mjs";
4
4
  import {
5
5
  checksumAddress,
6
6
  hashMessage,
@@ -13,6 +13,18 @@ import {
13
13
  // src/accounts/index.ts
14
14
  import { HDKey } from "@scure/bip32";
15
15
 
16
+ // src/accounts/generateMnemonic.ts
17
+ import { generateMnemonic as generateMnemonic_ } from "@scure/bip39";
18
+ function generateMnemonic(wordlist10) {
19
+ return generateMnemonic_(wordlist10);
20
+ }
21
+
22
+ // src/accounts/generatePrivateKey.ts
23
+ import { utils } from "@noble/secp256k1";
24
+ function generatePrivateKey() {
25
+ return toHex(utils.randomPrivateKey());
26
+ }
27
+
16
28
  // src/accounts/privateKeyToAccount.ts
17
29
  import { getPublicKey } from "@noble/secp256k1";
18
30
 
@@ -77,13 +89,35 @@ function privateKeyToAccount(privateKey) {
77
89
  source: "privateKey"
78
90
  };
79
91
  }
92
+
93
+ // src/accounts/wordlists.ts
94
+ import { wordlist } from "@scure/bip39/wordlists/czech";
95
+ import { wordlist as wordlist2 } from "@scure/bip39/wordlists/english";
96
+ import { wordlist as wordlist3 } from "@scure/bip39/wordlists/french";
97
+ import { wordlist as wordlist4 } from "@scure/bip39/wordlists/italian";
98
+ import { wordlist as wordlist5 } from "@scure/bip39/wordlists/japanese";
99
+ import { wordlist as wordlist6 } from "@scure/bip39/wordlists/korean";
100
+ import { wordlist as wordlist7 } from "@scure/bip39/wordlists/simplified-chinese";
101
+ import { wordlist as wordlist8 } from "@scure/bip39/wordlists/spanish";
102
+ import { wordlist as wordlist9 } from "@scure/bip39/wordlists/traditional-chinese";
80
103
  export {
81
104
  HDKey,
105
+ wordlist as czech,
106
+ wordlist2 as english,
107
+ wordlist3 as french,
108
+ generateMnemonic,
109
+ generatePrivateKey,
110
+ wordlist4 as italian,
111
+ wordlist5 as japanese,
112
+ wordlist6 as korean,
82
113
  parseAccount,
83
114
  privateKeyToAccount,
84
115
  publicKeyToAddress,
85
116
  signMessage,
86
117
  signTypedData,
87
- toAccount
118
+ wordlist7 as simplifiedChinese,
119
+ wordlist8 as spanish,
120
+ toAccount,
121
+ wordlist9 as traditionalChinese
88
122
  };
89
123
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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
+ {"version":3,"sources":["../../src/accounts/index.ts","../../src/accounts/generateMnemonic.ts","../../src/accounts/generatePrivateKey.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","../../src/accounts/wordlists.ts"],"sourcesContent":["import { HDKey } from '@scure/bip32'\n\nexport { HDKey }\n\nexport { generateMnemonic } from './generateMnemonic'\n\nexport { generatePrivateKey } from './generatePrivateKey'\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 {\n czech,\n english,\n french,\n italian,\n japanese,\n korean,\n simplifiedChinese,\n spanish,\n traditionalChinese,\n} from './wordlists'\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 { utils } from '@noble/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(utils.randomPrivateKey())\n}\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\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(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\n/**\n * @description Converts an ECDSA public key to an address.\n *\n * @param publicKey The public key to convert.\n *\n * @returns The 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\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 [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 /** 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 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 /** 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 return sign({\n hash: hashTypedData(typedData as HashTypedDataParameters),\n privateKey,\n })\n}\n","export { wordlist as czech } from '@scure/bip39/wordlists/czech'\nexport { wordlist as english } from '@scure/bip39/wordlists/english'\nexport { wordlist as french } from '@scure/bip39/wordlists/french'\nexport { wordlist as italian } from '@scure/bip39/wordlists/italian'\nexport { wordlist as japanese } from '@scure/bip39/wordlists/japanese'\nexport { wordlist as korean } from '@scure/bip39/wordlists/korean'\nexport { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese'\nexport { wordlist as spanish } from '@scure/bip39/wordlists/spanish'\nexport { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese'\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,aAAa;;;ACAtB,SAAS,oBAAoB,yBAAyB;AAS/C,SAAS,iBAAiBA,YAA4B;AAC3D,SAAO,kBAAkBA,UAAQ;AACnC;;;ACXA,SAAS,aAAa;AAUf,SAAS,qBAA0B;AACxC,SAAO,MAAM,MAAM,iBAAiB,CAAC;AACvC;;;ACZA,SAAS,oBAAoB;;;ACWtB,SAAS,mBAAmB,WAAyB;AAC1D,QAAM,UAAU,UAAU,KAAK,UAAU,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE;AACrE,SAAO,gBAAgB,KAAK,SAAS;AACvC;;;ACdA,SAAS,QAAQ,OAAO,iBAAiB;AAkBzC,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;;;ACDA,eAAsB,cAGpB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAGqC;AACnC,SAAO,KAAK;AAAA,IACV,MAAM,cAAc,SAAoC;AAAA,IACxD;AAAA,EACF,CAAC;AACH;;;AJvBO,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;;;AKrCA,SAAqB,gBAAa;AAClC,SAAqB,YAAZC,iBAA2B;AACpC,SAAqB,YAAZA,iBAA0B;AACnC,SAAqB,YAAZA,iBAA2B;AACpC,SAAqB,YAAZA,iBAA4B;AACrC,SAAqB,YAAZA,iBAA0B;AACnC,SAAqB,YAAZA,iBAAqC;AAC9C,SAAqB,YAAZA,iBAA2B;AACpC,SAAqB,YAAZA,iBAAsC;","names":["wordlist","wordlist"]}
@@ -28,4 +28,4 @@ function toAccount(source) {
28
28
 
29
29
 
30
30
  exports.toAccount = toAccount;
31
- //# sourceMappingURL=chunk-FQM5MF6U.js.map
31
+ //# sourceMappingURL=chunk-35AQXWIB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/accounts/toAccount.ts"],"names":[],"mappings":";;;;;;AAmBO,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\n/**\n * @description Creates an Account from a custom signing implementation.\n *\n * @returns A Local Account.\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"]}
@@ -28,4 +28,4 @@ function toAccount(source) {
28
28
  export {
29
29
  toAccount
30
30
  };
31
- //# sourceMappingURL=chunk-FNVFGFWN.mjs.map
31
+ //# sourceMappingURL=chunk-ZHKTGT4Q.mjs.map
@@ -0,0 +1 @@
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\n/**\n * @description Creates an Account from a custom signing implementation.\n *\n * @returns A Local Account.\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":";;;;;;AAmBO,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":[]}
@@ -1,11 +1,11 @@
1
1
  export { D as DecodeAbiParametersReturnType, E as EncodeAbiParametersReturnType, G as GetAbiItemParameters, d as decodeAbiParameters, e as encodeAbiParameters, g as getAbiItem } from './getAbiItem-693e6e1b.js';
2
2
  export { D as DecodeErrorResultParameters, a as DecodeErrorResultReturnType, b as DecodeEventLogParameters, c as DecodeEventLogReturnType, d as DecodeFunctionDataParameters, e as DecodeFunctionResultParameters, f as DecodeFunctionResultReturnType, E as EncodeDeployDataParameters, g as EncodeErrorResultParameters, h as EncodeEventTopicsParameters, i as EncodeFunctionDataParameters, j as EncodeFunctionResultParameters, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from './encodeFunctionResult-4792a6a3.js';
3
3
  export { a as formatAbiItem, f as formatAbiItemWithArgs } from './formatAbiItem-765ebc53.js';
4
- export { n as CreateContractEventFilterParameters, o as CreateContractEventFilterReturnType, Q as DeployContractParameters, U as DeployContractReturnType, p as EstimateContractGasParameters, q as EstimateContractGasReturnType, G as GetBytecodeParameters, r as GetBytecodeReturnType, s as GetStorageAtParameters, t as GetStorageAtReturnType, M as MulticallParameters, u as MulticallReturnType, O as OnLogsFn, v as OnLogsParameter, R as ReadContractParameters, w as ReadContractReturnType, x as SimulateContractParameters, y as SimulateContractReturnType, z as WatchContractEventParameters, V as WriteContractParameters, X as WriteContractReturnType, A as createContractEventFilter, Y as deployContract, D as estimateContractGas, H as getBytecode, I as getStorageAt, J as multicall, K as readContract, L as simulateContract, N as watchContractEvent, Z as writeContract } from './createPublicClient-d2c37c92.js';
4
+ export { n as CreateContractEventFilterParameters, o as CreateContractEventFilterReturnType, Q as DeployContractParameters, U as DeployContractReturnType, p as EstimateContractGasParameters, q as EstimateContractGasReturnType, G as GetBytecodeParameters, r as GetBytecodeReturnType, s as GetStorageAtParameters, t as GetStorageAtReturnType, M as MulticallParameters, u as MulticallReturnType, O as OnLogsFn, v as OnLogsParameter, R as ReadContractParameters, w as ReadContractReturnType, x as SimulateContractParameters, y as SimulateContractReturnType, z as WatchContractEventParameters, V as WriteContractParameters, X as WriteContractReturnType, A as createContractEventFilter, Y as deployContract, D as estimateContractGas, H as getBytecode, I as getStorageAt, J as multicall, K as readContract, L as simulateContract, N as watchContractEvent, Z as writeContract } from './createPublicClient-f876dff3.js';
5
5
  import 'abitype';
6
6
  import './chain-75b0942e.js';
7
7
  import '@wagmi/chains';
8
8
  import './eip1193-ae706fd8.js';
9
9
  import './createClient-f87255c1.js';
10
- import './typedData-ade018d6.js';
10
+ import './typedData-7cfe4bb6.js';
11
11
  import '@scure/bip32';
@@ -1,7 +1,7 @@
1
1
  import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-ae706fd8.js';
2
2
  import { a as Transport, b as ClientConfig, C as Client } from './createClient-f87255c1.js';
3
3
  import { Address, Abi, Narrow, TypedData, AbiEvent, ExtractAbiEvent } from 'abitype';
4
- import { A as Account, J as JsonRpcAccount, T as TypedDataDefinition } from './typedData-ade018d6.js';
4
+ import { A as Account, J as JsonRpcAccount, T as TypedDataDefinition } from './typedData-7cfe4bb6.js';
5
5
  import { C as Chain, W as ExtractFormatter, a1 as Formatters, a2 as Formatter, X as Formatted, c as Block, R as RpcBlock, O as Transaction, T as TransactionReceipt, z as RpcTransactionReceipt, a3 as TransactionType, D as RpcTransactionRequest, I as TransactionRequest, f as BlockTag, H as Hex, a4 as MergeIntersectionProperties, a5 as GetChain, h as ExtractConstructorArgsFromAbi, a as Hash, a6 as GetValue, g as ContractConfig, p as ExtractResultFromAbi, a7 as MaybeAbiEventName, a8 as MaybeExtractEventArgsFromAbi, e as BlockNumber, m as ExtractEventNameFromAbi, F as FeeHistory, L as Log, Y as FormattedTransaction, Z as TransactionFormatter, k as ExtractEventArgsFromAbi, a9 as Prettify } from './chain-75b0942e.js';
6
6
 
7
7
  type GetAccountParameter<TAccount extends Account | undefined = undefined> = TAccount extends undefined ? {
package/dist/ens.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- export { _ as GetEnsAddressParameters, $ as GetEnsNameParameters, a0 as getEnsAddress, a1 as getEnsName } from './createPublicClient-d2c37c92.js';
1
+ export { _ as GetEnsAddressParameters, $ as GetEnsNameParameters, a0 as getEnsAddress, a1 as getEnsName } from './createPublicClient-f876dff3.js';
2
2
  export { l as labelhash, n as namehash } from './namehash-afff0feb.js';
3
3
  import './eip1193-ae706fd8.js';
4
4
  import 'abitype';
5
5
  import './chain-75b0942e.js';
6
6
  import '@wagmi/chains';
7
7
  import './createClient-f87255c1.js';
8
- import './typedData-ade018d6.js';
8
+ import './typedData-7cfe4bb6.js';
9
9
  import '@scure/bip32';
10
10
 
11
11
  /**
package/dist/ethers.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { L as LocalAccount } from './typedData-ade018d6.js';
1
+ import { L as LocalAccount } from './typedData-7cfe4bb6.js';
2
2
  import '@scure/bip32';
3
3
  import 'abitype';
4
4
  import './chain-75b0942e.js';
package/dist/ethers.js CHANGED
@@ -1,12 +1,12 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
- var _chunkFQM5MF6Ujs = require('./chunk-FQM5MF6U.js');
3
+ var _chunk35AQXWIBjs = require('./chunk-35AQXWIB.js');
4
4
 
5
5
 
6
6
  var _chunkNJSAEA2Hjs = require('./chunk-NJSAEA2H.js');
7
7
 
8
8
  // src/adapters/ethers.ts
9
- var ethersWalletToAccount = (wallet) => _chunkFQM5MF6Ujs.toAccount.call(void 0, {
9
+ var ethersWalletToAccount = (wallet) => _chunk35AQXWIBjs.toAccount.call(void 0, {
10
10
  address: wallet.address,
11
11
  async signMessage({ message }) {
12
12
  return await wallet.signMessage(_chunkNJSAEA2Hjs.toBytes.call(void 0, message));
package/dist/ethers.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  toAccount
3
- } from "./chunk-FNVFGFWN.mjs";
3
+ } from "./chunk-ZHKTGT4Q.mjs";
4
4
  import {
5
5
  toBytes
6
6
  } from "./chunk-IVRML3IK.mjs";
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { T as TransportConfig, a as Transport, B as BaseRpcRequests } from './createClient-f87255c1.js';
2
2
  export { C as Client, b as ClientConfig, a as Transport, T as TransportConfig, c as createClient, d as createTransport } from './createClient-f87255c1.js';
3
- import { B as BaseError, H as HttpOptions, R as RpcResponse } from './parseGwei-377678bc.js';
4
- export { B as BaseError, C as CallExecutionError, a as ContractFunctionExecutionError, b as ContractFunctionRevertedError, c as ContractFunctionZeroDataError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, G as GetContractAddressOptions, o as GetCreate2AddressOptions, p as GetCreateAddressOptions, q as HashTypedDataParameters, r as HashTypedDataReturnType, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, N as NonceMaxValueError, h as NonceTooHighError, i as NonceTooLowError, j as RawContractError, s as RecoverAddressParameters, t as RecoverAddressReturnType, u as RecoverMessageAddressParameters, v as RecoverMessageAddressReturnType, w as RecoverTypedDataAddressParameters, x as RecoverTypedDataAddressReturnType, T as TipAboveFeeCapError, y as ToRlpReturnType, k as TransactionExecutionError, m as TransactionNotFoundError, n as TransactionReceiptNotFoundError, l as TransactionTypeNotSupportedError, U as UnknownNodeError, V as VerifyMessageParameters, z as VerifyMessageReturnType, A as VerifyTypedDataParameters, D as VerifyTypedDataReturnType, W as WaitForTransactionReceiptTimeoutError, J as boolToBytes, K as boolToHex, L as bytesToBigint, M as bytesToBool, O as bytesToHex, P as bytesToNumber, Q as bytesToString, S as concat, X as concatBytes, Y as concatHex, Z as formatEther, _ as formatGwei, $ as formatUnits, a0 as fromBytes, a1 as fromHex, a2 as fromRlp, a3 as getAddress, a4 as getContractAddress, a5 as getContractError, a6 as getCreate2Address, a7 as getCreateAddress, a8 as getEventSelector, a9 as getFunctionSelector, aa as hashMessage, ab as hashTypedData, ac as hexToBigInt, ad as hexToBool, ae as hexToBytes, af as hexToNumber, ag as hexToString, ah as isAddress, ai as isAddressEqual, aj as isBytes, ak as isHex, al as keccak256, am as numberToBytes, an as numberToHex, ao as pad, ap as padBytes, aq as padHex, ar as parseEther, as as parseGwei, at as parseUnits, au as recoverAddress, av as recoverMessageAddress, aw as size, ax as slice, ay as sliceBytes, az as sliceHex, aA as stringToBytes, aB as stringToHex, aC as stringify, aD as toBytes, aE as toHex, aF as toRlp, aG as trim, aH as validateTypedData, aI as verifyMessage } from './parseGwei-377678bc.js';
3
+ import { B as BaseError, H as HttpOptions, R as RpcResponse } from './parseGwei-1030ed5a.js';
4
+ export { B as BaseError, C as CallExecutionError, a as ContractFunctionExecutionError, b as ContractFunctionRevertedError, c as ContractFunctionZeroDataError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, G as GetContractAddressOptions, o as GetCreate2AddressOptions, p as GetCreateAddressOptions, q as HashTypedDataParameters, r as HashTypedDataReturnType, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, N as NonceMaxValueError, h as NonceTooHighError, i as NonceTooLowError, j as RawContractError, s as RecoverAddressParameters, t as RecoverAddressReturnType, u as RecoverMessageAddressParameters, v as RecoverMessageAddressReturnType, w as RecoverTypedDataAddressParameters, x as RecoverTypedDataAddressReturnType, T as TipAboveFeeCapError, y as ToRlpReturnType, k as TransactionExecutionError, m as TransactionNotFoundError, n as TransactionReceiptNotFoundError, l as TransactionTypeNotSupportedError, U as UnknownNodeError, V as VerifyMessageParameters, z as VerifyMessageReturnType, A as VerifyTypedDataParameters, D as VerifyTypedDataReturnType, W as WaitForTransactionReceiptTimeoutError, J as boolToBytes, K as boolToHex, L as bytesToBigint, M as bytesToBool, O as bytesToHex, P as bytesToNumber, Q as bytesToString, S as concat, X as concatBytes, Y as concatHex, Z as formatEther, _ as formatGwei, $ as formatUnits, a0 as fromBytes, a1 as fromHex, a2 as fromRlp, a3 as getAddress, a4 as getContractAddress, a5 as getContractError, a6 as getCreate2Address, a7 as getCreateAddress, a8 as getEventSelector, a9 as getFunctionSelector, aa as hashMessage, ab as hashTypedData, ac as hexToBigInt, ad as hexToBool, ae as hexToBytes, af as hexToNumber, ag as hexToString, ah as isAddress, ai as isAddressEqual, aj as isBytes, ak as isHex, al as keccak256, am as numberToBytes, an as numberToHex, ao as pad, ap as padBytes, aq as padHex, ar as parseEther, as as parseGwei, at as parseUnits, au as recoverAddress, av as recoverMessageAddress, aw as size, ax as slice, ay as sliceBytes, az as sliceHex, aA as stringToBytes, aB as stringToHex, aC as stringify, aD as toBytes, aE as toHex, aF as toRlp, aG as trim, aH as validateTypedData, aI as verifyMessage } from './parseGwei-1030ed5a.js';
5
5
  import WebSocket from 'isomorphic-ws';
6
6
  import { H as Hex, A as AbiItem, a as Hash, C as Chain, B as ByteArray } from './chain-75b0942e.js';
7
7
  export { A as AbiItem, b as AccessList, c as Block, d as BlockIdentifier, e as BlockNumber, f as BlockTag, B as ByteArray, C as Chain, g as ContractConfig, E as ExtractArgsFromAbi, h as ExtractConstructorArgsFromAbi, i as ExtractErrorArgsFromAbi, j as ExtractErrorNameFromAbi, k as ExtractEventArgsFromAbi, l as ExtractEventArgsFromTopics, m as ExtractEventNameFromAbi, W as ExtractFormatter, n as ExtractFunctionNameFromAbi, o as ExtractNameFromAbi, p as ExtractResultFromAbi, F as FeeHistory, q as FeeValues, r as FeeValuesEIP1559, s as FeeValuesLegacy, X as Formatted, Y as FormattedTransaction, a as Hash, H as Hex, L as Log, R as RpcBlock, t as RpcBlockIdentifier, u as RpcBlockNumber, v as RpcFeeHistory, w as RpcFeeValues, x as RpcLog, y as RpcTransaction, z as RpcTransactionReceipt, D as RpcTransactionRequest, G as RpcUncle, O as Transaction, P as TransactionBase, Q as TransactionEIP1559, S as TransactionEIP2930, Z as TransactionFormatter, U as TransactionLegacy, T as TransactionReceipt, I as TransactionRequest, J as TransactionRequestBase, K as TransactionRequestEIP1559, M as TransactionRequestEIP2930, N as TransactionRequestLegacy, V as Uncle, _ as defineTransaction, $ as formatTransaction, a0 as transactionType } from './chain-75b0942e.js';
8
- export { B as BlockFormatter, F as FormattedBlock, f as FormattedTransactionReceipt, g as FormattedTransactionRequest, e as ParseAccount, P as PublicClient, a as PublicClientConfig, T as TransactionReceiptFormatter, h as TransactionRequestFormatter, W as WalletClient, b as WalletClientConfig, c as createPublicClient, d as createWalletClient, i as defineBlock, j as defineTransactionReceipt, k as defineTransactionRequest, l as formatBlock, m as formatTransactionRequest } from './createPublicClient-d2c37c92.js';
8
+ export { B as BlockFormatter, F as FormattedBlock, f as FormattedTransactionReceipt, g as FormattedTransactionRequest, e as ParseAccount, P as PublicClient, a as PublicClientConfig, T as TransactionReceiptFormatter, h as TransactionRequestFormatter, W as WalletClient, b as WalletClientConfig, c as createPublicClient, d as createWalletClient, i as defineBlock, j as defineTransactionReceipt, k as defineTransactionRequest, l as formatBlock, m as formatTransactionRequest } from './createPublicClient-f876dff3.js';
9
9
  export { T as TestClient, a as TestClientConfig, c as createTestClient } from './test-98c0b642.js';
10
10
  import { AbiParameter } from 'abitype';
11
11
  export { Address, ParseAbi, ParseAbiItem, ParseAbiParameter, ParseAbiParameters, parseAbi, parseAbiItem, parseAbiParameter, parseAbiParameters } from 'abitype';
@@ -13,7 +13,7 @@ export { l as labelhash, n as namehash } from './namehash-afff0feb.js';
13
13
  export { D as DecodeAbiParametersReturnType, E as EncodeAbiParametersReturnType, G as GetAbiItemParameters, d as decodeAbiParameters, e as encodeAbiParameters, g as getAbiItem } from './getAbiItem-693e6e1b.js';
14
14
  export { D as DecodeErrorResultParameters, a as DecodeErrorResultReturnType, b as DecodeEventLogParameters, c as DecodeEventLogReturnType, d as DecodeFunctionDataParameters, e as DecodeFunctionResultParameters, f as DecodeFunctionResultReturnType, E as EncodeDeployDataParameters, g as EncodeErrorResultParameters, h as EncodeEventTopicsParameters, i as EncodeFunctionDataParameters, j as EncodeFunctionResultParameters, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from './encodeFunctionResult-4792a6a3.js';
15
15
  export { e as encodePacked } from './encodePacked-3fcdd54b.js';
16
- export { A as Account, a as AccountSource, C as CustomSource, H as HDAccount, b as HDOptions, J as JsonRpcAccount, L as LocalAccount } from './typedData-ade018d6.js';
16
+ export { A as Account, a as AccountSource, C as CustomSource, H as HDAccount, b as HDOptions, J as JsonRpcAccount, L as LocalAccount } from './typedData-7cfe4bb6.js';
17
17
  export { d as defineChain } from './chain-f8db473f.js';
18
18
  export { HDKey } from '@scure/bip32';
19
19
  import './eip1193-ae706fd8.js';
@@ -1,5 +1,5 @@
1
1
  import { Address } from 'abitype';
2
- import { A as Account } from './typedData-ade018d6.js';
2
+ import { A as Account } from './typedData-7cfe4bb6.js';
3
3
 
4
4
  declare function parseAccount(account: Address | Account): Account;
5
5
 
@@ -1,7 +1,7 @@
1
1
  import { Address, Abi, TypedData } from 'abitype';
2
2
  import { B as ByteArray, H as Hex, C as Chain, a as Hash, f as BlockTag, ab as EventDefinition } from './chain-75b0942e.js';
3
- import { A as Account, T as TypedDataDefinition } from './typedData-ade018d6.js';
4
- import { C as CallParameters, E as EstimateGasParameters, S as SendTransactionParameters } from './createPublicClient-d2c37c92.js';
3
+ import { A as Account, T as TypedDataDefinition } from './typedData-7cfe4bb6.js';
4
+ import { C as CallParameters, E as EstimateGasParameters, S as SendTransactionParameters } from './createPublicClient-f876dff3.js';
5
5
  import { a as DecodeErrorResultReturnType } from './encodeFunctionResult-4792a6a3.js';
6
6
  import WebSocket from 'isomorphic-ws';
7
7
 
package/dist/public.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { C as CallParameters, as as CallReturnType, at as CreateBlockFilterReturnType, au as CreateEventFilterParameters, av as CreateEventFilterReturnType, aw as CreatePendingTransactionFilterReturnType, E as EstimateGasParameters, ax as EstimateGasReturnType, ay as GetBalanceParameters, az as GetBalanceReturnType, aB as GetBlockNumberParameters, aC as GetBlockNumberReturnType, aA as GetBlockParameters, aD as GetBlockReturnType, aE as GetBlockTransactionCountParameters, aF as GetBlockTransactionCountReturnType, G as GetBytecodeParameters, r as GetBytecodeReturnType, aG as GetFeeHistoryParameters, aH as GetFeeHistoryReturnType, aI as GetFilterChangesParameters, aJ as GetFilterChangesReturnType, aK as GetFilterLogsParameters, aL as GetFilterLogsReturnType, aM as GetGasPriceReturnType, aO as GetTransactionConfirmationsParameters, aP as GetTransactionConfirmationsReturnType, aQ as GetTransactionCountParameters, aR as GetTransactionCountReturnType, aN as GetTransactionParameters, aS as GetTransactionReceiptParameters, aT as GetTransactionReceiptReturnType, aU as GetTransactionReturnType, aV as OnBlock, aW as OnBlockNumberFn, aX as OnBlockNumberParameter, aY as OnBlockParameter, O as OnLogsFn, v as OnLogsParameter, aZ as OnTransactionsFn, a_ as OnTransactionsParameter, a$ as ReplacementReason, b0 as ReplacementReturnType, b1 as UninstallFilterParameters, b2 as UninstallFilterReturnType, b3 as WaitForTransactionReceiptParameters, b4 as WaitForTransactionReceiptReturnType, b5 as WatchBlockNumberParameters, b6 as WatchBlocksParameters, b7 as WatchPendingTransactionsParameters, a2 as call, a3 as createBlockFilter, a4 as createEventFilter, a5 as createPendingTransactionFilter, a6 as estimateGas, a7 as getBalance, a8 as getBlock, a9 as getBlockNumber, aa as getBlockNumberCache, ab as getBlockTransactionCount, H as getBytecode, ac as getChainId, ad as getFeeHistory, ae as getFilterChanges, af as getFilterLogs, ah as getGasPrice, ag as getLogs, ai as getTransaction, aj as getTransactionConfirmations, ak as getTransactionCount, al as getTransactionReceipt, am as uninstallFilter, an as waitForTransactionReceipt, ao as watchBlockNumber, ap as watchBlocks, aq as watchEvent, ar as watchPendingTransactions } from './createPublicClient-d2c37c92.js';
1
+ export { C as CallParameters, as as CallReturnType, at as CreateBlockFilterReturnType, au as CreateEventFilterParameters, av as CreateEventFilterReturnType, aw as CreatePendingTransactionFilterReturnType, E as EstimateGasParameters, ax as EstimateGasReturnType, ay as GetBalanceParameters, az as GetBalanceReturnType, aB as GetBlockNumberParameters, aC as GetBlockNumberReturnType, aA as GetBlockParameters, aD as GetBlockReturnType, aE as GetBlockTransactionCountParameters, aF as GetBlockTransactionCountReturnType, G as GetBytecodeParameters, r as GetBytecodeReturnType, aG as GetFeeHistoryParameters, aH as GetFeeHistoryReturnType, aI as GetFilterChangesParameters, aJ as GetFilterChangesReturnType, aK as GetFilterLogsParameters, aL as GetFilterLogsReturnType, aM as GetGasPriceReturnType, aO as GetTransactionConfirmationsParameters, aP as GetTransactionConfirmationsReturnType, aQ as GetTransactionCountParameters, aR as GetTransactionCountReturnType, aN as GetTransactionParameters, aS as GetTransactionReceiptParameters, aT as GetTransactionReceiptReturnType, aU as GetTransactionReturnType, aV as OnBlock, aW as OnBlockNumberFn, aX as OnBlockNumberParameter, aY as OnBlockParameter, O as OnLogsFn, v as OnLogsParameter, aZ as OnTransactionsFn, a_ as OnTransactionsParameter, a$ as ReplacementReason, b0 as ReplacementReturnType, b1 as UninstallFilterParameters, b2 as UninstallFilterReturnType, b3 as WaitForTransactionReceiptParameters, b4 as WaitForTransactionReceiptReturnType, b5 as WatchBlockNumberParameters, b6 as WatchBlocksParameters, b7 as WatchPendingTransactionsParameters, a2 as call, a3 as createBlockFilter, a4 as createEventFilter, a5 as createPendingTransactionFilter, a6 as estimateGas, a7 as getBalance, a8 as getBlock, a9 as getBlockNumber, aa as getBlockNumberCache, ab as getBlockTransactionCount, H as getBytecode, ac as getChainId, ad as getFeeHistory, ae as getFilterChanges, af as getFilterLogs, ah as getGasPrice, ag as getLogs, ai as getTransaction, aj as getTransactionConfirmations, ak as getTransactionCount, al as getTransactionReceipt, am as uninstallFilter, an as waitForTransactionReceipt, ao as watchBlockNumber, ap as watchBlocks, aq as watchEvent, ar as watchPendingTransactions } from './createPublicClient-f876dff3.js';
2
2
  import './eip1193-ae706fd8.js';
3
3
  import 'abitype';
4
4
  import './chain-75b0942e.js';
5
5
  import '@wagmi/chains';
6
6
  import './createClient-f87255c1.js';
7
- import './typedData-ade018d6.js';
7
+ import './typedData-7cfe4bb6.js';
8
8
  import '@scure/bip32';
@@ -32,14 +32,18 @@ type HDAccount = LocalAccount<'hd'> & {
32
32
  getHdKey(): HDKey;
33
33
  };
34
34
  type HDOptions = {
35
+ /** The account index to use in the path (`"m/44'/60'/${accountIndex}'/0/0"`). */
35
36
  accountIndex?: number;
37
+ /** The address index to use in the path (`"m/44'/60'/0'/0/${addressIndex}"`). */
36
38
  addressIndex?: number;
39
+ /** The change index to use in the path (`"m/44'/60'/0'/${changeIndex}/0"`). */
37
40
  changeIndex?: number;
38
41
  path?: never;
39
42
  } | {
40
43
  accountIndex?: never;
41
44
  addressIndex?: never;
42
45
  changeIndex?: never;
46
+ /** The HD path. */
43
47
  path: `m/44'/60'/${string}`;
44
48
  };
45
49
  type PrivateKeyAccount = LocalAccount<'privateKey'>;
@@ -4,15 +4,15 @@ export { D as DecodeAbiParametersReturnType, E as EncodeAbiParametersReturnType,
4
4
  export { D as DecodeErrorResultParameters, a as DecodeErrorResultReturnType, b as DecodeEventLogParameters, c as DecodeEventLogReturnType, d as DecodeFunctionDataParameters, e as DecodeFunctionResultParameters, f as DecodeFunctionResultReturnType, E as EncodeDeployDataParameters, g as EncodeErrorResultParameters, h as EncodeEventTopicsParameters, i as EncodeFunctionDataParameters, j as EncodeFunctionResultParameters, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from '../encodeFunctionResult-4792a6a3.js';
5
5
  export { e as encodePacked } from '../encodePacked-3fcdd54b.js';
6
6
  export { a as formatAbiItem, f as formatAbiItemWithArgs } from '../formatAbiItem-765ebc53.js';
7
- export { p as parseAccount } from '../parseAccount-2d7ea01d.js';
8
- import { B as BaseError, C as CallExecutionError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, h as NonceTooHighError, i as NonceTooLowError, N as NonceMaxValueError, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, l as TransactionTypeNotSupportedError, T as TipAboveFeeCapError, U as UnknownNodeError, k as TransactionExecutionError } from '../parseGwei-377678bc.js';
9
- export { G as GetContractAddressOptions, o as GetCreate2AddressOptions, p as GetCreateAddressOptions, q as HashTypedDataParameters, r as HashTypedDataReturnType, H as HttpOptions, s as RecoverAddressParameters, t as RecoverAddressReturnType, u as RecoverMessageAddressParameters, v as RecoverMessageAddressReturnType, w as RecoverTypedDataAddressParameters, x as RecoverTypedDataAddressReturnType, R as RpcResponse, aJ as Socket, y as ToRlpReturnType, V as VerifyMessageParameters, z as VerifyMessageReturnType, A as VerifyTypedDataParameters, D as VerifyTypedDataReturnType, J as boolToBytes, K as boolToHex, L as bytesToBigint, M as bytesToBool, O as bytesToHex, P as bytesToNumber, Q as bytesToString, S as concat, X as concatBytes, Y as concatHex, Z as formatEther, _ as formatGwei, $ as formatUnits, a0 as fromBytes, a1 as fromHex, a2 as fromRlp, a3 as getAddress, a4 as getContractAddress, a5 as getContractError, a6 as getCreate2Address, a7 as getCreateAddress, a8 as getEventSelector, a9 as getFunctionSelector, aK as getSocket, aa as hashMessage, ab as hashTypedData, ac as hexToBigInt, ad as hexToBool, ae as hexToBytes, af as hexToNumber, ag as hexToString, ah as isAddress, ai as isAddressEqual, aj as isBytes, ak as isHex, al as keccak256, am as numberToBytes, an as numberToHex, ao as pad, ap as padBytes, aq as padHex, ar as parseEther, as as parseGwei, at as parseUnits, au as recoverAddress, av as recoverMessageAddress, aM as recoverTypedDataAddress, aL as rpc, aw as size, ax as slice, ay as sliceBytes, az as sliceHex, aA as stringToBytes, aB as stringToHex, aC as stringify, aD as toBytes, aE as toHex, aF as toRlp, aG as trim, aH as validateTypedData, aI as verifyMessage, aN as verifyTypedData } from '../parseGwei-377678bc.js';
7
+ export { p as parseAccount } from '../parseAccount-b6e8bc40.js';
8
+ import { B as BaseError, C as CallExecutionError, E as EstimateGasExecutionError, d as ExecutionRevertedError, F as FeeCapTooHighError, e as FeeCapTooLowError, h as NonceTooHighError, i as NonceTooLowError, N as NonceMaxValueError, I as InsufficientFundsError, f as IntrinsicGasTooHighError, g as IntrinsicGasTooLowError, l as TransactionTypeNotSupportedError, T as TipAboveFeeCapError, U as UnknownNodeError, k as TransactionExecutionError } from '../parseGwei-1030ed5a.js';
9
+ export { G as GetContractAddressOptions, o as GetCreate2AddressOptions, p as GetCreateAddressOptions, q as HashTypedDataParameters, r as HashTypedDataReturnType, H as HttpOptions, s as RecoverAddressParameters, t as RecoverAddressReturnType, u as RecoverMessageAddressParameters, v as RecoverMessageAddressReturnType, w as RecoverTypedDataAddressParameters, x as RecoverTypedDataAddressReturnType, R as RpcResponse, aJ as Socket, y as ToRlpReturnType, V as VerifyMessageParameters, z as VerifyMessageReturnType, A as VerifyTypedDataParameters, D as VerifyTypedDataReturnType, J as boolToBytes, K as boolToHex, L as bytesToBigint, M as bytesToBool, O as bytesToHex, P as bytesToNumber, Q as bytesToString, S as concat, X as concatBytes, Y as concatHex, Z as formatEther, _ as formatGwei, $ as formatUnits, a0 as fromBytes, a1 as fromHex, a2 as fromRlp, a3 as getAddress, a4 as getContractAddress, a5 as getContractError, a6 as getCreate2Address, a7 as getCreateAddress, a8 as getEventSelector, a9 as getFunctionSelector, aK as getSocket, aa as hashMessage, ab as hashTypedData, ac as hexToBigInt, ad as hexToBool, ae as hexToBytes, af as hexToNumber, ag as hexToString, ah as isAddress, ai as isAddressEqual, aj as isBytes, ak as isHex, al as keccak256, am as numberToBytes, an as numberToHex, ao as pad, ap as padBytes, aq as padHex, ar as parseEther, as as parseGwei, at as parseUnits, au as recoverAddress, av as recoverMessageAddress, aM as recoverTypedDataAddress, aL as rpc, aw as size, ax as slice, ay as sliceBytes, az as sliceHex, aA as stringToBytes, aB as stringToHex, aC as stringify, aD as toBytes, aE as toHex, aF as toRlp, aG as trim, aH as validateTypedData, aI as verifyMessage, aN as verifyTypedData } from '../parseGwei-1030ed5a.js';
10
10
  export { d as defineChain, g as getChainContractAddress } from '../chain-f8db473f.js';
11
- import { C as CallParameters, E as EstimateGasParameters, S as SendTransactionParameters, b8 as WalletClientArg, b9 as PublicClientArg, ba as GetAccountParameter } from '../createPublicClient-d2c37c92.js';
12
- export { B as BlockFormatter, F as FormattedBlock, f as FormattedTransactionReceipt, g as FormattedTransactionRequest, T as TransactionReceiptFormatter, h as TransactionRequestFormatter, i as defineBlock, j as defineTransactionReceipt, k as defineTransactionRequest, l as formatBlock, m as formatTransactionRequest } from '../createPublicClient-d2c37c92.js';
11
+ import { C as CallParameters, E as EstimateGasParameters, S as SendTransactionParameters, b8 as WalletClientArg, b9 as PublicClientArg, ba as GetAccountParameter } from '../createPublicClient-f876dff3.js';
12
+ export { B as BlockFormatter, F as FormattedBlock, f as FormattedTransactionReceipt, g as FormattedTransactionRequest, T as TransactionReceiptFormatter, h as TransactionRequestFormatter, i as defineBlock, j as defineTransactionReceipt, k as defineTransactionRequest, l as formatBlock, m as formatTransactionRequest } from '../createPublicClient-f876dff3.js';
13
13
  import { a2 as Formatter, C as Chain } from '../chain-75b0942e.js';
14
14
  export { W as ExtractFormatter, X as Formatted, Y as FormattedTransaction, Z as TransactionFormatter, ad as defineFormatter, _ as defineTransaction, ae as format, $ as formatTransaction, a0 as transactionType } from '../chain-75b0942e.js';
15
- import { A as Account } from '../typedData-ade018d6.js';
15
+ import { A as Account } from '../typedData-7cfe4bb6.js';
16
16
  import { a as Transport } from '../createClient-f87255c1.js';
17
17
  import 'isomorphic-ws';
18
18
  import '../eip1193-ae706fd8.js';
package/dist/wallet.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- export { bl as AddChainParameters, bm as FormattedTransactionRequest, bo as GetAddressesReturnType, bn as GetPermissionsReturnType, bp as RequestAddressesReturnType, bq as RequestPermissionsReturnType, S as SendTransactionParameters, br as SendTransactionReturnType, bs as SignMessageParameters, bt as SignMessageReturnType, bu as SignTypedDataParameters, bv as SignTypedDataReturnType, bw as SwitchChainParameters, bx as WatchAssetParameters, by as WatchAssetReturnType, bb as addChain, bc as getAddresses, bd as getPermissions, be as requestAddresses, bf as requestPermissions, bg as sendTransaction, bh as signMessage, bi as signTypedData, bj as switchChain, bk as watchAsset } from './createPublicClient-d2c37c92.js';
1
+ export { bl as AddChainParameters, bm as FormattedTransactionRequest, bo as GetAddressesReturnType, bn as GetPermissionsReturnType, bp as RequestAddressesReturnType, bq as RequestPermissionsReturnType, S as SendTransactionParameters, br as SendTransactionReturnType, bs as SignMessageParameters, bt as SignMessageReturnType, bu as SignTypedDataParameters, bv as SignTypedDataReturnType, bw as SwitchChainParameters, bx as WatchAssetParameters, by as WatchAssetReturnType, bb as addChain, bc as getAddresses, bd as getPermissions, be as requestAddresses, bf as requestPermissions, bg as sendTransaction, bh as signMessage, bi as signTypedData, bj as switchChain, bk as watchAsset } from './createPublicClient-f876dff3.js';
2
2
  import './eip1193-ae706fd8.js';
3
3
  import 'abitype';
4
4
  import './chain-75b0942e.js';
5
5
  import '@wagmi/chains';
6
6
  import './createClient-f87255c1.js';
7
- import './typedData-ade018d6.js';
7
+ import './typedData-7cfe4bb6.js';
8
8
  import '@scure/bip32';
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "isomorphic-ws": "^5.0.0",
13
13
  "ws": "^8.12.0"
14
14
  },
15
- "version": "0.2.0-jxom-local-accounts.20230321T212822",
15
+ "version": "0.2.0-jxom-local-accounts.20230325T211645",
16
16
  "files": [
17
17
  "/abi",
18
18
  "/accounts",
@@ -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":[]}
@@ -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"]}