@awarizon/web3 1.0.2 → 1.1.1

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/index.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Chain, WalletClient, Address, Abi, PublicClient, Hex } from 'viem';
2
2
  export { Abi, Address, Chain, Hash, TransactionReceipt, WalletClient } from 'viem';
3
- import { WalletEngine, CreatedWallet, ImportedWalletFromMnemonic, ImportedWalletFromPrivateKey, ExternalWalletClient } from '@awarizon/wallet-engine';
4
- export { ChainSwitchError, InvalidMnemonicError, InvalidPrivateKeyError, WalletEngine, WalletNotConnectedError } from '@awarizon/wallet-engine';
3
+ import { WalletEngine, CreatedWallet, ImportedWalletFromMnemonic, ImportedWalletFromPrivateKey, ConnectorInfo, ExternalWalletClient, EIP1193Provider, SignTypedDataParams, WalletChangeEvent, ChainChangeEvent } from '@awarizon/wallet-engine';
4
+ export { ChainChangeEvent, ChainMismatchError, ChainSwitchError, ConnectorInfo, CreatedWallet, EIP1193Provider, ImportedWalletFromMnemonic, ImportedWalletFromPrivateKey, InvalidMnemonicError, InvalidPrivateKeyError, SignTypedDataParams, WalletChangeEvent, WalletEngine, WalletNotConnectedError } from '@awarizon/wallet-engine';
5
5
  import { TransactionResult } from '@awarizon/tx-engine';
6
6
  export { ContractExecutionError, GasEstimationError, SimulationError, TransactionEngine, TransactionResult, TransactionTimeoutError } from '@awarizon/tx-engine';
7
7
  export { DuplicateFunctionError, InvalidABIError, UnsupportedABIItemError, generateAllMethodSignatures, generateMethodSignature, isPayableFunction, isWriteFunction, parseABI } from '@awarizon/abi-engine';
@@ -34,6 +34,12 @@ interface AwarizonConfig {
34
34
  * Override for local development or staging environments.
35
35
  */
36
36
  baseUrl?: string;
37
+ /**
38
+ * When true, the SDK automatically requests a chain switch on the external
39
+ * wallet before every write if the wallet is on the wrong network.
40
+ * Only affects external wallets (wagmi, RainbowKit, EIP-1193).
41
+ */
42
+ autoSwitchChain?: boolean;
37
43
  }
38
44
  interface ContractConfig<TAbi extends Abi = Abi> {
39
45
  /** The deployed contract address */
@@ -76,6 +82,545 @@ interface SDKWalletInfo {
76
82
  address: Address;
77
83
  chain: Chain;
78
84
  isExternal: boolean;
85
+ /** Name of the connector if an external wallet is active, e.g. "MetaMask" */
86
+ connectorName?: string;
87
+ }
88
+ interface ContractRegistryEntry {
89
+ address: Address;
90
+ abi: Abi;
91
+ }
92
+
93
+ declare const ERC20_ABI: readonly [{
94
+ readonly type: "event";
95
+ readonly name: "Approval";
96
+ readonly inputs: readonly [{
97
+ readonly indexed: true;
98
+ readonly name: "owner";
99
+ readonly type: "address";
100
+ }, {
101
+ readonly indexed: true;
102
+ readonly name: "spender";
103
+ readonly type: "address";
104
+ }, {
105
+ readonly indexed: false;
106
+ readonly name: "value";
107
+ readonly type: "uint256";
108
+ }];
109
+ }, {
110
+ readonly type: "event";
111
+ readonly name: "Transfer";
112
+ readonly inputs: readonly [{
113
+ readonly indexed: true;
114
+ readonly name: "from";
115
+ readonly type: "address";
116
+ }, {
117
+ readonly indexed: true;
118
+ readonly name: "to";
119
+ readonly type: "address";
120
+ }, {
121
+ readonly indexed: false;
122
+ readonly name: "value";
123
+ readonly type: "uint256";
124
+ }];
125
+ }, {
126
+ readonly type: "function";
127
+ readonly name: "allowance";
128
+ readonly stateMutability: "view";
129
+ readonly inputs: readonly [{
130
+ readonly name: "owner";
131
+ readonly type: "address";
132
+ }, {
133
+ readonly name: "spender";
134
+ readonly type: "address";
135
+ }];
136
+ readonly outputs: readonly [{
137
+ readonly type: "uint256";
138
+ }];
139
+ }, {
140
+ readonly type: "function";
141
+ readonly name: "approve";
142
+ readonly stateMutability: "nonpayable";
143
+ readonly inputs: readonly [{
144
+ readonly name: "spender";
145
+ readonly type: "address";
146
+ }, {
147
+ readonly name: "amount";
148
+ readonly type: "uint256";
149
+ }];
150
+ readonly outputs: readonly [{
151
+ readonly type: "bool";
152
+ }];
153
+ }, {
154
+ readonly type: "function";
155
+ readonly name: "balanceOf";
156
+ readonly stateMutability: "view";
157
+ readonly inputs: readonly [{
158
+ readonly name: "account";
159
+ readonly type: "address";
160
+ }];
161
+ readonly outputs: readonly [{
162
+ readonly type: "uint256";
163
+ }];
164
+ }, {
165
+ readonly type: "function";
166
+ readonly name: "decimals";
167
+ readonly stateMutability: "view";
168
+ readonly inputs: readonly [];
169
+ readonly outputs: readonly [{
170
+ readonly type: "uint8";
171
+ }];
172
+ }, {
173
+ readonly type: "function";
174
+ readonly name: "name";
175
+ readonly stateMutability: "view";
176
+ readonly inputs: readonly [];
177
+ readonly outputs: readonly [{
178
+ readonly type: "string";
179
+ }];
180
+ }, {
181
+ readonly type: "function";
182
+ readonly name: "symbol";
183
+ readonly stateMutability: "view";
184
+ readonly inputs: readonly [];
185
+ readonly outputs: readonly [{
186
+ readonly type: "string";
187
+ }];
188
+ }, {
189
+ readonly type: "function";
190
+ readonly name: "totalSupply";
191
+ readonly stateMutability: "view";
192
+ readonly inputs: readonly [];
193
+ readonly outputs: readonly [{
194
+ readonly type: "uint256";
195
+ }];
196
+ }, {
197
+ readonly type: "function";
198
+ readonly name: "transfer";
199
+ readonly stateMutability: "nonpayable";
200
+ readonly inputs: readonly [{
201
+ readonly name: "recipient";
202
+ readonly type: "address";
203
+ }, {
204
+ readonly name: "amount";
205
+ readonly type: "uint256";
206
+ }];
207
+ readonly outputs: readonly [{
208
+ readonly type: "bool";
209
+ }];
210
+ }, {
211
+ readonly type: "function";
212
+ readonly name: "transferFrom";
213
+ readonly stateMutability: "nonpayable";
214
+ readonly inputs: readonly [{
215
+ readonly name: "sender";
216
+ readonly type: "address";
217
+ }, {
218
+ readonly name: "recipient";
219
+ readonly type: "address";
220
+ }, {
221
+ readonly name: "amount";
222
+ readonly type: "uint256";
223
+ }];
224
+ readonly outputs: readonly [{
225
+ readonly type: "bool";
226
+ }];
227
+ }];
228
+ interface Erc20Contract {
229
+ name(): Promise<string>;
230
+ symbol(): Promise<string>;
231
+ decimals(): Promise<number>;
232
+ totalSupply(): Promise<bigint>;
233
+ balanceOf(owner: Address): Promise<bigint>;
234
+ allowance(owner: Address, spender: Address): Promise<bigint>;
235
+ transfer(to: Address, amount: bigint): Promise<TransactionResult>;
236
+ transferFrom(from: Address, to: Address, amount: bigint): Promise<TransactionResult>;
237
+ approve(spender: Address, amount: bigint): Promise<TransactionResult>;
238
+ on: ContractInstance['on'];
239
+ estimateGas: ContractInstance['estimateGas'];
240
+ readonly _address: Address;
241
+ readonly _abi: Abi;
242
+ }
243
+ declare const ERC721_ABI: readonly [{
244
+ readonly type: "function";
245
+ readonly name: "name";
246
+ readonly stateMutability: "view";
247
+ readonly inputs: readonly [];
248
+ readonly outputs: readonly [{
249
+ readonly type: "string";
250
+ }];
251
+ }, {
252
+ readonly type: "function";
253
+ readonly name: "symbol";
254
+ readonly stateMutability: "view";
255
+ readonly inputs: readonly [];
256
+ readonly outputs: readonly [{
257
+ readonly type: "string";
258
+ }];
259
+ }, {
260
+ readonly type: "function";
261
+ readonly name: "tokenURI";
262
+ readonly stateMutability: "view";
263
+ readonly inputs: readonly [{
264
+ readonly name: "tokenId";
265
+ readonly type: "uint256";
266
+ }];
267
+ readonly outputs: readonly [{
268
+ readonly type: "string";
269
+ }];
270
+ }, {
271
+ readonly type: "function";
272
+ readonly name: "totalSupply";
273
+ readonly stateMutability: "view";
274
+ readonly inputs: readonly [];
275
+ readonly outputs: readonly [{
276
+ readonly type: "uint256";
277
+ }];
278
+ }, {
279
+ readonly type: "function";
280
+ readonly name: "ownerOf";
281
+ readonly stateMutability: "view";
282
+ readonly inputs: readonly [{
283
+ readonly name: "tokenId";
284
+ readonly type: "uint256";
285
+ }];
286
+ readonly outputs: readonly [{
287
+ readonly type: "address";
288
+ }];
289
+ }, {
290
+ readonly type: "function";
291
+ readonly name: "balanceOf";
292
+ readonly stateMutability: "view";
293
+ readonly inputs: readonly [{
294
+ readonly name: "owner";
295
+ readonly type: "address";
296
+ }];
297
+ readonly outputs: readonly [{
298
+ readonly type: "uint256";
299
+ }];
300
+ }, {
301
+ readonly type: "function";
302
+ readonly name: "getApproved";
303
+ readonly stateMutability: "view";
304
+ readonly inputs: readonly [{
305
+ readonly name: "tokenId";
306
+ readonly type: "uint256";
307
+ }];
308
+ readonly outputs: readonly [{
309
+ readonly type: "address";
310
+ }];
311
+ }, {
312
+ readonly type: "function";
313
+ readonly name: "isApprovedForAll";
314
+ readonly stateMutability: "view";
315
+ readonly inputs: readonly [{
316
+ readonly name: "owner";
317
+ readonly type: "address";
318
+ }, {
319
+ readonly name: "operator";
320
+ readonly type: "address";
321
+ }];
322
+ readonly outputs: readonly [{
323
+ readonly type: "bool";
324
+ }];
325
+ }, {
326
+ readonly type: "function";
327
+ readonly name: "transferFrom";
328
+ readonly stateMutability: "nonpayable";
329
+ readonly inputs: readonly [{
330
+ readonly name: "from";
331
+ readonly type: "address";
332
+ }, {
333
+ readonly name: "to";
334
+ readonly type: "address";
335
+ }, {
336
+ readonly name: "tokenId";
337
+ readonly type: "uint256";
338
+ }];
339
+ readonly outputs: readonly [];
340
+ }, {
341
+ readonly type: "function";
342
+ readonly name: "safeTransferFrom";
343
+ readonly stateMutability: "nonpayable";
344
+ readonly inputs: readonly [{
345
+ readonly name: "from";
346
+ readonly type: "address";
347
+ }, {
348
+ readonly name: "to";
349
+ readonly type: "address";
350
+ }, {
351
+ readonly name: "tokenId";
352
+ readonly type: "uint256";
353
+ }];
354
+ readonly outputs: readonly [];
355
+ }, {
356
+ readonly type: "function";
357
+ readonly name: "approve";
358
+ readonly stateMutability: "nonpayable";
359
+ readonly inputs: readonly [{
360
+ readonly name: "to";
361
+ readonly type: "address";
362
+ }, {
363
+ readonly name: "tokenId";
364
+ readonly type: "uint256";
365
+ }];
366
+ readonly outputs: readonly [];
367
+ }, {
368
+ readonly type: "function";
369
+ readonly name: "setApprovalForAll";
370
+ readonly stateMutability: "nonpayable";
371
+ readonly inputs: readonly [{
372
+ readonly name: "operator";
373
+ readonly type: "address";
374
+ }, {
375
+ readonly name: "approved";
376
+ readonly type: "bool";
377
+ }];
378
+ readonly outputs: readonly [];
379
+ }, {
380
+ readonly type: "event";
381
+ readonly name: "Transfer";
382
+ readonly inputs: readonly [{
383
+ readonly indexed: true;
384
+ readonly name: "from";
385
+ readonly type: "address";
386
+ }, {
387
+ readonly indexed: true;
388
+ readonly name: "to";
389
+ readonly type: "address";
390
+ }, {
391
+ readonly indexed: true;
392
+ readonly name: "tokenId";
393
+ readonly type: "uint256";
394
+ }];
395
+ }, {
396
+ readonly type: "event";
397
+ readonly name: "Approval";
398
+ readonly inputs: readonly [{
399
+ readonly indexed: true;
400
+ readonly name: "owner";
401
+ readonly type: "address";
402
+ }, {
403
+ readonly indexed: true;
404
+ readonly name: "approved";
405
+ readonly type: "address";
406
+ }, {
407
+ readonly indexed: true;
408
+ readonly name: "tokenId";
409
+ readonly type: "uint256";
410
+ }];
411
+ }, {
412
+ readonly type: "event";
413
+ readonly name: "ApprovalForAll";
414
+ readonly inputs: readonly [{
415
+ readonly indexed: true;
416
+ readonly name: "owner";
417
+ readonly type: "address";
418
+ }, {
419
+ readonly indexed: true;
420
+ readonly name: "operator";
421
+ readonly type: "address";
422
+ }, {
423
+ readonly name: "approved";
424
+ readonly type: "bool";
425
+ }];
426
+ }];
427
+ interface Erc721Contract {
428
+ name(): Promise<string>;
429
+ symbol(): Promise<string>;
430
+ tokenURI(tokenId: bigint): Promise<string>;
431
+ totalSupply(): Promise<bigint>;
432
+ ownerOf(tokenId: bigint): Promise<Address>;
433
+ balanceOf(owner: Address): Promise<bigint>;
434
+ getApproved(tokenId: bigint): Promise<Address>;
435
+ isApprovedForAll(owner: Address, operator: Address): Promise<boolean>;
436
+ transferFrom(from: Address, to: Address, tokenId: bigint): Promise<TransactionResult>;
437
+ safeTransferFrom(from: Address, to: Address, tokenId: bigint): Promise<TransactionResult>;
438
+ approve(to: Address, tokenId: bigint): Promise<TransactionResult>;
439
+ setApprovalForAll(operator: Address, approved: boolean): Promise<TransactionResult>;
440
+ on: ContractInstance['on'];
441
+ estimateGas: ContractInstance['estimateGas'];
442
+ readonly _address: Address;
443
+ readonly _abi: Abi;
444
+ }
445
+ declare const ERC1155_ABI: readonly [{
446
+ readonly type: "function";
447
+ readonly name: "uri";
448
+ readonly stateMutability: "view";
449
+ readonly inputs: readonly [{
450
+ readonly name: "id";
451
+ readonly type: "uint256";
452
+ }];
453
+ readonly outputs: readonly [{
454
+ readonly type: "string";
455
+ }];
456
+ }, {
457
+ readonly type: "function";
458
+ readonly name: "balanceOf";
459
+ readonly stateMutability: "view";
460
+ readonly inputs: readonly [{
461
+ readonly name: "account";
462
+ readonly type: "address";
463
+ }, {
464
+ readonly name: "id";
465
+ readonly type: "uint256";
466
+ }];
467
+ readonly outputs: readonly [{
468
+ readonly type: "uint256";
469
+ }];
470
+ }, {
471
+ readonly type: "function";
472
+ readonly name: "balanceOfBatch";
473
+ readonly stateMutability: "view";
474
+ readonly inputs: readonly [{
475
+ readonly name: "accounts";
476
+ readonly type: "address[]";
477
+ }, {
478
+ readonly name: "ids";
479
+ readonly type: "uint256[]";
480
+ }];
481
+ readonly outputs: readonly [{
482
+ readonly type: "uint256[]";
483
+ }];
484
+ }, {
485
+ readonly type: "function";
486
+ readonly name: "isApprovedForAll";
487
+ readonly stateMutability: "view";
488
+ readonly inputs: readonly [{
489
+ readonly name: "account";
490
+ readonly type: "address";
491
+ }, {
492
+ readonly name: "operator";
493
+ readonly type: "address";
494
+ }];
495
+ readonly outputs: readonly [{
496
+ readonly type: "bool";
497
+ }];
498
+ }, {
499
+ readonly type: "function";
500
+ readonly name: "setApprovalForAll";
501
+ readonly stateMutability: "nonpayable";
502
+ readonly inputs: readonly [{
503
+ readonly name: "operator";
504
+ readonly type: "address";
505
+ }, {
506
+ readonly name: "approved";
507
+ readonly type: "bool";
508
+ }];
509
+ readonly outputs: readonly [];
510
+ }, {
511
+ readonly type: "function";
512
+ readonly name: "safeTransferFrom";
513
+ readonly stateMutability: "nonpayable";
514
+ readonly inputs: readonly [{
515
+ readonly name: "from";
516
+ readonly type: "address";
517
+ }, {
518
+ readonly name: "to";
519
+ readonly type: "address";
520
+ }, {
521
+ readonly name: "id";
522
+ readonly type: "uint256";
523
+ }, {
524
+ readonly name: "amount";
525
+ readonly type: "uint256";
526
+ }, {
527
+ readonly name: "data";
528
+ readonly type: "bytes";
529
+ }];
530
+ readonly outputs: readonly [];
531
+ }, {
532
+ readonly type: "function";
533
+ readonly name: "safeBatchTransferFrom";
534
+ readonly stateMutability: "nonpayable";
535
+ readonly inputs: readonly [{
536
+ readonly name: "from";
537
+ readonly type: "address";
538
+ }, {
539
+ readonly name: "to";
540
+ readonly type: "address";
541
+ }, {
542
+ readonly name: "ids";
543
+ readonly type: "uint256[]";
544
+ }, {
545
+ readonly name: "amounts";
546
+ readonly type: "uint256[]";
547
+ }, {
548
+ readonly name: "data";
549
+ readonly type: "bytes";
550
+ }];
551
+ readonly outputs: readonly [];
552
+ }, {
553
+ readonly type: "event";
554
+ readonly name: "TransferSingle";
555
+ readonly inputs: readonly [{
556
+ readonly indexed: true;
557
+ readonly name: "operator";
558
+ readonly type: "address";
559
+ }, {
560
+ readonly indexed: true;
561
+ readonly name: "from";
562
+ readonly type: "address";
563
+ }, {
564
+ readonly indexed: true;
565
+ readonly name: "to";
566
+ readonly type: "address";
567
+ }, {
568
+ readonly name: "id";
569
+ readonly type: "uint256";
570
+ }, {
571
+ readonly name: "value";
572
+ readonly type: "uint256";
573
+ }];
574
+ }, {
575
+ readonly type: "event";
576
+ readonly name: "TransferBatch";
577
+ readonly inputs: readonly [{
578
+ readonly indexed: true;
579
+ readonly name: "operator";
580
+ readonly type: "address";
581
+ }, {
582
+ readonly indexed: true;
583
+ readonly name: "from";
584
+ readonly type: "address";
585
+ }, {
586
+ readonly indexed: true;
587
+ readonly name: "to";
588
+ readonly type: "address";
589
+ }, {
590
+ readonly name: "ids";
591
+ readonly type: "uint256[]";
592
+ }, {
593
+ readonly name: "values";
594
+ readonly type: "uint256[]";
595
+ }];
596
+ }, {
597
+ readonly type: "event";
598
+ readonly name: "ApprovalForAll";
599
+ readonly inputs: readonly [{
600
+ readonly indexed: true;
601
+ readonly name: "account";
602
+ readonly type: "address";
603
+ }, {
604
+ readonly indexed: true;
605
+ readonly name: "operator";
606
+ readonly type: "address";
607
+ }, {
608
+ readonly name: "approved";
609
+ readonly type: "bool";
610
+ }];
611
+ }];
612
+ interface Erc1155Contract {
613
+ uri(id: bigint): Promise<string>;
614
+ balanceOf(account: Address, id: bigint): Promise<bigint>;
615
+ balanceOfBatch(accounts: Address[], ids: bigint[]): Promise<bigint[]>;
616
+ isApprovedForAll(account: Address, operator: Address): Promise<boolean>;
617
+ setApprovalForAll(operator: Address, approved: boolean): Promise<TransactionResult>;
618
+ safeTransferFrom(from: Address, to: Address, id: bigint, amount: bigint, data: `0x${string}`): Promise<TransactionResult>;
619
+ safeBatchTransferFrom(from: Address, to: Address, ids: bigint[], amounts: bigint[], data: `0x${string}`): Promise<TransactionResult>;
620
+ on: ContractInstance['on'];
621
+ estimateGas: ContractInstance['estimateGas'];
622
+ readonly _address: Address;
623
+ readonly _abi: Abi;
79
624
  }
80
625
 
81
626
  declare class NetworkMismatchError extends Error {
@@ -124,10 +669,26 @@ declare class WalletProxy {
124
669
  isConnected(): boolean;
125
670
  hasExternalWallet(): boolean;
126
671
  hasInternalWallet(): boolean;
127
- connectExternal(c: ExternalWalletClient): void;
672
+ getConnectorInfo(): ConnectorInfo;
673
+ connectExternal(c: ExternalWalletClient, info?: {
674
+ name?: string;
675
+ icon?: string;
676
+ }): void;
128
677
  disconnectExternal(): void;
129
678
  disconnect(): void;
130
679
  switchChain(chain: Chain): Promise<void>;
680
+ connectEIP1193(provider: EIP1193Provider, info?: {
681
+ name?: string;
682
+ icon?: string;
683
+ }): Promise<void>;
684
+ signMessage(message: string | {
685
+ raw: Hex | Uint8Array;
686
+ }): Promise<Hex>;
687
+ signTypedData(params: SignTypedDataParams): Promise<Hex>;
688
+ getChainId(): Promise<number>;
689
+ isChainMismatch(): Promise<boolean>;
690
+ onWalletChange(cb: (event: WalletChangeEvent) => void): () => void;
691
+ onChainChange(cb: (event: ChainChangeEvent) => void): () => void;
131
692
  }
132
693
  /**
133
694
  * Primary entry point for the Awarizon Web3 SDK.
@@ -155,11 +716,91 @@ declare class AwarizonWeb3 {
155
716
  private readonly _txEngine;
156
717
  private readonly _telemetry;
157
718
  private _contractCache;
719
+ private _registry;
158
720
  constructor(config: AwarizonConfig);
159
- connectWallet(walletClient: WalletClient): this;
721
+ /**
722
+ * Connect any viem WalletClient (wagmi, RainbowKit, custom).
723
+ * Optionally pass connector metadata to display in the UI.
724
+ *
725
+ * @example
726
+ * awarizon.connectWallet(walletClient, { name: "MetaMask" })
727
+ */
728
+ connectWallet(walletClient: WalletClient, connectorInfo?: {
729
+ name?: string;
730
+ icon?: string;
731
+ }): this;
732
+ /**
733
+ * Connect directly from a raw EIP-1193 provider without needing wagmi.
734
+ * Works with window.ethereum, WalletConnect v2, and any EIP-1193 object.
735
+ *
736
+ * @example
737
+ * await awarizon.connectEIP1193Provider(window.ethereum, { name: "MetaMask" })
738
+ */
739
+ connectEIP1193Provider(provider: EIP1193Provider, connectorInfo?: {
740
+ name?: string;
741
+ icon?: string;
742
+ }): Promise<this>;
160
743
  disconnectWallet(): this;
161
744
  switchChain(chain: Chain | string): Promise<this>;
162
745
  getWalletInfo(): SDKWalletInfo;
746
+ /**
747
+ * Sign a plain text or raw-bytes message.
748
+ * Use for Sign-In with Ethereum (SIWE) and off-chain authorization.
749
+ *
750
+ * @example
751
+ * const sig = await awarizon.signMessage("Hello, Awarizon!")
752
+ */
753
+ signMessage(message: string | {
754
+ raw: Hex | Uint8Array;
755
+ }): Promise<Hex>;
756
+ /**
757
+ * Sign EIP-712 typed structured data (permit2, SIWE, Seaport orders, etc.).
758
+ *
759
+ * @example
760
+ * const sig = await awarizon.signTypedData({
761
+ * domain: { name: "MyApp", version: "1", chainId: 8453 },
762
+ * types: { Transfer: [{ name: "to", type: "address" }, { name: "amount", type: "uint256" }] },
763
+ * primaryType: "Transfer",
764
+ * message: { to: "0x...", amount: "1000000" },
765
+ * })
766
+ */
767
+ signTypedData(params: SignTypedDataParams): Promise<Hex>;
768
+ /**
769
+ * Returns the chain ID the active wallet is currently on.
770
+ * For external wallets this may differ from the SDK's configured chain.
771
+ */
772
+ getChainId(): Promise<number>;
773
+ /**
774
+ * Returns true when the external wallet is on a different chain than the SDK.
775
+ * Use this to show a "wrong network" banner in your UI.
776
+ *
777
+ * @example
778
+ * if (await awarizon.isChainMismatch()) {
779
+ * alert("Please switch to Base in your wallet")
780
+ * }
781
+ */
782
+ isChainMismatch(): Promise<boolean>;
783
+ /**
784
+ * Returns metadata about the currently active connector.
785
+ * Useful for displaying "Connected via MetaMask" in the UI.
786
+ */
787
+ getConnectorInfo(): ConnectorInfo;
788
+ /**
789
+ * Subscribe to wallet changes (connect, disconnect, account switch).
790
+ * Returns an unsubscribe function — call it on cleanup.
791
+ *
792
+ * @example
793
+ * const unsub = awarizon.onWalletChange(({ address, type, name }) => {
794
+ * console.log("Wallet changed:", address, type, name)
795
+ * })
796
+ * unsub() // stop listening
797
+ */
798
+ onWalletChange(cb: (event: WalletChangeEvent) => void): () => void;
799
+ /**
800
+ * Subscribe to chain changes (switchChain calls).
801
+ * Returns an unsubscribe function.
802
+ */
803
+ onChainChange(cb: (event: ChainChangeEvent) => void): () => void;
163
804
  /**
164
805
  * Load a deployed contract and return a fully typed, ABI-powered instance.
165
806
  * Validates the API key on the first call — subsequent calls are instant.
@@ -247,6 +888,75 @@ declare class AwarizonWeb3 {
247
888
  method: string;
248
889
  args?: unknown[];
249
890
  }>): Promise<unknown[]>;
891
+ /**
892
+ * Load an ERC-20 token with fully typed methods — no ABI import needed.
893
+ *
894
+ * ```ts
895
+ * const token = await awarizon.erc20("0x...")
896
+ * const balance = await token.balanceOf(userAddress)
897
+ * const symbol = await token.symbol()
898
+ * await token.transfer(recipient, 100n)
899
+ * ```
900
+ */
901
+ erc20(address: Address): Promise<Erc20Contract>;
902
+ /**
903
+ * Load an ERC-721 NFT contract with fully typed methods — no ABI import needed.
904
+ *
905
+ * ```ts
906
+ * const nft = await awarizon.erc721("0x...")
907
+ * const owner = await nft.ownerOf(1n)
908
+ * const uri = await nft.tokenURI(1n)
909
+ * await nft.transferFrom(from, to, 1n)
910
+ * ```
911
+ */
912
+ erc721(address: Address): Promise<Erc721Contract>;
913
+ /**
914
+ * Load an ERC-1155 multi-token contract with fully typed methods — no ABI import needed.
915
+ *
916
+ * ```ts
917
+ * const items = await awarizon.erc1155("0x...")
918
+ * const balance = await items.balanceOf(userAddress, 42n)
919
+ * const uri = await items.uri(42n)
920
+ * await items.safeTransferFrom(from, to, 42n, 1n, "0x")
921
+ * ```
922
+ */
923
+ erc1155(address: Address): Promise<Erc1155Contract>;
924
+ /**
925
+ * Register a contract under a human-readable name.
926
+ * After registering, use `awarizon.use(name)` anywhere instead of repeating
927
+ * address + ABI every time.
928
+ *
929
+ * ```ts
930
+ * awarizon.register("USDC", { address: "0x...", abi: erc20Abi })
931
+ * awarizon.register("Vault", { address: "0x...", abi: vaultAbi })
932
+ *
933
+ * const usdc = await awarizon.use("USDC")
934
+ * const vault = await awarizon.use("Vault")
935
+ * ```
936
+ */
937
+ register(name: string, config: ContractRegistryEntry): this;
938
+ /**
939
+ * Retrieve a previously registered contract by name.
940
+ * Throws a descriptive error if the name was never registered.
941
+ *
942
+ * ```ts
943
+ * const usdc = await awarizon.use("USDC")
944
+ * await usdc.transfer(recipient, 100n)
945
+ * ```
946
+ */
947
+ use(name: string): Promise<ContractInstance>;
948
+ /**
949
+ * Remove a registered contract from the registry.
950
+ *
951
+ * ```ts
952
+ * awarizon.unregister("USDC")
953
+ * ```
954
+ */
955
+ unregister(name: string): this;
956
+ /**
957
+ * Return all registered contract names.
958
+ */
959
+ registeredContracts(): string[];
250
960
  get chainId(): number;
251
961
  get isConnected(): boolean;
252
962
  /**
@@ -327,4 +1037,4 @@ declare class TelemetryClient {
327
1037
  private _flushBeacon;
328
1038
  }
329
1039
 
330
- export { ApiKeyRequiredError, type AwarizonConfig, AwarizonWeb3, CHAINS, type ContractConfig, type ContractInstance, ContractNotLoadedError, type EventUnsubscribe, InvalidApiKeyError, NetworkMismatchError, type PayableOptions, ProviderError, type SDKWalletInfo, TelemetryClient, type TelemetryEvent, type TelemetryEventType, UnsupportedChainError, getSupportedChainIds, resolveChain };
1040
+ export { ApiKeyRequiredError, type AwarizonConfig, AwarizonWeb3, CHAINS, type ContractConfig, type ContractInstance, ContractNotLoadedError, type ContractRegistryEntry, ERC1155_ABI, ERC20_ABI, ERC721_ABI, type Erc1155Contract, type Erc20Contract, type Erc721Contract, type EventUnsubscribe, InvalidApiKeyError, NetworkMismatchError, type PayableOptions, ProviderError, type SDKWalletInfo, TelemetryClient, type TelemetryEvent, type TelemetryEventType, UnsupportedChainError, getSupportedChainIds, resolveChain };