@t2000/sdk 4.3.1 → 5.0.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.
@@ -1,134 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
2
- import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
-
4
- type AdapterCapability = 'save' | 'withdraw' | 'borrow' | 'repay';
5
- /**
6
- * Describes a protocol for indexer event classification.
7
- * Each adapter exports one of these so the server can auto-build
8
- * detection rules without manual sync.
9
- *
10
- * To add a new protocol: export a `descriptor` from your adapter file.
11
- */
12
- interface ProtocolDescriptor {
13
- /** Unique protocol ID — must match the adapter's `id` field */
14
- id: string;
15
- /** Human-readable name */
16
- name: string;
17
- /**
18
- * On-chain package IDs that identify this protocol's transactions.
19
- * For protocols with upgradeable packages, list the original/base package.
20
- */
21
- packages: string[];
22
- /**
23
- * Maps `module::function` patterns to action types.
24
- * The indexer matches Move call targets against these patterns.
25
- * For dynamic package IDs (e.g. NAVI), matching is done on module::function only.
26
- */
27
- actionMap: Record<string, string>;
28
- /**
29
- * If true, the indexer matches by module::function suffix only,
30
- * ignoring the package ID prefix. Use for protocols with frequently
31
- * upgraded (dynamic) package IDs.
32
- */
33
- dynamicPackageId?: boolean;
34
- }
35
- interface AdapterTxResult {
36
- tx: Transaction;
37
- feeCoin?: TransactionObjectArgument;
38
- meta?: Record<string, unknown>;
39
- }
40
- interface LendingRates {
41
- asset: string;
42
- saveApy: number;
43
- borrowApy: number;
44
- }
45
- interface AdapterPositions {
46
- supplies: Array<{
47
- asset: string;
48
- amount: number;
49
- amountUsd?: number;
50
- apy: number;
51
- }>;
52
- borrows: Array<{
53
- asset: string;
54
- amount: number;
55
- amountUsd?: number;
56
- apy: number;
57
- }>;
58
- }
59
- interface HealthInfo {
60
- healthFactor: number;
61
- supplied: number;
62
- borrowed: number;
63
- maxBorrow: number;
64
- liquidationThreshold: number;
65
- }
66
- interface LendingAdapter {
67
- readonly id: string;
68
- readonly name: string;
69
- readonly version: string;
70
- readonly capabilities: readonly AdapterCapability[];
71
- readonly supportedAssets: readonly string[];
72
- readonly supportsSameAssetBorrow: boolean;
73
- init(client: SuiJsonRpcClient): Promise<void>;
74
- getRates(asset: string): Promise<LendingRates>;
75
- getPositions(address: string): Promise<AdapterPositions>;
76
- getHealth(address: string): Promise<HealthInfo>;
77
- buildSaveTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
78
- buildWithdrawTx(address: string, amount: number, asset: string, options?: {
79
- skipPythUpdate?: boolean;
80
- }): Promise<AdapterTxResult & {
81
- effectiveAmount: number;
82
- }>;
83
- buildBorrowTx(address: string, amount: number, asset: string, options?: {
84
- skipPythUpdate?: boolean;
85
- }): Promise<AdapterTxResult>;
86
- buildRepayTx(address: string, amount: number, asset: string, options?: {
87
- skipOracle?: boolean;
88
- skipPythUpdate?: boolean;
89
- }): Promise<AdapterTxResult>;
90
- maxWithdraw(address: string, asset: string): Promise<{
91
- maxAmount: number;
92
- healthFactorAfter: number;
93
- currentHF: number;
94
- }>;
95
- maxBorrow(address: string, asset: string): Promise<{
96
- maxAmount: number;
97
- healthFactorAfter: number;
98
- currentHF: number;
99
- }>;
100
- addWithdrawToTx?(tx: Transaction, address: string, amount: number, asset: string, options?: {
101
- skipPythUpdate?: boolean;
102
- }): Promise<{
103
- coin: TransactionObjectArgument;
104
- effectiveAmount: number;
105
- }>;
106
- addSaveToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string): Promise<void>;
107
- /**
108
- * [B5 v2] Add a borrow to an existing PTB and return the borrowed coin
109
- * WITHOUT transferring it to the user. Lets consumer apps wedge a fee
110
- * transfer between the borrow and the user transfer (see
111
- * `audric/apps/web-v2/app/api/transactions/prepare/route.ts`).
112
- */
113
- addBorrowToTx?(tx: Transaction, address: string, amount: number, asset: string, options?: {
114
- skipPythUpdate?: boolean;
115
- }): Promise<TransactionObjectArgument>;
116
- addRepayToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
117
- skipPythUpdate?: boolean;
118
- }): Promise<void>;
119
- getPendingRewards?(address: string): Promise<PendingReward[]>;
120
- addClaimRewardsToTx?(tx: Transaction, address: string): Promise<PendingReward[]>;
121
- }
122
- interface PendingReward {
123
- protocol: string;
124
- asset: string;
125
- coinType: string;
126
- symbol: string;
127
- amount: number;
128
- estimatedValueUsd: number;
129
- }
130
-
131
- declare const naviDescriptor: ProtocolDescriptor;
132
- declare const allDescriptors: ProtocolDescriptor[];
133
-
134
- export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type PendingReward as P, type LendingRates as a, type AdapterPositions as b, type AdapterTxResult as c, type ProtocolDescriptor as d, allDescriptors as e, naviDescriptor as n };
@@ -1,134 +0,0 @@
1
- import { Transaction, TransactionObjectArgument } from '@mysten/sui/transactions';
2
- import { SuiJsonRpcClient } from '@mysten/sui/jsonRpc';
3
-
4
- type AdapterCapability = 'save' | 'withdraw' | 'borrow' | 'repay';
5
- /**
6
- * Describes a protocol for indexer event classification.
7
- * Each adapter exports one of these so the server can auto-build
8
- * detection rules without manual sync.
9
- *
10
- * To add a new protocol: export a `descriptor` from your adapter file.
11
- */
12
- interface ProtocolDescriptor {
13
- /** Unique protocol ID — must match the adapter's `id` field */
14
- id: string;
15
- /** Human-readable name */
16
- name: string;
17
- /**
18
- * On-chain package IDs that identify this protocol's transactions.
19
- * For protocols with upgradeable packages, list the original/base package.
20
- */
21
- packages: string[];
22
- /**
23
- * Maps `module::function` patterns to action types.
24
- * The indexer matches Move call targets against these patterns.
25
- * For dynamic package IDs (e.g. NAVI), matching is done on module::function only.
26
- */
27
- actionMap: Record<string, string>;
28
- /**
29
- * If true, the indexer matches by module::function suffix only,
30
- * ignoring the package ID prefix. Use for protocols with frequently
31
- * upgraded (dynamic) package IDs.
32
- */
33
- dynamicPackageId?: boolean;
34
- }
35
- interface AdapterTxResult {
36
- tx: Transaction;
37
- feeCoin?: TransactionObjectArgument;
38
- meta?: Record<string, unknown>;
39
- }
40
- interface LendingRates {
41
- asset: string;
42
- saveApy: number;
43
- borrowApy: number;
44
- }
45
- interface AdapterPositions {
46
- supplies: Array<{
47
- asset: string;
48
- amount: number;
49
- amountUsd?: number;
50
- apy: number;
51
- }>;
52
- borrows: Array<{
53
- asset: string;
54
- amount: number;
55
- amountUsd?: number;
56
- apy: number;
57
- }>;
58
- }
59
- interface HealthInfo {
60
- healthFactor: number;
61
- supplied: number;
62
- borrowed: number;
63
- maxBorrow: number;
64
- liquidationThreshold: number;
65
- }
66
- interface LendingAdapter {
67
- readonly id: string;
68
- readonly name: string;
69
- readonly version: string;
70
- readonly capabilities: readonly AdapterCapability[];
71
- readonly supportedAssets: readonly string[];
72
- readonly supportsSameAssetBorrow: boolean;
73
- init(client: SuiJsonRpcClient): Promise<void>;
74
- getRates(asset: string): Promise<LendingRates>;
75
- getPositions(address: string): Promise<AdapterPositions>;
76
- getHealth(address: string): Promise<HealthInfo>;
77
- buildSaveTx(address: string, amount: number, asset: string): Promise<AdapterTxResult>;
78
- buildWithdrawTx(address: string, amount: number, asset: string, options?: {
79
- skipPythUpdate?: boolean;
80
- }): Promise<AdapterTxResult & {
81
- effectiveAmount: number;
82
- }>;
83
- buildBorrowTx(address: string, amount: number, asset: string, options?: {
84
- skipPythUpdate?: boolean;
85
- }): Promise<AdapterTxResult>;
86
- buildRepayTx(address: string, amount: number, asset: string, options?: {
87
- skipOracle?: boolean;
88
- skipPythUpdate?: boolean;
89
- }): Promise<AdapterTxResult>;
90
- maxWithdraw(address: string, asset: string): Promise<{
91
- maxAmount: number;
92
- healthFactorAfter: number;
93
- currentHF: number;
94
- }>;
95
- maxBorrow(address: string, asset: string): Promise<{
96
- maxAmount: number;
97
- healthFactorAfter: number;
98
- currentHF: number;
99
- }>;
100
- addWithdrawToTx?(tx: Transaction, address: string, amount: number, asset: string, options?: {
101
- skipPythUpdate?: boolean;
102
- }): Promise<{
103
- coin: TransactionObjectArgument;
104
- effectiveAmount: number;
105
- }>;
106
- addSaveToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string): Promise<void>;
107
- /**
108
- * [B5 v2] Add a borrow to an existing PTB and return the borrowed coin
109
- * WITHOUT transferring it to the user. Lets consumer apps wedge a fee
110
- * transfer between the borrow and the user transfer (see
111
- * `audric/apps/web-v2/app/api/transactions/prepare/route.ts`).
112
- */
113
- addBorrowToTx?(tx: Transaction, address: string, amount: number, asset: string, options?: {
114
- skipPythUpdate?: boolean;
115
- }): Promise<TransactionObjectArgument>;
116
- addRepayToTx?(tx: Transaction, address: string, coin: TransactionObjectArgument, asset: string, options?: {
117
- skipPythUpdate?: boolean;
118
- }): Promise<void>;
119
- getPendingRewards?(address: string): Promise<PendingReward[]>;
120
- addClaimRewardsToTx?(tx: Transaction, address: string): Promise<PendingReward[]>;
121
- }
122
- interface PendingReward {
123
- protocol: string;
124
- asset: string;
125
- coinType: string;
126
- symbol: string;
127
- amount: number;
128
- estimatedValueUsd: number;
129
- }
130
-
131
- declare const naviDescriptor: ProtocolDescriptor;
132
- declare const allDescriptors: ProtocolDescriptor[];
133
-
134
- export { type AdapterCapability as A, type HealthInfo as H, type LendingAdapter as L, type PendingReward as P, type LendingRates as a, type AdapterPositions as b, type AdapterTxResult as c, type ProtocolDescriptor as d, allDescriptors as e, naviDescriptor as n };