@klaytn/js-ext-core
Advanced tools
Comparing version 0.9.8-beta to 0.9.9-beta
@@ -21,7 +21,9 @@ export declare enum TxType { | ||
} | ||
export declare function isKlaytnTxType(type: number): boolean; | ||
export declare function isBasicTxType(type: number): boolean; | ||
export declare function isFeeDelegationTxType(type: number): boolean; | ||
export declare function isPartialFeeDelegationTxType(type: number): boolean; | ||
export declare function isFeePayerSigTxType(type: number): boolean; | ||
export declare function parseTxType(type?: number | string): number; | ||
export declare function getKaikasTxType(type?: number | string): number | string | undefined; | ||
export declare function isKlaytnTxType(type?: number): boolean; | ||
export declare function isBasicTxType(type?: number): boolean; | ||
export declare function isFeeDelegationTxType(type?: number): boolean; | ||
export declare function isPartialFeeDelegationTxType(type?: number): boolean; | ||
export declare function isFeePayerSigTxType(type?: number): boolean; | ||
export declare enum AccountKeyType { | ||
@@ -35,5 +37,5 @@ Nil = 0, | ||
} | ||
export declare function isKlaytnAccountKeyType(type: number): boolean; | ||
export declare function isEmbeddableAccountKeyType(type: number): boolean; | ||
export declare function isKlaytnAccountKeyType(type?: number): boolean; | ||
export declare function isEmbeddableAccountKeyType(type?: number): boolean; | ||
export declare const CodeFormatEVM = 0; | ||
//# sourceMappingURL=const.d.ts.map |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CodeFormatEVM = exports.isEmbeddableAccountKeyType = exports.isKlaytnAccountKeyType = exports.AccountKeyType = exports.isFeePayerSigTxType = exports.isPartialFeeDelegationTxType = exports.isFeeDelegationTxType = exports.isBasicTxType = exports.isKlaytnTxType = exports.TxType = void 0; | ||
exports.CodeFormatEVM = exports.isEmbeddableAccountKeyType = exports.isKlaytnAccountKeyType = exports.AccountKeyType = exports.isFeePayerSigTxType = exports.isPartialFeeDelegationTxType = exports.isFeeDelegationTxType = exports.isBasicTxType = exports.isKlaytnTxType = exports.getKaikasTxType = exports.parseTxType = exports.TxType = void 0; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const data_1 = require("./data"); | ||
// Klaytn Type Enumeration | ||
@@ -29,18 +34,65 @@ var TxType; | ||
})(TxType || (exports.TxType = TxType = {})); | ||
// Parse Klaytn TxType in various formats including number (8), | ||
// hex string (0x08), camel case string ("ValueTransfer"), and snake case string ("VALUE_TRANSFER"). | ||
function parseTxType(type) { | ||
if (type == undefined) { | ||
return 0; | ||
} | ||
if (lodash_1.default.isNumber(type)) { | ||
return type; | ||
} | ||
if (lodash_1.default.isString(type) && type.length > 0) { | ||
// Try the hex string, e.g. "0x08" | ||
if (data_1.HexStr.isHex(type)) { | ||
return data_1.HexStr.toNumber(type); | ||
} | ||
// Try camel case string, e.g. "ValueTransfer", "TxTypeValueTransfer" | ||
// or snake case string, e.g. "VALUE_TRANSFER" | ||
let name = type; | ||
if (name.startsWith("TxType")) { | ||
name = name.substring(6); | ||
} | ||
name = lodash_1.default.upperFirst(lodash_1.default.camelCase(name)); | ||
if (lodash_1.default.has(TxType, name)) { | ||
return lodash_1.default.get(TxType, name); | ||
} | ||
} | ||
throw new Error(`Unrecognized tx type '${type}'. Expected a number.'`); | ||
} | ||
exports.parseTxType = parseTxType; | ||
// Convert Klaytn TxType to what Kaikas wallet (https://docs.kaikas.io/) understands. | ||
// Pass-through undefined and non-Klaytn TxTypes. | ||
// Convert Klaytn TxTypes to upper and snake case string (e.g. "VALUE_TRANSFER"). | ||
function getKaikasTxType(type) { | ||
const num = parseTxType(type); | ||
if (!isKlaytnTxType(num)) { | ||
return num; | ||
} | ||
else { | ||
const name = TxType[num]; | ||
return lodash_1.default.snakeCase(name).toUpperCase(); | ||
} | ||
} | ||
exports.getKaikasTxType = getKaikasTxType; | ||
// Returns true for Klaytn TxType. | ||
function isKlaytnTxType(type) { | ||
return (type in TxType); | ||
return !!type && (type in TxType); | ||
} | ||
exports.isKlaytnTxType = isKlaytnTxType; | ||
// Returns true for Klaytn Basic (i.e. not fee delegated) TxType. | ||
function isBasicTxType(type) { | ||
return (type in TxType) && ((type & 0x3) == 0x0); | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x0); | ||
} | ||
exports.isBasicTxType = isBasicTxType; | ||
// Returns true for Klaytn Fee Delegated TxType. | ||
function isFeeDelegationTxType(type) { | ||
return (type in TxType) && ((type & 0x3) == 0x1); | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x1); | ||
} | ||
exports.isFeeDelegationTxType = isFeeDelegationTxType; | ||
// Returns true for Klaytn Partial Fee Delegated (i.e. with ratio) TxType. | ||
function isPartialFeeDelegationTxType(type) { | ||
return (type in TxType) && ((type & 0x3) == 0x2); | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x2); | ||
} | ||
exports.isPartialFeeDelegationTxType = isPartialFeeDelegationTxType; | ||
// Returns true for Klaytn TxType with feePayer feature (i.e. fee delegation or partial fee delegation). | ||
function isFeePayerSigTxType(type) { | ||
@@ -60,10 +112,11 @@ return isFeeDelegationTxType(type) || isPartialFeeDelegationTxType(type); | ||
})(AccountKeyType || (exports.AccountKeyType = AccountKeyType = {})); | ||
// Returns true for Klaytn AccountKeyType. | ||
function isKlaytnAccountKeyType(type) { | ||
return (type in AccountKeyType); | ||
return !!type && (type in AccountKeyType); | ||
} | ||
exports.isKlaytnAccountKeyType = isKlaytnAccountKeyType; | ||
// Returns true if it can be embedded in an AccountKeyRoleBased | ||
// Returns true for AccountKeyTypes that can be embedded in an AccountKeyRoleBased | ||
// (i.e. AccountKeyNil, AccountKeyLegacy, AccountKeyPublic, AccountKeyFail, and AccountKeyWeightedMultiSig) | ||
function isEmbeddableAccountKeyType(type) { | ||
// any of AccountKeyNil, AccountKeyLegacy, AccountKeyPublic, AccountKeyFail, and AccountKeyWeightedMultiSig. | ||
return (type in AccountKeyType) && (type != AccountKeyType.RoleBased); | ||
return !!type && (type in AccountKeyType) && (type != AccountKeyType.RoleBased); | ||
} | ||
@@ -70,0 +123,0 @@ exports.isEmbeddableAccountKeyType = isEmbeddableAccountKeyType; |
@@ -0,11 +1,10 @@ | ||
import { SignatureLike as EthersSignatureLike } from "@ethersproject/bytes"; | ||
export declare function getPublicKeyFromPrivate(privateKey: string): string; | ||
export declare function getCompressedPublicKey(pub: any): string; | ||
export type SignatureTuple = [string, string, string]; | ||
export interface SignatureObject { | ||
r: string; | ||
s: string; | ||
v?: number; | ||
recoveryParam?: number; | ||
} | ||
export type SignatureLike = SignatureTuple | SignatureObject | string; | ||
export type SignatureLike = EthersSignatureLike | // { r, s, v } or { r, s, recoveryParam } | ||
string | // compact signature | ||
string[]; | ||
export declare function getSignatureTuple(sig: SignatureLike): SignatureTuple; | ||
export declare function getChainIdFromSignatureTuples(signatures?: any[]): number | undefined; | ||
//# sourceMappingURL=ec.d.ts.map |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSignatureTuple = exports.getCompressedPublicKey = void 0; | ||
exports.getChainIdFromSignatureTuples = exports.getSignatureTuple = exports.getCompressedPublicKey = exports.getPublicKeyFromPrivate = void 0; | ||
const bytes_1 = require("@ethersproject/bytes"); | ||
@@ -13,2 +13,8 @@ const elliptic_1 = require("elliptic"); | ||
const secp256k1 = new elliptic_1.ec("secp256k1"); | ||
// Returns a 33-byte compressed public key from a private key. | ||
function getPublicKeyFromPrivate(privateKey) { | ||
const key = secp256k1.keyFromPrivate(data_1.HexStr.stripHexPrefix(privateKey), "hex"); | ||
return getCompressedPublicKey(key.getPublic(true, "hex")); | ||
} | ||
exports.getPublicKeyFromPrivate = getPublicKeyFromPrivate; | ||
// Returns a 33-byte compressed public key from | ||
@@ -18,2 +24,5 @@ // a compressed (33-byte), uncompressed (65-byte) public key, | ||
function getCompressedPublicKey(pub) { | ||
if (pub instanceof Uint8Array) { | ||
pub = data_1.HexStr.from(pub); | ||
} | ||
if (lodash_1.default.isString(pub)) { // Hex string | ||
@@ -54,17 +63,49 @@ const hex = data_1.HexStr.from(data_1.HexStr.withHexPrefix(pub)); | ||
function getSignatureTuple(sig) { | ||
// For array, pass through splitSignature() for sanity check | ||
if (lodash_1.default.isArray(sig) && sig.length == 3) { | ||
// Pass through splitSignature() for sanity check | ||
let obj; | ||
if (lodash_1.default.isArray(sig)) { | ||
if (sig.length != 3) { | ||
throw new Error("Signature tuple must have 3 elements [v,r,s]"); | ||
} | ||
const numV = data_1.HexStr.toNumber(sig[0]); | ||
sig = { v: numV, r: sig[1], s: sig[2] }; | ||
obj = (0, bytes_1.splitSignature)({ v: numV, r: sig[1], s: sig[2] }); | ||
} | ||
const split = (0, bytes_1.splitSignature)(sig); | ||
else { | ||
obj = (0, bytes_1.splitSignature)(sig); | ||
} | ||
// R and S must not have leading zeros | ||
// c.f. https://github.com/ethers-io/ethers.js/blob/v5/packages/transactions/src.ts/index.ts#L298 | ||
return [ | ||
data_1.HexStr.fromNumber(split.v), | ||
data_1.HexStr.stripZeros(split.r), | ||
data_1.HexStr.stripZeros(split.s), | ||
data_1.HexStr.fromNumber(obj.v), | ||
data_1.HexStr.stripZeros(obj.r), | ||
data_1.HexStr.stripZeros(obj.s), | ||
]; | ||
} | ||
exports.getSignatureTuple = getSignatureTuple; | ||
// Extract chainId from tx.txSignatures[] or tx.feePayerSignatures[]. | ||
// It works because Klaytn TxType signatures are always EIP-155. | ||
// Returns undefined if chainId cannot be extracted. Use other methods like RPC to get chainId. | ||
function getChainIdFromSignatureTuples(signatures) { | ||
if (!lodash_1.default.isArray(signatures) || signatures.length == 0) { | ||
return undefined; | ||
} | ||
const signature = signatures[0]; | ||
if (!lodash_1.default.isArray(signature) || signature.length != 3) { | ||
return undefined; | ||
} | ||
const strV = signature[0]; | ||
if (!data_1.HexStr.isHex(strV)) { | ||
return undefined; | ||
} | ||
// v = 2 * chainId + {35, 36} | ||
// v + (v % 2) = 2 * chainId + 36 | ||
const v = data_1.HexStr.toNumber(strV); | ||
if (v >= 35) { | ||
return (v + (v % 2) - 36) / 2; | ||
} | ||
else { | ||
return undefined; | ||
} | ||
} | ||
exports.getChainIdFromSignatureTuples = getChainIdFromSignatureTuples; | ||
//# sourceMappingURL=ec.js.map |
@@ -8,4 +8,4 @@ import { BigNumber, BigNumberish } from "@ethersproject/bignumber"; | ||
export declare const parseUnits: typeof parseKlayUnits; | ||
export declare function fromPeb(number: any, unitName?: string | BigNumberish): string; | ||
export declare function fromPeb(value: BigNumberish, unitName?: string | BigNumberish): string; | ||
export declare function toPeb(value: string, unitName?: string | BigNumberish): string; | ||
//# sourceMappingURL=units.d.ts.map |
@@ -95,8 +95,10 @@ "use strict"; | ||
exports.parseUnits = parseKlayUnits; | ||
// Equivalent to web3.utils.fromWei | ||
function fromPeb(number, unitName) { | ||
return formatKlayUnits(number, unitName); | ||
// Equivalent to web3.utils.fromWei. | ||
// Convert [value]peb to [unit]. | ||
function fromPeb(value, unitName) { | ||
return formatKlayUnits(value, unitName); | ||
} | ||
exports.fromPeb = fromPeb; | ||
// Equivalent to web3.utils.toWei | ||
// Equivalent to web3.utils.toWei. | ||
// Convert [value][unit] to peb. | ||
function toPeb(value, unitName) { | ||
@@ -103,0 +105,0 @@ return parseKlayUnits(value, unitName).toString(); |
{ | ||
"name": "@klaytn/js-ext-core", | ||
"version": "0.9.8-beta", | ||
"version": "0.9.9-beta", | ||
"license": "MIT", | ||
@@ -25,4 +25,4 @@ "main": "dist/index.js", | ||
"@types/elliptic": "^6.4.16", | ||
"@types/jest": "^29.5.7", | ||
"@types/lodash": "^4.14.199", | ||
"@types/mocha": "^10.0.6", | ||
"@types/node": "^20.8.10", | ||
@@ -36,3 +36,4 @@ "@typescript-eslint/eslint-plugin": "^6.1.0", | ||
"ts-node": "^10.9.1", | ||
"typescript": "^5.0.4" | ||
"typescript": "^5.0.4", | ||
"web3-utils": "^4.1.0" | ||
}, | ||
@@ -39,0 +40,0 @@ "dependencies": { |
@@ -146,3 +146,3 @@ import { parse as parseEthTransaction, Transaction as EthersTransaction } from "@ethersproject/transactions"; | ||
// In TxTypeSmartContractDeploy, force 'to' = 0x for compatibility | ||
if (HexStr.fromNumber(fields.type) == HexStr.fromNumber(TxType.SmartContractDeploy) || | ||
if (HexStr.fromNumber(fields.type) == HexStr.fromNumber(TxType.SmartContractDeploy) || | ||
HexStr.fromNumber(fields.type) == HexStr.fromNumber(TxType.FeeDelegatedSmartContractDeploy) || | ||
@@ -149,0 +149,0 @@ HexStr.fromNumber(fields.type) == HexStr.fromNumber(TxType.FeeDelegatedSmartContractDeployWithRatio)) { |
@@ -0,1 +1,5 @@ | ||
import _ from "lodash"; | ||
import { HexStr } from "./data"; | ||
// Klaytn Type Enumeration | ||
@@ -28,15 +32,64 @@ export enum TxType { | ||
export function isKlaytnTxType(type: number): boolean { | ||
return (type in TxType); | ||
// Parse Klaytn TxType in various formats including number (8), | ||
// hex string (0x08), camel case string ("ValueTransfer"), and snake case string ("VALUE_TRANSFER"). | ||
export function parseTxType(type?: number | string): number { | ||
if (type == undefined) { | ||
return 0; | ||
} | ||
if (_.isNumber(type)) { | ||
return type; | ||
} | ||
if (_.isString(type) && type.length > 0) { | ||
// Try the hex string, e.g. "0x08" | ||
if (HexStr.isHex(type)) { | ||
return HexStr.toNumber(type); | ||
} | ||
// Try camel case string, e.g. "ValueTransfer", "TxTypeValueTransfer" | ||
// or snake case string, e.g. "VALUE_TRANSFER" | ||
let name = type; | ||
if (name.startsWith("TxType")) { | ||
name = name.substring(6); | ||
} | ||
name = _.upperFirst(_.camelCase(name)); | ||
if (_.has(TxType, name)) { | ||
return _.get(TxType, name); | ||
} | ||
} | ||
throw new Error(`Unrecognized tx type '${type}'. Expected a number.'`); | ||
} | ||
export function isBasicTxType(type: number): boolean { | ||
return (type in TxType) && ((type & 0x3) == 0x0); | ||
// Convert Klaytn TxType to what Kaikas wallet (https://docs.kaikas.io/) understands. | ||
// Pass-through undefined and non-Klaytn TxTypes. | ||
// Convert Klaytn TxTypes to upper and snake case string (e.g. "VALUE_TRANSFER"). | ||
export function getKaikasTxType(type?: number | string): number | string | undefined { | ||
const num = parseTxType(type); | ||
if (!isKlaytnTxType(num)) { | ||
return num; | ||
} else { | ||
const name = TxType[num]; | ||
return _.snakeCase(name).toUpperCase(); | ||
} | ||
} | ||
export function isFeeDelegationTxType(type: number): boolean { | ||
return (type in TxType) && ((type & 0x3) == 0x1); | ||
// Returns true for Klaytn TxType. | ||
export function isKlaytnTxType(type?: number): boolean { | ||
return !!type && (type in TxType); | ||
} | ||
export function isPartialFeeDelegationTxType(type: number): boolean { | ||
return (type in TxType) && ((type & 0x3) == 0x2); | ||
// Returns true for Klaytn Basic (i.e. not fee delegated) TxType. | ||
export function isBasicTxType(type?: number): boolean { | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x0); | ||
} | ||
export function isFeePayerSigTxType(type: number): boolean { | ||
// Returns true for Klaytn Fee Delegated TxType. | ||
export function isFeeDelegationTxType(type?: number): boolean { | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x1); | ||
} | ||
// Returns true for Klaytn Partial Fee Delegated (i.e. with ratio) TxType. | ||
export function isPartialFeeDelegationTxType(type?: number): boolean { | ||
return !!type && (type in TxType) && ((type & 0x3) == 0x2); | ||
} | ||
// Returns true for Klaytn TxType with feePayer feature (i.e. fee delegation or partial fee delegation). | ||
export function isFeePayerSigTxType(type?: number): boolean { | ||
return isFeeDelegationTxType(type) || isPartialFeeDelegationTxType(type); | ||
@@ -55,11 +108,12 @@ } | ||
export function isKlaytnAccountKeyType(type: number): boolean { | ||
return (type in AccountKeyType); | ||
// Returns true for Klaytn AccountKeyType. | ||
export function isKlaytnAccountKeyType(type?: number): boolean { | ||
return !!type && (type in AccountKeyType); | ||
} | ||
// Returns true if it can be embedded in an AccountKeyRoleBased | ||
export function isEmbeddableAccountKeyType(type: number): boolean { | ||
// any of AccountKeyNil, AccountKeyLegacy, AccountKeyPublic, AccountKeyFail, and AccountKeyWeightedMultiSig. | ||
return (type in AccountKeyType) && (type != AccountKeyType.RoleBased); | ||
// Returns true for AccountKeyTypes that can be embedded in an AccountKeyRoleBased | ||
// (i.e. AccountKeyNil, AccountKeyLegacy, AccountKeyPublic, AccountKeyFail, and AccountKeyWeightedMultiSig) | ||
export function isEmbeddableAccountKeyType(type?: number): boolean { | ||
return !!type && (type in AccountKeyType) && (type != AccountKeyType.RoleBased); | ||
} | ||
export const CodeFormatEVM = 0x00; |
@@ -1,2 +0,2 @@ | ||
import { splitSignature } from "@ethersproject/bytes"; | ||
import { SignatureLike as EthersSignatureLike, Signature, splitSignature } from "@ethersproject/bytes"; | ||
import { ec } from "elliptic"; | ||
@@ -9,2 +9,8 @@ import _ from "lodash"; | ||
// Returns a 33-byte compressed public key from a private key. | ||
export function getPublicKeyFromPrivate(privateKey: string): string { | ||
const key = secp256k1.keyFromPrivate(HexStr.stripHexPrefix(privateKey), "hex"); | ||
return getCompressedPublicKey(key.getPublic(true, "hex")); | ||
} | ||
// Returns a 33-byte compressed public key from | ||
@@ -14,2 +20,6 @@ // a compressed (33-byte), uncompressed (65-byte) public key, | ||
export function getCompressedPublicKey(pub: any): string { | ||
if (pub instanceof Uint8Array) { | ||
pub = HexStr.from(pub); | ||
} | ||
if (_.isString(pub)) { // Hex string | ||
@@ -38,15 +48,7 @@ const hex = HexStr.from(HexStr.withHexPrefix(pub)); | ||
// Commonly used signature object. | ||
export interface SignatureObject { | ||
r: string; | ||
s: string; | ||
v?: number; | ||
recoveryParam?: number; | ||
} | ||
// All kinds of ECDSA signatures returned from various libraries. | ||
export type SignatureLike = | ||
SignatureTuple | | ||
SignatureObject | | ||
string; | ||
EthersSignatureLike | // { r, s, v } or { r, s, recoveryParam } | ||
string | // compact signature | ||
string[]; // [v, r, s] | ||
@@ -71,8 +73,13 @@ // If the sig is an array, the first element 'v' must be one of: | ||
export function getSignatureTuple(sig: SignatureLike): SignatureTuple { | ||
// For array, pass through splitSignature() for sanity check | ||
if (_.isArray(sig) && sig.length == 3) { | ||
// Pass through splitSignature() for sanity check | ||
let obj: Signature; | ||
if (_.isArray(sig)) { | ||
if (sig.length != 3) { | ||
throw new Error("Signature tuple must have 3 elements [v,r,s]"); | ||
} | ||
const numV = HexStr.toNumber(sig[0]); | ||
sig = { v: numV, r: sig[1], s: sig[2] }; | ||
obj = splitSignature({ v: numV, r: sig[1], s: sig[2] }); | ||
} else { | ||
obj = splitSignature(sig); | ||
} | ||
const split = splitSignature(sig); | ||
@@ -82,6 +89,34 @@ // R and S must not have leading zeros | ||
return [ | ||
HexStr.fromNumber(split.v), | ||
HexStr.stripZeros(split.r), | ||
HexStr.stripZeros(split.s), | ||
HexStr.fromNumber(obj.v), | ||
HexStr.stripZeros(obj.r), | ||
HexStr.stripZeros(obj.s), | ||
]; | ||
} | ||
// Extract chainId from tx.txSignatures[] or tx.feePayerSignatures[]. | ||
// It works because Klaytn TxType signatures are always EIP-155. | ||
// Returns undefined if chainId cannot be extracted. Use other methods like RPC to get chainId. | ||
export function getChainIdFromSignatureTuples(signatures?: any[]): number | undefined { | ||
if (!_.isArray(signatures) || signatures.length == 0) { | ||
return undefined; | ||
} | ||
const signature = signatures[0]; | ||
if (!_.isArray(signature) || signature.length != 3) { | ||
return undefined; | ||
} | ||
const strV = signature[0]; | ||
if (!HexStr.isHex(strV)) { | ||
return undefined; | ||
} | ||
// v = 2 * chainId + {35, 36} | ||
// v + (v % 2) = 2 * chainId + 36 | ||
const v = HexStr.toNumber(strV); | ||
if (v >= 35) { | ||
return (v + (v % 2) - 36) / 2; | ||
} else { | ||
return undefined; | ||
} | ||
} |
@@ -95,10 +95,12 @@ // Unit conversion utilities | ||
// Equivalent to web3.utils.fromWei | ||
export function fromPeb(number: any, unitName?: string | BigNumberish): string { | ||
return formatKlayUnits(number, unitName); | ||
// Equivalent to web3.utils.fromWei. | ||
// Convert [value]peb to [unit]. | ||
export function fromPeb(value: BigNumberish, unitName?: string | BigNumberish): string { | ||
return formatKlayUnits(value, unitName); | ||
} | ||
// Equivalent to web3.utils.toWei | ||
export function toPeb(value: string, unitName?: string | BigNumberish): string { | ||
return parseKlayUnits(value, unitName).toString(); | ||
// Equivalent to web3.utils.toWei. | ||
// Convert [value][unit] to peb. | ||
export function toPeb(value: string, unitName?: string | BigNumberish): string { | ||
return parseKlayUnits(value, unitName).toString(); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
292181
4943
15