@exagent/sdk 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +489 -279
- package/dist/index.d.ts +489 -279
- package/dist/index.js +705 -431
- package/dist/index.mjs +703 -437
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,52 @@ import * as viem from 'viem';
|
|
|
2
2
|
import { Address, Hash, Chain, Account, Hex, WalletClient } from 'viem';
|
|
3
3
|
import * as viem_chains from 'viem/chains';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* ERC-8004 Global Agent Identifier
|
|
7
|
+
* Format: eip155:{chainId}:{registryAddress}:{agentId}
|
|
8
|
+
*
|
|
9
|
+
* This creates a universally unique identifier for any agent across
|
|
10
|
+
* all EVM chains, enabling cross-protocol agent discovery.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```
|
|
14
|
+
* // Base mainnet agent #42
|
|
15
|
+
* "eip155:8453:0xABC...DEF:42"
|
|
16
|
+
*
|
|
17
|
+
* // Base Sepolia testnet agent #7
|
|
18
|
+
* "eip155:84532:0x123...789:7"
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
type GlobalAgentId = `eip155:${number}:${Address}:${number}`;
|
|
22
|
+
/**
|
|
23
|
+
* Build an ERC-8004 compliant global agent identifier
|
|
24
|
+
*
|
|
25
|
+
* @param chainId - EVM chain ID (8453 for Base, 84532 for Base Sepolia)
|
|
26
|
+
* @param registryAddress - ExagentRegistry contract address
|
|
27
|
+
* @param agentId - On-chain agent ID (from ExagentRegistry)
|
|
28
|
+
* @returns Global agent identifier string
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* import { buildGlobalAgentId } from '@exagent/sdk';
|
|
33
|
+
*
|
|
34
|
+
* const globalId = buildGlobalAgentId(8453, '0xABC...DEF', 42);
|
|
35
|
+
* // => "eip155:8453:0xABC...DEF:42"
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
declare function buildGlobalAgentId(chainId: number, registryAddress: Address, agentId: number | bigint): GlobalAgentId;
|
|
39
|
+
/**
|
|
40
|
+
* Parse an ERC-8004 global agent identifier into its components
|
|
41
|
+
*
|
|
42
|
+
* @param globalId - The global agent identifier string
|
|
43
|
+
* @returns Parsed components: chainId, registryAddress, agentId
|
|
44
|
+
* @throws Error if the format is invalid
|
|
45
|
+
*/
|
|
46
|
+
declare function parseGlobalAgentId(globalId: string): {
|
|
47
|
+
chainId: number;
|
|
48
|
+
registryAddress: Address;
|
|
49
|
+
agentId: number;
|
|
50
|
+
};
|
|
5
51
|
/**
|
|
6
52
|
* Agent profile as stored on-chain
|
|
7
53
|
*/
|
|
@@ -27,7 +73,7 @@ interface AgentMetadata {
|
|
|
27
73
|
website?: string;
|
|
28
74
|
social?: {
|
|
29
75
|
twitter?: string;
|
|
30
|
-
|
|
76
|
+
github?: string;
|
|
31
77
|
};
|
|
32
78
|
}
|
|
33
79
|
/**
|
|
@@ -176,23 +222,6 @@ interface StakingInfo$1 extends StakeInfo {
|
|
|
176
222
|
/** Remaining time until unlock in seconds */
|
|
177
223
|
remainingLockTime: bigint;
|
|
178
224
|
}
|
|
179
|
-
/**
|
|
180
|
-
* Delegation info for an agent
|
|
181
|
-
*/
|
|
182
|
-
interface DelegationInfo$1 {
|
|
183
|
-
/** Total vEXA delegated to this agent */
|
|
184
|
-
totalVeEXA: bigint;
|
|
185
|
-
/** Number of unique delegators */
|
|
186
|
-
delegatorCount: bigint;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Discount tier for trading fee reductions based on vEXA holdings
|
|
190
|
-
* - none: 0% discount (0 vEXA)
|
|
191
|
-
* - bronze: 10% discount (10,000+ vEXA)
|
|
192
|
-
* - silver: 25% discount (50,000+ vEXA)
|
|
193
|
-
* - gold: 50% discount (100,000+ vEXA)
|
|
194
|
-
*/
|
|
195
|
-
type DiscountTier$1 = 'none' | 'bronze' | 'silver' | 'gold';
|
|
196
225
|
/**
|
|
197
226
|
* Vault configuration for creating a new vault
|
|
198
227
|
*/
|
|
@@ -267,7 +296,7 @@ interface VaultTradeEntry {
|
|
|
267
296
|
* Wrapper for ExagentRegistry contract interactions
|
|
268
297
|
*/
|
|
269
298
|
declare class ExagentRegistry {
|
|
270
|
-
|
|
299
|
+
readonly address: Address;
|
|
271
300
|
private readonly publicClient;
|
|
272
301
|
private readonly walletClient?;
|
|
273
302
|
private readonly chain;
|
|
@@ -277,9 +306,12 @@ declare class ExagentRegistry {
|
|
|
277
306
|
* Register a new agent
|
|
278
307
|
* @param name Unique agent name (3-32 chars, alphanumeric + spaces/hyphens/underscores)
|
|
279
308
|
* @param metadataURI IPFS URI for agent metadata
|
|
309
|
+
* @param riskUniverse Risk tier: 0=Core, 1=Established, 2=Derivatives, 3=Emerging, 4=Frontier
|
|
310
|
+
* @param maxPositionSizeBps Maximum position size in basis points (1-10000)
|
|
311
|
+
* @param maxDailyLossBps Maximum daily loss in basis points (1-10000)
|
|
280
312
|
* @returns Transaction hash
|
|
281
313
|
*/
|
|
282
|
-
register(name: string, metadataURI: string): Promise<Hash>;
|
|
314
|
+
register(name: string, metadataURI: string, riskUniverse?: number, maxPositionSizeBps?: bigint, maxDailyLossBps?: bigint): Promise<Hash>;
|
|
283
315
|
/**
|
|
284
316
|
* Check if a name is available for registration
|
|
285
317
|
* @param name The name to check
|
|
@@ -357,13 +389,13 @@ declare class ExagentRegistry {
|
|
|
357
389
|
*/
|
|
358
390
|
getNextAgentId(): Promise<bigint>;
|
|
359
391
|
/**
|
|
360
|
-
* Generate the
|
|
361
|
-
*
|
|
362
|
-
*
|
|
392
|
+
* Generate the message hash for wallet linking.
|
|
393
|
+
* Matches the contract's keccak256(abi.encodePacked(...)) exactly.
|
|
394
|
+
* Sign the returned hash with signMessage({ raw: hash }) to produce a valid signature.
|
|
363
395
|
* @param wallet The wallet to link
|
|
364
396
|
* @param agentId The agent ID to link to
|
|
365
397
|
* @param nonce The current nonce for the wallet
|
|
366
|
-
* @returns
|
|
398
|
+
* @returns keccak256 hash of the packed message (32 bytes)
|
|
367
399
|
*/
|
|
368
400
|
static generateLinkMessage(wallet: Address, agentId: bigint, nonce: bigint): Hex;
|
|
369
401
|
/**
|
|
@@ -429,6 +461,38 @@ declare class ExagentRegistry {
|
|
|
429
461
|
* @returns keccak256 hash of the config
|
|
430
462
|
*/
|
|
431
463
|
static calculateConfigHash(provider: string, model: string): `0x${string}`;
|
|
464
|
+
/**
|
|
465
|
+
* Retire an agent — marks it as retired, unlinks all wallets, allows new agent registration
|
|
466
|
+
* @param agentId The agent's ID
|
|
467
|
+
* @returns Transaction hash
|
|
468
|
+
*/
|
|
469
|
+
retireAgent(agentId: bigint): Promise<Hash>;
|
|
470
|
+
/**
|
|
471
|
+
* Check if an agent is retired
|
|
472
|
+
* @param agentId The agent's ID
|
|
473
|
+
* @returns True if agent is retired
|
|
474
|
+
*/
|
|
475
|
+
isRetired(agentId: bigint): Promise<boolean>;
|
|
476
|
+
/**
|
|
477
|
+
* Check if a token trade is allowed for an agent's risk universe
|
|
478
|
+
* @param agentId The agent's ID
|
|
479
|
+
* @param token The token address to check
|
|
480
|
+
* @param aggregator The aggregator being used (for trusted aggregator bypass)
|
|
481
|
+
* @returns True if the trade is allowed
|
|
482
|
+
*/
|
|
483
|
+
isTradeAllowed(agentId: bigint, token: Address, aggregator: Address): Promise<boolean>;
|
|
484
|
+
/**
|
|
485
|
+
* Get the risk universe for an agent
|
|
486
|
+
* @param agentId The agent's ID
|
|
487
|
+
* @returns Risk universe (0=Core, 1=Established, 2=Derivatives, 3=Emerging, 4=Frontier)
|
|
488
|
+
*/
|
|
489
|
+
getRiskUniverse(agentId: bigint): Promise<number>;
|
|
490
|
+
/**
|
|
491
|
+
* Get trade count for an agent
|
|
492
|
+
* @param agentId The agent's ID
|
|
493
|
+
* @returns Number of recorded trades
|
|
494
|
+
*/
|
|
495
|
+
getTradeCount(agentId: bigint): Promise<bigint>;
|
|
432
496
|
}
|
|
433
497
|
|
|
434
498
|
/**
|
|
@@ -581,7 +645,7 @@ declare class ExagentVault {
|
|
|
581
645
|
}
|
|
582
646
|
|
|
583
647
|
/**
|
|
584
|
-
* ExagentStaking ABI
|
|
648
|
+
* ExagentStaking ABI (Mainnet — Two-Phase: Deposit → Lock)
|
|
585
649
|
*/
|
|
586
650
|
declare const EXAGENT_STAKING_ABI: readonly [{
|
|
587
651
|
readonly type: "function";
|
|
@@ -593,7 +657,15 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
593
657
|
readonly stateMutability: "view";
|
|
594
658
|
}, {
|
|
595
659
|
readonly type: "function";
|
|
596
|
-
readonly name: "
|
|
660
|
+
readonly name: "totalDeposited";
|
|
661
|
+
readonly inputs: readonly [];
|
|
662
|
+
readonly outputs: readonly [{
|
|
663
|
+
readonly type: "uint256";
|
|
664
|
+
}];
|
|
665
|
+
readonly stateMutability: "view";
|
|
666
|
+
}, {
|
|
667
|
+
readonly type: "function";
|
|
668
|
+
readonly name: "totalLocked";
|
|
597
669
|
readonly inputs: readonly [];
|
|
598
670
|
readonly outputs: readonly [{
|
|
599
671
|
readonly type: "uint256";
|
|
@@ -609,10 +681,10 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
609
681
|
readonly stateMutability: "view";
|
|
610
682
|
}, {
|
|
611
683
|
readonly type: "function";
|
|
612
|
-
readonly name: "
|
|
684
|
+
readonly name: "totalEffectiveVeEXA";
|
|
613
685
|
readonly inputs: readonly [];
|
|
614
686
|
readonly outputs: readonly [{
|
|
615
|
-
readonly type: "
|
|
687
|
+
readonly type: "uint256";
|
|
616
688
|
}];
|
|
617
689
|
readonly stateMutability: "view";
|
|
618
690
|
}, {
|
|
@@ -631,6 +703,14 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
631
703
|
readonly type: "uint256";
|
|
632
704
|
}];
|
|
633
705
|
readonly stateMutability: "view";
|
|
706
|
+
}, {
|
|
707
|
+
readonly type: "function";
|
|
708
|
+
readonly name: "VAULT_ACCESS_THRESHOLD";
|
|
709
|
+
readonly inputs: readonly [];
|
|
710
|
+
readonly outputs: readonly [{
|
|
711
|
+
readonly type: "uint256";
|
|
712
|
+
}];
|
|
713
|
+
readonly stateMutability: "view";
|
|
634
714
|
}, {
|
|
635
715
|
readonly type: "function";
|
|
636
716
|
readonly name: "PRECISION";
|
|
@@ -641,20 +721,32 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
641
721
|
readonly stateMutability: "view";
|
|
642
722
|
}, {
|
|
643
723
|
readonly type: "function";
|
|
644
|
-
readonly name: "
|
|
724
|
+
readonly name: "deposit";
|
|
645
725
|
readonly inputs: readonly [{
|
|
646
726
|
readonly name: "amount";
|
|
647
727
|
readonly type: "uint256";
|
|
648
|
-
}
|
|
649
|
-
|
|
728
|
+
}];
|
|
729
|
+
readonly outputs: readonly [];
|
|
730
|
+
readonly stateMutability: "nonpayable";
|
|
731
|
+
}, {
|
|
732
|
+
readonly type: "function";
|
|
733
|
+
readonly name: "withdraw";
|
|
734
|
+
readonly inputs: readonly [{
|
|
735
|
+
readonly name: "amount";
|
|
650
736
|
readonly type: "uint256";
|
|
651
737
|
}];
|
|
652
738
|
readonly outputs: readonly [];
|
|
653
739
|
readonly stateMutability: "nonpayable";
|
|
654
740
|
}, {
|
|
655
741
|
readonly type: "function";
|
|
656
|
-
readonly name: "
|
|
657
|
-
readonly inputs: readonly [
|
|
742
|
+
readonly name: "lock";
|
|
743
|
+
readonly inputs: readonly [{
|
|
744
|
+
readonly name: "amount";
|
|
745
|
+
readonly type: "uint256";
|
|
746
|
+
}, {
|
|
747
|
+
readonly name: "lockDuration";
|
|
748
|
+
readonly type: "uint256";
|
|
749
|
+
}];
|
|
658
750
|
readonly outputs: readonly [];
|
|
659
751
|
readonly stateMutability: "nonpayable";
|
|
660
752
|
}, {
|
|
@@ -668,52 +760,51 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
668
760
|
readonly stateMutability: "nonpayable";
|
|
669
761
|
}, {
|
|
670
762
|
readonly type: "function";
|
|
671
|
-
readonly name: "
|
|
763
|
+
readonly name: "unlock";
|
|
672
764
|
readonly inputs: readonly [];
|
|
673
765
|
readonly outputs: readonly [];
|
|
674
766
|
readonly stateMutability: "nonpayable";
|
|
675
767
|
}, {
|
|
676
768
|
readonly type: "function";
|
|
677
|
-
readonly name: "
|
|
769
|
+
readonly name: "emergencyWithdraw";
|
|
678
770
|
readonly inputs: readonly [];
|
|
679
771
|
readonly outputs: readonly [];
|
|
680
772
|
readonly stateMutability: "nonpayable";
|
|
681
773
|
}, {
|
|
682
774
|
readonly type: "function";
|
|
683
|
-
readonly name: "
|
|
684
|
-
readonly inputs: readonly [
|
|
685
|
-
readonly name: "token";
|
|
686
|
-
readonly type: "address";
|
|
687
|
-
}];
|
|
775
|
+
readonly name: "claimRewards";
|
|
776
|
+
readonly inputs: readonly [];
|
|
688
777
|
readonly outputs: readonly [];
|
|
689
778
|
readonly stateMutability: "nonpayable";
|
|
690
779
|
}, {
|
|
691
780
|
readonly type: "function";
|
|
692
|
-
readonly name: "
|
|
693
|
-
readonly inputs: readonly [
|
|
694
|
-
readonly name: "agentId";
|
|
695
|
-
readonly type: "uint256";
|
|
696
|
-
}];
|
|
781
|
+
readonly name: "claimRewardsMulti";
|
|
782
|
+
readonly inputs: readonly [];
|
|
697
783
|
readonly outputs: readonly [];
|
|
698
784
|
readonly stateMutability: "nonpayable";
|
|
699
785
|
}, {
|
|
700
786
|
readonly type: "function";
|
|
701
|
-
readonly name: "
|
|
702
|
-
readonly inputs: readonly [
|
|
787
|
+
readonly name: "claimRewardsToken";
|
|
788
|
+
readonly inputs: readonly [{
|
|
789
|
+
readonly name: "token";
|
|
790
|
+
readonly type: "address";
|
|
791
|
+
}];
|
|
703
792
|
readonly outputs: readonly [];
|
|
704
793
|
readonly stateMutability: "nonpayable";
|
|
705
794
|
}, {
|
|
706
795
|
readonly type: "function";
|
|
707
|
-
readonly name: "
|
|
796
|
+
readonly name: "depositedAmount";
|
|
708
797
|
readonly inputs: readonly [{
|
|
709
|
-
readonly name: "
|
|
798
|
+
readonly name: "user";
|
|
799
|
+
readonly type: "address";
|
|
800
|
+
}];
|
|
801
|
+
readonly outputs: readonly [{
|
|
710
802
|
readonly type: "uint256";
|
|
711
803
|
}];
|
|
712
|
-
readonly
|
|
713
|
-
readonly stateMutability: "nonpayable";
|
|
804
|
+
readonly stateMutability: "view";
|
|
714
805
|
}, {
|
|
715
806
|
readonly type: "function";
|
|
716
|
-
readonly name: "
|
|
807
|
+
readonly name: "locks";
|
|
717
808
|
readonly inputs: readonly [{
|
|
718
809
|
readonly name: "user";
|
|
719
810
|
readonly type: "address";
|
|
@@ -743,6 +834,17 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
743
834
|
readonly type: "uint256";
|
|
744
835
|
}];
|
|
745
836
|
readonly stateMutability: "view";
|
|
837
|
+
}, {
|
|
838
|
+
readonly type: "function";
|
|
839
|
+
readonly name: "getEffectiveVeEXA";
|
|
840
|
+
readonly inputs: readonly [{
|
|
841
|
+
readonly name: "user";
|
|
842
|
+
readonly type: "address";
|
|
843
|
+
}];
|
|
844
|
+
readonly outputs: readonly [{
|
|
845
|
+
readonly type: "uint256";
|
|
846
|
+
}];
|
|
847
|
+
readonly stateMutability: "view";
|
|
746
848
|
}, {
|
|
747
849
|
readonly type: "function";
|
|
748
850
|
readonly name: "calculateVeEXA";
|
|
@@ -784,64 +886,45 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
784
886
|
readonly stateMutability: "view";
|
|
785
887
|
}, {
|
|
786
888
|
readonly type: "function";
|
|
787
|
-
readonly name: "
|
|
889
|
+
readonly name: "getEarningsTier";
|
|
788
890
|
readonly inputs: readonly [{
|
|
789
891
|
readonly name: "user";
|
|
790
892
|
readonly type: "address";
|
|
791
893
|
}];
|
|
792
894
|
readonly outputs: readonly [{
|
|
793
|
-
readonly
|
|
794
|
-
}];
|
|
795
|
-
readonly stateMutability: "view";
|
|
796
|
-
}, {
|
|
797
|
-
readonly type: "function";
|
|
798
|
-
readonly name: "getAgentDelegation";
|
|
799
|
-
readonly inputs: readonly [{
|
|
800
|
-
readonly name: "agentId";
|
|
801
|
-
readonly type: "uint256";
|
|
802
|
-
}];
|
|
803
|
-
readonly outputs: readonly [{
|
|
804
|
-
readonly name: "vexa";
|
|
895
|
+
readonly name: "multiplierBps";
|
|
805
896
|
readonly type: "uint256";
|
|
806
897
|
}, {
|
|
807
|
-
readonly name: "
|
|
808
|
-
readonly type: "
|
|
898
|
+
readonly name: "tierName";
|
|
899
|
+
readonly type: "string";
|
|
809
900
|
}];
|
|
810
901
|
readonly stateMutability: "view";
|
|
811
902
|
}, {
|
|
812
903
|
readonly type: "function";
|
|
813
|
-
readonly name: "
|
|
904
|
+
readonly name: "getEmergencyWithdrawPenalty";
|
|
814
905
|
readonly inputs: readonly [{
|
|
815
906
|
readonly name: "user";
|
|
816
907
|
readonly type: "address";
|
|
817
908
|
}];
|
|
818
909
|
readonly outputs: readonly [{
|
|
819
|
-
readonly name: "
|
|
910
|
+
readonly name: "penaltyBps";
|
|
820
911
|
readonly type: "uint256";
|
|
821
912
|
}];
|
|
822
913
|
readonly stateMutability: "view";
|
|
823
914
|
}, {
|
|
824
915
|
readonly type: "function";
|
|
825
|
-
readonly name: "
|
|
826
|
-
readonly inputs: readonly [];
|
|
827
|
-
readonly outputs: readonly [{
|
|
828
|
-
readonly type: "address[]";
|
|
829
|
-
}];
|
|
830
|
-
readonly stateMutability: "view";
|
|
831
|
-
}, {
|
|
832
|
-
readonly type: "function";
|
|
833
|
-
readonly name: "delegatedTo";
|
|
916
|
+
readonly name: "hasVaultAccess";
|
|
834
917
|
readonly inputs: readonly [{
|
|
835
918
|
readonly name: "user";
|
|
836
919
|
readonly type: "address";
|
|
837
920
|
}];
|
|
838
921
|
readonly outputs: readonly [{
|
|
839
|
-
readonly type: "
|
|
922
|
+
readonly type: "bool";
|
|
840
923
|
}];
|
|
841
924
|
readonly stateMutability: "view";
|
|
842
925
|
}, {
|
|
843
926
|
readonly type: "function";
|
|
844
|
-
readonly name: "
|
|
927
|
+
readonly name: "getUnlockedBalance";
|
|
845
928
|
readonly inputs: readonly [{
|
|
846
929
|
readonly name: "user";
|
|
847
930
|
readonly type: "address";
|
|
@@ -852,24 +935,10 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
852
935
|
readonly stateMutability: "view";
|
|
853
936
|
}, {
|
|
854
937
|
readonly type: "function";
|
|
855
|
-
readonly name: "
|
|
856
|
-
readonly inputs: readonly [
|
|
857
|
-
readonly name: "agentId";
|
|
858
|
-
readonly type: "uint256";
|
|
859
|
-
}];
|
|
860
|
-
readonly outputs: readonly [{
|
|
861
|
-
readonly type: "uint256";
|
|
862
|
-
}];
|
|
863
|
-
readonly stateMutability: "view";
|
|
864
|
-
}, {
|
|
865
|
-
readonly type: "function";
|
|
866
|
-
readonly name: "agentDelegatorCount";
|
|
867
|
-
readonly inputs: readonly [{
|
|
868
|
-
readonly name: "agentId";
|
|
869
|
-
readonly type: "uint256";
|
|
870
|
-
}];
|
|
938
|
+
readonly name: "getRewardTokens";
|
|
939
|
+
readonly inputs: readonly [];
|
|
871
940
|
readonly outputs: readonly [{
|
|
872
|
-
readonly type: "
|
|
941
|
+
readonly type: "address[]";
|
|
873
942
|
}];
|
|
874
943
|
readonly stateMutability: "view";
|
|
875
944
|
}, {
|
|
@@ -885,7 +954,7 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
885
954
|
readonly stateMutability: "view";
|
|
886
955
|
}, {
|
|
887
956
|
readonly type: "event";
|
|
888
|
-
readonly name: "
|
|
957
|
+
readonly name: "Deposited";
|
|
889
958
|
readonly inputs: readonly [{
|
|
890
959
|
readonly name: "user";
|
|
891
960
|
readonly type: "address";
|
|
@@ -895,21 +964,13 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
895
964
|
readonly type: "uint256";
|
|
896
965
|
readonly indexed: false;
|
|
897
966
|
}, {
|
|
898
|
-
readonly name: "
|
|
899
|
-
readonly type: "uint256";
|
|
900
|
-
readonly indexed: false;
|
|
901
|
-
}, {
|
|
902
|
-
readonly name: "unlockTime";
|
|
903
|
-
readonly type: "uint256";
|
|
904
|
-
readonly indexed: false;
|
|
905
|
-
}, {
|
|
906
|
-
readonly name: "vEXABalance";
|
|
967
|
+
readonly name: "totalDeposited";
|
|
907
968
|
readonly type: "uint256";
|
|
908
969
|
readonly indexed: false;
|
|
909
970
|
}];
|
|
910
971
|
}, {
|
|
911
972
|
readonly type: "event";
|
|
912
|
-
readonly name: "
|
|
973
|
+
readonly name: "Withdrawn";
|
|
913
974
|
readonly inputs: readonly [{
|
|
914
975
|
readonly name: "user";
|
|
915
976
|
readonly type: "address";
|
|
@@ -918,26 +979,38 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
918
979
|
readonly name: "amount";
|
|
919
980
|
readonly type: "uint256";
|
|
920
981
|
readonly indexed: false;
|
|
982
|
+
}, {
|
|
983
|
+
readonly name: "totalDeposited";
|
|
984
|
+
readonly type: "uint256";
|
|
985
|
+
readonly indexed: false;
|
|
921
986
|
}];
|
|
922
987
|
}, {
|
|
923
988
|
readonly type: "event";
|
|
924
|
-
readonly name: "
|
|
989
|
+
readonly name: "Locked";
|
|
925
990
|
readonly inputs: readonly [{
|
|
926
991
|
readonly name: "user";
|
|
927
992
|
readonly type: "address";
|
|
928
993
|
readonly indexed: true;
|
|
929
994
|
}, {
|
|
930
|
-
readonly name: "
|
|
995
|
+
readonly name: "amount";
|
|
931
996
|
readonly type: "uint256";
|
|
932
997
|
readonly indexed: false;
|
|
933
998
|
}, {
|
|
934
|
-
readonly name: "
|
|
999
|
+
readonly name: "lockDuration";
|
|
1000
|
+
readonly type: "uint256";
|
|
1001
|
+
readonly indexed: false;
|
|
1002
|
+
}, {
|
|
1003
|
+
readonly name: "unlockTime";
|
|
1004
|
+
readonly type: "uint256";
|
|
1005
|
+
readonly indexed: false;
|
|
1006
|
+
}, {
|
|
1007
|
+
readonly name: "vEXABalance";
|
|
935
1008
|
readonly type: "uint256";
|
|
936
1009
|
readonly indexed: false;
|
|
937
1010
|
}];
|
|
938
1011
|
}, {
|
|
939
1012
|
readonly type: "event";
|
|
940
|
-
readonly name: "
|
|
1013
|
+
readonly name: "Unlocked";
|
|
941
1014
|
readonly inputs: readonly [{
|
|
942
1015
|
readonly name: "user";
|
|
943
1016
|
readonly type: "address";
|
|
@@ -949,33 +1022,49 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
949
1022
|
}];
|
|
950
1023
|
}, {
|
|
951
1024
|
readonly type: "event";
|
|
952
|
-
readonly name: "
|
|
1025
|
+
readonly name: "EmergencyWithdrawal";
|
|
953
1026
|
readonly inputs: readonly [{
|
|
954
|
-
readonly name: "
|
|
1027
|
+
readonly name: "user";
|
|
955
1028
|
readonly type: "address";
|
|
956
1029
|
readonly indexed: true;
|
|
957
1030
|
}, {
|
|
958
|
-
readonly name: "
|
|
1031
|
+
readonly name: "returned";
|
|
959
1032
|
readonly type: "uint256";
|
|
960
|
-
readonly indexed:
|
|
1033
|
+
readonly indexed: false;
|
|
1034
|
+
}, {
|
|
1035
|
+
readonly name: "penalty";
|
|
1036
|
+
readonly type: "uint256";
|
|
1037
|
+
readonly indexed: false;
|
|
961
1038
|
}, {
|
|
962
|
-
readonly name: "
|
|
1039
|
+
readonly name: "penaltyBps";
|
|
963
1040
|
readonly type: "uint256";
|
|
964
1041
|
readonly indexed: false;
|
|
965
1042
|
}];
|
|
966
1043
|
}, {
|
|
967
1044
|
readonly type: "event";
|
|
968
|
-
readonly name: "
|
|
1045
|
+
readonly name: "LockExtended";
|
|
969
1046
|
readonly inputs: readonly [{
|
|
970
|
-
readonly name: "
|
|
1047
|
+
readonly name: "user";
|
|
971
1048
|
readonly type: "address";
|
|
972
1049
|
readonly indexed: true;
|
|
973
1050
|
}, {
|
|
974
|
-
readonly name: "
|
|
1051
|
+
readonly name: "newUnlockTime";
|
|
1052
|
+
readonly type: "uint256";
|
|
1053
|
+
readonly indexed: false;
|
|
1054
|
+
}, {
|
|
1055
|
+
readonly name: "newVeEXABalance";
|
|
975
1056
|
readonly type: "uint256";
|
|
1057
|
+
readonly indexed: false;
|
|
1058
|
+
}];
|
|
1059
|
+
}, {
|
|
1060
|
+
readonly type: "event";
|
|
1061
|
+
readonly name: "RewardsClaimed";
|
|
1062
|
+
readonly inputs: readonly [{
|
|
1063
|
+
readonly name: "user";
|
|
1064
|
+
readonly type: "address";
|
|
976
1065
|
readonly indexed: true;
|
|
977
1066
|
}, {
|
|
978
|
-
readonly name: "
|
|
1067
|
+
readonly name: "amount";
|
|
979
1068
|
readonly type: "uint256";
|
|
980
1069
|
readonly indexed: false;
|
|
981
1070
|
}];
|
|
@@ -997,16 +1086,29 @@ declare const EXAGENT_STAKING_ABI: readonly [{
|
|
|
997
1086
|
}];
|
|
998
1087
|
}];
|
|
999
1088
|
/**
|
|
1000
|
-
*
|
|
1089
|
+
* Deposit info for a user (Phase 1 — no lock)
|
|
1001
1090
|
*/
|
|
1002
|
-
interface
|
|
1003
|
-
/**
|
|
1091
|
+
interface DepositInfo {
|
|
1092
|
+
/** Total EXA deposited (locked + unlocked) */
|
|
1093
|
+
deposited: bigint;
|
|
1094
|
+
/** EXA currently locked */
|
|
1095
|
+
locked: bigint;
|
|
1096
|
+
/** EXA available for withdrawal or locking */
|
|
1097
|
+
unlocked: bigint;
|
|
1098
|
+
/** Whether user has vault access (meets deposit threshold) */
|
|
1099
|
+
hasVaultAccess: boolean;
|
|
1100
|
+
}
|
|
1101
|
+
/**
|
|
1102
|
+
* Lock info for a user (Phase 2)
|
|
1103
|
+
*/
|
|
1104
|
+
interface LockInfo {
|
|
1105
|
+
/** Amount of EXA locked */
|
|
1004
1106
|
amount: bigint;
|
|
1005
|
-
/** Timestamp when
|
|
1107
|
+
/** Timestamp when lock expires */
|
|
1006
1108
|
unlockTime: bigint;
|
|
1007
1109
|
/** Original lock duration in seconds */
|
|
1008
1110
|
lockDuration: bigint;
|
|
1009
|
-
/** vEXA balance at
|
|
1111
|
+
/** vEXA balance at lock time (before time decay) */
|
|
1010
1112
|
vEXABalance: bigint;
|
|
1011
1113
|
/** Current vEXA balance (with time decay applied) */
|
|
1012
1114
|
currentVeEXA: bigint;
|
|
@@ -1016,29 +1118,32 @@ interface StakingInfo {
|
|
|
1016
1118
|
remainingLockTime: bigint;
|
|
1017
1119
|
}
|
|
1018
1120
|
/**
|
|
1019
|
-
*
|
|
1121
|
+
* Combined staking info (deposit + lock)
|
|
1020
1122
|
*/
|
|
1021
|
-
interface
|
|
1022
|
-
/**
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
|
|
1123
|
+
interface StakingInfo {
|
|
1124
|
+
/** Deposit phase info */
|
|
1125
|
+
deposit: DepositInfo;
|
|
1126
|
+
/** Lock phase info (null if no active lock) */
|
|
1127
|
+
lock: LockInfo | null;
|
|
1026
1128
|
}
|
|
1027
1129
|
/**
|
|
1028
|
-
*
|
|
1130
|
+
* Earnings tier info from the mainnet staking contract
|
|
1029
1131
|
*/
|
|
1030
|
-
|
|
1031
|
-
/**
|
|
1032
|
-
|
|
1033
|
-
*/
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
readonly bronze: 1000;
|
|
1037
|
-
readonly silver: 2500;
|
|
1038
|
-
readonly gold: 5000;
|
|
1039
|
-
};
|
|
1132
|
+
interface EarningsTierInfo {
|
|
1133
|
+
/** Earnings multiplier in basis points (e.g. 10000 = 1x, 25000 = 2.5x) */
|
|
1134
|
+
multiplierBps: bigint;
|
|
1135
|
+
/** Tier name: None, Bronze, Silver, Gold, Platinum, Diamond */
|
|
1136
|
+
tierName: string;
|
|
1137
|
+
}
|
|
1040
1138
|
/**
|
|
1041
|
-
* ExagentStaking SDK
|
|
1139
|
+
* ExagentStaking SDK — Two-Phase Staking: Deposit for Vault Access, Lock for vEXA + Rewards
|
|
1140
|
+
*
|
|
1141
|
+
* Phase 1: deposit() → withdraw()
|
|
1142
|
+
* Deposit EXA to get vault access. No lock, no vEXA, no rewards. Instant withdraw.
|
|
1143
|
+
*
|
|
1144
|
+
* Phase 2: lock() → unlock() / emergencyWithdraw()
|
|
1145
|
+
* Lock deposited EXA for vEXA voting power and tiered earnings.
|
|
1146
|
+
* unlock() after expiry (0% penalty). emergencyWithdraw() before expiry (50%→20% penalty).
|
|
1042
1147
|
*/
|
|
1043
1148
|
declare class ExagentStaking {
|
|
1044
1149
|
readonly address: Address;
|
|
@@ -1048,33 +1153,58 @@ declare class ExagentStaking {
|
|
|
1048
1153
|
private readonly account?;
|
|
1049
1154
|
constructor(stakingAddress: Address, publicClient: any, walletClient?: any, chain?: Chain, account?: Account);
|
|
1050
1155
|
/**
|
|
1051
|
-
*
|
|
1052
|
-
* @param amount Amount of EXA to
|
|
1053
|
-
* @param lockDuration Lock duration in seconds (30 days to 2 years)
|
|
1156
|
+
* Deposit EXA tokens for vault access (no lock required)
|
|
1157
|
+
* @param amount Amount of EXA to deposit (in wei)
|
|
1054
1158
|
* @returns Transaction hash
|
|
1055
1159
|
*
|
|
1056
1160
|
* @example
|
|
1057
1161
|
* ```typescript
|
|
1058
|
-
* //
|
|
1059
|
-
* const tx = await staking.
|
|
1060
|
-
* parseEther('1000'),
|
|
1061
|
-
* BigInt(180 * 24 * 60 * 60) // 180 days in seconds
|
|
1062
|
-
* );
|
|
1162
|
+
* // Deposit 1000 EXA to unlock vault access
|
|
1163
|
+
* const tx = await staking.deposit(parseEther('1000'));
|
|
1063
1164
|
* ```
|
|
1064
1165
|
*/
|
|
1065
|
-
|
|
1166
|
+
deposit(amount: bigint): Promise<Hash>;
|
|
1066
1167
|
/**
|
|
1067
|
-
*
|
|
1168
|
+
* Withdraw unlocked EXA tokens (instant, no penalty)
|
|
1169
|
+
* @param amount Amount of EXA to withdraw (in wei)
|
|
1068
1170
|
* @returns Transaction hash
|
|
1069
|
-
* @throws Error if lock has not expired
|
|
1070
1171
|
*/
|
|
1071
|
-
|
|
1172
|
+
withdraw(amount: bigint): Promise<Hash>;
|
|
1173
|
+
/**
|
|
1174
|
+
* Lock deposited EXA to receive vEXA voting power and earn rewards
|
|
1175
|
+
* @param amount Amount of deposited EXA to lock (in wei)
|
|
1176
|
+
* @param lockDuration Lock duration in seconds (30 days to 2 years)
|
|
1177
|
+
* @returns Transaction hash
|
|
1178
|
+
*
|
|
1179
|
+
* @example
|
|
1180
|
+
* ```typescript
|
|
1181
|
+
* // Lock 1000 EXA for 6 months
|
|
1182
|
+
* const tx = await staking.lock(
|
|
1183
|
+
* parseEther('1000'),
|
|
1184
|
+
* ExagentStaking.LOCK_6_MONTHS
|
|
1185
|
+
* );
|
|
1186
|
+
* ```
|
|
1187
|
+
*/
|
|
1188
|
+
lock(amount: bigint, lockDuration: bigint): Promise<Hash>;
|
|
1072
1189
|
/**
|
|
1073
1190
|
* Extend lock duration for additional voting power
|
|
1074
1191
|
* @param newLockDuration New lock duration in seconds (must be longer than remaining)
|
|
1075
1192
|
* @returns Transaction hash
|
|
1076
1193
|
*/
|
|
1077
1194
|
extendLock(newLockDuration: bigint): Promise<Hash>;
|
|
1195
|
+
/**
|
|
1196
|
+
* Unlock EXA after lock expires (normal path — no penalty)
|
|
1197
|
+
* Returns locked amount to unlocked deposited balance.
|
|
1198
|
+
* @returns Transaction hash
|
|
1199
|
+
*/
|
|
1200
|
+
unlock(): Promise<Hash>;
|
|
1201
|
+
/**
|
|
1202
|
+
* Emergency withdrawal — instant exit from lock with graduated penalty
|
|
1203
|
+
* Two-phase penalty: 50%→20% over the first quarter of the lock, then flat 20% until expiry.
|
|
1204
|
+
* Penalty goes to treasury. Remaining returns to unlocked deposit balance.
|
|
1205
|
+
* @returns Transaction hash
|
|
1206
|
+
*/
|
|
1207
|
+
emergencyWithdraw(): Promise<Hash>;
|
|
1078
1208
|
/**
|
|
1079
1209
|
* Claim accumulated EXA rewards
|
|
1080
1210
|
* @returns Transaction hash
|
|
@@ -1092,28 +1222,17 @@ declare class ExagentStaking {
|
|
|
1092
1222
|
*/
|
|
1093
1223
|
claimRewardsToken(token: Address): Promise<Hash>;
|
|
1094
1224
|
/**
|
|
1095
|
-
*
|
|
1096
|
-
* @param
|
|
1097
|
-
* @returns
|
|
1098
|
-
*/
|
|
1099
|
-
delegate(agentId: bigint): Promise<Hash>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Remove delegation from current agent
|
|
1102
|
-
* @returns Transaction hash
|
|
1103
|
-
*/
|
|
1104
|
-
undelegate(): Promise<Hash>;
|
|
1105
|
-
/**
|
|
1106
|
-
* Re-delegate to a different agent (undelegate + delegate in one tx)
|
|
1107
|
-
* @param newAgentId The new agent ID to delegate to
|
|
1108
|
-
* @returns Transaction hash
|
|
1225
|
+
* Get comprehensive staking info for a user (deposit + lock)
|
|
1226
|
+
* @param userAddress Address to check (defaults to connected wallet)
|
|
1227
|
+
* @returns Combined staking info
|
|
1109
1228
|
*/
|
|
1110
|
-
|
|
1229
|
+
getStakingInfo(userAddress?: Address): Promise<StakingInfo>;
|
|
1111
1230
|
/**
|
|
1112
|
-
* Get
|
|
1231
|
+
* Get deposit info for a user
|
|
1113
1232
|
* @param userAddress Address to check (defaults to connected wallet)
|
|
1114
|
-
* @returns
|
|
1233
|
+
* @returns Deposit info
|
|
1115
1234
|
*/
|
|
1116
|
-
|
|
1235
|
+
getDepositInfo(userAddress?: Address): Promise<DepositInfo>;
|
|
1117
1236
|
/**
|
|
1118
1237
|
* Get current vEXA balance (with time decay applied)
|
|
1119
1238
|
* @param userAddress Address to check (defaults to connected wallet)
|
|
@@ -1121,26 +1240,29 @@ declare class ExagentStaking {
|
|
|
1121
1240
|
*/
|
|
1122
1241
|
getVeEXABalance(userAddress?: Address): Promise<bigint>;
|
|
1123
1242
|
/**
|
|
1124
|
-
* Get
|
|
1243
|
+
* Get effective vEXA (with tier multiplier applied)
|
|
1125
1244
|
* @param userAddress Address to check (defaults to connected wallet)
|
|
1126
|
-
* @returns
|
|
1245
|
+
* @returns Effective vEXA balance
|
|
1127
1246
|
*/
|
|
1128
|
-
|
|
1247
|
+
getEffectiveVeEXA(userAddress?: Address): Promise<bigint>;
|
|
1129
1248
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
* @param
|
|
1132
|
-
* @returns
|
|
1249
|
+
* Check if user has vault access (meets deposit threshold)
|
|
1250
|
+
* @param userAddress Address to check (defaults to connected wallet)
|
|
1251
|
+
* @returns True if user can access vaults
|
|
1133
1252
|
*/
|
|
1134
|
-
|
|
1253
|
+
hasVaultAccess(userAddress?: Address): Promise<boolean>;
|
|
1135
1254
|
/**
|
|
1136
|
-
* Get
|
|
1255
|
+
* Get earnings tier for a user (Bronze/Silver/Gold/Platinum/Diamond)
|
|
1137
1256
|
* @param userAddress Address to check (defaults to connected wallet)
|
|
1138
|
-
* @returns
|
|
1257
|
+
* @returns Tier info with multiplier and name
|
|
1139
1258
|
*/
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1259
|
+
getEarningsTier(userAddress?: Address): Promise<EarningsTierInfo>;
|
|
1260
|
+
/**
|
|
1261
|
+
* Get current emergency withdrawal penalty for a user
|
|
1262
|
+
* @param userAddress Address to check (defaults to connected wallet)
|
|
1263
|
+
* @returns Penalty in basis points (5000 = 50% at lock start, ramps to 2000 over first 25% of lock, then flat 2000)
|
|
1264
|
+
*/
|
|
1265
|
+
getEmergencyWithdrawPenalty(userAddress?: Address): Promise<bigint>;
|
|
1144
1266
|
/**
|
|
1145
1267
|
* Get pending EXA rewards for a user
|
|
1146
1268
|
* @param userAddress Address to check (defaults to connected wallet)
|
|
@@ -1166,18 +1288,23 @@ declare class ExagentStaking {
|
|
|
1166
1288
|
*/
|
|
1167
1289
|
isRewardToken(token: Address): Promise<boolean>;
|
|
1168
1290
|
/**
|
|
1169
|
-
* Get total
|
|
1170
|
-
* @returns Total
|
|
1291
|
+
* Get total EXA deposited across all users
|
|
1292
|
+
* @returns Total deposited amount in wei
|
|
1293
|
+
*/
|
|
1294
|
+
getTotalDeposited(): Promise<bigint>;
|
|
1295
|
+
/**
|
|
1296
|
+
* Get total EXA locked across all users
|
|
1297
|
+
* @returns Total locked amount in wei
|
|
1171
1298
|
*/
|
|
1172
|
-
|
|
1299
|
+
getTotalLocked(): Promise<bigint>;
|
|
1173
1300
|
/**
|
|
1174
1301
|
* Get total vEXA supply across all users
|
|
1175
1302
|
* @returns Total vEXA supply
|
|
1176
1303
|
*/
|
|
1177
1304
|
getTotalVeEXA(): Promise<bigint>;
|
|
1178
1305
|
/**
|
|
1179
|
-
* Calculate vEXA balance for a given
|
|
1180
|
-
* @param amount Amount of EXA to
|
|
1306
|
+
* Calculate vEXA balance for a given lock (preview)
|
|
1307
|
+
* @param amount Amount of EXA to lock
|
|
1181
1308
|
* @param lockDuration Lock duration in seconds
|
|
1182
1309
|
* @returns Expected vEXA balance
|
|
1183
1310
|
*/
|
|
@@ -1188,7 +1315,7 @@ declare class ExagentStaking {
|
|
|
1188
1315
|
*/
|
|
1189
1316
|
getExaTokenAddress(): Promise<Address>;
|
|
1190
1317
|
/**
|
|
1191
|
-
* Approve EXA token spending for
|
|
1318
|
+
* Approve EXA token spending for deposits
|
|
1192
1319
|
* @param amount Amount to approve
|
|
1193
1320
|
* @returns Transaction hash
|
|
1194
1321
|
*/
|
|
@@ -1209,6 +1336,8 @@ declare class ExagentStaking {
|
|
|
1209
1336
|
static readonly LOCK_2_YEARS: bigint;
|
|
1210
1337
|
}
|
|
1211
1338
|
|
|
1339
|
+
/** SDK version — sent to API for version gating */
|
|
1340
|
+
declare const SDK_VERSION = "0.1.4";
|
|
1212
1341
|
declare const CHAIN_CONFIG: {
|
|
1213
1342
|
readonly mainnet: {
|
|
1214
1343
|
blockExplorers: {
|
|
@@ -1604,7 +1733,13 @@ declare const CHAIN_CONFIG: {
|
|
|
1604
1733
|
formatters: {
|
|
1605
1734
|
readonly block: {
|
|
1606
1735
|
exclude: [] | undefined;
|
|
1607
|
-
format: (args: viem_chains.OpStackRpcBlock, action
|
|
1736
|
+
format: (args: viem_chains.OpStackRpcBlock, action
|
|
1737
|
+
/**
|
|
1738
|
+
* Validate that contract addresses are set for the given network.
|
|
1739
|
+
* Throws if mainnet addresses are all zero (not yet deployed).
|
|
1740
|
+
*/
|
|
1741
|
+
/** Phase 1 contracts — must be deployed on mainnet */
|
|
1742
|
+
?: string | undefined) => {
|
|
1608
1743
|
baseFeePerGas: bigint | null;
|
|
1609
1744
|
blobGasUsed: bigint;
|
|
1610
1745
|
difficulty: bigint;
|
|
@@ -1882,8 +2017,8 @@ declare const ZERO_X_CONFIG: {
|
|
|
1882
2017
|
* Exagent API configuration
|
|
1883
2018
|
*/
|
|
1884
2019
|
declare const EXAGENT_API_CONFIG: {
|
|
1885
|
-
readonly mainnet: "https://api.
|
|
1886
|
-
readonly testnet: "https://api.
|
|
2020
|
+
readonly mainnet: "https://exagent-api.onrender.com";
|
|
2021
|
+
readonly testnet: "https://exagent-api.onrender.com";
|
|
1887
2022
|
};
|
|
1888
2023
|
|
|
1889
2024
|
/**
|
|
@@ -1920,13 +2055,14 @@ interface ExagentClientConfig {
|
|
|
1920
2055
|
* capabilities: ['spot_trading'],
|
|
1921
2056
|
* });
|
|
1922
2057
|
*
|
|
1923
|
-
* // Execute trade
|
|
1924
|
-
* const
|
|
2058
|
+
* // Execute trade (always through ExagentRouter for attribution + fees)
|
|
2059
|
+
* const result = await exagent.trade({
|
|
1925
2060
|
* tokenIn: WETH,
|
|
1926
2061
|
* tokenOut: USDC,
|
|
1927
2062
|
* amountIn: parseEther('1'),
|
|
2063
|
+
* maxSlippageBps: 50,
|
|
1928
2064
|
* });
|
|
1929
|
-
*
|
|
2065
|
+
* console.log('Trade submitted:', result.hash);
|
|
1930
2066
|
* ```
|
|
1931
2067
|
*/
|
|
1932
2068
|
declare class ExagentClient {
|
|
@@ -1939,6 +2075,8 @@ declare class ExagentClient {
|
|
|
1939
2075
|
readonly staking: ExagentStaking;
|
|
1940
2076
|
private _agentId?;
|
|
1941
2077
|
constructor(config: ExagentClientConfig);
|
|
2078
|
+
/** Standard headers for all API requests (includes SDK version for gating) */
|
|
2079
|
+
private apiHeaders;
|
|
1942
2080
|
/**
|
|
1943
2081
|
* Register as a new agent on Exagent
|
|
1944
2082
|
* @param metadata Agent metadata (will be uploaded to IPFS)
|
|
@@ -1970,50 +2108,25 @@ declare class ExagentClient {
|
|
|
1970
2108
|
/**
|
|
1971
2109
|
* Link an additional wallet to this agent
|
|
1972
2110
|
* @param wallet Wallet address to link
|
|
1973
|
-
* @param signMessage Function to sign
|
|
2111
|
+
* @param signMessage Function to sign the message hash with the wallet (use signMessage({ raw: hash }))
|
|
1974
2112
|
*/
|
|
1975
|
-
linkWallet(wallet: Address, signMessage: (message:
|
|
2113
|
+
linkWallet(wallet: Address, signMessage: (message: {
|
|
2114
|
+
raw: `0x${string}`;
|
|
2115
|
+
}) => Promise<`0x${string}`>): Promise<Hash>;
|
|
1976
2116
|
/**
|
|
1977
2117
|
* Get all wallets linked to this agent
|
|
1978
2118
|
*/
|
|
1979
2119
|
getLinkedWallets(): Promise<Address[]>;
|
|
1980
2120
|
/**
|
|
1981
|
-
*
|
|
1982
|
-
*
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
*
|
|
1987
|
-
|
|
1988
|
-
getPrice(tokenIn: Address, tokenOut: Address, amountIn: bigint): Promise<PriceQuote>;
|
|
1989
|
-
/**
|
|
1990
|
-
* Execute a trade using a pre-fetched route
|
|
1991
|
-
* @param route Route quote from getRoute()
|
|
1992
|
-
* @param options Trade execution options
|
|
1993
|
-
* @returns Transaction hash
|
|
1994
|
-
*/
|
|
1995
|
-
executeTrade(route: RouteQuote, options?: {
|
|
1996
|
-
validateSlippage?: boolean;
|
|
1997
|
-
}): Promise<Hash>;
|
|
1998
|
-
/**
|
|
1999
|
-
* Get and execute a trade in one call
|
|
2000
|
-
* Convenience method that fetches route and executes
|
|
2001
|
-
*/
|
|
2002
|
-
swap(intent: TradeIntent): Promise<{
|
|
2003
|
-
hash: Hash;
|
|
2004
|
-
route: RouteQuote;
|
|
2005
|
-
}>;
|
|
2006
|
-
/**
|
|
2007
|
-
* Broadcast a trade intent to the network
|
|
2008
|
-
* Other agents can see this and potentially provide better execution
|
|
2009
|
-
*/
|
|
2010
|
-
broadcastIntent(intent: TradeIntent): Promise<void>;
|
|
2011
|
-
/**
|
|
2012
|
-
* Execute a trade through ExagentRouter for full attribution
|
|
2121
|
+
* Execute a trade through ExagentRouter
|
|
2122
|
+
*
|
|
2123
|
+
* All trades MUST go through the ExagentRouter. This ensures:
|
|
2124
|
+
* - Trade attribution for leaderboard ranking
|
|
2125
|
+
* - Protocol fee collection (0.2%)
|
|
2126
|
+
* - On-chain performance tracking
|
|
2127
|
+
* - Token whitelist enforcement per risk universe
|
|
2013
2128
|
*
|
|
2014
|
-
*
|
|
2015
|
-
* the ExagentRouter emit TradeExecuted events that are captured by the indexer
|
|
2016
|
-
* for accurate performance tracking and rankings.
|
|
2129
|
+
* There is no way to trade outside the router. This is by design.
|
|
2017
2130
|
*
|
|
2018
2131
|
* @param intent Trade parameters
|
|
2019
2132
|
* @returns Trade result with transaction hash
|
|
@@ -2112,48 +2225,79 @@ declare class ExagentClient {
|
|
|
2112
2225
|
*/
|
|
2113
2226
|
redeemFromVault(vaultAddress: Address, shares: bigint): Promise<Hash>;
|
|
2114
2227
|
/**
|
|
2115
|
-
*
|
|
2116
|
-
* @param amount Amount of EXA to
|
|
2228
|
+
* Deposit EXA tokens for vault access (no lock required)
|
|
2229
|
+
* @param amount Amount of EXA to deposit (in wei)
|
|
2230
|
+
* @returns Transaction hash
|
|
2231
|
+
*
|
|
2232
|
+
* @example
|
|
2233
|
+
* ```typescript
|
|
2234
|
+
* // Deposit 1000 EXA to unlock vault access
|
|
2235
|
+
* const tx = await exagent.depositExa(parseEther('1000'));
|
|
2236
|
+
* ```
|
|
2237
|
+
*/
|
|
2238
|
+
depositExa(amount: bigint): Promise<Hash>;
|
|
2239
|
+
/**
|
|
2240
|
+
* Withdraw unlocked EXA tokens (instant, no penalty)
|
|
2241
|
+
* @param amount Amount of EXA to withdraw (in wei)
|
|
2242
|
+
* @returns Transaction hash
|
|
2243
|
+
*/
|
|
2244
|
+
withdrawExa(amount: bigint): Promise<Hash>;
|
|
2245
|
+
/**
|
|
2246
|
+
* Lock deposited EXA to receive vEXA voting power and earn rewards
|
|
2247
|
+
* @param amount Amount of deposited EXA to lock (in wei)
|
|
2117
2248
|
* @param lockDuration Lock duration in seconds (30 days to 2 years)
|
|
2118
2249
|
* @returns Transaction hash
|
|
2119
2250
|
*
|
|
2120
2251
|
* @example
|
|
2121
2252
|
* ```typescript
|
|
2122
|
-
* //
|
|
2123
|
-
* const tx = await exagent.
|
|
2253
|
+
* // Lock 1000 EXA for 6 months
|
|
2254
|
+
* const tx = await exagent.lockExa(
|
|
2124
2255
|
* parseEther('1000'),
|
|
2125
2256
|
* ExagentStaking.LOCK_6_MONTHS
|
|
2126
2257
|
* );
|
|
2127
2258
|
* ```
|
|
2128
2259
|
*/
|
|
2129
|
-
|
|
2260
|
+
lockExa(amount: bigint, lockDuration: bigint): Promise<Hash>;
|
|
2130
2261
|
/**
|
|
2131
|
-
*
|
|
2262
|
+
* Unlock EXA after lock expires (no penalty)
|
|
2132
2263
|
* @returns Transaction hash
|
|
2133
2264
|
*/
|
|
2134
|
-
|
|
2265
|
+
unlockExa(): Promise<Hash>;
|
|
2135
2266
|
/**
|
|
2136
|
-
*
|
|
2137
|
-
* @returns
|
|
2267
|
+
* Emergency withdrawal from active lock (graduated 50%→20% penalty)
|
|
2268
|
+
* @returns Transaction hash
|
|
2269
|
+
*/
|
|
2270
|
+
emergencyWithdrawExa(): Promise<Hash>;
|
|
2271
|
+
/**
|
|
2272
|
+
* Get comprehensive staking info (deposit + lock) for the connected wallet
|
|
2273
|
+
* @returns Staking info including deposit status and lock status
|
|
2138
2274
|
*/
|
|
2139
2275
|
getStakingInfo(): Promise<StakingInfo>;
|
|
2276
|
+
/**
|
|
2277
|
+
* Get deposit info for the connected wallet
|
|
2278
|
+
* @returns Deposit info (deposited, locked, unlocked, vault access)
|
|
2279
|
+
*/
|
|
2280
|
+
getDepositInfo(): Promise<DepositInfo>;
|
|
2140
2281
|
/**
|
|
2141
2282
|
* Get current vEXA balance for the connected wallet
|
|
2142
2283
|
* @returns Current vEXA balance (with time decay applied)
|
|
2143
2284
|
*/
|
|
2144
2285
|
getVeEXABalance(): Promise<bigint>;
|
|
2145
2286
|
/**
|
|
2146
|
-
*
|
|
2147
|
-
* @
|
|
2148
|
-
|
|
2287
|
+
* Check if connected wallet has vault access (meets deposit threshold)
|
|
2288
|
+
* @returns True if user can access vaults
|
|
2289
|
+
*/
|
|
2290
|
+
hasVaultAccess(): Promise<boolean>;
|
|
2291
|
+
/**
|
|
2292
|
+
* Get earnings tier for the connected wallet
|
|
2293
|
+
* @returns Tier info with multiplier and name
|
|
2149
2294
|
*/
|
|
2150
|
-
|
|
2295
|
+
getEarningsTier(): Promise<EarningsTierInfo>;
|
|
2151
2296
|
/**
|
|
2152
|
-
* Get
|
|
2153
|
-
* @
|
|
2154
|
-
* @returns Delegation info with total vEXA and delegator count
|
|
2297
|
+
* Get emergency withdrawal penalty for the connected wallet
|
|
2298
|
+
* @returns Penalty in basis points (5000 = 50% at start, 2000 = 20% near expiry)
|
|
2155
2299
|
*/
|
|
2156
|
-
|
|
2300
|
+
getEmergencyWithdrawPenalty(): Promise<bigint>;
|
|
2157
2301
|
/**
|
|
2158
2302
|
* Claim all pending staking rewards (EXA + multi-token)
|
|
2159
2303
|
* @returns Transaction hashes for EXA and multi-token claims
|
|
@@ -2162,6 +2306,33 @@ declare class ExagentClient {
|
|
|
2162
2306
|
exaRewards: Hash;
|
|
2163
2307
|
multiTokenRewards: Hash;
|
|
2164
2308
|
}>;
|
|
2309
|
+
/**
|
|
2310
|
+
* Get the ERC-8004 global agent identifier for the current agent
|
|
2311
|
+
*
|
|
2312
|
+
* Format: eip155:{chainId}:{registryAddress}:{agentId}
|
|
2313
|
+
*
|
|
2314
|
+
* This creates a universally unique identifier that can be used for
|
|
2315
|
+
* cross-protocol agent discovery and interoperability.
|
|
2316
|
+
*
|
|
2317
|
+
* @returns The global agent ID string
|
|
2318
|
+
* @throws Error if agent is not registered
|
|
2319
|
+
*
|
|
2320
|
+
* @example
|
|
2321
|
+
* ```typescript
|
|
2322
|
+
* const globalId = await exagent.getGlobalAgentId();
|
|
2323
|
+
* // => "eip155:8453:0xABC...DEF:42"
|
|
2324
|
+
* ```
|
|
2325
|
+
*/
|
|
2326
|
+
getGlobalAgentId(): Promise<GlobalAgentId>;
|
|
2327
|
+
/**
|
|
2328
|
+
* Build a global agent ID for any agent (static utility)
|
|
2329
|
+
*
|
|
2330
|
+
* @param chainId - EVM chain ID
|
|
2331
|
+
* @param registryAddress - ExagentRegistry contract address
|
|
2332
|
+
* @param agentId - On-chain agent ID
|
|
2333
|
+
* @returns ERC-8004 global agent identifier
|
|
2334
|
+
*/
|
|
2335
|
+
static buildGlobalAgentId(chainId: number, registryAddress: Address, agentId: number | bigint): GlobalAgentId;
|
|
2165
2336
|
/**
|
|
2166
2337
|
* Get the agent's wallet address
|
|
2167
2338
|
*/
|
|
@@ -2175,12 +2346,11 @@ declare class ExagentClient {
|
|
|
2175
2346
|
raw: `0x${string}`;
|
|
2176
2347
|
}): Promise<`0x${string}`>;
|
|
2177
2348
|
private uploadMetadata;
|
|
2178
|
-
private signIntent;
|
|
2179
2349
|
private parseAgentIdFromReceipt;
|
|
2180
2350
|
}
|
|
2181
2351
|
|
|
2182
2352
|
/**
|
|
2183
|
-
* ExagentVaultFactory ABI
|
|
2353
|
+
* ExagentVaultFactory ABI (Mainnet — no burn fee, seed-based creation)
|
|
2184
2354
|
*/
|
|
2185
2355
|
declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
2186
2356
|
readonly type: "function";
|
|
@@ -2208,7 +2378,31 @@ declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
|
2208
2378
|
readonly stateMutability: "view";
|
|
2209
2379
|
}, {
|
|
2210
2380
|
readonly type: "function";
|
|
2211
|
-
readonly name: "
|
|
2381
|
+
readonly name: "feeCollector";
|
|
2382
|
+
readonly inputs: readonly [];
|
|
2383
|
+
readonly outputs: readonly [{
|
|
2384
|
+
readonly type: "address";
|
|
2385
|
+
}];
|
|
2386
|
+
readonly stateMutability: "view";
|
|
2387
|
+
}, {
|
|
2388
|
+
readonly type: "function";
|
|
2389
|
+
readonly name: "stakingContract";
|
|
2390
|
+
readonly inputs: readonly [];
|
|
2391
|
+
readonly outputs: readonly [{
|
|
2392
|
+
readonly type: "address";
|
|
2393
|
+
}];
|
|
2394
|
+
readonly stateMutability: "view";
|
|
2395
|
+
}, {
|
|
2396
|
+
readonly type: "function";
|
|
2397
|
+
readonly name: "VERIFIED_VEXA_REQUIREMENT";
|
|
2398
|
+
readonly inputs: readonly [];
|
|
2399
|
+
readonly outputs: readonly [{
|
|
2400
|
+
readonly type: "uint256";
|
|
2401
|
+
}];
|
|
2402
|
+
readonly stateMutability: "view";
|
|
2403
|
+
}, {
|
|
2404
|
+
readonly type: "function";
|
|
2405
|
+
readonly name: "MIN_SEED_AMOUNT";
|
|
2212
2406
|
readonly inputs: readonly [];
|
|
2213
2407
|
readonly outputs: readonly [{
|
|
2214
2408
|
readonly type: "uint256";
|
|
@@ -2216,7 +2410,15 @@ declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
|
2216
2410
|
readonly stateMutability: "view";
|
|
2217
2411
|
}, {
|
|
2218
2412
|
readonly type: "function";
|
|
2219
|
-
readonly name: "
|
|
2413
|
+
readonly name: "UNVERIFIED_CAP_MULTIPLIER";
|
|
2414
|
+
readonly inputs: readonly [];
|
|
2415
|
+
readonly outputs: readonly [{
|
|
2416
|
+
readonly type: "uint256";
|
|
2417
|
+
}];
|
|
2418
|
+
readonly stateMutability: "view";
|
|
2419
|
+
}, {
|
|
2420
|
+
readonly type: "function";
|
|
2421
|
+
readonly name: "VERIFIED_CAP_MULTIPLIER";
|
|
2220
2422
|
readonly inputs: readonly [];
|
|
2221
2423
|
readonly outputs: readonly [{
|
|
2222
2424
|
readonly type: "uint256";
|
|
@@ -2275,20 +2477,17 @@ declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
|
2275
2477
|
readonly stateMutability: "view";
|
|
2276
2478
|
}, {
|
|
2277
2479
|
readonly type: "function";
|
|
2278
|
-
readonly name: "
|
|
2279
|
-
readonly inputs: readonly [
|
|
2280
|
-
|
|
2281
|
-
readonly name: "veXARequired";
|
|
2282
|
-
readonly type: "uint256";
|
|
2283
|
-
}, {
|
|
2284
|
-
readonly name: "burnFee";
|
|
2480
|
+
readonly name: "canCreateVerifiedVault";
|
|
2481
|
+
readonly inputs: readonly [{
|
|
2482
|
+
readonly name: "agentId";
|
|
2285
2483
|
readonly type: "uint256";
|
|
2484
|
+
}];
|
|
2485
|
+
readonly outputs: readonly [{
|
|
2486
|
+
readonly name: "isVerified";
|
|
2487
|
+
readonly type: "bool";
|
|
2286
2488
|
}, {
|
|
2287
|
-
readonly name: "
|
|
2288
|
-
readonly type: "
|
|
2289
|
-
}, {
|
|
2290
|
-
readonly name: "exaToken";
|
|
2291
|
-
readonly type: "address";
|
|
2489
|
+
readonly name: "reason";
|
|
2490
|
+
readonly type: "string";
|
|
2292
2491
|
}];
|
|
2293
2492
|
readonly stateMutability: "view";
|
|
2294
2493
|
}, {
|
|
@@ -2300,6 +2499,9 @@ declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
|
2300
2499
|
}, {
|
|
2301
2500
|
readonly name: "asset";
|
|
2302
2501
|
readonly type: "address";
|
|
2502
|
+
}, {
|
|
2503
|
+
readonly name: "seedAmount";
|
|
2504
|
+
readonly type: "uint256";
|
|
2303
2505
|
}, {
|
|
2304
2506
|
readonly name: "name";
|
|
2305
2507
|
readonly type: "string";
|
|
@@ -2356,15 +2558,14 @@ declare const EXAGENT_VAULT_FACTORY_ABI: readonly [{
|
|
|
2356
2558
|
}];
|
|
2357
2559
|
}];
|
|
2358
2560
|
/**
|
|
2359
|
-
* Vault creation requirements from the factory
|
|
2561
|
+
* Vault creation requirements from the mainnet factory
|
|
2360
2562
|
*/
|
|
2361
2563
|
interface VaultCreationRequirements {
|
|
2362
2564
|
veXARequired: bigint;
|
|
2363
|
-
|
|
2565
|
+
minSeedAmount: bigint;
|
|
2566
|
+
unverifiedCapMultiplier: bigint;
|
|
2567
|
+
verifiedCapMultiplier: bigint;
|
|
2364
2568
|
stakingContract: Address;
|
|
2365
|
-
exaToken: Address;
|
|
2366
|
-
/** Whether requirements are effectively bypassed (testnet mode) */
|
|
2367
|
-
isBypassed: boolean;
|
|
2368
2569
|
}
|
|
2369
2570
|
/**
|
|
2370
2571
|
* Result of checking if an address can create a vault
|
|
@@ -2379,6 +2580,7 @@ interface CanCreateVaultResult {
|
|
|
2379
2580
|
interface CreateVaultOptions {
|
|
2380
2581
|
agentId: bigint;
|
|
2381
2582
|
asset: Address;
|
|
2583
|
+
seedAmount: bigint;
|
|
2382
2584
|
name: string;
|
|
2383
2585
|
symbol: string;
|
|
2384
2586
|
feeRecipient?: Address;
|
|
@@ -2394,7 +2596,7 @@ declare class ExagentVaultFactory {
|
|
|
2394
2596
|
private readonly account?;
|
|
2395
2597
|
constructor(factoryAddress: Address, publicClient: any, walletClient?: any, chain?: Chain, account?: Account);
|
|
2396
2598
|
/**
|
|
2397
|
-
* Get vault creation requirements
|
|
2599
|
+
* Get vault creation requirements (mainnet: seed-based, no burn fee)
|
|
2398
2600
|
*/
|
|
2399
2601
|
getRequirements(): Promise<VaultCreationRequirements>;
|
|
2400
2602
|
/**
|
|
@@ -2402,6 +2604,14 @@ declare class ExagentVaultFactory {
|
|
|
2402
2604
|
* @param creator Address to check
|
|
2403
2605
|
*/
|
|
2404
2606
|
canCreateVault(creator: Address): Promise<CanCreateVaultResult>;
|
|
2607
|
+
/**
|
|
2608
|
+
* Check if an agent can create a verified vault (higher deposit cap)
|
|
2609
|
+
* @param agentId Agent ID to check
|
|
2610
|
+
*/
|
|
2611
|
+
canCreateVerifiedVault(agentId: bigint): Promise<{
|
|
2612
|
+
isVerified: boolean;
|
|
2613
|
+
reason: string;
|
|
2614
|
+
}>;
|
|
2405
2615
|
/**
|
|
2406
2616
|
* Check if an asset is whitelisted for vault creation
|
|
2407
2617
|
* @param asset Asset address to check
|
|
@@ -2426,8 +2636,8 @@ declare class ExagentVaultFactory {
|
|
|
2426
2636
|
*/
|
|
2427
2637
|
hasVault(agentId: bigint, asset: Address): Promise<boolean>;
|
|
2428
2638
|
/**
|
|
2429
|
-
* Create a new vault for an agent
|
|
2430
|
-
* @param options Vault creation options
|
|
2639
|
+
* Create a new vault for an agent (mainnet: requires seed amount)
|
|
2640
|
+
* @param options Vault creation options including seedAmount
|
|
2431
2641
|
* @returns Transaction hash
|
|
2432
2642
|
*/
|
|
2433
2643
|
createVault(options: CreateVaultOptions): Promise<Hash>;
|
|
@@ -2435,7 +2645,7 @@ declare class ExagentVaultFactory {
|
|
|
2435
2645
|
* Check all requirements and create a vault if possible
|
|
2436
2646
|
* Returns detailed status about each requirement
|
|
2437
2647
|
*/
|
|
2438
|
-
checkAndCreateVault(agentId: bigint, asset: Address, name: string, symbol: string, feeRecipient?: Address): Promise<{
|
|
2648
|
+
checkAndCreateVault(agentId: bigint, asset: Address, seedAmount: bigint, name: string, symbol: string, feeRecipient?: Address): Promise<{
|
|
2439
2649
|
success: boolean;
|
|
2440
2650
|
vaultAddress?: Address;
|
|
2441
2651
|
txHash?: Hash;
|
|
@@ -2465,4 +2675,4 @@ declare const TESTNET_ADDRESSES: {
|
|
|
2465
2675
|
readonly usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
|
|
2466
2676
|
};
|
|
2467
2677
|
|
|
2468
|
-
export { type AgentMetadata, type AgentProfile,
|
|
2678
|
+
export { type AgentMetadata, type AgentProfile, type StakingInfo$1 as ApiStakingInfo, CHAIN_CONFIG, CONTRACT_ADDRESSES, type CanCreateVaultResult, type CreateVaultOptions, DEX_ADDRESSES, type DepositInfo, EXAGENT_API_CONFIG, EXAGENT_STAKING_ABI, EXAGENT_VAULT_FACTORY_ABI, type EarningsTierInfo, ExagentClient, type ExagentClientConfig, ExagentRegistry, ExagentStaking, ExagentVault, ExagentVaultFactory, type GlobalAgentId, type LockInfo, type NetworkType, type PerformanceSnapshot, type PriceQuote, type RouteQuote, type RouteStep, type RouterTradeResponse, SDK_VERSION, type ServiceRequest, type StakeInfo, type StakingInfo, TESTNET_ADDRESSES, type TradeIntent, type TradeResult, type UserVaultPosition, type VaultActivityEntry, type VaultConfig, type VaultCreationRequirements, type VaultInfo, type VaultPosition, type VaultSummary, type VaultTradeEntry, type WithdrawalRequest, ZERO_X_CONFIG, buildGlobalAgentId, parseGlobalAgentId };
|