@nadohq/shared 0.1.0-alpha.45 → 0.1.0-alpha.46
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/consts/chainEnvToChain.d.cts +32 -33
- package/dist/consts/chainEnvToChain.d.ts +32 -33
- package/dist/consts/index.d.cts +0 -1
- package/dist/consts/index.d.ts +0 -1
- package/dist/eip712/eip712ValueTypes.d.cts +1 -1
- package/dist/eip712/eip712ValueTypes.d.ts +1 -1
- package/dist/encoding/encoding.d.cts +1 -1
- package/dist/encoding/encoding.d.ts +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types/balanceTypes.d.cts +1 -1
- package/dist/types/balanceTypes.d.ts +1 -1
- package/dist/types/viemTypes.d.cts +1 -1
- package/dist/types/viemTypes.d.ts +1 -1
- package/dist/utils/balanceValue.d.cts +1 -1
- package/dist/utils/balanceValue.d.ts +1 -1
- package/dist/utils/bytes32.d.cts +1 -1
- package/dist/utils/bytes32.d.ts +1 -1
- package/dist/utils/math/bigDecimal.cjs +4 -3
- package/dist/utils/math/bigDecimal.cjs.map +1 -1
- package/dist/utils/math/bigDecimal.js +4 -3
- package/dist/utils/math/bigDecimal.js.map +1 -1
- package/dist/utils/productTypeFilter.d.cts +2 -2
- package/dist/utils/productTypeFilter.d.ts +2 -2
- package/dist/utils/toPrintableObject.cjs +2 -2
- package/dist/utils/toPrintableObject.cjs.map +1 -1
- package/dist/utils/toPrintableObject.d.cts +5 -1
- package/dist/utils/toPrintableObject.d.ts +5 -1
- package/dist/utils/toPrintableObject.js +2 -2
- package/dist/utils/toPrintableObject.js.map +1 -1
- package/package.json +6 -3
- package/src/utils/math/bigDecimal.ts +5 -3
- package/src/utils/toPrintableObject.ts +11 -2
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as abitype from 'abitype';
|
|
2
1
|
import * as viem_chains from 'viem/chains';
|
|
3
2
|
import * as viem from 'viem';
|
|
4
3
|
import { ChainEnv } from '../types/ChainEnv.cjs';
|
|
@@ -134,7 +133,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
134
133
|
gasUsed: bigint;
|
|
135
134
|
hash: `0x${string}` | null;
|
|
136
135
|
logsBloom: `0x${string}` | null;
|
|
137
|
-
miner:
|
|
136
|
+
miner: viem.Address;
|
|
138
137
|
mixHash: viem.Hash;
|
|
139
138
|
nonce: `0x${string}` | null;
|
|
140
139
|
number: bigint | null;
|
|
@@ -160,14 +159,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
160
159
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
161
160
|
blockHash: `0x${string}` | null;
|
|
162
161
|
blockNumber: bigint | null;
|
|
163
|
-
from:
|
|
162
|
+
from: viem.Address;
|
|
164
163
|
gas: bigint;
|
|
165
164
|
hash: viem.Hash;
|
|
166
165
|
input: viem.Hex;
|
|
167
166
|
nonce: number;
|
|
168
167
|
r: viem.Hex;
|
|
169
168
|
s: viem.Hex;
|
|
170
|
-
to:
|
|
169
|
+
to: viem.Address | null;
|
|
171
170
|
transactionIndex: number | null;
|
|
172
171
|
typeHex: viem.Hex | null;
|
|
173
172
|
v: bigint;
|
|
@@ -187,8 +186,8 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
187
186
|
v: bigint;
|
|
188
187
|
value: bigint;
|
|
189
188
|
gas: bigint;
|
|
190
|
-
to:
|
|
191
|
-
from:
|
|
189
|
+
to: viem.Address | null;
|
|
190
|
+
from: viem.Address;
|
|
192
191
|
nonce: number;
|
|
193
192
|
blockHash: `0x${string}` | null;
|
|
194
193
|
blockNumber: bigint | null;
|
|
@@ -212,14 +211,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
212
211
|
} | {
|
|
213
212
|
blockHash: `0x${string}` | null;
|
|
214
213
|
blockNumber: bigint | null;
|
|
215
|
-
from:
|
|
214
|
+
from: viem.Address;
|
|
216
215
|
gas: bigint;
|
|
217
216
|
hash: viem.Hash;
|
|
218
217
|
input: viem.Hex;
|
|
219
218
|
nonce: number;
|
|
220
219
|
r: viem.Hex;
|
|
221
220
|
s: viem.Hex;
|
|
222
|
-
to:
|
|
221
|
+
to: viem.Address | null;
|
|
223
222
|
transactionIndex: number | null;
|
|
224
223
|
typeHex: viem.Hex | null;
|
|
225
224
|
v: bigint;
|
|
@@ -240,14 +239,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
240
239
|
} | {
|
|
241
240
|
blockHash: `0x${string}` | null;
|
|
242
241
|
blockNumber: bigint | null;
|
|
243
|
-
from:
|
|
242
|
+
from: viem.Address;
|
|
244
243
|
gas: bigint;
|
|
245
244
|
hash: viem.Hash;
|
|
246
245
|
input: viem.Hex;
|
|
247
246
|
nonce: number;
|
|
248
247
|
r: viem.Hex;
|
|
249
248
|
s: viem.Hex;
|
|
250
|
-
to:
|
|
249
|
+
to: viem.Address | null;
|
|
251
250
|
transactionIndex: number | null;
|
|
252
251
|
typeHex: viem.Hex | null;
|
|
253
252
|
v: bigint;
|
|
@@ -268,14 +267,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
268
267
|
} | {
|
|
269
268
|
blockHash: `0x${string}` | null;
|
|
270
269
|
blockNumber: bigint | null;
|
|
271
|
-
from:
|
|
270
|
+
from: viem.Address;
|
|
272
271
|
gas: bigint;
|
|
273
272
|
hash: viem.Hash;
|
|
274
273
|
input: viem.Hex;
|
|
275
274
|
nonce: number;
|
|
276
275
|
r: viem.Hex;
|
|
277
276
|
s: viem.Hex;
|
|
278
|
-
to:
|
|
277
|
+
to: viem.Address | null;
|
|
279
278
|
transactionIndex: number | null;
|
|
280
279
|
typeHex: viem.Hex | null;
|
|
281
280
|
v: bigint;
|
|
@@ -296,14 +295,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
296
295
|
} | {
|
|
297
296
|
blockHash: `0x${string}` | null;
|
|
298
297
|
blockNumber: bigint | null;
|
|
299
|
-
from:
|
|
298
|
+
from: viem.Address;
|
|
300
299
|
gas: bigint;
|
|
301
300
|
hash: viem.Hash;
|
|
302
301
|
input: viem.Hex;
|
|
303
302
|
nonce: number;
|
|
304
303
|
r: viem.Hex;
|
|
305
304
|
s: viem.Hex;
|
|
306
|
-
to:
|
|
305
|
+
to: viem.Address | null;
|
|
307
306
|
transactionIndex: number | null;
|
|
308
307
|
typeHex: viem.Hex | null;
|
|
309
308
|
v: bigint;
|
|
@@ -331,16 +330,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
331
330
|
blobGasUsed?: bigint | undefined;
|
|
332
331
|
blockHash: viem.Hash;
|
|
333
332
|
blockNumber: bigint;
|
|
334
|
-
contractAddress:
|
|
333
|
+
contractAddress: viem.Address | null | undefined;
|
|
335
334
|
cumulativeGasUsed: bigint;
|
|
336
335
|
effectiveGasPrice: bigint;
|
|
337
|
-
from:
|
|
336
|
+
from: viem.Address;
|
|
338
337
|
gasUsed: bigint;
|
|
339
338
|
logs: viem.Log<bigint, number, false>[];
|
|
340
339
|
logsBloom: viem.Hex;
|
|
341
340
|
root?: `0x${string}` | undefined;
|
|
342
341
|
status: "success" | "reverted";
|
|
343
|
-
to:
|
|
342
|
+
to: viem.Address | null;
|
|
344
343
|
transactionHash: viem.Hash;
|
|
345
344
|
transactionIndex: number;
|
|
346
345
|
type: viem.TransactionType;
|
|
@@ -443,7 +442,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
443
442
|
gasUsed: bigint;
|
|
444
443
|
hash: `0x${string}` | null;
|
|
445
444
|
logsBloom: `0x${string}` | null;
|
|
446
|
-
miner:
|
|
445
|
+
miner: viem.Address;
|
|
447
446
|
mixHash: viem.Hash;
|
|
448
447
|
nonce: `0x${string}` | null;
|
|
449
448
|
number: bigint | null;
|
|
@@ -469,14 +468,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
469
468
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
470
469
|
blockHash: `0x${string}` | null;
|
|
471
470
|
blockNumber: bigint | null;
|
|
472
|
-
from:
|
|
471
|
+
from: viem.Address;
|
|
473
472
|
gas: bigint;
|
|
474
473
|
hash: viem.Hash;
|
|
475
474
|
input: viem.Hex;
|
|
476
475
|
nonce: number;
|
|
477
476
|
r: viem.Hex;
|
|
478
477
|
s: viem.Hex;
|
|
479
|
-
to:
|
|
478
|
+
to: viem.Address | null;
|
|
480
479
|
transactionIndex: number | null;
|
|
481
480
|
typeHex: viem.Hex | null;
|
|
482
481
|
v: bigint;
|
|
@@ -496,8 +495,8 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
496
495
|
v: bigint;
|
|
497
496
|
value: bigint;
|
|
498
497
|
gas: bigint;
|
|
499
|
-
to:
|
|
500
|
-
from:
|
|
498
|
+
to: viem.Address | null;
|
|
499
|
+
from: viem.Address;
|
|
501
500
|
nonce: number;
|
|
502
501
|
blockHash: `0x${string}` | null;
|
|
503
502
|
blockNumber: bigint | null;
|
|
@@ -521,14 +520,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
521
520
|
} | {
|
|
522
521
|
blockHash: `0x${string}` | null;
|
|
523
522
|
blockNumber: bigint | null;
|
|
524
|
-
from:
|
|
523
|
+
from: viem.Address;
|
|
525
524
|
gas: bigint;
|
|
526
525
|
hash: viem.Hash;
|
|
527
526
|
input: viem.Hex;
|
|
528
527
|
nonce: number;
|
|
529
528
|
r: viem.Hex;
|
|
530
529
|
s: viem.Hex;
|
|
531
|
-
to:
|
|
530
|
+
to: viem.Address | null;
|
|
532
531
|
transactionIndex: number | null;
|
|
533
532
|
typeHex: viem.Hex | null;
|
|
534
533
|
v: bigint;
|
|
@@ -549,14 +548,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
549
548
|
} | {
|
|
550
549
|
blockHash: `0x${string}` | null;
|
|
551
550
|
blockNumber: bigint | null;
|
|
552
|
-
from:
|
|
551
|
+
from: viem.Address;
|
|
553
552
|
gas: bigint;
|
|
554
553
|
hash: viem.Hash;
|
|
555
554
|
input: viem.Hex;
|
|
556
555
|
nonce: number;
|
|
557
556
|
r: viem.Hex;
|
|
558
557
|
s: viem.Hex;
|
|
559
|
-
to:
|
|
558
|
+
to: viem.Address | null;
|
|
560
559
|
transactionIndex: number | null;
|
|
561
560
|
typeHex: viem.Hex | null;
|
|
562
561
|
v: bigint;
|
|
@@ -577,14 +576,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
577
576
|
} | {
|
|
578
577
|
blockHash: `0x${string}` | null;
|
|
579
578
|
blockNumber: bigint | null;
|
|
580
|
-
from:
|
|
579
|
+
from: viem.Address;
|
|
581
580
|
gas: bigint;
|
|
582
581
|
hash: viem.Hash;
|
|
583
582
|
input: viem.Hex;
|
|
584
583
|
nonce: number;
|
|
585
584
|
r: viem.Hex;
|
|
586
585
|
s: viem.Hex;
|
|
587
|
-
to:
|
|
586
|
+
to: viem.Address | null;
|
|
588
587
|
transactionIndex: number | null;
|
|
589
588
|
typeHex: viem.Hex | null;
|
|
590
589
|
v: bigint;
|
|
@@ -605,14 +604,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
605
604
|
} | {
|
|
606
605
|
blockHash: `0x${string}` | null;
|
|
607
606
|
blockNumber: bigint | null;
|
|
608
|
-
from:
|
|
607
|
+
from: viem.Address;
|
|
609
608
|
gas: bigint;
|
|
610
609
|
hash: viem.Hash;
|
|
611
610
|
input: viem.Hex;
|
|
612
611
|
nonce: number;
|
|
613
612
|
r: viem.Hex;
|
|
614
613
|
s: viem.Hex;
|
|
615
|
-
to:
|
|
614
|
+
to: viem.Address | null;
|
|
616
615
|
transactionIndex: number | null;
|
|
617
616
|
typeHex: viem.Hex | null;
|
|
618
617
|
v: bigint;
|
|
@@ -640,16 +639,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
640
639
|
blobGasUsed?: bigint | undefined;
|
|
641
640
|
blockHash: viem.Hash;
|
|
642
641
|
blockNumber: bigint;
|
|
643
|
-
contractAddress:
|
|
642
|
+
contractAddress: viem.Address | null | undefined;
|
|
644
643
|
cumulativeGasUsed: bigint;
|
|
645
644
|
effectiveGasPrice: bigint;
|
|
646
|
-
from:
|
|
645
|
+
from: viem.Address;
|
|
647
646
|
gasUsed: bigint;
|
|
648
647
|
logs: viem.Log<bigint, number, false>[];
|
|
649
648
|
logsBloom: viem.Hex;
|
|
650
649
|
root?: `0x${string}` | undefined;
|
|
651
650
|
status: "success" | "reverted";
|
|
652
|
-
to:
|
|
651
|
+
to: viem.Address | null;
|
|
653
652
|
transactionHash: viem.Hash;
|
|
654
653
|
transactionIndex: number;
|
|
655
654
|
type: viem.TransactionType;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as abitype from 'abitype';
|
|
2
1
|
import * as viem_chains from 'viem/chains';
|
|
3
2
|
import * as viem from 'viem';
|
|
4
3
|
import { ChainEnv } from '../types/ChainEnv.js';
|
|
@@ -134,7 +133,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
134
133
|
gasUsed: bigint;
|
|
135
134
|
hash: `0x${string}` | null;
|
|
136
135
|
logsBloom: `0x${string}` | null;
|
|
137
|
-
miner:
|
|
136
|
+
miner: viem.Address;
|
|
138
137
|
mixHash: viem.Hash;
|
|
139
138
|
nonce: `0x${string}` | null;
|
|
140
139
|
number: bigint | null;
|
|
@@ -160,14 +159,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
160
159
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
161
160
|
blockHash: `0x${string}` | null;
|
|
162
161
|
blockNumber: bigint | null;
|
|
163
|
-
from:
|
|
162
|
+
from: viem.Address;
|
|
164
163
|
gas: bigint;
|
|
165
164
|
hash: viem.Hash;
|
|
166
165
|
input: viem.Hex;
|
|
167
166
|
nonce: number;
|
|
168
167
|
r: viem.Hex;
|
|
169
168
|
s: viem.Hex;
|
|
170
|
-
to:
|
|
169
|
+
to: viem.Address | null;
|
|
171
170
|
transactionIndex: number | null;
|
|
172
171
|
typeHex: viem.Hex | null;
|
|
173
172
|
v: bigint;
|
|
@@ -187,8 +186,8 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
187
186
|
v: bigint;
|
|
188
187
|
value: bigint;
|
|
189
188
|
gas: bigint;
|
|
190
|
-
to:
|
|
191
|
-
from:
|
|
189
|
+
to: viem.Address | null;
|
|
190
|
+
from: viem.Address;
|
|
192
191
|
nonce: number;
|
|
193
192
|
blockHash: `0x${string}` | null;
|
|
194
193
|
blockNumber: bigint | null;
|
|
@@ -212,14 +211,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
212
211
|
} | {
|
|
213
212
|
blockHash: `0x${string}` | null;
|
|
214
213
|
blockNumber: bigint | null;
|
|
215
|
-
from:
|
|
214
|
+
from: viem.Address;
|
|
216
215
|
gas: bigint;
|
|
217
216
|
hash: viem.Hash;
|
|
218
217
|
input: viem.Hex;
|
|
219
218
|
nonce: number;
|
|
220
219
|
r: viem.Hex;
|
|
221
220
|
s: viem.Hex;
|
|
222
|
-
to:
|
|
221
|
+
to: viem.Address | null;
|
|
223
222
|
transactionIndex: number | null;
|
|
224
223
|
typeHex: viem.Hex | null;
|
|
225
224
|
v: bigint;
|
|
@@ -240,14 +239,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
240
239
|
} | {
|
|
241
240
|
blockHash: `0x${string}` | null;
|
|
242
241
|
blockNumber: bigint | null;
|
|
243
|
-
from:
|
|
242
|
+
from: viem.Address;
|
|
244
243
|
gas: bigint;
|
|
245
244
|
hash: viem.Hash;
|
|
246
245
|
input: viem.Hex;
|
|
247
246
|
nonce: number;
|
|
248
247
|
r: viem.Hex;
|
|
249
248
|
s: viem.Hex;
|
|
250
|
-
to:
|
|
249
|
+
to: viem.Address | null;
|
|
251
250
|
transactionIndex: number | null;
|
|
252
251
|
typeHex: viem.Hex | null;
|
|
253
252
|
v: bigint;
|
|
@@ -268,14 +267,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
268
267
|
} | {
|
|
269
268
|
blockHash: `0x${string}` | null;
|
|
270
269
|
blockNumber: bigint | null;
|
|
271
|
-
from:
|
|
270
|
+
from: viem.Address;
|
|
272
271
|
gas: bigint;
|
|
273
272
|
hash: viem.Hash;
|
|
274
273
|
input: viem.Hex;
|
|
275
274
|
nonce: number;
|
|
276
275
|
r: viem.Hex;
|
|
277
276
|
s: viem.Hex;
|
|
278
|
-
to:
|
|
277
|
+
to: viem.Address | null;
|
|
279
278
|
transactionIndex: number | null;
|
|
280
279
|
typeHex: viem.Hex | null;
|
|
281
280
|
v: bigint;
|
|
@@ -296,14 +295,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
296
295
|
} | {
|
|
297
296
|
blockHash: `0x${string}` | null;
|
|
298
297
|
blockNumber: bigint | null;
|
|
299
|
-
from:
|
|
298
|
+
from: viem.Address;
|
|
300
299
|
gas: bigint;
|
|
301
300
|
hash: viem.Hash;
|
|
302
301
|
input: viem.Hex;
|
|
303
302
|
nonce: number;
|
|
304
303
|
r: viem.Hex;
|
|
305
304
|
s: viem.Hex;
|
|
306
|
-
to:
|
|
305
|
+
to: viem.Address | null;
|
|
307
306
|
transactionIndex: number | null;
|
|
308
307
|
typeHex: viem.Hex | null;
|
|
309
308
|
v: bigint;
|
|
@@ -331,16 +330,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
331
330
|
blobGasUsed?: bigint | undefined;
|
|
332
331
|
blockHash: viem.Hash;
|
|
333
332
|
blockNumber: bigint;
|
|
334
|
-
contractAddress:
|
|
333
|
+
contractAddress: viem.Address | null | undefined;
|
|
335
334
|
cumulativeGasUsed: bigint;
|
|
336
335
|
effectiveGasPrice: bigint;
|
|
337
|
-
from:
|
|
336
|
+
from: viem.Address;
|
|
338
337
|
gasUsed: bigint;
|
|
339
338
|
logs: viem.Log<bigint, number, false>[];
|
|
340
339
|
logsBloom: viem.Hex;
|
|
341
340
|
root?: `0x${string}` | undefined;
|
|
342
341
|
status: "success" | "reverted";
|
|
343
|
-
to:
|
|
342
|
+
to: viem.Address | null;
|
|
344
343
|
transactionHash: viem.Hash;
|
|
345
344
|
transactionIndex: number;
|
|
346
345
|
type: viem.TransactionType;
|
|
@@ -443,7 +442,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
443
442
|
gasUsed: bigint;
|
|
444
443
|
hash: `0x${string}` | null;
|
|
445
444
|
logsBloom: `0x${string}` | null;
|
|
446
|
-
miner:
|
|
445
|
+
miner: viem.Address;
|
|
447
446
|
mixHash: viem.Hash;
|
|
448
447
|
nonce: `0x${string}` | null;
|
|
449
448
|
number: bigint | null;
|
|
@@ -469,14 +468,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
469
468
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
470
469
|
blockHash: `0x${string}` | null;
|
|
471
470
|
blockNumber: bigint | null;
|
|
472
|
-
from:
|
|
471
|
+
from: viem.Address;
|
|
473
472
|
gas: bigint;
|
|
474
473
|
hash: viem.Hash;
|
|
475
474
|
input: viem.Hex;
|
|
476
475
|
nonce: number;
|
|
477
476
|
r: viem.Hex;
|
|
478
477
|
s: viem.Hex;
|
|
479
|
-
to:
|
|
478
|
+
to: viem.Address | null;
|
|
480
479
|
transactionIndex: number | null;
|
|
481
480
|
typeHex: viem.Hex | null;
|
|
482
481
|
v: bigint;
|
|
@@ -496,8 +495,8 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
496
495
|
v: bigint;
|
|
497
496
|
value: bigint;
|
|
498
497
|
gas: bigint;
|
|
499
|
-
to:
|
|
500
|
-
from:
|
|
498
|
+
to: viem.Address | null;
|
|
499
|
+
from: viem.Address;
|
|
501
500
|
nonce: number;
|
|
502
501
|
blockHash: `0x${string}` | null;
|
|
503
502
|
blockNumber: bigint | null;
|
|
@@ -521,14 +520,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
521
520
|
} | {
|
|
522
521
|
blockHash: `0x${string}` | null;
|
|
523
522
|
blockNumber: bigint | null;
|
|
524
|
-
from:
|
|
523
|
+
from: viem.Address;
|
|
525
524
|
gas: bigint;
|
|
526
525
|
hash: viem.Hash;
|
|
527
526
|
input: viem.Hex;
|
|
528
527
|
nonce: number;
|
|
529
528
|
r: viem.Hex;
|
|
530
529
|
s: viem.Hex;
|
|
531
|
-
to:
|
|
530
|
+
to: viem.Address | null;
|
|
532
531
|
transactionIndex: number | null;
|
|
533
532
|
typeHex: viem.Hex | null;
|
|
534
533
|
v: bigint;
|
|
@@ -549,14 +548,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
549
548
|
} | {
|
|
550
549
|
blockHash: `0x${string}` | null;
|
|
551
550
|
blockNumber: bigint | null;
|
|
552
|
-
from:
|
|
551
|
+
from: viem.Address;
|
|
553
552
|
gas: bigint;
|
|
554
553
|
hash: viem.Hash;
|
|
555
554
|
input: viem.Hex;
|
|
556
555
|
nonce: number;
|
|
557
556
|
r: viem.Hex;
|
|
558
557
|
s: viem.Hex;
|
|
559
|
-
to:
|
|
558
|
+
to: viem.Address | null;
|
|
560
559
|
transactionIndex: number | null;
|
|
561
560
|
typeHex: viem.Hex | null;
|
|
562
561
|
v: bigint;
|
|
@@ -577,14 +576,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
577
576
|
} | {
|
|
578
577
|
blockHash: `0x${string}` | null;
|
|
579
578
|
blockNumber: bigint | null;
|
|
580
|
-
from:
|
|
579
|
+
from: viem.Address;
|
|
581
580
|
gas: bigint;
|
|
582
581
|
hash: viem.Hash;
|
|
583
582
|
input: viem.Hex;
|
|
584
583
|
nonce: number;
|
|
585
584
|
r: viem.Hex;
|
|
586
585
|
s: viem.Hex;
|
|
587
|
-
to:
|
|
586
|
+
to: viem.Address | null;
|
|
588
587
|
transactionIndex: number | null;
|
|
589
588
|
typeHex: viem.Hex | null;
|
|
590
589
|
v: bigint;
|
|
@@ -605,14 +604,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
605
604
|
} | {
|
|
606
605
|
blockHash: `0x${string}` | null;
|
|
607
606
|
blockNumber: bigint | null;
|
|
608
|
-
from:
|
|
607
|
+
from: viem.Address;
|
|
609
608
|
gas: bigint;
|
|
610
609
|
hash: viem.Hash;
|
|
611
610
|
input: viem.Hex;
|
|
612
611
|
nonce: number;
|
|
613
612
|
r: viem.Hex;
|
|
614
613
|
s: viem.Hex;
|
|
615
|
-
to:
|
|
614
|
+
to: viem.Address | null;
|
|
616
615
|
transactionIndex: number | null;
|
|
617
616
|
typeHex: viem.Hex | null;
|
|
618
617
|
v: bigint;
|
|
@@ -640,16 +639,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
640
639
|
blobGasUsed?: bigint | undefined;
|
|
641
640
|
blockHash: viem.Hash;
|
|
642
641
|
blockNumber: bigint;
|
|
643
|
-
contractAddress:
|
|
642
|
+
contractAddress: viem.Address | null | undefined;
|
|
644
643
|
cumulativeGasUsed: bigint;
|
|
645
644
|
effectiveGasPrice: bigint;
|
|
646
|
-
from:
|
|
645
|
+
from: viem.Address;
|
|
647
646
|
gasUsed: bigint;
|
|
648
647
|
logs: viem.Log<bigint, number, false>[];
|
|
649
648
|
logsBloom: viem.Hex;
|
|
650
649
|
root?: `0x${string}` | undefined;
|
|
651
650
|
status: "success" | "reverted";
|
|
652
|
-
to:
|
|
651
|
+
to: viem.Address | null;
|
|
653
652
|
transactionHash: viem.Hash;
|
|
654
653
|
transactionIndex: number;
|
|
655
654
|
type: viem.TransactionType;
|
package/dist/consts/index.d.cts
CHANGED
package/dist/consts/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hex } from 'viem';
|
|
2
2
|
import { BigDecimalish } from '../utils/math/bigDecimal.cjs';
|
|
3
|
-
import {
|
|
3
|
+
import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.cjs';
|
|
4
4
|
import 'bignumber.js';
|
|
5
5
|
import '../types/subaccountTypes.cjs';
|
|
6
6
|
import '../types/bytes.cjs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hex } from 'viem';
|
|
2
2
|
import { BigDecimalish } from '../utils/math/bigDecimal.js';
|
|
3
|
-
import {
|
|
3
|
+
import { EIP712BurnNlpParams, EIP712LeaderboardAuthenticationParams, EIP712LinkSignerParams, EIP712LiquidateSubaccountParams, EIP712ListTriggerOrdersParams, EIP712MintNlpParams, EIP712CancelOrdersParams, EIP712OrderParams, EIP712CancelProductOrdersParams, EIP712TransferQuoteParams, EIP712WithdrawCollateralParams } from './signatureParamTypes.js';
|
|
4
4
|
import 'bignumber.js';
|
|
5
5
|
import '../types/subaccountTypes.js';
|
|
6
6
|
import '../types/bytes.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712WithdrawCollateralParams
|
|
1
|
+
import { SignedEIP712OrderParams, SignedTx, EIP712WithdrawCollateralParams } from '../eip712/signatureParamTypes.cjs';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import '../types/subaccountTypes.cjs';
|
|
4
4
|
import '../types/bytes.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SignedTx, EIP712WithdrawCollateralParams
|
|
1
|
+
import { SignedEIP712OrderParams, SignedTx, EIP712WithdrawCollateralParams } from '../eip712/signatureParamTypes.js';
|
|
2
2
|
import 'viem';
|
|
3
3
|
import '../types/subaccountTypes.js';
|
|
4
4
|
import '../types/bytes.js';
|
package/dist/index.d.cts
CHANGED
|
@@ -62,6 +62,6 @@ export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './ut
|
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.cjs';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.cjs';
|
|
64
64
|
export { default as BigDecimal } from 'bignumber.js';
|
|
65
|
-
import 'abitype';
|
|
66
65
|
import 'viem/chains';
|
|
67
66
|
import 'viem';
|
|
67
|
+
import 'abitype';
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,6 @@ export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './ut
|
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.js';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.js';
|
|
64
64
|
export { default as BigDecimal } from 'bignumber.js';
|
|
65
|
-
import 'abitype';
|
|
66
65
|
import 'viem/chains';
|
|
67
66
|
import 'viem';
|
|
67
|
+
import 'abitype';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigDecimal from 'bignumber.js';
|
|
2
2
|
import { HealthType } from './healthTypes.cjs';
|
|
3
|
-
import { ProductEngineType,
|
|
3
|
+
import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.cjs';
|
|
4
4
|
|
|
5
5
|
type BalanceSide = 'long' | 'short';
|
|
6
6
|
type BalanceHealthContributions = Record<HealthType, BigDecimal>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigDecimal from 'bignumber.js';
|
|
2
2
|
import { HealthType } from './healthTypes.js';
|
|
3
|
-
import { ProductEngineType,
|
|
3
|
+
import { ProductEngineType, SpotProduct, PerpProduct } from './productTypes.js';
|
|
4
4
|
|
|
5
5
|
type BalanceSide = 'long' | 'short';
|
|
6
6
|
type BalanceHealthContributions = Record<HealthType, BigDecimal>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Account, Abi, GetContractReturnType, WalletClient, Transport, Chain, RpcSchema, PublicClient } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An account with its corresponding private key. Viem does not allow private keys to be accessible from an account
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Account, Abi, GetContractReturnType, WalletClient, Transport, Chain, RpcSchema, PublicClient } from 'viem';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* An account with its corresponding private key. Viem does not allow private keys to be accessible from an account
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.cjs';
|
|
2
2
|
import BigDecimal from 'bignumber.js';
|
|
3
3
|
import '../types/healthTypes.cjs';
|
|
4
4
|
import '../types/productTypes.cjs';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PerpBalanceWithProduct, SpotBalanceWithProduct } from '../types/balanceTypes.js';
|
|
2
2
|
import BigDecimal from 'bignumber.js';
|
|
3
3
|
import '../types/healthTypes.js';
|
|
4
4
|
import '../types/productTypes.js';
|
package/dist/utils/bytes32.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hex } from 'viem';
|
|
2
2
|
import { Bytes } from '../types/bytes.cjs';
|
|
3
|
-
import {
|
|
3
|
+
import { SubaccountBytes32, Subaccount, SubaccountNameBytes12 } from '../types/subaccountTypes.cjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Converts a subaccount object (owner + name) to its bytes32 representation.
|
package/dist/utils/bytes32.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Hex } from 'viem';
|
|
2
2
|
import { Bytes } from '../types/bytes.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SubaccountBytes32, Subaccount, SubaccountNameBytes12 } from '../types/subaccountTypes.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Converts a subaccount object (owner + name) to its bytes32 representation.
|
|
@@ -37,10 +37,11 @@ module.exports = __toCommonJS(bigDecimal_exports);
|
|
|
37
37
|
var import_bignumber = __toESM(require("bignumber.js"), 1);
|
|
38
38
|
var import_bignumber2 = __toESM(require("bignumber.js"), 1);
|
|
39
39
|
function toBigDecimal(val) {
|
|
40
|
+
if (import_bignumber.default.isBigNumber(val)) {
|
|
41
|
+
return val;
|
|
42
|
+
}
|
|
40
43
|
const bnConstructorVal = (() => {
|
|
41
|
-
if (val
|
|
42
|
-
return val;
|
|
43
|
-
} else if (typeof val === "string" || typeof val === "number") {
|
|
44
|
+
if (typeof val === "string" || typeof val === "number") {
|
|
44
45
|
return val;
|
|
45
46
|
} else if (typeof val === "bigint") {
|
|
46
47
|
return val.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { default as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { default as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { default as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { default as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n if (BigDecimal.isBigNumber(val)) {\n return val;\n }\n\n const bnConstructorVal = (() => {\n if (typeof val === 'string' || typeof val === 'number') {\n return val;\n } else if (typeof val === 'bigint') {\n return val.toString();\n }\n // This is unlikely to occur, but it's here for completeness. Uses the suggestion here: https://typescript-eslint.io/rules/no-base-to-string/#alternatives\n return JSON.stringify(val);\n })();\n return new BigDecimal(bnConstructorVal);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAsC;AAGtC,IAAAA,oBAAsC;AAe/B,SAAS,aAAa,KAAgC;AAC3D,MAAI,iBAAAC,QAAW,YAAY,GAAG,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,MAAM;AAC9B,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,UAAU;AACtD,aAAO;AAAA,IACT,WAAW,OAAO,QAAQ,UAAU;AAClC,aAAO,IAAI,SAAS;AAAA,IACtB;AAEA,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,GAAG;AACH,SAAO,IAAI,iBAAAA,QAAW,gBAAgB;AACxC;","names":["import_bignumber","BigDecimal"]}
|
|
@@ -4,10 +4,11 @@ import "../../chunk-5WRI5ZAA.js";
|
|
|
4
4
|
import { default as BigDecimal } from "bignumber.js";
|
|
5
5
|
import { default as default2 } from "bignumber.js";
|
|
6
6
|
function toBigDecimal(val) {
|
|
7
|
+
if (BigDecimal.isBigNumber(val)) {
|
|
8
|
+
return val;
|
|
9
|
+
}
|
|
7
10
|
const bnConstructorVal = (() => {
|
|
8
|
-
if (val
|
|
9
|
-
return val;
|
|
10
|
-
} else if (typeof val === "string" || typeof val === "number") {
|
|
11
|
+
if (typeof val === "string" || typeof val === "number") {
|
|
11
12
|
return val;
|
|
12
13
|
} else if (typeof val === "bigint") {
|
|
13
14
|
return val.toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { default as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { default as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/bigDecimal.ts"],"sourcesContent":["import { default as BigDecimal } from 'bignumber.js';\n\n// Renames `BigNumber` type from `bignumber.js`.\nexport { default as BigDecimal } from 'bignumber.js';\n\n/**\n * BigDecimal is a renamed `BigNumber` type from `bignumber.js`.\n * Includes valid values & instances for BigDecimal.\n *\n * @see https://mikemcl.github.io/bignumber.js/\n */\nexport type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;\n\n/**\n * Converts a value to an instance of BigDecimal\n *\n * @param val\n */\nexport function toBigDecimal(val: BigDecimalish): BigDecimal {\n if (BigDecimal.isBigNumber(val)) {\n return val;\n }\n\n const bnConstructorVal = (() => {\n if (typeof val === 'string' || typeof val === 'number') {\n return val;\n } else if (typeof val === 'bigint') {\n return val.toString();\n }\n // This is unlikely to occur, but it's here for completeness. Uses the suggestion here: https://typescript-eslint.io/rules/no-base-to-string/#alternatives\n return JSON.stringify(val);\n })();\n return new BigDecimal(bnConstructorVal);\n}\n"],"mappings":";;;AAAA,SAAS,WAAW,kBAAkB;AAGtC,SAAoB,WAAXA,gBAA6B;AAe/B,SAAS,aAAa,KAAgC;AAC3D,MAAI,WAAW,YAAY,GAAG,GAAG;AAC/B,WAAO;AAAA,EACT;AAEA,QAAM,oBAAoB,MAAM;AAC9B,QAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,UAAU;AACtD,aAAO;AAAA,IACT,WAAW,OAAO,QAAQ,UAAU;AAClC,aAAO,IAAI,SAAS;AAAA,IACtB;AAEA,WAAO,KAAK,UAAU,GAAG;AAAA,EAC3B,GAAG;AACH,SAAO,IAAI,WAAW,gBAAgB;AACxC;","names":["default"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Balance,
|
|
2
|
-
import { Product,
|
|
1
|
+
import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes.cjs';
|
|
2
|
+
import { Product, PerpProduct, SpotProduct } from '../types/productTypes.cjs';
|
|
3
3
|
import 'bignumber.js';
|
|
4
4
|
import '../types/healthTypes.cjs';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Balance,
|
|
2
|
-
import { Product,
|
|
1
|
+
import { Balance, PerpBalance, SpotBalance } from '../types/balanceTypes.js';
|
|
2
|
+
import { Product, PerpProduct, SpotProduct } from '../types/productTypes.js';
|
|
3
3
|
import 'bignumber.js';
|
|
4
4
|
import '../types/healthTypes.js';
|
|
5
5
|
|
|
@@ -25,7 +25,7 @@ __export(toPrintableObject_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(toPrintableObject_exports);
|
|
26
26
|
var import_bigDecimal = require("./math/bigDecimal.cjs");
|
|
27
27
|
function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
|
|
28
|
-
if (obj
|
|
28
|
+
if (obj === null || obj === void 0) {
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
if (obj instanceof import_bigDecimal.BigDecimal || typeof obj === "bigint") {
|
|
@@ -47,7 +47,7 @@ function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
47
47
|
])
|
|
48
48
|
);
|
|
49
49
|
} catch {
|
|
50
|
-
return "[Unserializable Object]";
|
|
50
|
+
return { error: "[Unserializable Object]" };
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
return obj;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj
|
|
1
|
+
{"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(\n obj: null | undefined,\n seen?: WeakSet<object>,\n): null;\nexport function toPrintableObject(\n obj: BigDecimal | bigint,\n seen?: WeakSet<object>,\n): string;\nexport function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj === null || obj === undefined) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => toPrintableObject(item, seen));\n }\n if (typeof obj === 'object') {\n // Detect cyclic references\n if (seen.has(obj)) {\n return '[Circular]';\n }\n seen.add(obj);\n\n try {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value, seen),\n ]),\n );\n } catch {\n return { error: '[Unserializable Object]' };\n }\n }\n return obj;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAepB,SAAS,kBAAkB,KAAc,OAAO,oBAAI,QAAQ,GAAY;AAC7E,MAAI,QAAQ,QAAQ,QAAQ,QAAW;AACrC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,gCAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,EACxD;AACA,MAAI,OAAO,QAAQ,UAAU;AAE3B,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AAEZ,QAAI;AACF,aAAO,OAAO;AAAA,QACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,UACxC;AAAA,UACA,kBAAkB,OAAO,IAAI;AAAA,QAC/B,CAAC;AAAA,MACH;AAAA,IACF,QAAQ;AACN,aAAO,EAAE,OAAO,0BAA0B;AAAA,IAC5C;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import BigDecimal from 'bignumber.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Util for converting any BigDecimal types into a string so that it can be logged nicely.
|
|
3
5
|
* Handles cyclic references by returning '[Circular]' for already-visited objects.
|
|
4
6
|
*/
|
|
5
|
-
declare function toPrintableObject(obj:
|
|
7
|
+
declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
|
|
8
|
+
declare function toPrintableObject(obj: BigDecimal | bigint, seen?: WeakSet<object>): string;
|
|
9
|
+
declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
|
|
6
10
|
|
|
7
11
|
export { toPrintableObject };
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import BigDecimal from 'bignumber.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Util for converting any BigDecimal types into a string so that it can be logged nicely.
|
|
3
5
|
* Handles cyclic references by returning '[Circular]' for already-visited objects.
|
|
4
6
|
*/
|
|
5
|
-
declare function toPrintableObject(obj:
|
|
7
|
+
declare function toPrintableObject(obj: null | undefined, seen?: WeakSet<object>): null;
|
|
8
|
+
declare function toPrintableObject(obj: BigDecimal | bigint, seen?: WeakSet<object>): string;
|
|
9
|
+
declare function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
|
|
6
10
|
|
|
7
11
|
export { toPrintableObject };
|
|
@@ -3,7 +3,7 @@ import "../chunk-5WRI5ZAA.js";
|
|
|
3
3
|
// src/utils/toPrintableObject.ts
|
|
4
4
|
import { BigDecimal } from "./math/bigDecimal.js";
|
|
5
5
|
function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
|
|
6
|
-
if (obj
|
|
6
|
+
if (obj === null || obj === void 0) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
9
|
if (obj instanceof BigDecimal || typeof obj === "bigint") {
|
|
@@ -25,7 +25,7 @@ function toPrintableObject(obj, seen = /* @__PURE__ */ new WeakSet()) {
|
|
|
25
25
|
])
|
|
26
26
|
);
|
|
27
27
|
} catch {
|
|
28
|
-
return "[Unserializable Object]";
|
|
28
|
+
return { error: "[Unserializable Object]" };
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj
|
|
1
|
+
{"version":3,"sources":["../../src/utils/toPrintableObject.ts"],"sourcesContent":["import { BigDecimal } from './math/bigDecimal';\n\n/**\n * Util for converting any BigDecimal types into a string so that it can be logged nicely.\n * Handles cyclic references by returning '[Circular]' for already-visited objects.\n */\nexport function toPrintableObject(\n obj: null | undefined,\n seen?: WeakSet<object>,\n): null;\nexport function toPrintableObject(\n obj: BigDecimal | bigint,\n seen?: WeakSet<object>,\n): string;\nexport function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;\nexport function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {\n if (obj === null || obj === undefined) {\n return null;\n }\n if (obj instanceof BigDecimal || typeof obj === 'bigint') {\n return obj.toString();\n }\n if (Array.isArray(obj)) {\n return obj.map((item) => toPrintableObject(item, seen));\n }\n if (typeof obj === 'object') {\n // Detect cyclic references\n if (seen.has(obj)) {\n return '[Circular]';\n }\n seen.add(obj);\n\n try {\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [\n key,\n toPrintableObject(value, seen),\n ]),\n );\n } catch {\n return { error: '[Unserializable Object]' };\n }\n }\n return obj;\n}\n"],"mappings":";;;AAAA,SAAS,kBAAkB;AAepB,SAAS,kBAAkB,KAAc,OAAO,oBAAI,QAAQ,GAAY;AAC7E,MAAI,QAAQ,QAAQ,QAAQ,QAAW;AACrC,WAAO;AAAA,EACT;AACA,MAAI,eAAe,cAAc,OAAO,QAAQ,UAAU;AACxD,WAAO,IAAI,SAAS;AAAA,EACtB;AACA,MAAI,MAAM,QAAQ,GAAG,GAAG;AACtB,WAAO,IAAI,IAAI,CAAC,SAAS,kBAAkB,MAAM,IAAI,CAAC;AAAA,EACxD;AACA,MAAI,OAAO,QAAQ,UAAU;AAE3B,QAAI,KAAK,IAAI,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACA,SAAK,IAAI,GAAG;AAEZ,QAAI;AACF,aAAO,OAAO;AAAA,QACZ,OAAO,QAAQ,GAAG,EAAE,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AAAA,UACxC;AAAA,UACA,kBAAkB,OAAO,IAAI;AAAA,QAC/B,CAAC;AAAA,MACH;AAAA,IACF,QAAQ;AACN,aAAO,EAAE,OAAO,0BAA0B;AAAA,IAC5C;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/shared",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.46",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Shared utilities, types, and contract helpers for Nado SDK",
|
|
@@ -44,10 +44,13 @@
|
|
|
44
44
|
"bignumber.js": "^9.3.0",
|
|
45
45
|
"viem": "*"
|
|
46
46
|
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"abitype": "^1.2.3"
|
|
49
|
+
},
|
|
47
50
|
"devDependencies": {
|
|
48
51
|
"@jest/globals": "*",
|
|
49
52
|
"bignumber.js": "^9.3.0",
|
|
50
|
-
"viem": "
|
|
53
|
+
"viem": "workspace:*"
|
|
51
54
|
},
|
|
52
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "b27f1064e530c10aadbf8d386ee24e7f330d0a1f"
|
|
53
56
|
}
|
|
@@ -17,10 +17,12 @@ export type BigDecimalish = BigDecimal | BigDecimal.Value | bigint;
|
|
|
17
17
|
* @param val
|
|
18
18
|
*/
|
|
19
19
|
export function toBigDecimal(val: BigDecimalish): BigDecimal {
|
|
20
|
+
if (BigDecimal.isBigNumber(val)) {
|
|
21
|
+
return val;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
const bnConstructorVal = (() => {
|
|
21
|
-
if (val
|
|
22
|
-
return val;
|
|
23
|
-
} else if (typeof val === 'string' || typeof val === 'number') {
|
|
25
|
+
if (typeof val === 'string' || typeof val === 'number') {
|
|
24
26
|
return val;
|
|
25
27
|
} else if (typeof val === 'bigint') {
|
|
26
28
|
return val.toString();
|
|
@@ -4,8 +4,17 @@ import { BigDecimal } from './math/bigDecimal';
|
|
|
4
4
|
* Util for converting any BigDecimal types into a string so that it can be logged nicely.
|
|
5
5
|
* Handles cyclic references by returning '[Circular]' for already-visited objects.
|
|
6
6
|
*/
|
|
7
|
+
export function toPrintableObject(
|
|
8
|
+
obj: null | undefined,
|
|
9
|
+
seen?: WeakSet<object>,
|
|
10
|
+
): null;
|
|
11
|
+
export function toPrintableObject(
|
|
12
|
+
obj: BigDecimal | bigint,
|
|
13
|
+
seen?: WeakSet<object>,
|
|
14
|
+
): string;
|
|
15
|
+
export function toPrintableObject(obj: unknown, seen?: WeakSet<object>): object;
|
|
7
16
|
export function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {
|
|
8
|
-
if (obj
|
|
17
|
+
if (obj === null || obj === undefined) {
|
|
9
18
|
return null;
|
|
10
19
|
}
|
|
11
20
|
if (obj instanceof BigDecimal || typeof obj === 'bigint') {
|
|
@@ -29,7 +38,7 @@ export function toPrintableObject(obj: unknown, seen = new WeakSet()): unknown {
|
|
|
29
38
|
]),
|
|
30
39
|
);
|
|
31
40
|
} catch {
|
|
32
|
-
return '[Unserializable Object]';
|
|
41
|
+
return { error: '[Unserializable Object]' };
|
|
33
42
|
}
|
|
34
43
|
}
|
|
35
44
|
return obj;
|