ault-sdk-ts 0.0.2-alpha.14 → 0.0.2-alpha.16

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.
@@ -1,6 +1,7 @@
1
1
  import type { NetworkConfig } from "../core/network";
2
2
  import type { FetchWithRetryOptions, FetchFn } from "../core/http";
3
3
  import type { AultClient } from "../client";
4
+ import type { ManifestResolver } from "../core/manifest-resolver";
4
5
  import type { AccountxApi } from "../rest/accountx";
5
6
  import type { AgentApi } from "../rest/agent";
6
7
  import type { AuthorityApi, AuthorityRoleInput } from "../rest/authority";
@@ -416,54 +417,6 @@ export interface ParallelQueryApi {
416
417
  getLicenseDelegationsParallel(licenseIds: string[]): Promise<LicenseDelegationStatus[]>;
417
418
  analyzeLicenses(owner: string): Promise<LicenseAnalysis>;
418
419
  }
419
- /**
420
- * High-level client interface for the Ault SDK.
421
- * Provides simplified methods for common operations.
422
- */
423
- export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi {
424
- /** Network configuration */
425
- readonly network: NetworkConfig;
426
- /** Signer address in Ault bech32 format */
427
- readonly address: string;
428
- /** Accountx module queries (fee-free account registration). */
429
- readonly accountx: AccountxApi;
430
- /** Agent module queries */
431
- readonly agent: AgentApi;
432
- /** Authority module queries */
433
- readonly authority: AuthorityApi;
434
- /** Bank module queries (proto-canonical Coin amounts as strings). */
435
- readonly bank: BankApi;
436
- /** CLOB module queries */
437
- readonly clob: ClobApi;
438
- /** License module queries */
439
- readonly license: LicenseApi;
440
- /** Market module queries */
441
- readonly market: MarketApi;
442
- /** Miner module queries */
443
- readonly miner: MinerApi;
444
- /** Rate limit module queries */
445
- readonly ratelimit: RateLimitApi;
446
- /** Reward module queries */
447
- readonly reward: RewardApi;
448
- /** Staking/distribution queries */
449
- readonly staking: StakingApi;
450
- /** Token registry module queries */
451
- readonly tokenregistry: TokenRegistryApi;
452
- /** Access to the underlying low-level client for advanced use cases. */
453
- readonly _lowLevel: AultClient;
454
- }
455
- export type { RewardParams, Role, ProtoAny };
456
- export interface AgentClientOptions {
457
- network: NetworkConfig;
458
- masterAddress: string;
459
- agentPrivateKey: string;
460
- fetchFn?: FetchFn;
461
- fetchOptions?: FetchWithRetryOptions;
462
- defaultGasLimit?: string;
463
- defaultMemo?: string;
464
- defaultConfirmationTimeoutMs?: number;
465
- defaultTimeoutSeconds?: number;
466
- }
467
420
  export interface AgentTxOptions extends TxOptions {
468
421
  timeoutSeconds?: number;
469
422
  }
@@ -503,12 +456,85 @@ export interface AgentClobTxApi {
503
456
  builderFeeRate?: string;
504
457
  } & AgentTxOptions): Promise<TxResult>;
505
458
  }
506
- export interface AgentClient extends AgentClobTxApi {
507
- readonly network: NetworkConfig;
459
+ /**
460
+ * Agent identity + agent-signed CLOB tx surface attached to a `Client`.
461
+ * `client.asAgent` is non-null only after `client.attachAgent(...)`.
462
+ */
463
+ export interface AgentSurface extends AgentClobTxApi {
464
+ /** Agent address (bech32). */
465
+ readonly address: string;
466
+ /** Master address — same as `client.address`. */
508
467
  readonly masterAddress: string;
509
- readonly agentAddress: string;
468
+ }
469
+ export interface AttachAgentOptions {
470
+ /** Hex-encoded agent private key (with or without `0x`). */
471
+ agentPrivateKey: string;
472
+ /** Optional default per-tx broadcast timeout. Default: `AGENT_DEFAULTS.TIMEOUT_SECONDS`. */
473
+ defaultTimeoutSeconds?: number;
474
+ /** Optional default gas limit for agent txs. Default: `AGENT_DEFAULTS.GAS_LIMIT`. */
475
+ defaultGasLimit?: string;
476
+ /** Optional default memo. */
477
+ defaultMemo?: string;
478
+ /** Optional confirmation polling timeout. */
479
+ defaultConfirmationTimeoutMs?: number;
480
+ }
481
+ /**
482
+ * High-level client interface for the Ault SDK.
483
+ * Provides simplified methods for common operations.
484
+ */
485
+ export interface Client extends AccountxTxApi, AgentTxApi, AuthorityTxApi, ClobTxApi, LicenseTxApi, MarketTxApi, MinerTxApi, RateLimitTxApi, RewardTxApi, StakingTxApi, TokenRegistryTxApi, ParallelQueryApi {
486
+ /** Network configuration */
487
+ readonly network: NetworkConfig;
488
+ /** Signer address in Ault bech32 format */
489
+ readonly address: string;
490
+ /** Accountx module queries (fee-free account registration). */
491
+ readonly accountx: AccountxApi;
492
+ /** Agent module queries */
510
493
  readonly agent: AgentApi;
494
+ /** Authority module queries */
495
+ readonly authority: AuthorityApi;
496
+ /** Bank module queries (proto-canonical Coin amounts as strings). */
497
+ readonly bank: BankApi;
498
+ /** CLOB module queries */
511
499
  readonly clob: ClobApi;
500
+ /** License module queries */
501
+ readonly license: LicenseApi;
502
+ /** Market module queries */
512
503
  readonly market: MarketApi;
504
+ /** Miner module queries */
505
+ readonly miner: MinerApi;
506
+ /** Rate limit module queries */
507
+ readonly ratelimit: RateLimitApi;
508
+ /** Reward module queries */
509
+ readonly reward: RewardApi;
510
+ /** Staking/distribution queries */
511
+ readonly staking: StakingApi;
512
+ /** Token registry module queries */
513
+ readonly tokenregistry: TokenRegistryApi;
514
+ /**
515
+ * Agent-signed tx surface. Null until `attachAgent` is called; cleared by
516
+ * `detachAgent`. The reference changes on attach/detach — consumers
517
+ * caching the value should re-read after either call.
518
+ */
519
+ asAgent: AgentSurface | null;
520
+ /**
521
+ * Attach an agent identity to this client. Replaces any previously attached
522
+ * agent. The new surface is also written to `client.asAgent`. Reuses the
523
+ * client's manifest resolver and master account-info cache, so no new
524
+ * manifest fetch or account RPC is issued.
525
+ */
526
+ attachAgent(options: AttachAgentOptions): AgentSurface;
527
+ /** Detach the current agent identity. `client.asAgent` becomes null. No-op if no agent attached. */
528
+ detachAgent(): void;
529
+ /** Access to the underlying low-level client for advanced use cases. */
513
530
  readonly _lowLevel: AultClient;
531
+ /** Access to the underlying manifest resolver. Stable, advanced use only. */
532
+ readonly _resolver: ManifestResolver;
533
+ /**
534
+ * Releases resources held by the client (background manifest refresh timer).
535
+ * Call this when the client is no longer needed (e.g. app teardown, signout)
536
+ * to avoid leaking timers in long-lived processes.
537
+ */
538
+ dispose(): void;
514
539
  }
540
+ export type { RewardParams, Role, ProtoAny };
@@ -1,2 +1,2 @@
1
- export type { Client, ClientOptions, FlexibleSignerInput, TxResult } from "./high-level/types";
1
+ export type { AgentClobTxApi, AgentSurface, AgentTxOptions, AttachAgentOptions, Client, ClientOptions, FlexibleSignerInput, TxResult, } from "./high-level/types";
2
2
  export { createClient } from "./high-level/create-client";