@nadohq/shared 0.9.0 → 0.11.0
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 +72 -0
- package/dist/consts/chainEnvToChain.d.cts +43 -36
- package/dist/consts/chainEnvToChain.d.ts +43 -36
- package/dist/consts/index.d.cts +1 -0
- package/dist/consts/index.d.ts +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -1,2 +1,74 @@
|
|
|
1
1
|
# `@nadohq/shared`
|
|
2
2
|
|
|
3
|
+
Shared utilities, types, and contract helpers for the Nado SDK. Provides ABIs, deployment addresses, EIP-712 signing logic, on-chain helpers, encoding utilities, and math/time functions used across all Nado packages.
|
|
4
|
+
|
|
5
|
+
[Full SDK Documentation](https://nadohq.github.io/nado-typescript-sdk/index.html)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @nadohq/shared viem bignumber.js
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Most apps should use `@nadohq/client` instead, which includes this package. Install `@nadohq/shared` directly when you need low-level access to contract ABIs, EIP-712 signing, or type definitions without pulling in the HTTP clients.
|
|
14
|
+
|
|
15
|
+
## Modules
|
|
16
|
+
|
|
17
|
+
### `abis`
|
|
18
|
+
|
|
19
|
+
Contract ABIs for all Nado contracts: `Clearinghouse`, `Endpoint`, `SpotEngine`, `PerpEngine`, `Querier`, `WithdrawPool`, `ERC20`. Aggregated via `NADO_ABIS`.
|
|
20
|
+
|
|
21
|
+
### `deployments`
|
|
22
|
+
|
|
23
|
+
On-chain contract addresses by environment via `NADO_DEPLOYMENTS`.
|
|
24
|
+
|
|
25
|
+
### `consts`
|
|
26
|
+
|
|
27
|
+
Chain environment mappings (`chainEnvToChain`), product ID constants, and chain configurations.
|
|
28
|
+
|
|
29
|
+
### `eip712`
|
|
30
|
+
|
|
31
|
+
EIP-712 typed signing for Nado transactions: `getSignedTransactionRequest`, `getNadoEIP712Values`, `getNadoEIP712Types`, `getNadoEIP712Domain`, `orderDigest`, and signable request type definitions.
|
|
32
|
+
|
|
33
|
+
### `execute`
|
|
34
|
+
|
|
35
|
+
On-chain transaction helpers: `depositCollateral`, `approveDepositAllowance`.
|
|
36
|
+
|
|
37
|
+
### `types`
|
|
38
|
+
|
|
39
|
+
Core type definitions: `ChainEnv`, market/subaccount/order/product types, `WalletClientWithAccount`, health types, and more.
|
|
40
|
+
|
|
41
|
+
### `utils`
|
|
42
|
+
|
|
43
|
+
- **Math**: `BigDecimal` helpers, `sumBigNumberBy`, `toBigInt`, `toIntegerString`, `clamp`, decimal adjustment
|
|
44
|
+
- **Orders**: nonce generation, appendix packing/unpacking, `recvTime`
|
|
45
|
+
- **Bytes**: `bytes32` encoding/decoding, hex validation, address validation
|
|
46
|
+
- **Errors**: `WalletNotProvidedError`
|
|
47
|
+
- **Other**: `createDeterministicLinkedSignerPrivateKey`, `asyncResult`, `toPrintableObject`, time utilities
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
```ts
|
|
52
|
+
import {
|
|
53
|
+
NADO_DEPLOYMENTS,
|
|
54
|
+
NADO_ABIS,
|
|
55
|
+
getSignedTransactionRequest,
|
|
56
|
+
depositCollateral,
|
|
57
|
+
BigDecimal,
|
|
58
|
+
} from '@nadohq/shared';
|
|
59
|
+
|
|
60
|
+
// Get contract addresses for mainnet
|
|
61
|
+
const addresses = NADO_DEPLOYMENTS.inkMainnet;
|
|
62
|
+
|
|
63
|
+
// Sign an EIP-712 transaction
|
|
64
|
+
const signed = await getSignedTransactionRequest({
|
|
65
|
+
requestType: 'place_order',
|
|
66
|
+
params: { ... },
|
|
67
|
+
walletClient,
|
|
68
|
+
verifyingAddress: addresses.endpoint,
|
|
69
|
+
});
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
ISC
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as abitype from 'abitype';
|
|
1
2
|
import * as viem_chains from 'viem/chains';
|
|
2
3
|
import * as viem from 'viem';
|
|
3
4
|
import { ChainEnv } from '../types/ChainEnv.cjs';
|
|
@@ -43,6 +44,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
43
44
|
sourceId?: number | undefined | undefined;
|
|
44
45
|
testnet?: boolean | undefined | undefined;
|
|
45
46
|
custom?: Record<string, unknown> | undefined;
|
|
47
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
46
48
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
47
49
|
formatters?: undefined;
|
|
48
50
|
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
@@ -53,6 +55,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
53
55
|
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
54
56
|
}] | undefined;
|
|
55
57
|
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
58
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
56
59
|
};
|
|
57
60
|
readonly inkTestnet: {
|
|
58
61
|
blockExplorers: {
|
|
@@ -119,6 +122,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
119
122
|
sourceId: 11155111;
|
|
120
123
|
testnet: true;
|
|
121
124
|
custom?: Record<string, unknown> | undefined;
|
|
125
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
122
126
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
123
127
|
formatters: {
|
|
124
128
|
readonly block: {
|
|
@@ -133,7 +137,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
133
137
|
gasUsed: bigint;
|
|
134
138
|
hash: `0x${string}` | null;
|
|
135
139
|
logsBloom: `0x${string}` | null;
|
|
136
|
-
miner:
|
|
140
|
+
miner: abitype.Address;
|
|
137
141
|
mixHash: viem.Hash;
|
|
138
142
|
nonce: `0x${string}` | null;
|
|
139
143
|
number: bigint | null;
|
|
@@ -159,14 +163,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
159
163
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
160
164
|
blockHash: `0x${string}` | null;
|
|
161
165
|
blockNumber: bigint | null;
|
|
162
|
-
from:
|
|
166
|
+
from: abitype.Address;
|
|
163
167
|
gas: bigint;
|
|
164
168
|
hash: viem.Hash;
|
|
165
169
|
input: viem.Hex;
|
|
166
170
|
nonce: number;
|
|
167
171
|
r: viem.Hex;
|
|
168
172
|
s: viem.Hex;
|
|
169
|
-
to:
|
|
173
|
+
to: abitype.Address | null;
|
|
170
174
|
transactionIndex: number | null;
|
|
171
175
|
typeHex: viem.Hex | null;
|
|
172
176
|
v: bigint;
|
|
@@ -184,16 +188,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
184
188
|
r: viem.Hex;
|
|
185
189
|
s: viem.Hex;
|
|
186
190
|
v: bigint;
|
|
187
|
-
|
|
191
|
+
to: abitype.Address | null;
|
|
192
|
+
from: abitype.Address;
|
|
188
193
|
gas: bigint;
|
|
189
|
-
to: viem.Address | null;
|
|
190
|
-
from: viem.Address;
|
|
191
194
|
nonce: number;
|
|
195
|
+
value: bigint;
|
|
192
196
|
blockHash: `0x${string}` | null;
|
|
193
197
|
blockNumber: bigint | null;
|
|
194
|
-
transactionIndex: number | null;
|
|
195
198
|
hash: viem.Hash;
|
|
196
199
|
input: viem.Hex;
|
|
200
|
+
transactionIndex: number | null;
|
|
197
201
|
typeHex: viem.Hex | null;
|
|
198
202
|
accessList?: undefined | undefined;
|
|
199
203
|
authorizationList?: undefined | undefined;
|
|
@@ -211,14 +215,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
211
215
|
} | {
|
|
212
216
|
blockHash: `0x${string}` | null;
|
|
213
217
|
blockNumber: bigint | null;
|
|
214
|
-
from:
|
|
218
|
+
from: abitype.Address;
|
|
215
219
|
gas: bigint;
|
|
216
220
|
hash: viem.Hash;
|
|
217
221
|
input: viem.Hex;
|
|
218
222
|
nonce: number;
|
|
219
223
|
r: viem.Hex;
|
|
220
224
|
s: viem.Hex;
|
|
221
|
-
to:
|
|
225
|
+
to: abitype.Address | null;
|
|
222
226
|
transactionIndex: number | null;
|
|
223
227
|
typeHex: viem.Hex | null;
|
|
224
228
|
v: bigint;
|
|
@@ -239,14 +243,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
239
243
|
} | {
|
|
240
244
|
blockHash: `0x${string}` | null;
|
|
241
245
|
blockNumber: bigint | null;
|
|
242
|
-
from:
|
|
246
|
+
from: abitype.Address;
|
|
243
247
|
gas: bigint;
|
|
244
248
|
hash: viem.Hash;
|
|
245
249
|
input: viem.Hex;
|
|
246
250
|
nonce: number;
|
|
247
251
|
r: viem.Hex;
|
|
248
252
|
s: viem.Hex;
|
|
249
|
-
to:
|
|
253
|
+
to: abitype.Address | null;
|
|
250
254
|
transactionIndex: number | null;
|
|
251
255
|
typeHex: viem.Hex | null;
|
|
252
256
|
v: bigint;
|
|
@@ -267,14 +271,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
267
271
|
} | {
|
|
268
272
|
blockHash: `0x${string}` | null;
|
|
269
273
|
blockNumber: bigint | null;
|
|
270
|
-
from:
|
|
274
|
+
from: abitype.Address;
|
|
271
275
|
gas: bigint;
|
|
272
276
|
hash: viem.Hash;
|
|
273
277
|
input: viem.Hex;
|
|
274
278
|
nonce: number;
|
|
275
279
|
r: viem.Hex;
|
|
276
280
|
s: viem.Hex;
|
|
277
|
-
to:
|
|
281
|
+
to: abitype.Address | null;
|
|
278
282
|
transactionIndex: number | null;
|
|
279
283
|
typeHex: viem.Hex | null;
|
|
280
284
|
v: bigint;
|
|
@@ -295,14 +299,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
295
299
|
} | {
|
|
296
300
|
blockHash: `0x${string}` | null;
|
|
297
301
|
blockNumber: bigint | null;
|
|
298
|
-
from:
|
|
302
|
+
from: abitype.Address;
|
|
299
303
|
gas: bigint;
|
|
300
304
|
hash: viem.Hash;
|
|
301
305
|
input: viem.Hex;
|
|
302
306
|
nonce: number;
|
|
303
307
|
r: viem.Hex;
|
|
304
308
|
s: viem.Hex;
|
|
305
|
-
to:
|
|
309
|
+
to: abitype.Address | null;
|
|
306
310
|
transactionIndex: number | null;
|
|
307
311
|
typeHex: viem.Hex | null;
|
|
308
312
|
v: bigint;
|
|
@@ -330,16 +334,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
330
334
|
blobGasUsed?: bigint | undefined;
|
|
331
335
|
blockHash: viem.Hash;
|
|
332
336
|
blockNumber: bigint;
|
|
333
|
-
contractAddress:
|
|
337
|
+
contractAddress: abitype.Address | null | undefined;
|
|
334
338
|
cumulativeGasUsed: bigint;
|
|
335
339
|
effectiveGasPrice: bigint;
|
|
336
|
-
from:
|
|
340
|
+
from: abitype.Address;
|
|
337
341
|
gasUsed: bigint;
|
|
338
342
|
logs: viem.Log<bigint, number, false>[];
|
|
339
343
|
logsBloom: viem.Hex;
|
|
340
344
|
root?: `0x${string}` | undefined;
|
|
341
345
|
status: "success" | "reverted";
|
|
342
|
-
to:
|
|
346
|
+
to: abitype.Address | null;
|
|
343
347
|
transactionHash: viem.Hash;
|
|
344
348
|
transactionIndex: number;
|
|
345
349
|
type: viem.TransactionType;
|
|
@@ -361,6 +365,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
361
365
|
serializers: {
|
|
362
366
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
363
367
|
};
|
|
368
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
364
369
|
};
|
|
365
370
|
readonly inkMainnet: {
|
|
366
371
|
blockExplorers: {
|
|
@@ -428,6 +433,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
428
433
|
sourceId: 1;
|
|
429
434
|
testnet: false;
|
|
430
435
|
custom?: Record<string, unknown> | undefined;
|
|
436
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
431
437
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
432
438
|
formatters: {
|
|
433
439
|
readonly block: {
|
|
@@ -442,7 +448,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
442
448
|
gasUsed: bigint;
|
|
443
449
|
hash: `0x${string}` | null;
|
|
444
450
|
logsBloom: `0x${string}` | null;
|
|
445
|
-
miner:
|
|
451
|
+
miner: abitype.Address;
|
|
446
452
|
mixHash: viem.Hash;
|
|
447
453
|
nonce: `0x${string}` | null;
|
|
448
454
|
number: bigint | null;
|
|
@@ -468,14 +474,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
468
474
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
469
475
|
blockHash: `0x${string}` | null;
|
|
470
476
|
blockNumber: bigint | null;
|
|
471
|
-
from:
|
|
477
|
+
from: abitype.Address;
|
|
472
478
|
gas: bigint;
|
|
473
479
|
hash: viem.Hash;
|
|
474
480
|
input: viem.Hex;
|
|
475
481
|
nonce: number;
|
|
476
482
|
r: viem.Hex;
|
|
477
483
|
s: viem.Hex;
|
|
478
|
-
to:
|
|
484
|
+
to: abitype.Address | null;
|
|
479
485
|
transactionIndex: number | null;
|
|
480
486
|
typeHex: viem.Hex | null;
|
|
481
487
|
v: bigint;
|
|
@@ -493,16 +499,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
493
499
|
r: viem.Hex;
|
|
494
500
|
s: viem.Hex;
|
|
495
501
|
v: bigint;
|
|
496
|
-
|
|
502
|
+
to: abitype.Address | null;
|
|
503
|
+
from: abitype.Address;
|
|
497
504
|
gas: bigint;
|
|
498
|
-
to: viem.Address | null;
|
|
499
|
-
from: viem.Address;
|
|
500
505
|
nonce: number;
|
|
506
|
+
value: bigint;
|
|
501
507
|
blockHash: `0x${string}` | null;
|
|
502
508
|
blockNumber: bigint | null;
|
|
503
|
-
transactionIndex: number | null;
|
|
504
509
|
hash: viem.Hash;
|
|
505
510
|
input: viem.Hex;
|
|
511
|
+
transactionIndex: number | null;
|
|
506
512
|
typeHex: viem.Hex | null;
|
|
507
513
|
accessList?: undefined | undefined;
|
|
508
514
|
authorizationList?: undefined | undefined;
|
|
@@ -520,14 +526,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
520
526
|
} | {
|
|
521
527
|
blockHash: `0x${string}` | null;
|
|
522
528
|
blockNumber: bigint | null;
|
|
523
|
-
from:
|
|
529
|
+
from: abitype.Address;
|
|
524
530
|
gas: bigint;
|
|
525
531
|
hash: viem.Hash;
|
|
526
532
|
input: viem.Hex;
|
|
527
533
|
nonce: number;
|
|
528
534
|
r: viem.Hex;
|
|
529
535
|
s: viem.Hex;
|
|
530
|
-
to:
|
|
536
|
+
to: abitype.Address | null;
|
|
531
537
|
transactionIndex: number | null;
|
|
532
538
|
typeHex: viem.Hex | null;
|
|
533
539
|
v: bigint;
|
|
@@ -548,14 +554,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
548
554
|
} | {
|
|
549
555
|
blockHash: `0x${string}` | null;
|
|
550
556
|
blockNumber: bigint | null;
|
|
551
|
-
from:
|
|
557
|
+
from: abitype.Address;
|
|
552
558
|
gas: bigint;
|
|
553
559
|
hash: viem.Hash;
|
|
554
560
|
input: viem.Hex;
|
|
555
561
|
nonce: number;
|
|
556
562
|
r: viem.Hex;
|
|
557
563
|
s: viem.Hex;
|
|
558
|
-
to:
|
|
564
|
+
to: abitype.Address | null;
|
|
559
565
|
transactionIndex: number | null;
|
|
560
566
|
typeHex: viem.Hex | null;
|
|
561
567
|
v: bigint;
|
|
@@ -576,14 +582,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
576
582
|
} | {
|
|
577
583
|
blockHash: `0x${string}` | null;
|
|
578
584
|
blockNumber: bigint | null;
|
|
579
|
-
from:
|
|
585
|
+
from: abitype.Address;
|
|
580
586
|
gas: bigint;
|
|
581
587
|
hash: viem.Hash;
|
|
582
588
|
input: viem.Hex;
|
|
583
589
|
nonce: number;
|
|
584
590
|
r: viem.Hex;
|
|
585
591
|
s: viem.Hex;
|
|
586
|
-
to:
|
|
592
|
+
to: abitype.Address | null;
|
|
587
593
|
transactionIndex: number | null;
|
|
588
594
|
typeHex: viem.Hex | null;
|
|
589
595
|
v: bigint;
|
|
@@ -604,14 +610,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
604
610
|
} | {
|
|
605
611
|
blockHash: `0x${string}` | null;
|
|
606
612
|
blockNumber: bigint | null;
|
|
607
|
-
from:
|
|
613
|
+
from: abitype.Address;
|
|
608
614
|
gas: bigint;
|
|
609
615
|
hash: viem.Hash;
|
|
610
616
|
input: viem.Hex;
|
|
611
617
|
nonce: number;
|
|
612
618
|
r: viem.Hex;
|
|
613
619
|
s: viem.Hex;
|
|
614
|
-
to:
|
|
620
|
+
to: abitype.Address | null;
|
|
615
621
|
transactionIndex: number | null;
|
|
616
622
|
typeHex: viem.Hex | null;
|
|
617
623
|
v: bigint;
|
|
@@ -639,16 +645,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
639
645
|
blobGasUsed?: bigint | undefined;
|
|
640
646
|
blockHash: viem.Hash;
|
|
641
647
|
blockNumber: bigint;
|
|
642
|
-
contractAddress:
|
|
648
|
+
contractAddress: abitype.Address | null | undefined;
|
|
643
649
|
cumulativeGasUsed: bigint;
|
|
644
650
|
effectiveGasPrice: bigint;
|
|
645
|
-
from:
|
|
651
|
+
from: abitype.Address;
|
|
646
652
|
gasUsed: bigint;
|
|
647
653
|
logs: viem.Log<bigint, number, false>[];
|
|
648
654
|
logsBloom: viem.Hex;
|
|
649
655
|
root?: `0x${string}` | undefined;
|
|
650
656
|
status: "success" | "reverted";
|
|
651
|
-
to:
|
|
657
|
+
to: abitype.Address | null;
|
|
652
658
|
transactionHash: viem.Hash;
|
|
653
659
|
transactionIndex: number;
|
|
654
660
|
type: viem.TransactionType;
|
|
@@ -670,6 +676,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
670
676
|
serializers: {
|
|
671
677
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
672
678
|
};
|
|
679
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
673
680
|
};
|
|
674
681
|
};
|
|
675
682
|
declare const CHAIN_ID_TO_CHAIN_ENV: Record<number, ChainEnv>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as abitype from 'abitype';
|
|
1
2
|
import * as viem_chains from 'viem/chains';
|
|
2
3
|
import * as viem from 'viem';
|
|
3
4
|
import { ChainEnv } from '../types/ChainEnv.js';
|
|
@@ -43,6 +44,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
43
44
|
sourceId?: number | undefined | undefined;
|
|
44
45
|
testnet?: boolean | undefined | undefined;
|
|
45
46
|
custom?: Record<string, unknown> | undefined;
|
|
47
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
46
48
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
47
49
|
formatters?: undefined;
|
|
48
50
|
prepareTransactionRequest?: ((args: viem.PrepareTransactionRequestParameters, options: {
|
|
@@ -53,6 +55,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
53
55
|
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
54
56
|
}] | undefined;
|
|
55
57
|
serializers?: viem.ChainSerializers<undefined, viem.TransactionSerializable> | undefined;
|
|
58
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
56
59
|
};
|
|
57
60
|
readonly inkTestnet: {
|
|
58
61
|
blockExplorers: {
|
|
@@ -119,6 +122,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
119
122
|
sourceId: 11155111;
|
|
120
123
|
testnet: true;
|
|
121
124
|
custom?: Record<string, unknown> | undefined;
|
|
125
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
122
126
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
123
127
|
formatters: {
|
|
124
128
|
readonly block: {
|
|
@@ -133,7 +137,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
133
137
|
gasUsed: bigint;
|
|
134
138
|
hash: `0x${string}` | null;
|
|
135
139
|
logsBloom: `0x${string}` | null;
|
|
136
|
-
miner:
|
|
140
|
+
miner: abitype.Address;
|
|
137
141
|
mixHash: viem.Hash;
|
|
138
142
|
nonce: `0x${string}` | null;
|
|
139
143
|
number: bigint | null;
|
|
@@ -159,14 +163,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
159
163
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
160
164
|
blockHash: `0x${string}` | null;
|
|
161
165
|
blockNumber: bigint | null;
|
|
162
|
-
from:
|
|
166
|
+
from: abitype.Address;
|
|
163
167
|
gas: bigint;
|
|
164
168
|
hash: viem.Hash;
|
|
165
169
|
input: viem.Hex;
|
|
166
170
|
nonce: number;
|
|
167
171
|
r: viem.Hex;
|
|
168
172
|
s: viem.Hex;
|
|
169
|
-
to:
|
|
173
|
+
to: abitype.Address | null;
|
|
170
174
|
transactionIndex: number | null;
|
|
171
175
|
typeHex: viem.Hex | null;
|
|
172
176
|
v: bigint;
|
|
@@ -184,16 +188,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
184
188
|
r: viem.Hex;
|
|
185
189
|
s: viem.Hex;
|
|
186
190
|
v: bigint;
|
|
187
|
-
|
|
191
|
+
to: abitype.Address | null;
|
|
192
|
+
from: abitype.Address;
|
|
188
193
|
gas: bigint;
|
|
189
|
-
to: viem.Address | null;
|
|
190
|
-
from: viem.Address;
|
|
191
194
|
nonce: number;
|
|
195
|
+
value: bigint;
|
|
192
196
|
blockHash: `0x${string}` | null;
|
|
193
197
|
blockNumber: bigint | null;
|
|
194
|
-
transactionIndex: number | null;
|
|
195
198
|
hash: viem.Hash;
|
|
196
199
|
input: viem.Hex;
|
|
200
|
+
transactionIndex: number | null;
|
|
197
201
|
typeHex: viem.Hex | null;
|
|
198
202
|
accessList?: undefined | undefined;
|
|
199
203
|
authorizationList?: undefined | undefined;
|
|
@@ -211,14 +215,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
211
215
|
} | {
|
|
212
216
|
blockHash: `0x${string}` | null;
|
|
213
217
|
blockNumber: bigint | null;
|
|
214
|
-
from:
|
|
218
|
+
from: abitype.Address;
|
|
215
219
|
gas: bigint;
|
|
216
220
|
hash: viem.Hash;
|
|
217
221
|
input: viem.Hex;
|
|
218
222
|
nonce: number;
|
|
219
223
|
r: viem.Hex;
|
|
220
224
|
s: viem.Hex;
|
|
221
|
-
to:
|
|
225
|
+
to: abitype.Address | null;
|
|
222
226
|
transactionIndex: number | null;
|
|
223
227
|
typeHex: viem.Hex | null;
|
|
224
228
|
v: bigint;
|
|
@@ -239,14 +243,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
239
243
|
} | {
|
|
240
244
|
blockHash: `0x${string}` | null;
|
|
241
245
|
blockNumber: bigint | null;
|
|
242
|
-
from:
|
|
246
|
+
from: abitype.Address;
|
|
243
247
|
gas: bigint;
|
|
244
248
|
hash: viem.Hash;
|
|
245
249
|
input: viem.Hex;
|
|
246
250
|
nonce: number;
|
|
247
251
|
r: viem.Hex;
|
|
248
252
|
s: viem.Hex;
|
|
249
|
-
to:
|
|
253
|
+
to: abitype.Address | null;
|
|
250
254
|
transactionIndex: number | null;
|
|
251
255
|
typeHex: viem.Hex | null;
|
|
252
256
|
v: bigint;
|
|
@@ -267,14 +271,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
267
271
|
} | {
|
|
268
272
|
blockHash: `0x${string}` | null;
|
|
269
273
|
blockNumber: bigint | null;
|
|
270
|
-
from:
|
|
274
|
+
from: abitype.Address;
|
|
271
275
|
gas: bigint;
|
|
272
276
|
hash: viem.Hash;
|
|
273
277
|
input: viem.Hex;
|
|
274
278
|
nonce: number;
|
|
275
279
|
r: viem.Hex;
|
|
276
280
|
s: viem.Hex;
|
|
277
|
-
to:
|
|
281
|
+
to: abitype.Address | null;
|
|
278
282
|
transactionIndex: number | null;
|
|
279
283
|
typeHex: viem.Hex | null;
|
|
280
284
|
v: bigint;
|
|
@@ -295,14 +299,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
295
299
|
} | {
|
|
296
300
|
blockHash: `0x${string}` | null;
|
|
297
301
|
blockNumber: bigint | null;
|
|
298
|
-
from:
|
|
302
|
+
from: abitype.Address;
|
|
299
303
|
gas: bigint;
|
|
300
304
|
hash: viem.Hash;
|
|
301
305
|
input: viem.Hex;
|
|
302
306
|
nonce: number;
|
|
303
307
|
r: viem.Hex;
|
|
304
308
|
s: viem.Hex;
|
|
305
|
-
to:
|
|
309
|
+
to: abitype.Address | null;
|
|
306
310
|
transactionIndex: number | null;
|
|
307
311
|
typeHex: viem.Hex | null;
|
|
308
312
|
v: bigint;
|
|
@@ -330,16 +334,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
330
334
|
blobGasUsed?: bigint | undefined;
|
|
331
335
|
blockHash: viem.Hash;
|
|
332
336
|
blockNumber: bigint;
|
|
333
|
-
contractAddress:
|
|
337
|
+
contractAddress: abitype.Address | null | undefined;
|
|
334
338
|
cumulativeGasUsed: bigint;
|
|
335
339
|
effectiveGasPrice: bigint;
|
|
336
|
-
from:
|
|
340
|
+
from: abitype.Address;
|
|
337
341
|
gasUsed: bigint;
|
|
338
342
|
logs: viem.Log<bigint, number, false>[];
|
|
339
343
|
logsBloom: viem.Hex;
|
|
340
344
|
root?: `0x${string}` | undefined;
|
|
341
345
|
status: "success" | "reverted";
|
|
342
|
-
to:
|
|
346
|
+
to: abitype.Address | null;
|
|
343
347
|
transactionHash: viem.Hash;
|
|
344
348
|
transactionIndex: number;
|
|
345
349
|
type: viem.TransactionType;
|
|
@@ -361,6 +365,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
361
365
|
serializers: {
|
|
362
366
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
363
367
|
};
|
|
368
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
364
369
|
};
|
|
365
370
|
readonly inkMainnet: {
|
|
366
371
|
blockExplorers: {
|
|
@@ -428,6 +433,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
428
433
|
sourceId: 1;
|
|
429
434
|
testnet: false;
|
|
430
435
|
custom?: Record<string, unknown> | undefined;
|
|
436
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
431
437
|
fees?: viem.ChainFees<undefined> | undefined;
|
|
432
438
|
formatters: {
|
|
433
439
|
readonly block: {
|
|
@@ -442,7 +448,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
442
448
|
gasUsed: bigint;
|
|
443
449
|
hash: `0x${string}` | null;
|
|
444
450
|
logsBloom: `0x${string}` | null;
|
|
445
|
-
miner:
|
|
451
|
+
miner: abitype.Address;
|
|
446
452
|
mixHash: viem.Hash;
|
|
447
453
|
nonce: `0x${string}` | null;
|
|
448
454
|
number: bigint | null;
|
|
@@ -468,14 +474,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
468
474
|
format: (args: viem_chains.OpStackRpcTransaction, action?: string | undefined) => ({
|
|
469
475
|
blockHash: `0x${string}` | null;
|
|
470
476
|
blockNumber: bigint | null;
|
|
471
|
-
from:
|
|
477
|
+
from: abitype.Address;
|
|
472
478
|
gas: bigint;
|
|
473
479
|
hash: viem.Hash;
|
|
474
480
|
input: viem.Hex;
|
|
475
481
|
nonce: number;
|
|
476
482
|
r: viem.Hex;
|
|
477
483
|
s: viem.Hex;
|
|
478
|
-
to:
|
|
484
|
+
to: abitype.Address | null;
|
|
479
485
|
transactionIndex: number | null;
|
|
480
486
|
typeHex: viem.Hex | null;
|
|
481
487
|
v: bigint;
|
|
@@ -493,16 +499,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
493
499
|
r: viem.Hex;
|
|
494
500
|
s: viem.Hex;
|
|
495
501
|
v: bigint;
|
|
496
|
-
|
|
502
|
+
to: abitype.Address | null;
|
|
503
|
+
from: abitype.Address;
|
|
497
504
|
gas: bigint;
|
|
498
|
-
to: viem.Address | null;
|
|
499
|
-
from: viem.Address;
|
|
500
505
|
nonce: number;
|
|
506
|
+
value: bigint;
|
|
501
507
|
blockHash: `0x${string}` | null;
|
|
502
508
|
blockNumber: bigint | null;
|
|
503
|
-
transactionIndex: number | null;
|
|
504
509
|
hash: viem.Hash;
|
|
505
510
|
input: viem.Hex;
|
|
511
|
+
transactionIndex: number | null;
|
|
506
512
|
typeHex: viem.Hex | null;
|
|
507
513
|
accessList?: undefined | undefined;
|
|
508
514
|
authorizationList?: undefined | undefined;
|
|
@@ -520,14 +526,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
520
526
|
} | {
|
|
521
527
|
blockHash: `0x${string}` | null;
|
|
522
528
|
blockNumber: bigint | null;
|
|
523
|
-
from:
|
|
529
|
+
from: abitype.Address;
|
|
524
530
|
gas: bigint;
|
|
525
531
|
hash: viem.Hash;
|
|
526
532
|
input: viem.Hex;
|
|
527
533
|
nonce: number;
|
|
528
534
|
r: viem.Hex;
|
|
529
535
|
s: viem.Hex;
|
|
530
|
-
to:
|
|
536
|
+
to: abitype.Address | null;
|
|
531
537
|
transactionIndex: number | null;
|
|
532
538
|
typeHex: viem.Hex | null;
|
|
533
539
|
v: bigint;
|
|
@@ -548,14 +554,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
548
554
|
} | {
|
|
549
555
|
blockHash: `0x${string}` | null;
|
|
550
556
|
blockNumber: bigint | null;
|
|
551
|
-
from:
|
|
557
|
+
from: abitype.Address;
|
|
552
558
|
gas: bigint;
|
|
553
559
|
hash: viem.Hash;
|
|
554
560
|
input: viem.Hex;
|
|
555
561
|
nonce: number;
|
|
556
562
|
r: viem.Hex;
|
|
557
563
|
s: viem.Hex;
|
|
558
|
-
to:
|
|
564
|
+
to: abitype.Address | null;
|
|
559
565
|
transactionIndex: number | null;
|
|
560
566
|
typeHex: viem.Hex | null;
|
|
561
567
|
v: bigint;
|
|
@@ -576,14 +582,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
576
582
|
} | {
|
|
577
583
|
blockHash: `0x${string}` | null;
|
|
578
584
|
blockNumber: bigint | null;
|
|
579
|
-
from:
|
|
585
|
+
from: abitype.Address;
|
|
580
586
|
gas: bigint;
|
|
581
587
|
hash: viem.Hash;
|
|
582
588
|
input: viem.Hex;
|
|
583
589
|
nonce: number;
|
|
584
590
|
r: viem.Hex;
|
|
585
591
|
s: viem.Hex;
|
|
586
|
-
to:
|
|
592
|
+
to: abitype.Address | null;
|
|
587
593
|
transactionIndex: number | null;
|
|
588
594
|
typeHex: viem.Hex | null;
|
|
589
595
|
v: bigint;
|
|
@@ -604,14 +610,14 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
604
610
|
} | {
|
|
605
611
|
blockHash: `0x${string}` | null;
|
|
606
612
|
blockNumber: bigint | null;
|
|
607
|
-
from:
|
|
613
|
+
from: abitype.Address;
|
|
608
614
|
gas: bigint;
|
|
609
615
|
hash: viem.Hash;
|
|
610
616
|
input: viem.Hex;
|
|
611
617
|
nonce: number;
|
|
612
618
|
r: viem.Hex;
|
|
613
619
|
s: viem.Hex;
|
|
614
|
-
to:
|
|
620
|
+
to: abitype.Address | null;
|
|
615
621
|
transactionIndex: number | null;
|
|
616
622
|
typeHex: viem.Hex | null;
|
|
617
623
|
v: bigint;
|
|
@@ -639,16 +645,16 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
639
645
|
blobGasUsed?: bigint | undefined;
|
|
640
646
|
blockHash: viem.Hash;
|
|
641
647
|
blockNumber: bigint;
|
|
642
|
-
contractAddress:
|
|
648
|
+
contractAddress: abitype.Address | null | undefined;
|
|
643
649
|
cumulativeGasUsed: bigint;
|
|
644
650
|
effectiveGasPrice: bigint;
|
|
645
|
-
from:
|
|
651
|
+
from: abitype.Address;
|
|
646
652
|
gasUsed: bigint;
|
|
647
653
|
logs: viem.Log<bigint, number, false>[];
|
|
648
654
|
logsBloom: viem.Hex;
|
|
649
655
|
root?: `0x${string}` | undefined;
|
|
650
656
|
status: "success" | "reverted";
|
|
651
|
-
to:
|
|
657
|
+
to: abitype.Address | null;
|
|
652
658
|
transactionHash: viem.Hash;
|
|
653
659
|
transactionIndex: number;
|
|
654
660
|
type: viem.TransactionType;
|
|
@@ -670,6 +676,7 @@ declare const CHAIN_ENV_TO_CHAIN: {
|
|
|
670
676
|
serializers: {
|
|
671
677
|
readonly transaction: typeof viem_chains.serializeTransactionOpStack;
|
|
672
678
|
};
|
|
679
|
+
verifyHash?: ((client: viem.Client, parameters: viem.VerifyHashActionParameters) => Promise<viem.VerifyHashActionReturnType>) | undefined;
|
|
673
680
|
};
|
|
674
681
|
};
|
|
675
682
|
declare const CHAIN_ID_TO_CHAIN_ENV: Record<number, ChainEnv>;
|
package/dist/consts/index.d.cts
CHANGED
package/dist/consts/index.d.ts
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -61,7 +61,7 @@ export { getDefaultRecvTime } from './utils/orders/recvTime.cjs';
|
|
|
61
61
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.cjs';
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.cjs';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.cjs';
|
|
64
|
+
import 'abitype';
|
|
64
65
|
import 'viem/chains';
|
|
65
66
|
import 'viem';
|
|
66
|
-
import 'abitype';
|
|
67
67
|
import 'bignumber.js';
|
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,7 @@ export { getDefaultRecvTime } from './utils/orders/recvTime.js';
|
|
|
61
61
|
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './utils/productTypeFilter.js';
|
|
62
62
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './utils/time.js';
|
|
63
63
|
export { toPrintableObject } from './utils/toPrintableObject.js';
|
|
64
|
+
import 'abitype';
|
|
64
65
|
import 'viem/chains';
|
|
65
66
|
import 'viem';
|
|
66
|
-
import 'abitype';
|
|
67
67
|
import 'bignumber.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nadohq/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"description": "Shared utilities, types, and contract helpers for Nado SDK",
|
|
@@ -41,16 +41,16 @@
|
|
|
41
41
|
"module": "./dist/index.js",
|
|
42
42
|
"types": "./dist/index.d.ts",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"abitype": "
|
|
44
|
+
"abitype": "1.2.3"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"bignumber.js": "
|
|
48
|
-
"viem": "
|
|
47
|
+
"bignumber.js": "10.0.2",
|
|
48
|
+
"viem": "2.45.3"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@jest/globals": "
|
|
52
|
-
"bignumber.js": "
|
|
53
|
-
"viem": "
|
|
51
|
+
"@jest/globals": "30.2.0",
|
|
52
|
+
"bignumber.js": "10.0.2",
|
|
53
|
+
"viem": "2.45.3"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "67e111a1c7b4c989a686784a564f3b246b6b1caf"
|
|
56
56
|
}
|