@avacuscc/sdk 0.1.0 → 0.2.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/README.md +267 -0
- package/package.json +4 -4
- package/packages/sdk/dist/index.d.mts +675 -7
- package/packages/sdk/dist/index.d.ts +675 -7
- package/packages/sdk/dist/index.js +532 -18
- package/packages/sdk/dist/index.mjs +844 -18
- package/packages/sdk/dist/{sns-D0rtlsZp.d.mts → sns-NuV2JpAA.d.mts} +24 -1
- package/packages/sdk/dist/{sns-D0rtlsZp.d.ts → sns-NuV2JpAA.d.ts} +24 -1
- package/packages/sdk/dist/sns.d.mts +1 -1
- package/packages/sdk/dist/sns.d.ts +1 -1
- package/packages/sdk/dist/sns.js +71 -14
- package/packages/sdk/dist/sns.mjs +383 -9
- package/packages/sdk/dist/chunk-T5BAFYHX.mjs +0 -342
|
@@ -1,17 +1,381 @@
|
|
|
1
|
-
import { H as HttpAdapter, S as SnsService, B as BaseClientOptions } from './sns-
|
|
2
|
-
export { A as AVACUS_ENDPOINTS, a as
|
|
1
|
+
import { H as HttpAdapter, S as SnsService, B as BaseClientOptions } from './sns-NuV2JpAA.mjs';
|
|
2
|
+
export { A as AVACUS_ENDPOINTS, a as AvacusEnvironment, b as BASE_CONNECT_SIGNED_MSG, c as BASE_GAS_SPONSOR_SIGNED_MSG, d as BASE_REDIRECT_SIGNED_MSG, D as DEFAULT_BASE_SIGNED_MESSAGE, R as ResolvedClientSettings, e as SNS_SERVICE_PATH, f as SignMessageFn, g as SnsAuthClient, h as SnsAuthClientOptions, i as SnsAuthTokenPayload, j as SnsAuthenticateParams, k as SnsAvatar, l as SnsCreateUserDeviceParams, m as SnsCreateUserParams, n as SnsCreateUserPayload, o as SnsCreateUserResult, p as SnsCreateUserWithSignatureParams, q as SnsDevice, r as SnsGetNonceParams, s as SnsGetProfilesParams, t as SnsLoginParams, u as SnsLoginResult, v as SnsNonceResponse, w as SnsProfile, x as SnsServiceName, y as SnsServiceOptions, z as isKnownAvacusBaseUrl, C as loginWithSns, E as resolveAvacusBaseUrl, F as resolveClientSettings, G as resolveServiceUrl } from './sns-NuV2JpAA.mjs';
|
|
3
3
|
|
|
4
4
|
declare class BalancerService {
|
|
5
5
|
private readonly http;
|
|
6
6
|
constructor(http: HttpAdapter);
|
|
7
|
+
/**
|
|
8
|
+
* Returns the list of balancer pools.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const pools = await client.balancer.getPools();
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
7
15
|
getPools(): Promise<unknown>;
|
|
8
16
|
}
|
|
9
17
|
|
|
18
|
+
type GasAccountTransactionType = 'DEPOSIT' | 'WITHDRAW' | 'USAGE' | 'TRANSFER_SPONSOR' | 'PAYMASTER_PAYMENT';
|
|
19
|
+
type GasAccountTransactionStatus = 'PENDING' | 'CONFIRMED' | 'CANCELLED' | 'FAILED';
|
|
20
|
+
type SponsorType = 'ADMIN' | 'USER';
|
|
21
|
+
interface ApiEnvelope<TData> {
|
|
22
|
+
status: boolean;
|
|
23
|
+
data: TData;
|
|
24
|
+
code: number;
|
|
25
|
+
}
|
|
26
|
+
interface ApiEnvelopeWithMeta<TData, TMeta> extends ApiEnvelope<TData> {
|
|
27
|
+
meta: TMeta;
|
|
28
|
+
}
|
|
29
|
+
interface StableTokenImage {
|
|
30
|
+
thumb: string;
|
|
31
|
+
small: string;
|
|
32
|
+
large: string;
|
|
33
|
+
}
|
|
34
|
+
interface StableToken {
|
|
35
|
+
id: string;
|
|
36
|
+
chainId: number;
|
|
37
|
+
address: string;
|
|
38
|
+
name: string;
|
|
39
|
+
symbol: string;
|
|
40
|
+
decimals: number;
|
|
41
|
+
image: StableTokenImage;
|
|
42
|
+
isActive: boolean;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
type StableTokenListResult = ApiEnvelope<StableToken[]>;
|
|
47
|
+
interface GasAccountEntity {
|
|
48
|
+
id: string;
|
|
49
|
+
address: string;
|
|
50
|
+
isActive: boolean;
|
|
51
|
+
createdAt: string;
|
|
52
|
+
updatedAt: string;
|
|
53
|
+
}
|
|
54
|
+
interface PendingBreakdown {
|
|
55
|
+
deposit: string;
|
|
56
|
+
withdraw: string;
|
|
57
|
+
usage: string;
|
|
58
|
+
transferSponsor: string;
|
|
59
|
+
}
|
|
60
|
+
interface PendingTotals extends PendingBreakdown {
|
|
61
|
+
total: string;
|
|
62
|
+
}
|
|
63
|
+
interface ComputedBalance {
|
|
64
|
+
effectiveBalance: string;
|
|
65
|
+
projectedBalance: string;
|
|
66
|
+
}
|
|
67
|
+
interface GasAccountBalanceSnapshot {
|
|
68
|
+
availableBalance: string;
|
|
69
|
+
totalDeposited: string;
|
|
70
|
+
totalWithdrawn: string;
|
|
71
|
+
totalUsed: string;
|
|
72
|
+
totalTransferSponsor: string;
|
|
73
|
+
pending: PendingTotals;
|
|
74
|
+
computed: ComputedBalance;
|
|
75
|
+
lastUpdatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
type GetMultipleBalancesParams = {
|
|
78
|
+
addresses: string[];
|
|
79
|
+
};
|
|
80
|
+
type GetMultipleBalancesResult = ApiEnvelope<Record<string, GasAccountBalanceSnapshot>>;
|
|
81
|
+
interface PendingTransactions {
|
|
82
|
+
deposits: unknown[];
|
|
83
|
+
withdraws: unknown[];
|
|
84
|
+
usages: unknown[];
|
|
85
|
+
transactions: unknown[];
|
|
86
|
+
}
|
|
87
|
+
interface NetworkRef {
|
|
88
|
+
chainId: number;
|
|
89
|
+
name?: string;
|
|
90
|
+
nodeUrls?: string[];
|
|
91
|
+
nodeUrl?: string | null;
|
|
92
|
+
isActive?: boolean;
|
|
93
|
+
blockTime?: number;
|
|
94
|
+
nativeCurrency?: string;
|
|
95
|
+
explorerUrl?: string;
|
|
96
|
+
createdAt?: string;
|
|
97
|
+
updatedAt?: string;
|
|
98
|
+
}
|
|
99
|
+
interface GasAccountTransaction {
|
|
100
|
+
id: string;
|
|
101
|
+
gasAccountId: string;
|
|
102
|
+
transactionType: GasAccountTransactionType;
|
|
103
|
+
amount: string;
|
|
104
|
+
chainId: number;
|
|
105
|
+
toAddress: string;
|
|
106
|
+
txHash: string | null;
|
|
107
|
+
status: GasAccountTransactionStatus;
|
|
108
|
+
blockNumber?: number | null;
|
|
109
|
+
confirmations?: number;
|
|
110
|
+
logIndex?: number | null;
|
|
111
|
+
notes?: string | null;
|
|
112
|
+
actor?: string | null;
|
|
113
|
+
tokenAddress?: string | null;
|
|
114
|
+
details?: unknown;
|
|
115
|
+
parentId?: string | null;
|
|
116
|
+
sponsorType?: SponsorType | null;
|
|
117
|
+
sponsorGasAccountId?: string | null;
|
|
118
|
+
createdAt: string;
|
|
119
|
+
updatedAt: string;
|
|
120
|
+
network?: NetworkRef;
|
|
121
|
+
gasAccount?: GasAccountEntity;
|
|
122
|
+
sponsorshipMetadata?: unknown;
|
|
123
|
+
}
|
|
124
|
+
interface GasAccountSummaryData {
|
|
125
|
+
account: GasAccountEntity;
|
|
126
|
+
balance: {
|
|
127
|
+
totalDeposited: string;
|
|
128
|
+
totalWithdrawn: string;
|
|
129
|
+
totalUsed: string;
|
|
130
|
+
totalTransferSponsor: string;
|
|
131
|
+
availableBalance: string;
|
|
132
|
+
effectiveBalance: string;
|
|
133
|
+
projectedBalance: string;
|
|
134
|
+
totalPending: string;
|
|
135
|
+
pendingBreakdown: PendingBreakdown;
|
|
136
|
+
};
|
|
137
|
+
recentTransactions: GasAccountTransaction[];
|
|
138
|
+
pendingTransactions: PendingTransactions;
|
|
139
|
+
summary: {
|
|
140
|
+
totalTransactions: number;
|
|
141
|
+
pendingCount: number;
|
|
142
|
+
hasBalance: boolean;
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
type GasAccountSummaryResult = ApiEnvelope<GasAccountSummaryData>;
|
|
146
|
+
interface GasAccountWhitelistEntry {
|
|
147
|
+
address: string;
|
|
148
|
+
expiresAt: string | null;
|
|
149
|
+
}
|
|
150
|
+
interface GasAccountWhitelistData {
|
|
151
|
+
whitelist: GasAccountWhitelistEntry[];
|
|
152
|
+
nonce: number;
|
|
153
|
+
}
|
|
154
|
+
type GasAccountWhitelistResult = ApiEnvelope<GasAccountWhitelistData>;
|
|
155
|
+
interface RegisterWhitelistSpenderEntry {
|
|
156
|
+
address: string;
|
|
157
|
+
expiresAt: number;
|
|
158
|
+
}
|
|
159
|
+
interface RegisterWhitelistSpendersParams {
|
|
160
|
+
spenders: RegisterWhitelistSpenderEntry[];
|
|
161
|
+
signature: string;
|
|
162
|
+
nonce: number;
|
|
163
|
+
deadline: number;
|
|
164
|
+
}
|
|
165
|
+
interface RegisterWhitelistSpendersTypedDataDomain {
|
|
166
|
+
name: 'AvacusGasAccount';
|
|
167
|
+
version: string;
|
|
168
|
+
}
|
|
169
|
+
interface RegisterWhitelistSpendersTypedDataMessage {
|
|
170
|
+
owner: string;
|
|
171
|
+
spenders: RegisterWhitelistSpenderEntry[];
|
|
172
|
+
nonce: number;
|
|
173
|
+
deadline: number;
|
|
174
|
+
}
|
|
175
|
+
interface RegisterWhitelistSpendersTypedData {
|
|
176
|
+
domain: RegisterWhitelistSpendersTypedDataDomain;
|
|
177
|
+
types: {
|
|
178
|
+
SpenderEntry: readonly [
|
|
179
|
+
{
|
|
180
|
+
name: 'address';
|
|
181
|
+
type: 'address';
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: 'expiresAt';
|
|
185
|
+
type: 'uint256';
|
|
186
|
+
}
|
|
187
|
+
];
|
|
188
|
+
RegisterSpenders: readonly [
|
|
189
|
+
{
|
|
190
|
+
name: 'owner';
|
|
191
|
+
type: 'address';
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
name: 'spenders';
|
|
195
|
+
type: 'SpenderEntry[]';
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
name: 'nonce';
|
|
199
|
+
type: 'uint256';
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: 'deadline';
|
|
203
|
+
type: 'uint256';
|
|
204
|
+
}
|
|
205
|
+
];
|
|
206
|
+
};
|
|
207
|
+
primaryType: 'RegisterSpenders';
|
|
208
|
+
message: RegisterWhitelistSpendersTypedDataMessage;
|
|
209
|
+
}
|
|
210
|
+
type SignRegisterWhitelistSpendersTypedDataFn = (typedData: RegisterWhitelistSpendersTypedData) => Promise<string>;
|
|
211
|
+
interface RegisterWhitelistSpendersWithSignatureParams {
|
|
212
|
+
owner: string;
|
|
213
|
+
spenders: RegisterWhitelistSpenderEntry[];
|
|
214
|
+
version?: string;
|
|
215
|
+
deadline?: number;
|
|
216
|
+
signTypedData: SignRegisterWhitelistSpendersTypedDataFn;
|
|
217
|
+
}
|
|
218
|
+
interface EthersLikeTypedDataSigner {
|
|
219
|
+
signTypedData(domain: RegisterWhitelistSpendersTypedData['domain'], types: Record<string, Array<{
|
|
220
|
+
name: string;
|
|
221
|
+
type: string;
|
|
222
|
+
}>>, value: RegisterWhitelistSpendersTypedData['message']): Promise<string>;
|
|
223
|
+
}
|
|
224
|
+
interface RegisterWhitelistSpendersWithEthersParams {
|
|
225
|
+
owner: string;
|
|
226
|
+
spenders: RegisterWhitelistSpenderEntry[];
|
|
227
|
+
version?: string;
|
|
228
|
+
deadline?: number;
|
|
229
|
+
signer: EthersLikeTypedDataSigner;
|
|
230
|
+
}
|
|
231
|
+
interface BuildRegisterWhitelistSpendersTypedDataParams {
|
|
232
|
+
owner: string;
|
|
233
|
+
spenders: RegisterWhitelistSpenderEntry[];
|
|
234
|
+
version?: string;
|
|
235
|
+
nonce: number;
|
|
236
|
+
deadline: number;
|
|
237
|
+
}
|
|
238
|
+
interface RegisterWhitelistSpendersData extends GasAccountWhitelistData {
|
|
239
|
+
upserted: string[];
|
|
240
|
+
}
|
|
241
|
+
type RegisterWhitelistSpendersResult = ApiEnvelope<RegisterWhitelistSpendersData>;
|
|
242
|
+
interface RemoveWhitelistSpendersParams {
|
|
243
|
+
spenders: string[];
|
|
244
|
+
}
|
|
245
|
+
interface RemoveWhitelistSpendersData {
|
|
246
|
+
removed: string[];
|
|
247
|
+
whitelist: GasAccountWhitelistEntry[];
|
|
248
|
+
}
|
|
249
|
+
type RemoveWhitelistSpendersResult = ApiEnvelope<RemoveWhitelistSpendersData>;
|
|
250
|
+
type GasAccountBalanceResult = ApiEnvelope<GasAccountBalanceSnapshot>;
|
|
251
|
+
interface GasAccountBalanceDetailedSnapshot extends GasAccountBalanceSnapshot {
|
|
252
|
+
pendingTransactions: PendingTransactions;
|
|
253
|
+
}
|
|
254
|
+
type GasAccountBalanceDetailedResult = ApiEnvelope<GasAccountBalanceDetailedSnapshot>;
|
|
255
|
+
interface GasAccountBalanceStatsData {
|
|
256
|
+
address: string;
|
|
257
|
+
stats: {
|
|
258
|
+
totalDeposited: string;
|
|
259
|
+
totalWithdrawn: string;
|
|
260
|
+
totalUsed: string;
|
|
261
|
+
totalTransferSponsor: string;
|
|
262
|
+
availableBalance: string;
|
|
263
|
+
effectiveBalance: string;
|
|
264
|
+
projectedBalance: string;
|
|
265
|
+
totalPending: string;
|
|
266
|
+
pendingBreakdown: PendingBreakdown;
|
|
267
|
+
};
|
|
268
|
+
timestamp: string;
|
|
269
|
+
}
|
|
270
|
+
type GasAccountBalanceStatsResult = ApiEnvelope<GasAccountBalanceStatsData>;
|
|
271
|
+
interface GasAccountTransactionListParams {
|
|
272
|
+
page?: number;
|
|
273
|
+
per?: number;
|
|
274
|
+
type?: Exclude<GasAccountTransactionType, 'PAYMASTER_PAYMENT'>;
|
|
275
|
+
status?: GasAccountTransactionStatus;
|
|
276
|
+
}
|
|
277
|
+
interface GasAccountTransactionListData {
|
|
278
|
+
address: string;
|
|
279
|
+
transactions: GasAccountTransaction[];
|
|
280
|
+
filters: {
|
|
281
|
+
type: GasAccountTransactionListParams['type'] | null;
|
|
282
|
+
status: GasAccountTransactionStatus | null;
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
interface PaginationMeta {
|
|
286
|
+
current_page: number;
|
|
287
|
+
next_page: number | null;
|
|
288
|
+
prev_page: number | null;
|
|
289
|
+
total_pages: number;
|
|
290
|
+
total_count: number;
|
|
291
|
+
}
|
|
292
|
+
type GasAccountTransactionListResult = ApiEnvelopeWithMeta<GasAccountTransactionListData, PaginationMeta>;
|
|
293
|
+
interface GasAccountTransactionDetailData {
|
|
294
|
+
address: string;
|
|
295
|
+
transaction: GasAccountTransaction;
|
|
296
|
+
timestamp: string;
|
|
297
|
+
}
|
|
298
|
+
type GasAccountTransactionDetailResult = ApiEnvelope<GasAccountTransactionDetailData>;
|
|
299
|
+
interface CreateDepositParams {
|
|
300
|
+
chainId: number;
|
|
301
|
+
amount: string;
|
|
302
|
+
tokenAddress: string;
|
|
303
|
+
txHash: string;
|
|
304
|
+
actor: string;
|
|
305
|
+
notes?: string;
|
|
306
|
+
}
|
|
307
|
+
interface CreateDepositData {
|
|
308
|
+
transaction: GasAccountTransaction;
|
|
309
|
+
timestamp: string;
|
|
310
|
+
}
|
|
311
|
+
type CreateDepositResult = ApiEnvelope<CreateDepositData>;
|
|
312
|
+
interface UseBalanceParams {
|
|
313
|
+
toAddress: string;
|
|
314
|
+
chainId: number;
|
|
315
|
+
gasLimit: number;
|
|
316
|
+
gasPrice?: number;
|
|
317
|
+
maxFeePerGas?: number;
|
|
318
|
+
maxPriorityFeePerGas?: number;
|
|
319
|
+
notes?: string;
|
|
320
|
+
sourceAddress?: string;
|
|
321
|
+
}
|
|
322
|
+
interface UseBalanceData {
|
|
323
|
+
transaction: GasAccountTransaction;
|
|
324
|
+
balance: {
|
|
325
|
+
availableBalance: string;
|
|
326
|
+
effectiveBalance: string;
|
|
327
|
+
projectedBalance: string;
|
|
328
|
+
pendingUsage: string;
|
|
329
|
+
};
|
|
330
|
+
message: string;
|
|
331
|
+
timestamp: string;
|
|
332
|
+
}
|
|
333
|
+
type UseBalanceResult = ApiEnvelope<UseBalanceData>;
|
|
334
|
+
interface SponsoredTransferAuthorization {
|
|
335
|
+
tokenAddress: string;
|
|
336
|
+
from: string;
|
|
337
|
+
to: string;
|
|
338
|
+
value: string;
|
|
339
|
+
validBefore: number;
|
|
340
|
+
validAfter: number;
|
|
341
|
+
nonce: string;
|
|
342
|
+
signature: string;
|
|
343
|
+
}
|
|
344
|
+
interface SponsoredTransferParams {
|
|
345
|
+
transactions: SponsoredTransferAuthorization[];
|
|
346
|
+
chainId: number;
|
|
347
|
+
type: SponsorType;
|
|
348
|
+
sponsorGasAccountId?: string;
|
|
349
|
+
notes?: string;
|
|
350
|
+
}
|
|
351
|
+
interface SponsoredTransferData {
|
|
352
|
+
transaction: GasAccountTransaction;
|
|
353
|
+
timestamp: string;
|
|
354
|
+
}
|
|
355
|
+
type SponsoredTransferResult = ApiEnvelope<SponsoredTransferData>;
|
|
356
|
+
interface CancelGasAccountTransactionData {
|
|
357
|
+
transaction: GasAccountTransaction;
|
|
358
|
+
timestamp: string;
|
|
359
|
+
}
|
|
360
|
+
type CancelGasAccountTransactionResult = ApiEnvelope<CancelGasAccountTransactionData>;
|
|
361
|
+
interface CreateFundingRequestParams {
|
|
362
|
+
sourceAddress: string;
|
|
363
|
+
toAddress: string;
|
|
364
|
+
chainId: number;
|
|
365
|
+
gasLimit: number;
|
|
366
|
+
gasPrice?: number;
|
|
367
|
+
maxFeePerGas?: number;
|
|
368
|
+
maxPriorityFeePerGas?: number;
|
|
369
|
+
notes?: string;
|
|
370
|
+
}
|
|
371
|
+
type CreateFundingRequestResult = ApiEnvelope<UseBalanceData>;
|
|
372
|
+
|
|
10
373
|
/**
|
|
11
374
|
* Base path for gas-account endpoints. The client resolves this path against the
|
|
12
375
|
* selected environment host before creating the service adapter.
|
|
13
376
|
*/
|
|
14
377
|
declare const GAS_ACCOUNT_SERVICE_PATH = "1/gas-account/";
|
|
378
|
+
declare const DEFAULT_REGISTER_WHITELIST_SPENDERS_VERSION = "1";
|
|
15
379
|
declare class GasAccountService {
|
|
16
380
|
private readonly http;
|
|
17
381
|
/**
|
|
@@ -23,13 +387,317 @@ declare class GasAccountService {
|
|
|
23
387
|
/**
|
|
24
388
|
* Returns the deposit vault address mapping keyed by chain ID.
|
|
25
389
|
* Requires a JWT token from a successful SNS login.
|
|
390
|
+
*
|
|
391
|
+
* @example
|
|
392
|
+
* ```ts
|
|
393
|
+
* await client.sns.login({
|
|
394
|
+
* walletAddress,
|
|
395
|
+
* signMessage,
|
|
396
|
+
* });
|
|
397
|
+
*
|
|
398
|
+
* const vaults = await client.gasAccount.getDepositVaults();
|
|
399
|
+
* ```
|
|
26
400
|
*/
|
|
27
|
-
getDepositVaults(): Promise<
|
|
401
|
+
getDepositVaults(): Promise<Record<string, string>>;
|
|
28
402
|
/**
|
|
29
|
-
* Returns the authenticated gas
|
|
30
|
-
*
|
|
403
|
+
* Returns the authenticated user's gas account summary, including balances,
|
|
404
|
+
* recent transactions, and pending transactions.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```ts
|
|
408
|
+
* const summary = await client.gasAccount.getSummary();
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
getSummary(): Promise<GasAccountSummaryResult>;
|
|
412
|
+
/**
|
|
413
|
+
* Returns supported stable tokens, optionally filtered by chain ID.
|
|
414
|
+
*
|
|
415
|
+
* @param chainId Optional network chain ID used to filter supported tokens.
|
|
416
|
+
*
|
|
417
|
+
* @example
|
|
418
|
+
* ```ts
|
|
419
|
+
* const tokens = await client.gasAccount.getStableTokens();
|
|
420
|
+
* const bscTestnetTokens = await client.gasAccount.getStableTokens(97);
|
|
421
|
+
* ```
|
|
422
|
+
*/
|
|
423
|
+
getStableTokens(chainId?: number): Promise<StableTokenListResult>;
|
|
424
|
+
/**
|
|
425
|
+
* Returns the authenticated user's current whitelist spender entries and nonce.
|
|
426
|
+
*
|
|
427
|
+
* @example
|
|
428
|
+
* ```ts
|
|
429
|
+
* const whitelist = await client.gasAccount.getWhitelistSpenders();
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
getWhitelistSpenders(): Promise<GasAccountWhitelistResult>;
|
|
433
|
+
/**
|
|
434
|
+
* Adds or updates whitelist spender entries using a signed EIP-712 payload.
|
|
435
|
+
*
|
|
436
|
+
* @param params Spenders, signature, nonce, and deadline for registration.
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* ```ts
|
|
440
|
+
* const { data } = await client.gasAccount.getWhitelistSpenders();
|
|
441
|
+
* const typedData = client.gasAccount.buildRegisterWhitelistSpendersTypedData({
|
|
442
|
+
* owner: wallet.address,
|
|
443
|
+
* spenders,
|
|
444
|
+
* nonce: data.nonce,
|
|
445
|
+
* deadline: Math.floor(Date.now() / 1000) + 600,
|
|
446
|
+
* });
|
|
447
|
+
*
|
|
448
|
+
* const signature = await wallet.signTypedData(
|
|
449
|
+
* typedData.domain,
|
|
450
|
+
* typedData.types,
|
|
451
|
+
* typedData.message,
|
|
452
|
+
* );
|
|
453
|
+
*
|
|
454
|
+
* await client.gasAccount.registerWhitelistSpenders({
|
|
455
|
+
* spenders,
|
|
456
|
+
* nonce: data.nonce,
|
|
457
|
+
* deadline: typedData.message.deadline,
|
|
458
|
+
* signature,
|
|
459
|
+
* });
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
registerWhitelistSpenders(params: RegisterWhitelistSpendersParams): Promise<RegisterWhitelistSpendersResult>;
|
|
463
|
+
/**
|
|
464
|
+
* Convenience helper that fetches the current whitelist nonce, builds the
|
|
465
|
+
* typed-data payload, asks the caller to sign it, and submits the request.
|
|
466
|
+
*
|
|
467
|
+
* @param params Owner address, spender entries, optional deadline, and a typed-data signer.
|
|
468
|
+
*
|
|
469
|
+
* @example
|
|
470
|
+
* ```ts
|
|
471
|
+
* await client.gasAccount.registerWhitelistSpendersWithSignature({
|
|
472
|
+
* owner: wallet.address,
|
|
473
|
+
* spenders,
|
|
474
|
+
* signTypedData: (typedData) =>
|
|
475
|
+
* wallet.signTypedData(
|
|
476
|
+
* typedData.domain,
|
|
477
|
+
* typedData.types,
|
|
478
|
+
* typedData.message,
|
|
479
|
+
* ),
|
|
480
|
+
* });
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
483
|
+
registerWhitelistSpendersWithSignature(params: RegisterWhitelistSpendersWithSignatureParams): Promise<RegisterWhitelistSpendersResult>;
|
|
484
|
+
/**
|
|
485
|
+
* Convenience helper for ethers-compatible signers.
|
|
486
|
+
*
|
|
487
|
+
* @param params Owner address, spender entries, optional domain version/deadline, and an ethers-compatible signer.
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```ts
|
|
491
|
+
* await client.gasAccount.registerWhitelistSpendersWithEthers({
|
|
492
|
+
* owner: wallet.address,
|
|
493
|
+
* spenders,
|
|
494
|
+
* signer: wallet,
|
|
495
|
+
* });
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
registerWhitelistSpendersWithEthers(params: RegisterWhitelistSpendersWithEthersParams): Promise<RegisterWhitelistSpendersResult>;
|
|
499
|
+
/**
|
|
500
|
+
* Builds the EIP-712 typed-data payload required by whitelist registration.
|
|
501
|
+
*
|
|
502
|
+
* @param params Owner, spenders, nonce, and deadline used in the signature payload.
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```ts
|
|
506
|
+
* const typedData = client.gasAccount.buildRegisterWhitelistSpendersTypedData({
|
|
507
|
+
* owner: wallet.address,
|
|
508
|
+
* spenders,
|
|
509
|
+
* nonce: 0,
|
|
510
|
+
* deadline: Math.floor(Date.now() / 1000) + 600,
|
|
511
|
+
* });
|
|
512
|
+
* ```
|
|
513
|
+
*/
|
|
514
|
+
buildRegisterWhitelistSpendersTypedData(params: BuildRegisterWhitelistSpendersTypedDataParams): RegisterWhitelistSpendersTypedData;
|
|
515
|
+
/**
|
|
516
|
+
* Removes one or more whitelist spender addresses from the authenticated account.
|
|
517
|
+
*
|
|
518
|
+
* @param params Spender addresses to revoke.
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* await client.gasAccount.removeWhitelistSpenders({
|
|
523
|
+
* spenders: ['0x9876543210987654321098765432109876543210'],
|
|
524
|
+
* });
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
removeWhitelistSpenders(params: RemoveWhitelistSpendersParams): Promise<RemoveWhitelistSpendersResult>;
|
|
528
|
+
/**
|
|
529
|
+
* Returns the authenticated user's balance summary.
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```ts
|
|
533
|
+
* const balance = await client.gasAccount.getBalance();
|
|
534
|
+
* ```
|
|
535
|
+
*/
|
|
536
|
+
getBalance(): Promise<GasAccountBalanceResult>;
|
|
537
|
+
/**
|
|
538
|
+
* Returns the authenticated user's balance summary with pending transaction lists.
|
|
539
|
+
*
|
|
540
|
+
* @example
|
|
541
|
+
* ```ts
|
|
542
|
+
* const detailedBalance = await client.gasAccount.getDetailedBalance();
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
getDetailedBalance(): Promise<GasAccountBalanceDetailedResult>;
|
|
546
|
+
/**
|
|
547
|
+
* Returns balance statistics for the authenticated user's gas account.
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* ```ts
|
|
551
|
+
* const stats = await client.gasAccount.getBalanceStats();
|
|
552
|
+
* ```
|
|
553
|
+
*/
|
|
554
|
+
getBalanceStats(): Promise<GasAccountBalanceStatsResult>;
|
|
555
|
+
/**
|
|
556
|
+
* Returns balances for a batch of addresses through the public balances endpoint.
|
|
557
|
+
*
|
|
558
|
+
* @param params Address batch to query.
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```ts
|
|
562
|
+
* const balances = await client.gasAccount.getBalances({
|
|
563
|
+
* addresses: [
|
|
564
|
+
* '0x3a0430580303f4De9C5320aC013f14cd92192bfA',
|
|
565
|
+
* '0x610b463d2f57d2e0d9e785a7ff423fbae36f0624',
|
|
566
|
+
* ],
|
|
567
|
+
* });
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
getBalances(params: GetMultipleBalancesParams): Promise<GetMultipleBalancesResult>;
|
|
571
|
+
/**
|
|
572
|
+
* Returns a paginated transaction list for the authenticated user's gas account.
|
|
573
|
+
*
|
|
574
|
+
* @param params Optional pagination and filter parameters.
|
|
575
|
+
*
|
|
576
|
+
* @example
|
|
577
|
+
* ```ts
|
|
578
|
+
* const transactions = await client.gasAccount.listTransactions({
|
|
579
|
+
* page: 1,
|
|
580
|
+
* per: 10,
|
|
581
|
+
* type: 'DEPOSIT',
|
|
582
|
+
* status: 'CONFIRMED',
|
|
583
|
+
* });
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
listTransactions(params?: GasAccountTransactionListParams): Promise<GasAccountTransactionListResult>;
|
|
587
|
+
/**
|
|
588
|
+
* Returns detailed data for a specific transaction ID.
|
|
589
|
+
*
|
|
590
|
+
* @param transactionId Transaction UUID.
|
|
591
|
+
*
|
|
592
|
+
* @example
|
|
593
|
+
* ```ts
|
|
594
|
+
* const transaction = await client.gasAccount.getTransactionById(transactionId);
|
|
595
|
+
* ```
|
|
596
|
+
*/
|
|
597
|
+
getTransactionById(transactionId: string): Promise<GasAccountTransactionDetailResult>;
|
|
598
|
+
/**
|
|
599
|
+
* Creates a pending deposit transaction for the authenticated user.
|
|
600
|
+
*
|
|
601
|
+
* @param params Deposit payload.
|
|
602
|
+
*
|
|
603
|
+
* @example
|
|
604
|
+
* ```ts
|
|
605
|
+
* await client.gasAccount.createDeposit({
|
|
606
|
+
* chainId: 97,
|
|
607
|
+
* amount: '100.00000000',
|
|
608
|
+
* tokenAddress: '0x5bF5121A17e3329D07Ba43f758dEC271D9105132',
|
|
609
|
+
* txHash: '0xe3844e7bc420b2d409058e6bf5534fdba69b917907d691abf65862654df749d7',
|
|
610
|
+
* actor: walletAddress,
|
|
611
|
+
* notes: 'Deposit from wallet',
|
|
612
|
+
* });
|
|
613
|
+
* ```
|
|
614
|
+
*/
|
|
615
|
+
createDeposit(params: CreateDepositParams): Promise<CreateDepositResult>;
|
|
616
|
+
/**
|
|
617
|
+
* Creates a gas-usage request against the caller's balance or a whitelisted source address.
|
|
618
|
+
* When `sourceAddress` is provided, the caller spends from another owner's
|
|
619
|
+
* gas account and therefore must already be registered as a whitelist spender
|
|
620
|
+
* for that source account.
|
|
621
|
+
*
|
|
622
|
+
* @param params Usage request payload.
|
|
623
|
+
*
|
|
624
|
+
* @example
|
|
625
|
+
* ```ts
|
|
626
|
+
* await client.gasAccount.useBalance({
|
|
627
|
+
* toAddress: '0x9876543210987654321098765432109876543210',
|
|
628
|
+
* chainId: 97,
|
|
629
|
+
* gasLimit: 21000,
|
|
630
|
+
* gasPrice: 5,
|
|
631
|
+
* notes: 'Gas for token transfer',
|
|
632
|
+
* });
|
|
633
|
+
*
|
|
634
|
+
* await client.gasAccount.useBalance({
|
|
635
|
+
* toAddress: '0x9876543210987654321098765432109876543210',
|
|
636
|
+
* chainId: 97,
|
|
637
|
+
* gasLimit: 21000,
|
|
638
|
+
* gasPrice: 5,
|
|
639
|
+
* sourceAddress: '0x610b463d2f57d2e0d9e785a7ff423fbae36f0624',
|
|
640
|
+
* notes: 'Use gas from delegated source account',
|
|
641
|
+
* });
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
useBalance(params: UseBalanceParams): Promise<UseBalanceResult>;
|
|
645
|
+
/**
|
|
646
|
+
* Creates a sponsored transfer request.
|
|
647
|
+
*
|
|
648
|
+
* @param params Sponsored transfer payload.
|
|
649
|
+
*
|
|
650
|
+
* @example
|
|
651
|
+
* ```ts
|
|
652
|
+
* await client.gasAccount.createSponsoredTransfer({
|
|
653
|
+
* transactions: [
|
|
654
|
+
* {
|
|
655
|
+
* tokenAddress: '0x409E7b65eF7B243529e3F97be2A122123c55DE63',
|
|
656
|
+
* from: '0x1234567890123456789012345678901234567890',
|
|
657
|
+
* to: '0x9876543210987654321098765432109876543210',
|
|
658
|
+
* value: '1000000000000000000',
|
|
659
|
+
* validBefore: 1735689600,
|
|
660
|
+
* validAfter: 0,
|
|
661
|
+
* nonce: '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
662
|
+
* signature: '0x...',
|
|
663
|
+
* },
|
|
664
|
+
* ],
|
|
665
|
+
* chainId: 97,
|
|
666
|
+
* type: 'ADMIN',
|
|
667
|
+
* notes: 'JPYC transfer sponsorship',
|
|
668
|
+
* });
|
|
669
|
+
* ```
|
|
670
|
+
*/
|
|
671
|
+
createSponsoredTransfer(params: SponsoredTransferParams): Promise<SponsoredTransferResult>;
|
|
672
|
+
/**
|
|
673
|
+
* Cancels a pending gas-account transaction that has not yet been broadcast.
|
|
674
|
+
*
|
|
675
|
+
* @param transactionId Transaction UUID.
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```ts
|
|
679
|
+
* await client.gasAccount.cancelTransaction(transactionId);
|
|
680
|
+
* ```
|
|
681
|
+
*/
|
|
682
|
+
cancelTransaction(transactionId: string): Promise<CancelGasAccountTransactionResult>;
|
|
683
|
+
/**
|
|
684
|
+
* Creates an internal funding request on behalf of another service.
|
|
685
|
+
*
|
|
686
|
+
* @param params Funding request payload.
|
|
687
|
+
*
|
|
688
|
+
* @example
|
|
689
|
+
* ```ts
|
|
690
|
+
* await client.gasAccount.createFundingRequest({
|
|
691
|
+
* sourceAddress: '0x610b463d2f57d2e0d9e785a7ff423fbae36f0624',
|
|
692
|
+
* toAddress: '0x9876543210987654321098765432109876543210',
|
|
693
|
+
* chainId: 97,
|
|
694
|
+
* gasLimit: 21000,
|
|
695
|
+
* gasPrice: 5,
|
|
696
|
+
* notes: 'Gas for token transfer',
|
|
697
|
+
* });
|
|
698
|
+
* ```
|
|
31
699
|
*/
|
|
32
|
-
|
|
700
|
+
createFundingRequest(params: CreateFundingRequestParams): Promise<CreateFundingRequestResult>;
|
|
33
701
|
}
|
|
34
702
|
|
|
35
703
|
interface AvacusClientOptions extends BaseClientOptions {
|
|
@@ -50,4 +718,4 @@ declare class AvacusClient {
|
|
|
50
718
|
constructor(options?: AvacusClientOptions);
|
|
51
719
|
}
|
|
52
720
|
|
|
53
|
-
export { AvacusClient, type AvacusClientOptions, BalancerService, BaseClientOptions, GAS_ACCOUNT_SERVICE_PATH, GasAccountService,
|
|
721
|
+
export { type ApiEnvelope, type ApiEnvelopeWithMeta, AvacusClient, type AvacusClientOptions, BalancerService, BaseClientOptions, type BuildRegisterWhitelistSpendersTypedDataParams, type CancelGasAccountTransactionData, type CancelGasAccountTransactionResult, type ComputedBalance, type CreateDepositData, type CreateDepositParams, type CreateDepositResult, type CreateFundingRequestParams, type CreateFundingRequestResult, DEFAULT_REGISTER_WHITELIST_SPENDERS_VERSION, type EthersLikeTypedDataSigner, GAS_ACCOUNT_SERVICE_PATH, type GasAccountBalanceDetailedResult, type GasAccountBalanceDetailedSnapshot, type GasAccountBalanceResult, type GasAccountBalanceSnapshot, type GasAccountBalanceStatsData, type GasAccountBalanceStatsResult, type GasAccountEntity, GasAccountService, type GasAccountSummaryData, type GasAccountSummaryResult, type GasAccountTransaction, type GasAccountTransactionDetailData, type GasAccountTransactionDetailResult, type GasAccountTransactionListData, type GasAccountTransactionListParams, type GasAccountTransactionListResult, type GasAccountTransactionStatus, type GasAccountTransactionType, type GasAccountWhitelistData, type GasAccountWhitelistEntry, type GasAccountWhitelistResult, type GetMultipleBalancesParams, type GetMultipleBalancesResult, type NetworkRef, type PaginationMeta, type PendingBreakdown, type PendingTotals, type PendingTransactions, type RegisterWhitelistSpenderEntry, type RegisterWhitelistSpendersData, type RegisterWhitelistSpendersParams, type RegisterWhitelistSpendersResult, type RegisterWhitelistSpendersTypedData, type RegisterWhitelistSpendersTypedDataDomain, type RegisterWhitelistSpendersTypedDataMessage, type RegisterWhitelistSpendersWithEthersParams, type RegisterWhitelistSpendersWithSignatureParams, type RemoveWhitelistSpendersData, type RemoveWhitelistSpendersParams, type RemoveWhitelistSpendersResult, type SignRegisterWhitelistSpendersTypedDataFn, SnsService, type SponsorType, type SponsoredTransferAuthorization, type SponsoredTransferData, type SponsoredTransferParams, type SponsoredTransferResult, type StableToken, type StableTokenImage, type StableTokenListResult, type UseBalanceData, type UseBalanceParams, type UseBalanceResult };
|