@quentinadam/evm-base 0.1.2 → 0.1.4
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/dist/computeCREATE2Address.js +1 -1
- package/dist/computeCREATE2Address.js.map +1 -1
- package/dist/createInspectableDataWrapper.d.ts +0 -1
- package/dist/createInspectableDataWrapper.d.ts.map +1 -1
- package/dist/createInspectableDataWrapper.js.map +1 -1
- package/dist/createInspectableScaledBigIntWrapper.d.ts +2 -0
- package/dist/createInspectableScaledBigIntWrapper.d.ts.map +1 -0
- package/dist/createInspectableScaledBigIntWrapper.js +34 -0
- package/dist/createInspectableScaledBigIntWrapper.js.map +1 -0
- package/dist/inspect.d.ts +5 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +2 -0
- package/dist/inspect.js.map +1 -0
- package/dist/mod.d.ts +2 -1
- package/dist/mod.d.ts.map +1 -1
- package/dist/mod.js +2 -1
- package/dist/mod.js.map +1 -1
- package/package.json +1 -1
- package/src/computeCREATE2Address.ts +1 -1
- package/src/createInspectableDataWrapper.ts +1 -2
- package/src/createInspectableScaledBigIntWrapper.ts +40 -0
- package/src/inspect.ts +2 -0
- package/src/mod.ts +2 -0
|
@@ -10,7 +10,7 @@ export default function computeCREATE2Address(params, { prefixByte, addressFromB
|
|
|
10
10
|
return keccak256(concat([bytecode, constructorArguments].filter((chunk) => chunk !== undefined)));
|
|
11
11
|
})();
|
|
12
12
|
const bytes = keccak256(concat([
|
|
13
|
-
new Uint8Array(prefixByte),
|
|
13
|
+
new Uint8Array([prefixByte]),
|
|
14
14
|
bytesFromAddress(deployer),
|
|
15
15
|
salt instanceof Uint8Array ? salt : fromUintBE(salt, 32),
|
|
16
16
|
bytecodeHash,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"computeCREATE2Address.js","sourceRoot":"","sources":["../src/computeCREATE2Address.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,6BAA6B,CAA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AAY,CAAC;QACtB,CAAC;QACD,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC;IACpG,CAAC,CAAC,EAAE,CAAC;IACL,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,CAAC;QAC7B,IAAI,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC;QAC5B,gBAAgB,CAAC,QAAQ,CAAC;QAC1B,IAAI,YAAY,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC;QACxD,YAAY;KACb,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACf,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInspectableDataWrapper.d.ts","sourceRoot":"","sources":["../src/createInspectableDataWrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createInspectableDataWrapper.d.ts","sourceRoot":"","sources":["../src/createInspectableDataWrapper.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CA8B9E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInspectableDataWrapper.js","sourceRoot":"","sources":["../src/createInspectableDataWrapper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createInspectableDataWrapper.js","sourceRoot":"","sources":["../src/createInspectableDataWrapper.ts"],"names":[],"mappings":"AACA,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,4BAA4B,CAAC,KAAiB;IACpE,OAAO,IAAI,CAAC,MAAM,sBAAsB;QAC7B,MAAM,CAA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spectableScaledBigIntWrapper.d.ts","sourceRoot":"","sources":["../src/createInspectableScaledBigIntWrapper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,oCAAoC,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqCpG"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export default function createInspectableScaledBigIntWrapper(value, exponent) {
|
|
2
|
+
return new (class ScaledBigInt {
|
|
3
|
+
#value;
|
|
4
|
+
#exponent;
|
|
5
|
+
constructor(value, exponent) {
|
|
6
|
+
this.#value = value;
|
|
7
|
+
this.#exponent = exponent;
|
|
8
|
+
}
|
|
9
|
+
[Symbol.for('Deno.customInspect')](inspect, options) {
|
|
10
|
+
return this.#customInspect(inspect, options);
|
|
11
|
+
}
|
|
12
|
+
[Symbol.for('nodejs.util.inspect.custom')](_depth, options, inspect) {
|
|
13
|
+
return this.#customInspect(inspect, options);
|
|
14
|
+
}
|
|
15
|
+
toString() {
|
|
16
|
+
return ((string) => {
|
|
17
|
+
return string.slice(0, -this.#exponent) + '.' + string.slice(-this.#exponent);
|
|
18
|
+
})(this.#value.toString().padStart(this.#exponent + 1, '0')).replace(/\.?0+$/, '') + 'e' + this.#exponent;
|
|
19
|
+
}
|
|
20
|
+
#customInspect(inspect, options) {
|
|
21
|
+
const stylize = options.stylize;
|
|
22
|
+
if (typeof stylize === 'function') {
|
|
23
|
+
return stylize(this.toString(), 'number');
|
|
24
|
+
}
|
|
25
|
+
const coloredNumber = inspect(0, options);
|
|
26
|
+
// deno-lint-ignore no-control-regex
|
|
27
|
+
const start = coloredNumber.match(/^\x1b\[[0-9;]*m/)?.[0] ?? '';
|
|
28
|
+
// deno-lint-ignore no-control-regex
|
|
29
|
+
const end = coloredNumber.match(/\x1b\[[0-9;]*m$/)?.[0] ?? '';
|
|
30
|
+
return `${start}${this.toString()}${end}`;
|
|
31
|
+
}
|
|
32
|
+
})(value, exponent);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=createInspectableScaledBigIntWrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createInspectableScaledBigIntWrapper.js","sourceRoot":"","sources":["../src/createInspectableScaledBigIntWrapper.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,oCAAoC,CAAC,KAAa,EAAE,QAAgB;IAC1F,OAAO,IAAI,CAAC,MAAM,YAAY;QACnB,MAAM,CAAC;QACP,SAAS,CAAC;QAEnB,YAAY,KAAa,EAAE,QAAgB;YACzC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC5B,CAAC;QAED,CAAC,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC,OAAkB,EAAE,OAAgB;YACrE,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAED,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,MAAc,EAAE,OAAgB,EAAE,OAAkB;YAC7F,OAAO,IAAI,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QAED,QAAQ;YACN,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjB,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAChF,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5G,CAAC;QAED,cAAc,CAAC,OAAkB,EAAE,OAAgB;YACjD,MAAM,OAAO,GAAI,OAA0B,CAAC,OAAO,CAAC;YACpD,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;gBAClC,OAAO,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,CAAC;YAC5C,CAAC;YACD,MAAM,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;YAC1C,oCAAoC;YACpC,MAAM,KAAK,GAAG,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAChE,oCAAoC;YACpC,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,OAAO,GAAG,KAAK,GAAG,IAAI,CAAC,QAAQ,EAAE,GAAG,GAAG,EAAE,CAAC;QAC5C,CAAC;KACF,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.d.ts","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,MAAM,CAAC;AACtE,MAAM,MAAM,cAAc,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
package/dist/inspect.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspect.js","sourceRoot":"","sources":["../src/inspect.ts"],"names":[],"mappings":""}
|
package/dist/mod.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import computeCREATEAddress from './computeCREATEAddress.ts';
|
|
|
5
5
|
import Client from './Client.ts';
|
|
6
6
|
import ClientError from './ClientError.ts';
|
|
7
7
|
import createInspectableDataWrapper from './createInspectableDataWrapper.ts';
|
|
8
|
+
import createInspectableScaledBigIntWrapper from './createInspectableScaledBigIntWrapper.ts';
|
|
8
9
|
import DataEncoder from './DataEncoder.ts';
|
|
9
10
|
import ClientHelper from './ClientHelper.ts';
|
|
10
11
|
import type Log from './Log.ts';
|
|
@@ -12,6 +13,6 @@ import MethodSignatureRegistry from './MethodSignatureRegistry.ts';
|
|
|
12
13
|
import MulticallClient from './MulticallClient.ts';
|
|
13
14
|
import type Transaction from './Transaction.ts';
|
|
14
15
|
import type TransactionReceipt from './TransactionReceipt.ts';
|
|
15
|
-
export { ABI, Client, ClientError, ClientHelper, computeCREATE2Address, computeCREATEAddress, createInspectableDataWrapper, DataEncoder, MethodSignatureRegistry, MulticallClient, };
|
|
16
|
+
export { ABI, Client, ClientError, ClientHelper, computeCREATE2Address, computeCREATEAddress, createInspectableDataWrapper, createInspectableScaledBigIntWrapper, DataEncoder, MethodSignatureRegistry, MulticallClient, };
|
|
16
17
|
export type { Block, Log, Transaction, TransactionReceipt };
|
|
17
18
|
//# sourceMappingURL=mod.d.ts.map
|
package/dist/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,YAAY,MAAM,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EACpB,4BAA4B,EAC5B,oCAAoC,EACpC,WAAW,EACX,uBAAuB,EACvB,eAAe,GAChB,CAAC;AAEF,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC"}
|
package/dist/mod.js
CHANGED
|
@@ -4,9 +4,10 @@ import computeCREATEAddress from "./computeCREATEAddress.js";
|
|
|
4
4
|
import Client from "./Client.js";
|
|
5
5
|
import ClientError from "./ClientError.js";
|
|
6
6
|
import createInspectableDataWrapper from "./createInspectableDataWrapper.js";
|
|
7
|
+
import createInspectableScaledBigIntWrapper from "./createInspectableScaledBigIntWrapper.js";
|
|
7
8
|
import DataEncoder from "./DataEncoder.js";
|
|
8
9
|
import ClientHelper from "./ClientHelper.js";
|
|
9
10
|
import MethodSignatureRegistry from "./MethodSignatureRegistry.js";
|
|
10
11
|
import MulticallClient from "./MulticallClient.js";
|
|
11
|
-
export { ABI, Client, ClientError, ClientHelper, computeCREATE2Address, computeCREATEAddress, createInspectableDataWrapper, DataEncoder, MethodSignatureRegistry, MulticallClient, };
|
|
12
|
+
export { ABI, Client, ClientError, ClientHelper, computeCREATE2Address, computeCREATEAddress, createInspectableDataWrapper, createInspectableScaledBigIntWrapper, DataEncoder, MethodSignatureRegistry, MulticallClient, };
|
|
12
13
|
//# sourceMappingURL=mod.js.map
|
package/dist/mod.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAInD,OAAO,EACL,GAAG,EACH,MAAM,EACN,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,WAAW,EACX,uBAAuB,EACvB,eAAe,GAChB,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,UAAU,CAAC;AAE3B,OAAO,qBAAqB,MAAM,4BAA4B,CAAC;AAC/D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,oCAAoC,MAAM,2CAA2C,CAAC;AAC7F,OAAO,WAAW,MAAM,kBAAkB,CAAC;AAC3C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,uBAAuB,MAAM,8BAA8B,CAAC;AACnE,OAAO,eAAe,MAAM,sBAAsB,CAAC;AAInD,OAAO,EACL,GAAG,EACH,MAAM,EACN,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,oBAAoB,EACpB,4BAA4B,EAC5B,oCAAoC,EACpC,WAAW,EACX,uBAAuB,EACvB,eAAe,GAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export default function computeCREATE2Address(
|
|
|
23
23
|
return keccak256(concat([bytecode, constructorArguments].filter((chunk) => chunk !== undefined)));
|
|
24
24
|
})();
|
|
25
25
|
const bytes = keccak256(concat([
|
|
26
|
-
new Uint8Array(prefixByte),
|
|
26
|
+
new Uint8Array([prefixByte]),
|
|
27
27
|
bytesFromAddress(deployer),
|
|
28
28
|
salt instanceof Uint8Array ? salt : fromUintBE(salt, 32),
|
|
29
29
|
bytecodeHash,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import type { InspectFn } from './inspect.ts';
|
|
1
2
|
import MethodSignatureRegistry from './MethodSignatureRegistry.ts';
|
|
2
3
|
|
|
3
|
-
export type InspectFn = (value: unknown, options?: unknown) => string;
|
|
4
|
-
|
|
5
4
|
export default function createInspectableDataWrapper(bytes: Uint8Array): object {
|
|
6
5
|
return new (class InspectableDataWrapper {
|
|
7
6
|
readonly #bytes: Uint8Array;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { InspectFn, InspectOptions } from './inspect.ts';
|
|
2
|
+
|
|
3
|
+
export default function createInspectableScaledBigIntWrapper(value: bigint, exponent: number): object {
|
|
4
|
+
return new (class ScaledBigInt {
|
|
5
|
+
readonly #value;
|
|
6
|
+
readonly #exponent;
|
|
7
|
+
|
|
8
|
+
constructor(value: bigint, exponent: number) {
|
|
9
|
+
this.#value = value;
|
|
10
|
+
this.#exponent = exponent;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[Symbol.for('Deno.customInspect')](inspect: InspectFn, options: unknown): string {
|
|
14
|
+
return this.#customInspect(inspect, options);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
[Symbol.for('nodejs.util.inspect.custom')](_depth: number, options: unknown, inspect: InspectFn): string {
|
|
18
|
+
return this.#customInspect(inspect, options);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
toString() {
|
|
22
|
+
return ((string) => {
|
|
23
|
+
return string.slice(0, -this.#exponent) + '.' + string.slice(-this.#exponent);
|
|
24
|
+
})(this.#value.toString().padStart(this.#exponent + 1, '0')).replace(/\.?0+$/, '') + 'e' + this.#exponent;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#customInspect(inspect: InspectFn, options: unknown): string {
|
|
28
|
+
const stylize = (options as InspectOptions).stylize;
|
|
29
|
+
if (typeof stylize === 'function') {
|
|
30
|
+
return stylize(this.toString(), 'number');
|
|
31
|
+
}
|
|
32
|
+
const coloredNumber = inspect(0, options);
|
|
33
|
+
// deno-lint-ignore no-control-regex
|
|
34
|
+
const start = coloredNumber.match(/^\x1b\[[0-9;]*m/)?.[0] ?? '';
|
|
35
|
+
// deno-lint-ignore no-control-regex
|
|
36
|
+
const end = coloredNumber.match(/\x1b\[[0-9;]*m$/)?.[0] ?? '';
|
|
37
|
+
return `${start}${this.toString()}${end}`;
|
|
38
|
+
}
|
|
39
|
+
})(value, exponent);
|
|
40
|
+
}
|
package/src/inspect.ts
ADDED
package/src/mod.ts
CHANGED
|
@@ -5,6 +5,7 @@ import computeCREATEAddress from './computeCREATEAddress.ts';
|
|
|
5
5
|
import Client from './Client.ts';
|
|
6
6
|
import ClientError from './ClientError.ts';
|
|
7
7
|
import createInspectableDataWrapper from './createInspectableDataWrapper.ts';
|
|
8
|
+
import createInspectableScaledBigIntWrapper from './createInspectableScaledBigIntWrapper.ts';
|
|
8
9
|
import DataEncoder from './DataEncoder.ts';
|
|
9
10
|
import ClientHelper from './ClientHelper.ts';
|
|
10
11
|
import type Log from './Log.ts';
|
|
@@ -21,6 +22,7 @@ export {
|
|
|
21
22
|
computeCREATE2Address,
|
|
22
23
|
computeCREATEAddress,
|
|
23
24
|
createInspectableDataWrapper,
|
|
25
|
+
createInspectableScaledBigIntWrapper,
|
|
24
26
|
DataEncoder,
|
|
25
27
|
MethodSignatureRegistry,
|
|
26
28
|
MulticallClient,
|