voidai-sdk 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +360 -36
- package/dist/api/client.d.ts +65 -3
- package/dist/api/client.js +270 -12
- package/dist/config.d.ts +12 -2
- package/dist/config.js +12 -5
- package/dist/core/bridge.d.ts +29 -0
- package/dist/core/bridge.js +115 -0
- package/dist/index.d.ts +31 -3
- package/dist/index.js +29 -4
- package/dist/types/index.d.ts +167 -4
- package/dist-browser/voidai-sdk.js +1 -1
- package/dist-browser/voidai-sdk.js.LICENSE.txt +4 -0
- package/package.json +2 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
export type Environment = 'development' | 'production' | 'staging';
|
|
2
|
+
/**
|
|
3
|
+
* Options for BridgeSDK (frontend usage).
|
|
4
|
+
* Use apiKey only; secretKey is not supported for frontend.
|
|
5
|
+
*/
|
|
2
6
|
export interface BridgeSDKOptions {
|
|
3
7
|
apiKey: string;
|
|
4
8
|
environment?: Environment;
|
|
5
|
-
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Options for BridgeSDKServer (backend usage).
|
|
12
|
+
* Requires both apiKey and secretKey for JWT authentication.
|
|
13
|
+
*/
|
|
14
|
+
export interface BridgeSDKServerOptions {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
secretKey: string;
|
|
17
|
+
environment?: Environment;
|
|
6
18
|
}
|
|
7
19
|
export interface Chain {
|
|
8
20
|
id: number;
|
|
@@ -36,7 +48,7 @@ export interface Asset {
|
|
|
36
48
|
tokenName: string;
|
|
37
49
|
symbol: string;
|
|
38
50
|
decimal: number;
|
|
39
|
-
type: string;
|
|
51
|
+
type: string | null;
|
|
40
52
|
tokenPoolAddress: string;
|
|
41
53
|
tokenPoolType: string;
|
|
42
54
|
tokenAddress: string;
|
|
@@ -46,9 +58,160 @@ export interface Asset {
|
|
|
46
58
|
createdAt: string;
|
|
47
59
|
updatedAt: string;
|
|
48
60
|
}
|
|
61
|
+
export interface Pagination {
|
|
62
|
+
total: number;
|
|
63
|
+
page: number;
|
|
64
|
+
limit: number;
|
|
65
|
+
totalPages: number;
|
|
66
|
+
}
|
|
49
67
|
export interface ChainsApiResponse {
|
|
50
|
-
|
|
68
|
+
success: boolean;
|
|
69
|
+
message: string;
|
|
70
|
+
data: {
|
|
71
|
+
chains: Chain[];
|
|
72
|
+
};
|
|
51
73
|
}
|
|
52
74
|
export interface AssetsApiResponse {
|
|
53
|
-
|
|
75
|
+
success: boolean;
|
|
76
|
+
message: string;
|
|
77
|
+
data: {
|
|
78
|
+
assets: Asset[];
|
|
79
|
+
pagination: Pagination;
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export interface ApiKeyValidationData {
|
|
83
|
+
keyId: string;
|
|
84
|
+
tenantId: string;
|
|
85
|
+
name: string;
|
|
86
|
+
}
|
|
87
|
+
export interface ApiKeyValidationSuccessResponse {
|
|
88
|
+
success: true;
|
|
89
|
+
data: ApiKeyValidationData;
|
|
90
|
+
}
|
|
91
|
+
export interface ApiKeyValidationErrorResponse {
|
|
92
|
+
success: false;
|
|
93
|
+
error: {
|
|
94
|
+
code: string;
|
|
95
|
+
message: string;
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export type ApiKeyValidationResponse = ApiKeyValidationSuccessResponse | ApiKeyValidationErrorResponse;
|
|
99
|
+
export interface AuthLoginRequest {
|
|
100
|
+
apiKey: string;
|
|
101
|
+
secretKey?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface AuthLoginSuccessResponse {
|
|
104
|
+
success: true;
|
|
105
|
+
accessToken: string;
|
|
106
|
+
}
|
|
107
|
+
export interface AuthLoginErrorResponse {
|
|
108
|
+
success: false;
|
|
109
|
+
error?: {
|
|
110
|
+
code?: string;
|
|
111
|
+
message?: string;
|
|
112
|
+
};
|
|
113
|
+
message?: string;
|
|
114
|
+
}
|
|
115
|
+
export type AuthLoginResponse = AuthLoginSuccessResponse | AuthLoginErrorResponse;
|
|
116
|
+
export interface BridgeSwapRequest {
|
|
117
|
+
fromWallet: string;
|
|
118
|
+
toWallet: string;
|
|
119
|
+
fromToken: string;
|
|
120
|
+
toToken: string;
|
|
121
|
+
fromChain: string;
|
|
122
|
+
toChain: string;
|
|
123
|
+
amount: number;
|
|
124
|
+
subnetId?: number;
|
|
125
|
+
}
|
|
126
|
+
export interface BridgeSwapResponseBase {
|
|
127
|
+
identifier: string;
|
|
128
|
+
}
|
|
129
|
+
export interface BridgeSwapResponseWithEncodedData extends BridgeSwapResponseBase {
|
|
130
|
+
encodedData: string;
|
|
131
|
+
signature: string;
|
|
132
|
+
/**
|
|
133
|
+
* Optional helper payload prepared by the SDK for
|
|
134
|
+
* EVM burn transactions (wTAO/wALPHA -> TAO/ALPHA).
|
|
135
|
+
* Frontends can pass this directly to wallet providers.
|
|
136
|
+
*/
|
|
137
|
+
evmTransaction?: {
|
|
138
|
+
to: string;
|
|
139
|
+
data: string;
|
|
140
|
+
value: string;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
export interface BridgeSwapResponseWithSubnet extends BridgeSwapResponseBase {
|
|
144
|
+
subnetDestinationHotkey: string;
|
|
145
|
+
}
|
|
146
|
+
export type BridgeSwapResponse = BridgeSwapResponseWithEncodedData | BridgeSwapResponseWithSubnet | BridgeSwapResponseBase;
|
|
147
|
+
export type RouteOperationType = 'SWAP' | 'BRIDGE' | 'CCIP';
|
|
148
|
+
export interface RouteSwapRequest {
|
|
149
|
+
operationType: 'SWAP';
|
|
150
|
+
originAssetId: number;
|
|
151
|
+
destinationAssetId: number;
|
|
152
|
+
fromAddress: string;
|
|
153
|
+
toAddress: string;
|
|
154
|
+
amount: number;
|
|
155
|
+
}
|
|
156
|
+
export interface RouteBridgeRequest {
|
|
157
|
+
operationType: 'BRIDGE';
|
|
158
|
+
fromChain: string;
|
|
159
|
+
toChain: string;
|
|
160
|
+
fromToken: string;
|
|
161
|
+
toToken: string;
|
|
162
|
+
fromWallet: string;
|
|
163
|
+
toWallet: string;
|
|
164
|
+
amount: number;
|
|
165
|
+
subnetId?: number;
|
|
166
|
+
}
|
|
167
|
+
export interface RouteCcipRequest {
|
|
168
|
+
operationType: 'CCIP';
|
|
169
|
+
originAssetId: number;
|
|
170
|
+
destinationAssetId: number;
|
|
171
|
+
fromAddress: string;
|
|
172
|
+
toAddress: string;
|
|
173
|
+
amount: number;
|
|
174
|
+
}
|
|
175
|
+
export type RouteTransactionRequest = RouteSwapRequest | RouteBridgeRequest | RouteCcipRequest;
|
|
176
|
+
export interface RouteTransactionResponseData {
|
|
177
|
+
to: string;
|
|
178
|
+
data: string;
|
|
179
|
+
value: string;
|
|
180
|
+
chainId: number;
|
|
181
|
+
}
|
|
182
|
+
export interface RouteTransactionResponse {
|
|
183
|
+
operationType: RouteOperationType;
|
|
184
|
+
identifier: string;
|
|
185
|
+
success: boolean;
|
|
186
|
+
message: string;
|
|
187
|
+
data?: RouteTransactionResponseData;
|
|
188
|
+
ccipFee?: string;
|
|
189
|
+
}
|
|
190
|
+
export interface BridgeFeeEstimateRequest {
|
|
191
|
+
fromToken: string;
|
|
192
|
+
toToken: string;
|
|
193
|
+
amount: number;
|
|
194
|
+
}
|
|
195
|
+
export interface BridgeFeeEstimateResponse {
|
|
196
|
+
success: boolean;
|
|
197
|
+
message: string;
|
|
198
|
+
data: {
|
|
199
|
+
fee: string;
|
|
200
|
+
recipientAmount: string;
|
|
201
|
+
tenantFee: string;
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
export interface RouterSwapFeeEstimateRequest {
|
|
205
|
+
originAssetId: number;
|
|
206
|
+
destinationAssetId: number;
|
|
207
|
+
amount: number;
|
|
208
|
+
operationType: RouteOperationType;
|
|
209
|
+
toAddress: string;
|
|
210
|
+
}
|
|
211
|
+
export interface RouterSwapFeeEstimateResponse {
|
|
212
|
+
swapAmount: string;
|
|
213
|
+
totalFee: string;
|
|
214
|
+
platformFee: string;
|
|
215
|
+
ccipFee: string;
|
|
216
|
+
tenantFee: string;
|
|
54
217
|
}
|