quais 1.0.0-alpha.4 → 1.2.0-pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/quais.js +73 -7
- package/dist/quais.js.map +1 -1
- package/dist/quais.min.js +1 -1
- package/dist/quais.umd.js +74 -6
- package/dist/quais.umd.js.map +1 -1
- package/dist/quais.umd.min.js +1 -1
- package/dist/wordlists-extra.js +1 -1
- package/dist/wordlists-extra.js.map +1 -1
- package/dist/wordlists-extra.min.js +1 -1
- package/lib/commonjs/_version.js +1 -1
- package/lib/commonjs/constants/strings.d.ts +10 -1
- package/lib/commonjs/constants/strings.d.ts.map +1 -1
- package/lib/commonjs/constants/strings.js +11 -2
- package/lib/commonjs/constants/strings.js.map +1 -1
- package/lib/commonjs/hash/index.d.ts +1 -1
- package/lib/commonjs/hash/index.d.ts.map +1 -1
- package/lib/commonjs/hash/index.js +3 -1
- package/lib/commonjs/hash/index.js.map +1 -1
- package/lib/commonjs/hash/message.d.ts +31 -3
- package/lib/commonjs/hash/message.d.ts.map +1 -1
- package/lib/commonjs/hash/message.js +43 -4
- package/lib/commonjs/hash/message.js.map +1 -1
- package/lib/commonjs/providers/format.js +1 -1
- package/lib/commonjs/quais.d.ts +1 -1
- package/lib/commonjs/quais.d.ts.map +1 -1
- package/lib/commonjs/quais.js +5 -3
- package/lib/commonjs/quais.js.map +1 -1
- package/lib/commonjs/wallet/hdwallet.d.ts +14 -0
- package/lib/commonjs/wallet/hdwallet.d.ts.map +1 -1
- package/lib/commonjs/wallet/hdwallet.js +19 -0
- package/lib/commonjs/wallet/hdwallet.js.map +1 -1
- package/lib/esm/_version.js +1 -1
- package/lib/esm/constants/strings.d.ts +10 -1
- package/lib/esm/constants/strings.d.ts.map +1 -1
- package/lib/esm/constants/strings.js +10 -1
- package/lib/esm/constants/strings.js.map +1 -1
- package/lib/esm/hash/index.d.ts +1 -1
- package/lib/esm/hash/index.d.ts.map +1 -1
- package/lib/esm/hash/index.js +1 -1
- package/lib/esm/hash/index.js.map +1 -1
- package/lib/esm/hash/message.d.ts +31 -3
- package/lib/esm/hash/message.d.ts.map +1 -1
- package/lib/esm/hash/message.js +40 -3
- package/lib/esm/hash/message.js.map +1 -1
- package/lib/esm/providers/format.js +1 -1
- package/lib/esm/quais.d.ts +1 -1
- package/lib/esm/quais.d.ts.map +1 -1
- package/lib/esm/quais.js +1 -1
- package/lib/esm/quais.js.map +1 -1
- package/lib/esm/wallet/hdwallet.d.ts +14 -0
- package/lib/esm/wallet/hdwallet.d.ts.map +1 -1
- package/lib/esm/wallet/hdwallet.js +19 -0
- package/lib/esm/wallet/hdwallet.js.map +1 -1
- package/package.json +146 -146
- package/src/_version.ts +1 -1
- package/src/constants/strings.ts +11 -1
- package/src/hash/index.ts +1 -1
- package/src/hash/message.ts +42 -4
- package/src/providers/format.ts +1 -1
- package/src/quais.ts +2 -0
- package/src/wallet/hdwallet.ts +21 -0
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ in [TypeScript](https://www.typescriptlang.org).
|
|
|
28
28
|
**Versions**
|
|
29
29
|
|
|
30
30
|
- [0.1.17](https://www.npmjs.com/package/quais/v/0.1.17): Full support for Quai Network's Iron Age Testnet.
|
|
31
|
-
- [1.0.0-alpha](https://www.npmjs.com/package/quais/v/1.0.0-alpha.
|
|
31
|
+
- [1.0.0-alpha](https://www.npmjs.com/package/quais/v/1.0.0-alpha.5): Full support for Quai Network's Golden Age Testnet.
|
|
32
32
|
|
|
33
33
|
## Keep Updated
|
|
34
34
|
|
package/dist/quais.js
CHANGED
|
@@ -7,7 +7,7 @@ import * as pb_1 from 'google-protobuf';
|
|
|
7
7
|
*
|
|
8
8
|
* @ignore
|
|
9
9
|
*/
|
|
10
|
-
const version = '1.0.0-alpha.
|
|
10
|
+
const version = '1.0.0-alpha.5';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Property helper functions.
|
|
@@ -11571,6 +11571,15 @@ const MaxInt256 = BigInt('0x7fffffffffffffffffffffffffffffffffffffffffffffffffff
|
|
|
11571
11571
|
* @category Constants
|
|
11572
11572
|
*/
|
|
11573
11573
|
const quaisymbol = '\u039e'; // "\uD835\uDF63";
|
|
11574
|
+
/**
|
|
11575
|
+
* A constant for the Quai Network equivalent of the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal message
|
|
11576
|
+
* prefix.
|
|
11577
|
+
*
|
|
11578
|
+
* (**i.e.** `"\\x19Quai Signed Message:\\n"`)
|
|
11579
|
+
*
|
|
11580
|
+
* @category Constants
|
|
11581
|
+
*/
|
|
11582
|
+
const MessagePrefix = '\x19Quai Signed Message:\n';
|
|
11574
11583
|
/**
|
|
11575
11584
|
* A constant for the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal message prefix.
|
|
11576
11585
|
*
|
|
@@ -11578,7 +11587,7 @@ const quaisymbol = '\u039e'; // "\uD835\uDF63";
|
|
|
11578
11587
|
*
|
|
11579
11588
|
* @category Constants
|
|
11580
11589
|
*/
|
|
11581
|
-
const
|
|
11590
|
+
const EthMessagePrefix = '\x19Ethereum Signed Message:\n';
|
|
11582
11591
|
|
|
11583
11592
|
/**
|
|
11584
11593
|
* A shard represents a chain within the Quai network hierarchy. A shard refer to the Prime chain, a region under the
|
|
@@ -14512,7 +14521,8 @@ function id(value) {
|
|
|
14512
14521
|
}
|
|
14513
14522
|
|
|
14514
14523
|
/**
|
|
14515
|
-
* Computes the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal-sign message
|
|
14524
|
+
* Computes the Quai Network equivalent of the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal-sign message
|
|
14525
|
+
* digest to sign.
|
|
14516
14526
|
*
|
|
14517
14527
|
* This prefixes the message with {@link MessagePrefix | **MessagePrefix**} and the decimal length of `message` and
|
|
14518
14528
|
* computes the {@link keccak256 | **keccak256**} digest.
|
|
@@ -14542,7 +14552,6 @@ function id(value) {
|
|
|
14542
14552
|
* ```
|
|
14543
14553
|
*
|
|
14544
14554
|
* @param {Uint8Array | string} message - The message to hash.
|
|
14545
|
-
*
|
|
14546
14555
|
* @returns {string} The message digest.
|
|
14547
14556
|
*/
|
|
14548
14557
|
function hashMessage(message) {
|
|
@@ -14557,13 +14566,49 @@ function hashMessage(message) {
|
|
|
14557
14566
|
* @category Hash
|
|
14558
14567
|
* @param {Uint8Array | string} message - The message that was signed.
|
|
14559
14568
|
* @param {SignatureLike} sig - The signature to verify.
|
|
14560
|
-
*
|
|
14561
14569
|
* @returns {string} The address of the signer.
|
|
14562
14570
|
*/
|
|
14563
14571
|
function verifyMessage(message, sig) {
|
|
14564
14572
|
const digest = hashMessage(message);
|
|
14565
14573
|
return recoverAddress(digest, sig);
|
|
14566
14574
|
}
|
|
14575
|
+
/**
|
|
14576
|
+
* Computes the [EIP-191](https://eips.ethereum.org/EIPS/eip-191) personal-sign message digest to sign.
|
|
14577
|
+
*
|
|
14578
|
+
* This prefixes the message with {@link EthMessagePrefix | **EthMessagePrefix**} and the decimal length of `message` and
|
|
14579
|
+
* computes the {@link keccak256 | **keccak256**} digest.
|
|
14580
|
+
*
|
|
14581
|
+
* If `message` is a string, it is converted to its UTF-8 bytes first. To compute the digest of a
|
|
14582
|
+
* [**DataHexString**](../types-aliases/DataHex), it must be converted to [**bytes**](../functions/getBytes).
|
|
14583
|
+
*
|
|
14584
|
+
* This is the same as `hashMessage` except it uses `EthMessagePrefix` instead of `MessagePrefix` and is available for
|
|
14585
|
+
* broader compatibility with EVM signing practices.
|
|
14586
|
+
*
|
|
14587
|
+
* @category Hash
|
|
14588
|
+
* @param message
|
|
14589
|
+
* @returns
|
|
14590
|
+
*/
|
|
14591
|
+
function ethHashMessage(message) {
|
|
14592
|
+
if (typeof message === 'string') {
|
|
14593
|
+
message = toUtf8Bytes(message);
|
|
14594
|
+
}
|
|
14595
|
+
return keccak256(concat([toUtf8Bytes(EthMessagePrefix), toUtf8Bytes(String(message.length)), message]));
|
|
14596
|
+
}
|
|
14597
|
+
/**
|
|
14598
|
+
* Return the address of the private key that produced the signature `sig` during signing for `message`.
|
|
14599
|
+
*
|
|
14600
|
+
* This is the same as `verifyMessage` except it uses `EthMessagePrefix` instead of `MessagePrefix` and is available for
|
|
14601
|
+
* broader compatibility with EVM signing practices.
|
|
14602
|
+
*
|
|
14603
|
+
* @category Hash
|
|
14604
|
+
* @param message - The message that was signed.
|
|
14605
|
+
* @param sig - The signature to verify.
|
|
14606
|
+
* @returns {string} The address of the signer.
|
|
14607
|
+
*/
|
|
14608
|
+
function ethVerifyMessage(message, sig) {
|
|
14609
|
+
const digest = ethHashMessage(message);
|
|
14610
|
+
return recoverAddress(digest, sig);
|
|
14611
|
+
}
|
|
14567
14612
|
|
|
14568
14613
|
const regexBytes = new RegExp('^bytes([0-9]+)$');
|
|
14569
14614
|
const regexNumber = new RegExp('^(u?int)([0-9]*)$');
|
|
@@ -18726,7 +18771,7 @@ function formatTransactionResponse(value) {
|
|
|
18726
18771
|
gasLimit: allowNull((value) => (value ? BigInt(value) : null), null),
|
|
18727
18772
|
to: allowNull(getAddress, null),
|
|
18728
18773
|
value: allowNull((value) => (value ? BigInt(value) : null), null),
|
|
18729
|
-
nonce: allowNull((value) => (value ? parseInt(value,
|
|
18774
|
+
nonce: allowNull((value) => (value ? parseInt(value, 10) : null), null),
|
|
18730
18775
|
creates: allowNull(getAddress, null),
|
|
18731
18776
|
chainId: allowNull((value) => (value ? BigInt(value) : null), null),
|
|
18732
18777
|
data: (value) => value,
|
|
@@ -24715,6 +24760,14 @@ class AbstractHDWallet {
|
|
|
24715
24760
|
coinType() {
|
|
24716
24761
|
return this.constructor._coinType;
|
|
24717
24762
|
}
|
|
24763
|
+
/**
|
|
24764
|
+
* Returns the extended public key of the root node of the HD wallet.
|
|
24765
|
+
*
|
|
24766
|
+
* @returns {string} The extended public key.
|
|
24767
|
+
*/
|
|
24768
|
+
get xPub() {
|
|
24769
|
+
return this._root.extendedKey;
|
|
24770
|
+
}
|
|
24718
24771
|
/**
|
|
24719
24772
|
* Derives the next valid address node for a specified account, starting index, and zone. The method ensures the
|
|
24720
24773
|
* derived address belongs to the correct shard and ledger, as defined by the Quai blockchain specifications.
|
|
@@ -24824,6 +24877,17 @@ class AbstractHDWallet {
|
|
|
24824
24877
|
}
|
|
24825
24878
|
return addressInfo;
|
|
24826
24879
|
}
|
|
24880
|
+
/**
|
|
24881
|
+
* Returns the private key for a given address. This method should be used with caution as it exposes the private
|
|
24882
|
+
* key to the user.
|
|
24883
|
+
*
|
|
24884
|
+
* @param {string} address - The address associated with the desired private key.
|
|
24885
|
+
* @returns {string} The private key.
|
|
24886
|
+
*/
|
|
24887
|
+
getPrivateKey(address) {
|
|
24888
|
+
const hdNode = this._getHDNodeForAddress(address);
|
|
24889
|
+
return hdNode.privateKey;
|
|
24890
|
+
}
|
|
24827
24891
|
/**
|
|
24828
24892
|
* Gets the addresses for a given account.
|
|
24829
24893
|
*
|
|
@@ -30406,6 +30470,8 @@ var quais = /*#__PURE__*/Object.freeze({
|
|
|
30406
30470
|
encodeBytes32: encodeBytes32,
|
|
30407
30471
|
encryptKeystoreJson: encryptKeystoreJson,
|
|
30408
30472
|
encryptKeystoreJsonSync: encryptKeystoreJsonSync,
|
|
30473
|
+
ethHashMessage: ethHashMessage,
|
|
30474
|
+
ethVerifyMessage: ethVerifyMessage,
|
|
30409
30475
|
formatMixedCaseChecksumAddress: formatMixedCaseChecksumAddress,
|
|
30410
30476
|
formatQuai: formatQuai,
|
|
30411
30477
|
formatUnits: formatUnits,
|
|
@@ -30472,5 +30538,5 @@ var quais = /*#__PURE__*/Object.freeze({
|
|
|
30472
30538
|
zeroPadValue: zeroPadValue
|
|
30473
30539
|
});
|
|
30474
30540
|
|
|
30475
|
-
export { AbiCoder, AbstractProvider, AbstractSigner, BaseContract, Block, BrowserProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, ErrorDescription, ErrorFragment, EventFragment, EventLog, EventPayload, FallbackFragment, FeeData, FetchCancelSignal, FetchRequest, FetchResponse, FewestCoinSelector, FixedNumber, Fragment, FunctionFragment, Indexed, Interface, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, LangEs, Log, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N$1 as N, NamedFragment, Network, ParamType, QiHDWallet, QiTransaction, QuaiHDWallet, QuaiTransaction, Result, Shard, Signature, SigningKey, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketProvider, SocketSubscriber, StructFragment, TransactionDescription, TransactionReceipt, Typed, TypedDataEncoder, UndecodedEventLog, UnmanagedSubscriber, VoidSigner, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, ZeroAddress, ZeroHash, Zone, accessListify, checkResultErrors, computeAddress, computeHmac, concat, copyRequest, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32, decryptKeystoreJson, decryptKeystoreJsonSync, encodeBase58, encodeBase64, encodeBytes32, encryptKeystoreJson, encryptKeystoreJsonSync, formatMixedCaseChecksumAddress, formatQuai, formatUnits, fromTwos, getAddress, getAddressDetails, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getNumber, getTxType, getUint, getZoneForAddress, hashMessage, hexlify, id, isAddress, isAddressable, isBytesLike, isCallException, isError, isHexString, isKeystoreJson, isQiAddress, isQuaiAddress, keccak256, lock, mask, musigCrypto, parseQuai, parseUnits, pbkdf2, quais, quaisymbol, randomBytes, recoverAddress, resolveAddress, ripemd160, scrypt, scryptSync, sha256, sha512, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, toBeArray, toBeHex, toBigInt, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, uuidV4, validateAddress, verifyMessage, verifyTypedData, version, wordlists, zeroPadBytes, zeroPadValue };
|
|
30541
|
+
export { AbiCoder, AbstractProvider, AbstractSigner, BaseContract, Block, BrowserProvider, ConstructorFragment, Contract, ContractEventPayload, ContractFactory, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, ErrorDescription, ErrorFragment, EventFragment, EventLog, EventPayload, FallbackFragment, FeeData, FetchCancelSignal, FetchRequest, FetchResponse, FewestCoinSelector, FixedNumber, Fragment, FunctionFragment, Indexed, Interface, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, LangEn, LangEs, Log, LogDescription, MaxInt256, MaxUint256, MessagePrefix, MinInt256, Mnemonic, N$1 as N, NamedFragment, Network, ParamType, QiHDWallet, QiTransaction, QuaiHDWallet, QuaiTransaction, Result, Shard, Signature, SigningKey, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketProvider, SocketSubscriber, StructFragment, TransactionDescription, TransactionReceipt, Typed, TypedDataEncoder, UndecodedEventLog, UnmanagedSubscriber, VoidSigner, Wallet, WebSocketProvider, WeiPerEther, Wordlist, WordlistOwl, WordlistOwlA, ZeroAddress, ZeroHash, Zone, accessListify, checkResultErrors, computeAddress, computeHmac, concat, copyRequest, dataLength, dataSlice, decodeBase58, decodeBase64, decodeBytes32, decryptKeystoreJson, decryptKeystoreJsonSync, encodeBase58, encodeBase64, encodeBytes32, encryptKeystoreJson, encryptKeystoreJsonSync, ethHashMessage, ethVerifyMessage, formatMixedCaseChecksumAddress, formatQuai, formatUnits, fromTwos, getAddress, getAddressDetails, getBigInt, getBytes, getBytesCopy, getCreate2Address, getCreateAddress, getNumber, getTxType, getUint, getZoneForAddress, hashMessage, hexlify, id, isAddress, isAddressable, isBytesLike, isCallException, isError, isHexString, isKeystoreJson, isQiAddress, isQuaiAddress, keccak256, lock, mask, musigCrypto, parseQuai, parseUnits, pbkdf2, quais, quaisymbol, randomBytes, recoverAddress, resolveAddress, ripemd160, scrypt, scryptSync, sha256, sha512, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, stripZerosLeft, toBeArray, toBeHex, toBigInt, toNumber, toQuantity, toTwos, toUtf8Bytes, toUtf8CodePoints, toUtf8String, uuidV4, validateAddress, verifyMessage, verifyTypedData, version, wordlists, zeroPadBytes, zeroPadValue };
|
|
30476
30542
|
//# sourceMappingURL=quais.js.map
|