viem 0.0.0-main.20231115T222931 → 0.0.0-main.20231119T230454
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/_cjs/chains/definitions/aurora.js +6 -0
- package/_cjs/chains/definitions/aurora.js.map +1 -1
- package/_cjs/errors/node.js +11 -11
- package/_cjs/errors/node.js.map +1 -1
- package/_cjs/errors/rpc.js +18 -18
- package/_cjs/errors/rpc.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/unit/formatEther.js.map +1 -1
- package/_cjs/utils/unit/formatGwei.js.map +1 -1
- package/_cjs/utils/unit/formatUnits.js.map +1 -1
- package/_cjs/utils/unit/parseEther.js.map +1 -1
- package/_cjs/utils/unit/parseGwei.js.map +1 -1
- package/_cjs/utils/unit/parseUnits.js.map +1 -1
- package/_esm/chains/definitions/aurora.js +6 -0
- package/_esm/chains/definitions/aurora.js.map +1 -1
- package/_esm/errors/node.js +22 -11
- package/_esm/errors/node.js.map +1 -1
- package/_esm/errors/rpc.js +36 -18
- package/_esm/errors/rpc.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/utils/unit/formatEther.js +11 -0
- package/_esm/utils/unit/formatEther.js.map +1 -1
- package/_esm/utils/unit/formatGwei.js +11 -0
- package/_esm/utils/unit/formatGwei.js.map +1 -1
- package/_esm/utils/unit/formatUnits.js +11 -0
- package/_esm/utils/unit/formatUnits.js.map +1 -1
- package/_esm/utils/unit/parseEther.js +11 -0
- package/_esm/utils/unit/parseEther.js.map +1 -1
- package/_esm/utils/unit/parseGwei.js +11 -0
- package/_esm/utils/unit/parseGwei.js.map +1 -1
- package/_esm/utils/unit/parseUnits.js +11 -0
- package/_esm/utils/unit/parseUnits.js.map +1 -1
- package/_types/chains/definitions/aurora.d.ts +6 -0
- package/_types/chains/definitions/aurora.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/unit/formatEther.d.ts +11 -0
- package/_types/utils/unit/formatEther.d.ts.map +1 -1
- package/_types/utils/unit/formatGwei.d.ts +11 -0
- package/_types/utils/unit/formatGwei.d.ts.map +1 -1
- package/_types/utils/unit/formatUnits.d.ts +11 -0
- package/_types/utils/unit/formatUnits.d.ts.map +1 -1
- package/_types/utils/unit/parseEther.d.ts +11 -0
- package/_types/utils/unit/parseEther.d.ts.map +1 -1
- package/_types/utils/unit/parseGwei.d.ts +11 -0
- package/_types/utils/unit/parseGwei.d.ts.map +1 -1
- package/_types/utils/unit/parseUnits.d.ts +11 -0
- package/_types/utils/unit/parseUnits.d.ts.map +1 -1
- package/chains/definitions/aurora.ts +6 -0
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/utils/unit/formatEther.ts +11 -0
- package/utils/unit/formatGwei.ts +11 -0
- package/utils/unit/formatUnits.ts +11 -0
- package/utils/unit/parseEther.ts +11 -0
- package/utils/unit/parseGwei.ts +11 -0
- package/utils/unit/parseUnits.ts +11 -0
@@ -1,4 +1,15 @@
|
|
1
1
|
import type { ErrorType } from '../../errors/utils.js';
|
2
2
|
export type ParseUnitsErrorType = ErrorType;
|
3
|
+
/**
|
4
|
+
* Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
|
5
|
+
*
|
6
|
+
* - Docs: https://viem.sh/docs/utilities/parseUnits.html
|
7
|
+
*
|
8
|
+
* @example
|
9
|
+
* import { parseUnits } from 'viem'
|
10
|
+
*
|
11
|
+
* parseUnits('420', 9)
|
12
|
+
* // 420000000000n
|
13
|
+
*/
|
3
14
|
export declare function parseUnits(value: string, decimals: number): bigint;
|
4
15
|
//# sourceMappingURL=parseUnits.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"parseUnits.d.ts","sourceRoot":"","sources":["../../../utils/unit/parseUnits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE3C,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAqCzD"}
|
1
|
+
{"version":3,"file":"parseUnits.d.ts","sourceRoot":"","sources":["../../../utils/unit/parseUnits.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAEtD,MAAM,MAAM,mBAAmB,GAAG,SAAS,CAAA;AAE3C;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,UAqCzD"}
|
@@ -18,4 +18,10 @@ export const aurora = /*#__PURE__*/ defineChain({
|
|
18
18
|
etherscan: { name: 'Aurorascan', url: 'https://aurorascan.dev' },
|
19
19
|
default: { name: 'Aurorascan', url: 'https://aurorascan.dev' },
|
20
20
|
},
|
21
|
+
contracts: {
|
22
|
+
multicall3: {
|
23
|
+
address: '0xca11bde05977b3631167028862be2a173976ca11',
|
24
|
+
blockCreated: 62907816,
|
25
|
+
},
|
26
|
+
},
|
21
27
|
})
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '0.0.0-main.
|
1
|
+
export const version = '0.0.0-main.20231119T230454'
|
package/package.json
CHANGED
@@ -4,6 +4,17 @@ import { type FormatUnitsErrorType, formatUnits } from './formatUnits.js'
|
|
4
4
|
|
5
5
|
export type FormatEtherErrorType = FormatUnitsErrorType
|
6
6
|
|
7
|
+
/**
|
8
|
+
* Converts numerical wei to a string representation of ether.
|
9
|
+
*
|
10
|
+
* - Docs: https://viem.sh/docs/utilities/formatEther.html
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* import { formatEther } from 'viem'
|
14
|
+
*
|
15
|
+
* formatEther(1000000000000000000n)
|
16
|
+
* // '1'
|
17
|
+
*/
|
7
18
|
export function formatEther(wei: bigint, unit: 'wei' | 'gwei' = 'wei') {
|
8
19
|
return formatUnits(wei, etherUnits[unit])
|
9
20
|
}
|
package/utils/unit/formatGwei.ts
CHANGED
@@ -4,6 +4,17 @@ import { type FormatUnitsErrorType, formatUnits } from './formatUnits.js'
|
|
4
4
|
|
5
5
|
export type FormatGweiErrorType = FormatUnitsErrorType
|
6
6
|
|
7
|
+
/**
|
8
|
+
* Converts numerical wei to a string representation of gwei.
|
9
|
+
*
|
10
|
+
* - Docs: https://viem.sh/docs/utilities/formatGwei.html
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* import { formatGwei } from 'viem'
|
14
|
+
*
|
15
|
+
* formatGwei(1000000000n)
|
16
|
+
* // '1'
|
17
|
+
*/
|
7
18
|
export function formatGwei(wei: bigint, unit: 'wei' = 'wei') {
|
8
19
|
return formatUnits(wei, gweiUnits[unit])
|
9
20
|
}
|
@@ -2,6 +2,17 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
2
2
|
|
3
3
|
export type FormatUnitsErrorType = ErrorType
|
4
4
|
|
5
|
+
/**
|
6
|
+
* Divides a number by a given exponent of base 10 (10exponent), and formats it into a string representation of the number..
|
7
|
+
*
|
8
|
+
* - Docs: https://viem.sh/docs/utilities/formatUnits.html
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* import { formatUnits } from 'viem'
|
12
|
+
*
|
13
|
+
* formatUnits(420000000000n, 9)
|
14
|
+
* // '420'
|
15
|
+
*/
|
5
16
|
export function formatUnits(value: bigint, decimals: number) {
|
6
17
|
let display = value.toString()
|
7
18
|
|
package/utils/unit/parseEther.ts
CHANGED
@@ -5,6 +5,17 @@ import { type ParseUnitsErrorType, parseUnits } from './parseUnits.js'
|
|
5
5
|
|
6
6
|
export type ParseEtherErrorType = ParseUnitsErrorType | ErrorType
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Converts a string representation of ether to numerical wei.
|
10
|
+
*
|
11
|
+
* - Docs: https://viem.sh/docs/utilities/parseEther.html
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
* import { parseEther } from 'viem'
|
15
|
+
*
|
16
|
+
* parseEther('420')
|
17
|
+
* // 420000000000000000000n
|
18
|
+
*/
|
8
19
|
export function parseEther(ether: string, unit: 'wei' | 'gwei' = 'wei') {
|
9
20
|
return parseUnits(ether, etherUnits[unit])
|
10
21
|
}
|
package/utils/unit/parseGwei.ts
CHANGED
@@ -5,6 +5,17 @@ import { type ParseUnitsErrorType, parseUnits } from './parseUnits.js'
|
|
5
5
|
|
6
6
|
export type ParseGweiErrorType = ParseUnitsErrorType | ErrorType
|
7
7
|
|
8
|
+
/**
|
9
|
+
* Converts a string representation of gwei to numerical wei.
|
10
|
+
*
|
11
|
+
* - Docs: https://viem.sh/docs/utilities/parseGwei.html
|
12
|
+
*
|
13
|
+
* @example
|
14
|
+
* import { parseGwei } from 'viem'
|
15
|
+
*
|
16
|
+
* parseGwei('420')
|
17
|
+
* // 420000000000n
|
18
|
+
*/
|
8
19
|
export function parseGwei(ether: string, unit: 'wei' = 'wei') {
|
9
20
|
return parseUnits(ether, gweiUnits[unit])
|
10
21
|
}
|
package/utils/unit/parseUnits.ts
CHANGED
@@ -2,6 +2,17 @@ import type { ErrorType } from '../../errors/utils.js'
|
|
2
2
|
|
3
3
|
export type ParseUnitsErrorType = ErrorType
|
4
4
|
|
5
|
+
/**
|
6
|
+
* Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
|
7
|
+
*
|
8
|
+
* - Docs: https://viem.sh/docs/utilities/parseUnits.html
|
9
|
+
*
|
10
|
+
* @example
|
11
|
+
* import { parseUnits } from 'viem'
|
12
|
+
*
|
13
|
+
* parseUnits('420', 9)
|
14
|
+
* // 420000000000n
|
15
|
+
*/
|
5
16
|
export function parseUnits(value: string, decimals: number) {
|
6
17
|
let [integer, fraction = '0'] = value.split('.')
|
7
18
|
|