FRE-600: Fix code review blockers

- Consolidated duplicate UndoManagers to single instance
- Fixed connection promise to only resolve on 'connected' status
- Fixed WebSocketProvider import (WebsocketProvider)
- Added proper doc.destroy() cleanup
- Renamed isPresenceInitialized property to avoid conflict

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
2026-04-25 00:08:01 -04:00
parent 65b552bb08
commit 7c684a42cc
48450 changed files with 5679671 additions and 383 deletions

13
node_modules/viem/_esm/accounts/generateMnemonic.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { generateMnemonic as generateMnemonic_ } from '@scure/bip39';
/**
* @description Generates a random mnemonic phrase with a given wordlist.
*
* @param wordlist The wordlist to use for generating the mnemonic phrase.
* @param strength mnemonic strength 128-256 bits
*
* @returns A randomly generated mnemonic phrase.
*/
export function generateMnemonic(wordlist, strength) {
return generateMnemonic_(wordlist, strength);
}
//# sourceMappingURL=generateMnemonic.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"generateMnemonic.js","sourceRoot":"","sources":["../../accounts/generateMnemonic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,IAAI,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAKpE;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAkB,EAClB,QAA6B;IAE7B,OAAO,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AAC9C,CAAC"}

11
node_modules/viem/_esm/accounts/generatePrivateKey.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
import { secp256k1 } from '@noble/curves/secp256k1';
import { toHex } from '../utils/encoding/toHex.js';
/**
* @description Generates a random private key.
*
* @returns A randomly generated private key.
*/
export function generatePrivateKey() {
return toHex(secp256k1.utils.randomPrivateKey());
}
//# sourceMappingURL=generatePrivateKey.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"generatePrivateKey.js","sourceRoot":"","sources":["../../accounts/generatePrivateKey.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAInD,OAAO,EAAuB,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAIvE;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAA;AAClD,CAAC"}

17
node_modules/viem/_esm/accounts/hdKeyToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { toHex } from '../utils/encoding/toHex.js';
import { privateKeyToAccount, } from './privateKeyToAccount.js';
/**
* @description Creates an Account from a HD Key.
*
* @returns A HD Account.
*/
export function hdKeyToAccount(hdKey_, { accountIndex = 0, addressIndex = 0, changeIndex = 0, path, ...options } = {}) {
const hdKey = hdKey_.derive(path || `m/44'/60'/${accountIndex}'/${changeIndex}/${addressIndex}`);
const account = privateKeyToAccount(toHex(hdKey.privateKey), options);
return {
...account,
getHdKey: () => hdKey,
source: 'hd',
};
}
//# sourceMappingURL=hdKeyToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"hdKeyToAccount.js","sourceRoot":"","sources":["../../accounts/hdKeyToAccount.ts"],"names":[],"mappings":"AAEA,OAAO,EAAuB,KAAK,EAAE,MAAM,4BAA4B,CAAA;AACvE,OAAO,EAGL,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AAUjC;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,MAAa,EACb,EACE,YAAY,GAAG,CAAC,EAChB,YAAY,GAAG,CAAC,EAChB,WAAW,GAAG,CAAC,EACf,IAAI,EACJ,GAAG,OAAO,KACe,EAAE;IAE7B,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CACzB,IAAI,IAAI,aAAa,YAAY,KAAK,WAAW,IAAI,YAAY,EAAE,CACpE,CAAA;IACD,MAAM,OAAO,GAAG,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,UAAW,CAAC,EAAE,OAAO,CAAC,CAAA;IACtE,OAAO;QACL,GAAG,OAAO;QACV,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK;QACrB,MAAM,EAAE,IAAI;KACb,CAAA;AACH,CAAC"}

22
node_modules/viem/_esm/accounts/index.js generated vendored Normal file
View File

@@ -0,0 +1,22 @@
// biome-ignore lint/performance/noBarrelFile: entrypoint module
export { HDKey } from '@scure/bip32';
export { createNonceManager, nonceManager, } from '../utils/nonceManager.js';
export {
/** @deprecated Use `serializeSignature` instead. */
serializeSignature as signatureToHex, serializeSignature, } from '../utils/signature/serializeSignature.js';
export { generateMnemonic, } from './generateMnemonic.js';
export { generatePrivateKey, } from './generatePrivateKey.js';
export { hdKeyToAccount, } from './hdKeyToAccount.js';
export { mnemonicToAccount, } from './mnemonicToAccount.js';
export { privateKeyToAccount, } from './privateKeyToAccount.js';
export { toAccount } from './toAccount.js';
export { parseAccount, } from './utils/parseAccount.js';
export { privateKeyToAddress, } from './utils/privateKeyToAddress.js';
export { publicKeyToAddress, } from './utils/publicKeyToAddress.js';
export { setSignEntropy, sign, } from './utils/sign.js';
export { signAuthorization, } from './utils/signAuthorization.js';
export { signMessage, } from './utils/signMessage.js';
export { signTransaction, } from './utils/signTransaction.js';
export { signTypedData, } from './utils/signTypedData.js';
export { czech, english, french, italian, japanese, korean, portuguese, simplifiedChinese, spanish, traditionalChinese, } from './wordlists.js';
//# sourceMappingURL=index.js.map

1
node_modules/viem/_esm/accounts/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../accounts/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEpC,OAAO,EAEL,kBAAkB,EAGlB,YAAY,GACb,MAAM,0BAA0B,CAAA;AACjC,OAAO;AAIL,oDAAoD;AACpD,kBAAkB,IAAI,cAAc,EACpC,kBAAkB,GACnB,MAAM,0CAA0C,CAAA;AACjD,OAAO,EAEL,gBAAgB,GACjB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAEL,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAGL,cAAc,GACf,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAGL,iBAAiB,GAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAGL,mBAAmB,GACpB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAA2B,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAWnE,OAAO,EAEL,YAAY,GACb,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAEL,mBAAmB,GACpB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAEL,kBAAkB,GACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAIL,cAAc,EACd,IAAI,GACL,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAIL,iBAAiB,GAClB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAIL,WAAW,GACZ,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAIL,eAAe,GAChB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAIL,aAAa,GACd,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,KAAK,EACL,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,EACN,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,kBAAkB,GACnB,MAAM,gBAAgB,CAAA"}

13
node_modules/viem/_esm/accounts/mnemonicToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
import { HDKey } from '@scure/bip32';
import { mnemonicToSeedSync } from '@scure/bip39';
import { hdKeyToAccount, } from './hdKeyToAccount.js';
/**
* @description Creates an Account from a mnemonic phrase.
*
* @returns A HD Account.
*/
export function mnemonicToAccount(mnemonic, { passphrase, ...hdKeyOpts } = {}) {
const seed = mnemonicToSeedSync(mnemonic, passphrase);
return hdKeyToAccount(HDKey.fromMasterSeed(seed), hdKeyOpts);
}
//# sourceMappingURL=mnemonicToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"mnemonicToAccount.js","sourceRoot":"","sources":["../../accounts/mnemonicToAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAGjD,OAAO,EAGL,cAAc,GACf,MAAM,qBAAqB,CAAA;AAS5B;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,EAAE,UAAU,EAAE,GAAG,SAAS,KAA+B,EAAE;IAE3D,MAAM,IAAI,GAAG,kBAAkB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;IACrD,OAAO,cAAc,CAAC,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,CAAA;AAC9D,CAAC"}

44
node_modules/viem/_esm/accounts/privateKeyToAccount.js generated vendored Normal file
View File

@@ -0,0 +1,44 @@
import { secp256k1 } from '@noble/curves/secp256k1';
import { toHex } from '../utils/encoding/toHex.js';
import { toAccount } from './toAccount.js';
import { publicKeyToAddress, } from './utils/publicKeyToAddress.js';
import { sign } from './utils/sign.js';
import { signAuthorization } from './utils/signAuthorization.js';
import { signMessage } from './utils/signMessage.js';
import { signTransaction, } from './utils/signTransaction.js';
import { signTypedData, } from './utils/signTypedData.js';
/**
* @description Creates an Account from a private key.
*
* @returns A Private Key Account.
*/
export function privateKeyToAccount(privateKey, options = {}) {
const { nonceManager } = options;
const publicKey = toHex(secp256k1.getPublicKey(privateKey.slice(2), false));
const address = publicKeyToAddress(publicKey);
const account = toAccount({
address,
nonceManager,
async sign({ hash }) {
return sign({ hash, privateKey, to: 'hex' });
},
async signAuthorization(authorization) {
return signAuthorization({ ...authorization, privateKey });
},
async signMessage({ message }) {
return signMessage({ message, privateKey });
},
async signTransaction(transaction, { serializer } = {}) {
return signTransaction({ privateKey, transaction, serializer });
},
async signTypedData(typedData) {
return signTypedData({ ...typedData, privateKey });
},
});
return {
...account,
publicKey,
source: 'privateKey',
};
}
//# sourceMappingURL=privateKeyToAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"privateKeyToAccount.js","sourceRoot":"","sources":["../../accounts/privateKeyToAccount.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAGnD,OAAO,EAAuB,KAAK,EAAE,MAAM,4BAA4B,CAAA;AAEvE,OAAO,EAA2B,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAEnE,OAAO,EAEL,kBAAkB,GACnB,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAsB,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAA6B,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAC/E,OAAO,EAEL,eAAe,GAChB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAEL,aAAa,GACd,MAAM,0BAA0B,CAAA;AAgBjC;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,UAAe,EACf,UAAsC,EAAE;IAExC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAA;IAChC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAA;IAC3E,MAAM,OAAO,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAA;IAE7C,MAAM,OAAO,GAAG,SAAS,CAAC;QACxB,OAAO;QACP,YAAY;QACZ,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE;YACjB,OAAO,IAAI,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAC9C,CAAC;QACD,KAAK,CAAC,iBAAiB,CAAC,aAAa;YACnC,OAAO,iBAAiB,CAAC,EAAE,GAAG,aAAa,EAAE,UAAU,EAAE,CAAC,CAAA;QAC5D,CAAC;QACD,KAAK,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE;YAC3B,OAAO,WAAW,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,CAAA;QAC7C,CAAC;QACD,KAAK,CAAC,eAAe,CAAC,WAAW,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE;YACpD,OAAO,eAAe,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAA;QACjE,CAAC;QACD,KAAK,CAAC,aAAa,CAAC,SAAS;YAC3B,OAAO,aAAa,CAAC,EAAE,GAAG,SAAS,EAAE,UAAU,EAAS,CAAC,CAAA;QAC3D,CAAC;KACF,CAAC,CAAA;IAEF,OAAO;QACL,GAAG,OAAO;QACV,SAAS;QACT,MAAM,EAAE,YAAY;KACA,CAAA;AACxB,CAAC"}

32
node_modules/viem/_esm/accounts/toAccount.js generated vendored Normal file
View File

@@ -0,0 +1,32 @@
// TODO(v3): Rename to `toLocalAccount` + add `source` property to define source (privateKey, mnemonic, hdKey, etc).
import { InvalidAddressError, } from '../errors/address.js';
import { isAddress, } from '../utils/address/isAddress.js';
/**
* @description Creates an Account from a custom signing implementation.
*
* @returns A Local Account.
*/
export function toAccount(source) {
if (typeof source === 'string') {
if (!isAddress(source, { strict: false }))
throw new InvalidAddressError({ address: source });
return {
address: source,
type: 'json-rpc',
};
}
if (!isAddress(source.address, { strict: false }))
throw new InvalidAddressError({ address: source.address });
return {
address: source.address,
nonceManager: source.nonceManager,
sign: source.sign,
signAuthorization: source.signAuthorization,
signMessage: source.signMessage,
signTransaction: source.signTransaction,
signTypedData: source.signTypedData,
source: 'custom',
type: 'local',
};
}
//# sourceMappingURL=toAccount.js.map

1
node_modules/viem/_esm/accounts/toAccount.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"toAccount.js","sourceRoot":"","sources":["../../accounts/toAccount.ts"],"names":[],"mappings":"AAAA,oHAAoH;AAIpH,OAAO,EACL,mBAAmB,GAEpB,MAAM,sBAAsB,CAAA;AAE7B,OAAO,EAEL,SAAS,GACV,MAAM,+BAA+B,CAAA;AAiBtC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,MAAqB;IAErB,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAC/B,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YACvC,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAA;QACpD,OAAO;YACL,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,UAAU;SACsB,CAAA;IAC1C,CAAC;IAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC/C,MAAM,IAAI,mBAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAA;IAC5D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;QAC3C,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,eAAe,EAAE,MAAM,CAAC,eAAe;QACvC,aAAa,EAAE,MAAM,CAAC,aAAa;QACnC,MAAM,EAAE,QAAQ;QAChB,IAAI,EAAE,OAAO;KACyB,CAAA;AAC1C,CAAC"}

2
node_modules/viem/_esm/accounts/types.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=types.js.map

1
node_modules/viem/_esm/accounts/types.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../accounts/types.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,6 @@
export function parseAccount(account) {
if (typeof account === 'string')
return { address: account, type: 'json-rpc' };
return account;
}
//# sourceMappingURL=parseAccount.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"parseAccount.js","sourceRoot":"","sources":["../../../accounts/utils/parseAccount.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,YAAY,CAC1B,OAAyB;IAEzB,IAAI,OAAO,OAAO,KAAK,QAAQ;QAC7B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAS,CAAA;IACtD,OAAO,OAAc,CAAA;AACvB,CAAC"}

View File

@@ -0,0 +1,15 @@
import { secp256k1 } from '@noble/curves/secp256k1';
import { bytesToHex, } from '../../utils/encoding/toHex.js';
import { publicKeyToAddress, } from './publicKeyToAddress.js';
/**
* @description Converts an ECDSA private key to an address.
*
* @param privateKey The private key to convert.
*
* @returns The address.
*/
export function privateKeyToAddress(privateKey) {
const publicKey = bytesToHex(secp256k1.getPublicKey(privateKey.slice(2), false));
return publicKeyToAddress(publicKey);
}
//# sourceMappingURL=privateKeyToAddress.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"privateKeyToAddress.js","sourceRoot":"","sources":["../../../accounts/utils/privateKeyToAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAKnD,OAAO,EAEL,UAAU,GACX,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAEL,kBAAkB,GACnB,MAAM,yBAAyB,CAAA;AAOhC;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAe;IACjD,MAAM,SAAS,GAAG,UAAU,CAC1B,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CACnD,CAAA;IACD,OAAO,kBAAkB,CAAC,SAAS,CAAC,CAAA;AACtC,CAAC"}

View File

@@ -0,0 +1,14 @@
import { checksumAddress, } from '../../utils/address/getAddress.js';
import { keccak256, } from '../../utils/hash/keccak256.js';
/**
* @description Converts an ECDSA public key to an address.
*
* @param publicKey The public key to convert.
*
* @returns The address.
*/
export function publicKeyToAddress(publicKey) {
const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
return checksumAddress(`0x${address}`);
}
//# sourceMappingURL=publicKeyToAddress.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"publicKeyToAddress.js","sourceRoot":"","sources":["../../../accounts/utils/publicKeyToAddress.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,eAAe,GAChB,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAEL,SAAS,GACV,MAAM,+BAA+B,CAAA;AAOtC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAC/C,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IACtE,OAAO,eAAe,CAAC,KAAK,OAAO,EAAE,CAAY,CAAA;AACnD,CAAC"}

43
node_modules/viem/_esm/accounts/utils/sign.js generated vendored Normal file
View File

@@ -0,0 +1,43 @@
// TODO(v3): Convert to sync.
import { secp256k1 } from '@noble/curves/secp256k1';
import { isHex } from '../../utils/data/isHex.js';
import { hexToBytes, } from '../../utils/encoding/toBytes.js';
import { numberToHex, } from '../../utils/encoding/toHex.js';
import { serializeSignature } from '../../utils/signature/serializeSignature.js';
let extraEntropy = false;
/**
* Sets extra entropy for signing functions.
*/
export function setSignEntropy(entropy) {
if (!entropy)
throw new Error('must be a `true` or a hex value.');
extraEntropy = entropy;
}
/**
* @description Signs a hash with a given private key.
*
* @param hash The hash to sign.
* @param privateKey The private key to sign with.
*
* @returns The signature.
*/
export async function sign({ hash, privateKey, to = 'object', }) {
const { r, s, recovery } = secp256k1.sign(hash.slice(2), privateKey.slice(2), {
lowS: true,
extraEntropy: isHex(extraEntropy, { strict: false })
? hexToBytes(extraEntropy)
: extraEntropy,
});
const signature = {
r: numberToHex(r, { size: 32 }),
s: numberToHex(s, { size: 32 }),
v: recovery ? 28n : 27n,
yParity: recovery,
};
return (() => {
if (to === 'bytes' || to === 'hex')
return serializeSignature({ ...signature, to });
return signature;
})();
}
//# sourceMappingURL=sign.js.map

1
node_modules/viem/_esm/accounts/utils/sign.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../../accounts/utils/sign.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAInD,OAAO,EAAuB,KAAK,EAAE,MAAM,2BAA2B,CAAA;AACtE,OAAO,EAEL,UAAU,GACX,MAAM,iCAAiC,CAAA;AACxC,OAAO,EAEL,WAAW,GACZ,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,6CAA6C,CAAA;AAqBhF,IAAI,YAAY,GAAkB,KAAK,CAAA;AAEvC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAmB;IAChD,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAA;IACjE,YAAY,GAAG,OAAO,CAAA;AACxB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,IAAI,CAA2B,EACnD,IAAI,EACJ,UAAU,EACV,EAAE,GAAG,QAAQ,GACM;IACnB,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,IAAI,CACvC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EACb,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EACnB;QACE,IAAI,EAAE,IAAI;QACV,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;YAClD,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC;YAC1B,CAAC,CAAC,YAAY;KACjB,CACF,CAAA;IACD,MAAM,SAAS,GAAG;QAChB,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;QAC/B,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;QACvB,OAAO,EAAE,QAAQ;KAClB,CAAA;IACD,OAAO,CAAC,GAAG,EAAE;QACX,IAAI,EAAE,KAAK,OAAO,IAAI,EAAE,KAAK,KAAK;YAChC,OAAO,kBAAkB,CAAC,EAAE,GAAG,SAAS,EAAE,EAAE,EAAE,CAAC,CAAA;QACjD,OAAO,SAAS,CAAA;IAClB,CAAC,CAAC,EAAwB,CAAA;AAC5B,CAAC"}

View File

@@ -0,0 +1,23 @@
import { hashAuthorization, } from '../../utils/authorization/hashAuthorization.js';
import { sign, } from './sign.js';
/**
* Signs an Authorization hash in [EIP-7702 format](https://eips.ethereum.org/EIPS/eip-7702): `keccak256('0x05' || rlp([chain_id, address, nonce]))`.
*/
export async function signAuthorization(parameters) {
const { chainId, nonce, privateKey, to = 'object' } = parameters;
const address = parameters.contractAddress ?? parameters.address;
const signature = await sign({
hash: hashAuthorization({ address, chainId, nonce }),
privateKey,
to,
});
if (to === 'object')
return {
address,
chainId,
nonce,
...signature,
};
return signature;
}
//# sourceMappingURL=signAuthorization.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"signAuthorization.js","sourceRoot":"","sources":["../../../accounts/utils/signAuthorization.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,iBAAiB,GAClB,MAAM,gDAAgD,CAAA;AACvD,OAAO,EAIL,IAAI,GACL,MAAM,WAAW,CAAA;AAoBlB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,UAA2C;IAE3C,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAA;IAChE,MAAM,OAAO,GAAG,UAAU,CAAC,eAAe,IAAI,UAAU,CAAC,OAAO,CAAA;IAChE,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC;QAC3B,IAAI,EAAE,iBAAiB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QACpD,UAAU;QACV,EAAE;KACH,CAAC,CAAA;IACF,IAAI,EAAE,KAAK,QAAQ;QACjB,OAAO;YACL,OAAO;YACP,OAAO;YACP,KAAK;YACL,GAAI,SAAuB;SACrB,CAAA;IACV,OAAO,SAAgB,CAAA;AACzB,CAAC"}

12
node_modules/viem/_esm/accounts/utils/signMessage.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
import { hashMessage, } from '../../utils/signature/hashMessage.js';
import { sign } from './sign.js';
/**
* @description Calculates an Ethereum-specific signature in [EIP-191 format](https://eips.ethereum.org/EIPS/eip-191):
* `keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))`.
*
* @returns The signature.
*/
export async function signMessage({ message, privateKey, }) {
return await sign({ hash: hashMessage(message), privateKey, to: 'hex' });
}
//# sourceMappingURL=signMessage.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"signMessage.js","sourceRoot":"","sources":["../../../accounts/utils/signMessage.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,WAAW,GACZ,MAAM,sCAAsC,CAAA;AAE7C,OAAO,EAAsB,IAAI,EAAE,MAAM,WAAW,CAAA;AAgBpD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,EAChC,OAAO,EACP,UAAU,GACY;IACtB,OAAO,MAAM,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;AAC1E,CAAC"}

View File

@@ -0,0 +1,22 @@
import { keccak256, } from '../../utils/hash/keccak256.js';
import { serializeTransaction, } from '../../utils/transaction/serializeTransaction.js';
import { sign } from './sign.js';
export async function signTransaction(parameters) {
const { privateKey, transaction, serializer = serializeTransaction, } = parameters;
const signableTransaction = (() => {
// For EIP-4844 Transactions, we want to sign the transaction payload body (tx_payload_body) without the sidecars (ie. without the network wrapper).
// See: https://github.com/ethereum/EIPs/blob/e00f4daa66bd56e2dbd5f1d36d09fd613811a48b/EIPS/eip-4844.md#networking
if (transaction.type === 'eip4844')
return {
...transaction,
sidecars: false,
};
return transaction;
})();
const signature = await sign({
hash: keccak256(await serializer(signableTransaction)),
privateKey,
});
return (await serializer(transaction, signature));
}
//# sourceMappingURL=signTransaction.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"signTransaction.js","sourceRoot":"","sources":["../../../accounts/utils/signTransaction.ts"],"names":[],"mappings":"AAMA,OAAO,EAEL,SAAS,GACV,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAEL,oBAAoB,GACrB,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAAsB,IAAI,EAAE,MAAM,WAAW,CAAA;AAuBpD,MAAM,CAAC,KAAK,UAAU,eAAe,CAKnC,UAA8D;IAE9D,MAAM,EACJ,UAAU,EACV,WAAW,EACX,UAAU,GAAG,oBAAoB,GAClC,GAAG,UAAU,CAAA;IAEd,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE;QAChC,oJAAoJ;QACpJ,kHAAkH;QAClH,IAAI,WAAW,CAAC,IAAI,KAAK,SAAS;YAChC,OAAO;gBACL,GAAG,WAAW;gBACd,QAAQ,EAAE,KAAK;aAChB,CAAA;QACH,OAAO,WAAW,CAAA;IACpB,CAAC,CAAC,EAAE,CAAA;IAEJ,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC;QAC3B,IAAI,EAAE,SAAS,CAAC,MAAM,UAAU,CAAC,mBAAmB,CAAC,CAAC;QACtD,UAAU;KACX,CAAC,CAAA;IACF,OAAO,CAAC,MAAM,UAAU,CACtB,WAAW,EACX,SAAS,CACV,CAAuD,CAAA;AAC1D,CAAC"}

17
node_modules/viem/_esm/accounts/utils/signTypedData.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
import { hashTypedData, } from '../../utils/signature/hashTypedData.js';
import { sign } from './sign.js';
/**
* @description Signs typed data and calculates an Ethereum-specific signature in [https://eips.ethereum.org/EIPS/eip-712](https://eips.ethereum.org/EIPS/eip-712):
* `sign(keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)))`.
*
* @returns The signature.
*/
export async function signTypedData(parameters) {
const { privateKey, ...typedData } = parameters;
return await sign({
hash: hashTypedData(typedData),
privateKey,
to: 'hex',
});
}
//# sourceMappingURL=signTypedData.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"signTypedData.js","sourceRoot":"","sources":["../../../accounts/utils/signTypedData.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,aAAa,GACd,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAsB,IAAI,EAAE,MAAM,WAAW,CAAA;AAiBpD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAIjC,UAA2D;IAE3D,MAAM,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,GAChC,UAAgD,CAAA;IAClD,OAAO,MAAM,IAAI,CAAC;QAChB,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC;QAC9B,UAAU;QACV,EAAE,EAAE,KAAK;KACV,CAAC,CAAA;AACJ,CAAC"}

12
node_modules/viem/_esm/accounts/wordlists.js generated vendored Normal file
View File

@@ -0,0 +1,12 @@
// biome-ignore lint/performance/noBarrelFile: _
export { wordlist as czech } from '@scure/bip39/wordlists/czech';
export { wordlist as english } from '@scure/bip39/wordlists/english';
export { wordlist as french } from '@scure/bip39/wordlists/french';
export { wordlist as italian } from '@scure/bip39/wordlists/italian';
export { wordlist as japanese } from '@scure/bip39/wordlists/japanese';
export { wordlist as korean } from '@scure/bip39/wordlists/korean';
export { wordlist as portuguese } from '@scure/bip39/wordlists/portuguese';
export { wordlist as simplifiedChinese } from '@scure/bip39/wordlists/simplified-chinese';
export { wordlist as spanish } from '@scure/bip39/wordlists/spanish';
export { wordlist as traditionalChinese } from '@scure/bip39/wordlists/traditional-chinese';
//# sourceMappingURL=wordlists.js.map

1
node_modules/viem/_esm/accounts/wordlists.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../accounts/wordlists.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,QAAQ,IAAI,KAAK,EAAE,MAAM,8BAA8B,CAAA;AAChE,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,QAAQ,IAAI,QAAQ,EAAE,MAAM,iCAAiC,CAAA;AACtE,OAAO,EAAE,QAAQ,IAAI,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAC1E,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AACzF,OAAO,EAAE,QAAQ,IAAI,OAAO,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,QAAQ,IAAI,kBAAkB,EAAE,MAAM,4CAA4C,CAAA"}