@avacuscc/sdk 0.1.0 → 0.2.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.
- package/README.md +246 -0
- package/package.json +1 -1
- package/packages/sdk/dist/{chunk-T5BAFYHX.mjs → chunk-XWC6XZPN.mjs} +68 -12
- package/packages/sdk/dist/index.d.mts +663 -7
- package/packages/sdk/dist/index.d.ts +663 -7
- package/packages/sdk/dist/index.js +520 -16
- package/packages/sdk/dist/index.mjs +455 -5
- package/packages/sdk/dist/{sns-D0rtlsZp.d.mts → sns-Zwan9DNM.d.mts} +24 -1
- package/packages/sdk/dist/{sns-D0rtlsZp.d.ts → sns-Zwan9DNM.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 -12
- package/packages/sdk/dist/sns.mjs +7 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AVACUS_ENDPOINTS,
|
|
3
|
+
BASE_CONNECT_SIGNED_MSG,
|
|
4
|
+
BASE_GAS_SPONSOR_SIGNED_MSG,
|
|
5
|
+
BASE_REDIRECT_SIGNED_MSG,
|
|
3
6
|
DEFAULT_BASE_SIGNED_MESSAGE,
|
|
4
7
|
HttpAdapter,
|
|
5
8
|
SNS_SERVICE_PATH,
|
|
@@ -10,7 +13,7 @@ import {
|
|
|
10
13
|
resolveAvacusBaseUrl,
|
|
11
14
|
resolveClientSettings,
|
|
12
15
|
resolveServiceUrl
|
|
13
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-XWC6XZPN.mjs";
|
|
14
17
|
|
|
15
18
|
// packages/sdk/src/services/balancer.ts
|
|
16
19
|
var BalancerService = class {
|
|
@@ -18,6 +21,14 @@ var BalancerService = class {
|
|
|
18
21
|
this.http = http;
|
|
19
22
|
}
|
|
20
23
|
http;
|
|
24
|
+
/**
|
|
25
|
+
* Returns the list of balancer pools.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const pools = await client.balancer.getPools();
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
21
32
|
async getPools() {
|
|
22
33
|
return this.http.get("balancer/pools");
|
|
23
34
|
}
|
|
@@ -25,6 +36,30 @@ var BalancerService = class {
|
|
|
25
36
|
|
|
26
37
|
// packages/sdk/src/services/gasAccount.ts
|
|
27
38
|
var GAS_ACCOUNT_SERVICE_PATH = "1/gas-account/";
|
|
39
|
+
var DEFAULT_REGISTER_WHITELIST_SPENDERS_VERSION = "1";
|
|
40
|
+
var REGISTER_WHITELIST_SPENDERS_TYPED_DATA = {
|
|
41
|
+
domain: {
|
|
42
|
+
name: "AvacusGasAccount"
|
|
43
|
+
},
|
|
44
|
+
types: {
|
|
45
|
+
SpenderEntry: [
|
|
46
|
+
{ name: "address", type: "address" },
|
|
47
|
+
{ name: "expiresAt", type: "uint256" }
|
|
48
|
+
],
|
|
49
|
+
RegisterSpenders: [
|
|
50
|
+
{ name: "owner", type: "address" },
|
|
51
|
+
{ name: "spenders", type: "SpenderEntry[]" },
|
|
52
|
+
{ name: "nonce", type: "uint256" },
|
|
53
|
+
{ name: "deadline", type: "uint256" }
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
primaryType: "RegisterSpenders"
|
|
57
|
+
};
|
|
58
|
+
function toMutableTypedDataTypes(types) {
|
|
59
|
+
return Object.fromEntries(
|
|
60
|
+
Object.entries(types).map(([key, fields]) => [key, [...fields]])
|
|
61
|
+
);
|
|
62
|
+
}
|
|
28
63
|
var GasAccountService = class {
|
|
29
64
|
/**
|
|
30
65
|
* Creates the gas-account service using a service-scoped HTTP adapter.
|
|
@@ -38,16 +73,427 @@ var GasAccountService = class {
|
|
|
38
73
|
/**
|
|
39
74
|
* Returns the deposit vault address mapping keyed by chain ID.
|
|
40
75
|
* Requires a JWT token from a successful SNS login.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```ts
|
|
79
|
+
* await client.sns.login({
|
|
80
|
+
* walletAddress,
|
|
81
|
+
* signMessage,
|
|
82
|
+
* });
|
|
83
|
+
*
|
|
84
|
+
* const vaults = await client.gasAccount.getDepositVaults();
|
|
85
|
+
* ```
|
|
41
86
|
*/
|
|
42
87
|
async getDepositVaults() {
|
|
43
88
|
return this.http.get("deposit_vaults", { auth: true });
|
|
44
89
|
}
|
|
45
90
|
/**
|
|
46
|
-
* Returns the authenticated gas
|
|
47
|
-
*
|
|
91
|
+
* Returns the authenticated user's gas account summary, including balances,
|
|
92
|
+
* recent transactions, and pending transactions.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const summary = await client.gasAccount.getSummary();
|
|
97
|
+
* ```
|
|
48
98
|
*/
|
|
49
|
-
async
|
|
50
|
-
return this.http.get("
|
|
99
|
+
async getSummary() {
|
|
100
|
+
return this.http.get("summary", { auth: true });
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Returns supported stable tokens, optionally filtered by chain ID.
|
|
104
|
+
*
|
|
105
|
+
* @param chainId Optional network chain ID used to filter supported tokens.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```ts
|
|
109
|
+
* const tokens = await client.gasAccount.getStableTokens();
|
|
110
|
+
* const bscTestnetTokens = await client.gasAccount.getStableTokens(97);
|
|
111
|
+
* ```
|
|
112
|
+
*/
|
|
113
|
+
async getStableTokens(chainId) {
|
|
114
|
+
const searchParams = new URLSearchParams();
|
|
115
|
+
if (chainId !== void 0) {
|
|
116
|
+
searchParams.set("chainId", String(chainId));
|
|
117
|
+
}
|
|
118
|
+
const path = searchParams.size > 0 ? `stable_tokens?${searchParams.toString()}` : "stable_tokens";
|
|
119
|
+
return this.http.get(path, { auth: true });
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Returns the authenticated user's current whitelist spender entries and nonce.
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```ts
|
|
126
|
+
* const whitelist = await client.gasAccount.getWhitelistSpenders();
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
async getWhitelistSpenders() {
|
|
130
|
+
return this.http.get("whitelist-spenders", { auth: true });
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Adds or updates whitelist spender entries using a signed EIP-712 payload.
|
|
134
|
+
*
|
|
135
|
+
* @param params Spenders, signature, nonce, and deadline for registration.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* const { data } = await client.gasAccount.getWhitelistSpenders();
|
|
140
|
+
* const typedData = client.gasAccount.buildRegisterWhitelistSpendersTypedData({
|
|
141
|
+
* owner: wallet.address,
|
|
142
|
+
* spenders,
|
|
143
|
+
* nonce: data.nonce,
|
|
144
|
+
* deadline: Math.floor(Date.now() / 1000) + 600,
|
|
145
|
+
* });
|
|
146
|
+
*
|
|
147
|
+
* const signature = await wallet.signTypedData(
|
|
148
|
+
* typedData.domain,
|
|
149
|
+
* typedData.types,
|
|
150
|
+
* typedData.message,
|
|
151
|
+
* );
|
|
152
|
+
*
|
|
153
|
+
* await client.gasAccount.registerWhitelistSpenders({
|
|
154
|
+
* spenders,
|
|
155
|
+
* nonce: data.nonce,
|
|
156
|
+
* deadline: typedData.message.deadline,
|
|
157
|
+
* signature,
|
|
158
|
+
* });
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
async registerWhitelistSpenders(params) {
|
|
162
|
+
return this.http.post("whitelist-spenders", params, {
|
|
163
|
+
auth: true
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Convenience helper that fetches the current whitelist nonce, builds the
|
|
168
|
+
* typed-data payload, asks the caller to sign it, and submits the request.
|
|
169
|
+
*
|
|
170
|
+
* @param params Owner address, spender entries, optional deadline, and a typed-data signer.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* await client.gasAccount.registerWhitelistSpendersWithSignature({
|
|
175
|
+
* owner: wallet.address,
|
|
176
|
+
* spenders,
|
|
177
|
+
* signTypedData: (typedData) =>
|
|
178
|
+
* wallet.signTypedData(
|
|
179
|
+
* typedData.domain,
|
|
180
|
+
* typedData.types,
|
|
181
|
+
* typedData.message,
|
|
182
|
+
* ),
|
|
183
|
+
* });
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
async registerWhitelistSpendersWithSignature(params) {
|
|
187
|
+
const { data } = await this.getWhitelistSpenders();
|
|
188
|
+
const nonce = data.nonce;
|
|
189
|
+
const deadline = params.deadline ?? Math.floor(Date.now() / 1e3) + 600;
|
|
190
|
+
const typedData = this.buildRegisterWhitelistSpendersTypedData({
|
|
191
|
+
owner: params.owner,
|
|
192
|
+
spenders: params.spenders,
|
|
193
|
+
version: params.version,
|
|
194
|
+
nonce,
|
|
195
|
+
deadline
|
|
196
|
+
});
|
|
197
|
+
const signature = await params.signTypedData(typedData);
|
|
198
|
+
return this.registerWhitelistSpenders({
|
|
199
|
+
spenders: params.spenders,
|
|
200
|
+
signature,
|
|
201
|
+
nonce,
|
|
202
|
+
deadline
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Convenience helper for ethers-compatible signers.
|
|
207
|
+
*
|
|
208
|
+
* @param params Owner address, spender entries, optional domain version/deadline, and an ethers-compatible signer.
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```ts
|
|
212
|
+
* await client.gasAccount.registerWhitelistSpendersWithEthers({
|
|
213
|
+
* owner: wallet.address,
|
|
214
|
+
* spenders,
|
|
215
|
+
* signer: wallet,
|
|
216
|
+
* });
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
async registerWhitelistSpendersWithEthers(params) {
|
|
220
|
+
return this.registerWhitelistSpendersWithSignature({
|
|
221
|
+
owner: params.owner,
|
|
222
|
+
spenders: params.spenders,
|
|
223
|
+
version: params.version,
|
|
224
|
+
deadline: params.deadline,
|
|
225
|
+
signTypedData: (typedData) => params.signer.signTypedData(
|
|
226
|
+
typedData.domain,
|
|
227
|
+
toMutableTypedDataTypes(typedData.types),
|
|
228
|
+
typedData.message
|
|
229
|
+
)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* Builds the EIP-712 typed-data payload required by whitelist registration.
|
|
234
|
+
*
|
|
235
|
+
* @param params Owner, spenders, nonce, and deadline used in the signature payload.
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```ts
|
|
239
|
+
* const typedData = client.gasAccount.buildRegisterWhitelistSpendersTypedData({
|
|
240
|
+
* owner: wallet.address,
|
|
241
|
+
* spenders,
|
|
242
|
+
* nonce: 0,
|
|
243
|
+
* deadline: Math.floor(Date.now() / 1000) + 600,
|
|
244
|
+
* });
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
buildRegisterWhitelistSpendersTypedData(params) {
|
|
248
|
+
return {
|
|
249
|
+
...REGISTER_WHITELIST_SPENDERS_TYPED_DATA,
|
|
250
|
+
domain: {
|
|
251
|
+
...REGISTER_WHITELIST_SPENDERS_TYPED_DATA.domain,
|
|
252
|
+
version: params.version ?? DEFAULT_REGISTER_WHITELIST_SPENDERS_VERSION
|
|
253
|
+
},
|
|
254
|
+
message: {
|
|
255
|
+
owner: params.owner,
|
|
256
|
+
spenders: params.spenders,
|
|
257
|
+
nonce: params.nonce,
|
|
258
|
+
deadline: params.deadline
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Removes one or more whitelist spender addresses from the authenticated account.
|
|
264
|
+
*
|
|
265
|
+
* @param params Spender addresses to revoke.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* await client.gasAccount.removeWhitelistSpenders({
|
|
270
|
+
* spenders: ['0x9876543210987654321098765432109876543210'],
|
|
271
|
+
* });
|
|
272
|
+
* ```
|
|
273
|
+
*/
|
|
274
|
+
async removeWhitelistSpenders(params) {
|
|
275
|
+
return this.http.delete("whitelist-spenders", params, {
|
|
276
|
+
auth: true
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Returns the authenticated user's balance summary.
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```ts
|
|
284
|
+
* const balance = await client.gasAccount.getBalance();
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
async getBalance() {
|
|
288
|
+
return this.http.get("gas-account-balance", { auth: true });
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Returns the authenticated user's balance summary with pending transaction lists.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```ts
|
|
295
|
+
* const detailedBalance = await client.gasAccount.getDetailedBalance();
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
async getDetailedBalance() {
|
|
299
|
+
return this.http.get("gas-account-balance/detailed", {
|
|
300
|
+
auth: true
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Returns balance statistics for the authenticated user's gas account.
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```ts
|
|
308
|
+
* const stats = await client.gasAccount.getBalanceStats();
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
async getBalanceStats() {
|
|
312
|
+
return this.http.get("gas-account-balance/stats", {
|
|
313
|
+
auth: true
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Returns balances for a batch of addresses through the public balances endpoint.
|
|
318
|
+
*
|
|
319
|
+
* @param params Address batch to query.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```ts
|
|
323
|
+
* const balances = await client.gasAccount.getBalances({
|
|
324
|
+
* addresses: [
|
|
325
|
+
* '0x3a0430580303f4De9C5320aC013f14cd92192bfA',
|
|
326
|
+
* '0x610b463d2f57d2e0d9e785a7ff423fbae36f0624',
|
|
327
|
+
* ],
|
|
328
|
+
* });
|
|
329
|
+
* ```
|
|
330
|
+
*/
|
|
331
|
+
async getBalances(params) {
|
|
332
|
+
return this.http.put("gas-account-balance/balances", params);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Returns a paginated transaction list for the authenticated user's gas account.
|
|
336
|
+
*
|
|
337
|
+
* @param params Optional pagination and filter parameters.
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```ts
|
|
341
|
+
* const transactions = await client.gasAccount.listTransactions({
|
|
342
|
+
* page: 1,
|
|
343
|
+
* per: 10,
|
|
344
|
+
* type: 'DEPOSIT',
|
|
345
|
+
* status: 'CONFIRMED',
|
|
346
|
+
* });
|
|
347
|
+
* ```
|
|
348
|
+
*/
|
|
349
|
+
async listTransactions(params = {}) {
|
|
350
|
+
const searchParams = new URLSearchParams();
|
|
351
|
+
if (params.page !== void 0) {
|
|
352
|
+
searchParams.set("page", String(params.page));
|
|
353
|
+
}
|
|
354
|
+
if (params.per !== void 0) {
|
|
355
|
+
searchParams.set("per", String(params.per));
|
|
356
|
+
}
|
|
357
|
+
if (params.type) {
|
|
358
|
+
searchParams.set("type", params.type);
|
|
359
|
+
}
|
|
360
|
+
if (params.status) {
|
|
361
|
+
searchParams.set("status", params.status);
|
|
362
|
+
}
|
|
363
|
+
const path = searchParams.size > 0 ? `gas-account-transaction?${searchParams.toString()}` : "gas-account-transaction";
|
|
364
|
+
return this.http.get(path, { auth: true });
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Returns detailed data for a specific transaction ID.
|
|
368
|
+
*
|
|
369
|
+
* @param transactionId Transaction UUID.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* ```ts
|
|
373
|
+
* const transaction = await client.gasAccount.getTransactionById(transactionId);
|
|
374
|
+
* ```
|
|
375
|
+
*/
|
|
376
|
+
async getTransactionById(transactionId) {
|
|
377
|
+
return this.http.get(
|
|
378
|
+
`gas-account-transaction/${transactionId}`,
|
|
379
|
+
{ auth: true }
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Creates a pending deposit transaction for the authenticated user.
|
|
384
|
+
*
|
|
385
|
+
* @param params Deposit payload.
|
|
386
|
+
*
|
|
387
|
+
* @example
|
|
388
|
+
* ```ts
|
|
389
|
+
* await client.gasAccount.createDeposit({
|
|
390
|
+
* chainId: 97,
|
|
391
|
+
* amount: '100.00000000',
|
|
392
|
+
* tokenAddress: '0x5bF5121A17e3329D07Ba43f758dEC271D9105132',
|
|
393
|
+
* txHash: '0xe3844e7bc420b2d409058e6bf5534fdba69b917907d691abf65862654df749d7',
|
|
394
|
+
* actor: walletAddress,
|
|
395
|
+
* notes: 'Deposit from wallet',
|
|
396
|
+
* });
|
|
397
|
+
* ```
|
|
398
|
+
*/
|
|
399
|
+
async createDeposit(params) {
|
|
400
|
+
return this.http.post("gas-account-transaction/deposit", params, {
|
|
401
|
+
auth: true
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Creates a gas-usage request against the caller's balance or a whitelisted source address.
|
|
406
|
+
*
|
|
407
|
+
* @param params Usage request payload.
|
|
408
|
+
*
|
|
409
|
+
* @example
|
|
410
|
+
* ```ts
|
|
411
|
+
* await client.gasAccount.useBalance({
|
|
412
|
+
* toAddress: '0x9876543210987654321098765432109876543210',
|
|
413
|
+
* chainId: 97,
|
|
414
|
+
* gasLimit: 21000,
|
|
415
|
+
* gasPrice: 5,
|
|
416
|
+
* notes: 'Gas for token transfer',
|
|
417
|
+
* });
|
|
418
|
+
* ```
|
|
419
|
+
*/
|
|
420
|
+
async useBalance(params) {
|
|
421
|
+
return this.http.post("gas-account-transaction/use-balance", params, {
|
|
422
|
+
auth: true
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Creates a sponsored transfer request.
|
|
427
|
+
*
|
|
428
|
+
* @param params Sponsored transfer payload.
|
|
429
|
+
*
|
|
430
|
+
* @example
|
|
431
|
+
* ```ts
|
|
432
|
+
* await client.gasAccount.createSponsoredTransfer({
|
|
433
|
+
* transactions: [
|
|
434
|
+
* {
|
|
435
|
+
* tokenAddress: '0x409E7b65eF7B243529e3F97be2A122123c55DE63',
|
|
436
|
+
* from: '0x1234567890123456789012345678901234567890',
|
|
437
|
+
* to: '0x9876543210987654321098765432109876543210',
|
|
438
|
+
* value: '1000000000000000000',
|
|
439
|
+
* validBefore: 1735689600,
|
|
440
|
+
* validAfter: 0,
|
|
441
|
+
* nonce: '0x0000000000000000000000000000000000000000000000000000000000000001',
|
|
442
|
+
* signature: '0x...',
|
|
443
|
+
* },
|
|
444
|
+
* ],
|
|
445
|
+
* chainId: 97,
|
|
446
|
+
* type: 'ADMIN',
|
|
447
|
+
* notes: 'JPYC transfer sponsorship',
|
|
448
|
+
* });
|
|
449
|
+
* ```
|
|
450
|
+
*/
|
|
451
|
+
async createSponsoredTransfer(params) {
|
|
452
|
+
return this.http.post(
|
|
453
|
+
"gas-account-transaction/sponsored-transfers",
|
|
454
|
+
params,
|
|
455
|
+
{ auth: true }
|
|
456
|
+
);
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
* Cancels a pending gas-account transaction that has not yet been broadcast.
|
|
460
|
+
*
|
|
461
|
+
* @param transactionId Transaction UUID.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* ```ts
|
|
465
|
+
* await client.gasAccount.cancelTransaction(transactionId);
|
|
466
|
+
* ```
|
|
467
|
+
*/
|
|
468
|
+
async cancelTransaction(transactionId) {
|
|
469
|
+
return this.http.put(
|
|
470
|
+
`gas-account-transaction/${transactionId}/cancel`,
|
|
471
|
+
void 0,
|
|
472
|
+
{ auth: true }
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
/**
|
|
476
|
+
* Creates an internal funding request on behalf of another service.
|
|
477
|
+
*
|
|
478
|
+
* @param params Funding request payload.
|
|
479
|
+
*
|
|
480
|
+
* @example
|
|
481
|
+
* ```ts
|
|
482
|
+
* await client.gasAccount.createFundingRequest({
|
|
483
|
+
* sourceAddress: '0x610b463d2f57d2e0d9e785a7ff423fbae36f0624',
|
|
484
|
+
* toAddress: '0x9876543210987654321098765432109876543210',
|
|
485
|
+
* chainId: 97,
|
|
486
|
+
* gasLimit: 21000,
|
|
487
|
+
* gasPrice: 5,
|
|
488
|
+
* notes: 'Gas for token transfer',
|
|
489
|
+
* });
|
|
490
|
+
* ```
|
|
491
|
+
*/
|
|
492
|
+
async createFundingRequest(params) {
|
|
493
|
+
return this.http.post(
|
|
494
|
+
"internal/gas-account-transaction/funding-requests",
|
|
495
|
+
params
|
|
496
|
+
);
|
|
51
497
|
}
|
|
52
498
|
};
|
|
53
499
|
|
|
@@ -88,8 +534,12 @@ var AvacusClient = class {
|
|
|
88
534
|
export {
|
|
89
535
|
AVACUS_ENDPOINTS,
|
|
90
536
|
AvacusClient,
|
|
537
|
+
BASE_CONNECT_SIGNED_MSG,
|
|
538
|
+
BASE_GAS_SPONSOR_SIGNED_MSG,
|
|
539
|
+
BASE_REDIRECT_SIGNED_MSG,
|
|
91
540
|
BalancerService,
|
|
92
541
|
DEFAULT_BASE_SIGNED_MESSAGE,
|
|
542
|
+
DEFAULT_REGISTER_WHITELIST_SPENDERS_VERSION,
|
|
93
543
|
GAS_ACCOUNT_SERVICE_PATH,
|
|
94
544
|
GasAccountService,
|
|
95
545
|
HttpAdapter,
|
|
@@ -70,6 +70,22 @@ declare class HttpAdapter {
|
|
|
70
70
|
* @param options Request behavior such as auth requirement and extra headers.
|
|
71
71
|
*/
|
|
72
72
|
post<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Sends an HTTP PUT request with a JSON body to a path relative to this adapter base URL.
|
|
75
|
+
*
|
|
76
|
+
* @param path Relative endpoint path.
|
|
77
|
+
* @param body Serializable request payload.
|
|
78
|
+
* @param options Request behavior such as auth requirement and extra headers.
|
|
79
|
+
*/
|
|
80
|
+
put<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Sends an HTTP DELETE request with an optional JSON body to a path relative to this adapter base URL.
|
|
83
|
+
*
|
|
84
|
+
* @param path Relative endpoint path.
|
|
85
|
+
* @param body Optional serializable request payload.
|
|
86
|
+
* @param options Request behavior such as auth requirement and extra headers.
|
|
87
|
+
*/
|
|
88
|
+
delete<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
73
89
|
/**
|
|
74
90
|
* Builds the final request headers by combining default headers, per-request
|
|
75
91
|
* headers, and an authorization header when the request requires auth.
|
|
@@ -86,9 +102,11 @@ declare class HttpAdapter {
|
|
|
86
102
|
}
|
|
87
103
|
|
|
88
104
|
type SignMessageFn = (message: string) => Promise<string>;
|
|
105
|
+
type SnsServiceName = 'connect' | 'redirect' | 'gas-sponsor';
|
|
89
106
|
interface SnsLoginParams {
|
|
90
107
|
walletAddress: string;
|
|
91
108
|
signMessage: SignMessageFn;
|
|
109
|
+
serviceName?: SnsServiceName;
|
|
92
110
|
}
|
|
93
111
|
interface SnsGetNonceParams {
|
|
94
112
|
walletAddress: string;
|
|
@@ -97,11 +115,13 @@ interface SnsAuthenticateParams {
|
|
|
97
115
|
walletAddress: string;
|
|
98
116
|
message: string;
|
|
99
117
|
signature: string;
|
|
118
|
+
serviceName?: SnsServiceName;
|
|
100
119
|
}
|
|
101
120
|
interface SnsAuthTokenPayload {
|
|
102
121
|
wallet_address: string;
|
|
103
122
|
message: string;
|
|
104
123
|
signature: string;
|
|
124
|
+
service_name?: SnsServiceName;
|
|
105
125
|
}
|
|
106
126
|
interface SnsGetProfilesParams {
|
|
107
127
|
wallets?: string[];
|
|
@@ -175,6 +195,9 @@ interface SnsServiceOptions {
|
|
|
175
195
|
}
|
|
176
196
|
|
|
177
197
|
declare const DEFAULT_BASE_SIGNED_MESSAGE = "Hi there from Avacus Wallet! Please sign this message to prove that you can access to secure chat. To stop hackers access to your secure chat, do not sign this message outside Avacus Wallet, and here's a unique message ID they can't guess: ";
|
|
198
|
+
declare const BASE_CONNECT_SIGNED_MSG = "Hi there from Avacus Connect! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Connect, and here's a unique message ID they can't guess: ";
|
|
199
|
+
declare const BASE_REDIRECT_SIGNED_MSG = "Hi there from Avacus Redirect! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Redirect, and here's a unique message ID they can't guess: ";
|
|
200
|
+
declare const BASE_GAS_SPONSOR_SIGNED_MSG = "Hi there from Avacus Gas Sponsor! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Gas Sponsor, and here's a unique message ID they can't guess: ";
|
|
178
201
|
/**
|
|
179
202
|
* Base path for all SNS endpoints. The client composes this with the resolved
|
|
180
203
|
* environment host before injecting the HTTP adapter into the service.
|
|
@@ -264,4 +287,4 @@ declare class SnsAuthClient extends SnsService {
|
|
|
264
287
|
isUsingCustomBaseUrl(): boolean;
|
|
265
288
|
}
|
|
266
289
|
|
|
267
|
-
export { AVACUS_ENDPOINTS as A, type BaseClientOptions as B,
|
|
290
|
+
export { AVACUS_ENDPOINTS as A, type BaseClientOptions as B, type SnsServiceOptions as C, DEFAULT_BASE_SIGNED_MESSAGE as D, isKnownAvacusBaseUrl as E, loginWithSns as F, resolveAvacusBaseUrl as G, HttpAdapter as H, resolveClientSettings as I, resolveServiceUrl as J, type RequestOptions as R, SnsService as S, type AuthState as a, type AvacusEnvironment as b, BASE_CONNECT_SIGNED_MSG as c, BASE_GAS_SPONSOR_SIGNED_MSG as d, BASE_REDIRECT_SIGNED_MSG as e, type ResolvedClientSettings as f, SNS_SERVICE_PATH as g, type SignMessageFn as h, SnsAuthClient as i, type SnsAuthClientOptions as j, type SnsAuthTokenPayload as k, type SnsAuthenticateParams as l, type SnsAvatar as m, type SnsCreateUserDeviceParams as n, type SnsCreateUserParams as o, type SnsCreateUserPayload as p, type SnsCreateUserResult as q, type SnsCreateUserWithSignatureParams as r, type SnsDevice as s, type SnsGetNonceParams as t, type SnsGetProfilesParams as u, type SnsLoginParams as v, type SnsLoginResult as w, type SnsNonceResponse as x, type SnsProfile as y, type SnsServiceName as z };
|
|
@@ -70,6 +70,22 @@ declare class HttpAdapter {
|
|
|
70
70
|
* @param options Request behavior such as auth requirement and extra headers.
|
|
71
71
|
*/
|
|
72
72
|
post<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Sends an HTTP PUT request with a JSON body to a path relative to this adapter base URL.
|
|
75
|
+
*
|
|
76
|
+
* @param path Relative endpoint path.
|
|
77
|
+
* @param body Serializable request payload.
|
|
78
|
+
* @param options Request behavior such as auth requirement and extra headers.
|
|
79
|
+
*/
|
|
80
|
+
put<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
81
|
+
/**
|
|
82
|
+
* Sends an HTTP DELETE request with an optional JSON body to a path relative to this adapter base URL.
|
|
83
|
+
*
|
|
84
|
+
* @param path Relative endpoint path.
|
|
85
|
+
* @param body Optional serializable request payload.
|
|
86
|
+
* @param options Request behavior such as auth requirement and extra headers.
|
|
87
|
+
*/
|
|
88
|
+
delete<T = unknown>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
73
89
|
/**
|
|
74
90
|
* Builds the final request headers by combining default headers, per-request
|
|
75
91
|
* headers, and an authorization header when the request requires auth.
|
|
@@ -86,9 +102,11 @@ declare class HttpAdapter {
|
|
|
86
102
|
}
|
|
87
103
|
|
|
88
104
|
type SignMessageFn = (message: string) => Promise<string>;
|
|
105
|
+
type SnsServiceName = 'connect' | 'redirect' | 'gas-sponsor';
|
|
89
106
|
interface SnsLoginParams {
|
|
90
107
|
walletAddress: string;
|
|
91
108
|
signMessage: SignMessageFn;
|
|
109
|
+
serviceName?: SnsServiceName;
|
|
92
110
|
}
|
|
93
111
|
interface SnsGetNonceParams {
|
|
94
112
|
walletAddress: string;
|
|
@@ -97,11 +115,13 @@ interface SnsAuthenticateParams {
|
|
|
97
115
|
walletAddress: string;
|
|
98
116
|
message: string;
|
|
99
117
|
signature: string;
|
|
118
|
+
serviceName?: SnsServiceName;
|
|
100
119
|
}
|
|
101
120
|
interface SnsAuthTokenPayload {
|
|
102
121
|
wallet_address: string;
|
|
103
122
|
message: string;
|
|
104
123
|
signature: string;
|
|
124
|
+
service_name?: SnsServiceName;
|
|
105
125
|
}
|
|
106
126
|
interface SnsGetProfilesParams {
|
|
107
127
|
wallets?: string[];
|
|
@@ -175,6 +195,9 @@ interface SnsServiceOptions {
|
|
|
175
195
|
}
|
|
176
196
|
|
|
177
197
|
declare const DEFAULT_BASE_SIGNED_MESSAGE = "Hi there from Avacus Wallet! Please sign this message to prove that you can access to secure chat. To stop hackers access to your secure chat, do not sign this message outside Avacus Wallet, and here's a unique message ID they can't guess: ";
|
|
198
|
+
declare const BASE_CONNECT_SIGNED_MSG = "Hi there from Avacus Connect! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Connect, and here's a unique message ID they can't guess: ";
|
|
199
|
+
declare const BASE_REDIRECT_SIGNED_MSG = "Hi there from Avacus Redirect! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Redirect, and here's a unique message ID they can't guess: ";
|
|
200
|
+
declare const BASE_GAS_SPONSOR_SIGNED_MSG = "Hi there from Avacus Gas Sponsor! Please sign this message to prove that you can access our service. For security reasons, do not sign this message outside Avacus Gas Sponsor, and here's a unique message ID they can't guess: ";
|
|
178
201
|
/**
|
|
179
202
|
* Base path for all SNS endpoints. The client composes this with the resolved
|
|
180
203
|
* environment host before injecting the HTTP adapter into the service.
|
|
@@ -264,4 +287,4 @@ declare class SnsAuthClient extends SnsService {
|
|
|
264
287
|
isUsingCustomBaseUrl(): boolean;
|
|
265
288
|
}
|
|
266
289
|
|
|
267
|
-
export { AVACUS_ENDPOINTS as A, type BaseClientOptions as B,
|
|
290
|
+
export { AVACUS_ENDPOINTS as A, type BaseClientOptions as B, type SnsServiceOptions as C, DEFAULT_BASE_SIGNED_MESSAGE as D, isKnownAvacusBaseUrl as E, loginWithSns as F, resolveAvacusBaseUrl as G, HttpAdapter as H, resolveClientSettings as I, resolveServiceUrl as J, type RequestOptions as R, SnsService as S, type AuthState as a, type AvacusEnvironment as b, BASE_CONNECT_SIGNED_MSG as c, BASE_GAS_SPONSOR_SIGNED_MSG as d, BASE_REDIRECT_SIGNED_MSG as e, type ResolvedClientSettings as f, SNS_SERVICE_PATH as g, type SignMessageFn as h, SnsAuthClient as i, type SnsAuthClientOptions as j, type SnsAuthTokenPayload as k, type SnsAuthenticateParams as l, type SnsAvatar as m, type SnsCreateUserDeviceParams as n, type SnsCreateUserParams as o, type SnsCreateUserPayload as p, type SnsCreateUserResult as q, type SnsCreateUserWithSignatureParams as r, type SnsDevice as s, type SnsGetNonceParams as t, type SnsGetProfilesParams as u, type SnsLoginParams as v, type SnsLoginResult as w, type SnsNonceResponse as x, type SnsProfile as y, type SnsServiceName as z };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AVACUS_ENDPOINTS, a as AuthState, b as AvacusEnvironment, D as DEFAULT_BASE_SIGNED_MESSAGE, H as HttpAdapter, R as RequestOptions,
|
|
1
|
+
export { A as AVACUS_ENDPOINTS, a as AuthState, b as AvacusEnvironment, c as BASE_CONNECT_SIGNED_MSG, d as BASE_GAS_SPONSOR_SIGNED_MSG, e as BASE_REDIRECT_SIGNED_MSG, D as DEFAULT_BASE_SIGNED_MESSAGE, H as HttpAdapter, R as RequestOptions, f as ResolvedClientSettings, h as SignMessageFn, i as SnsAuthClient, j as SnsAuthClientOptions, k as SnsAuthTokenPayload, l as SnsAuthenticateParams, m as SnsAvatar, n as SnsCreateUserDeviceParams, o as SnsCreateUserParams, p as SnsCreateUserPayload, q as SnsCreateUserResult, r as SnsCreateUserWithSignatureParams, s as SnsDevice, t as SnsGetNonceParams, u as SnsGetProfilesParams, v as SnsLoginParams, w as SnsLoginResult, x as SnsNonceResponse, y as SnsProfile, S as SnsService, z as SnsServiceName, C as SnsServiceOptions, F as loginWithSns } from './sns-Zwan9DNM.mjs';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { A as AVACUS_ENDPOINTS, a as AuthState, b as AvacusEnvironment, D as DEFAULT_BASE_SIGNED_MESSAGE, H as HttpAdapter, R as RequestOptions,
|
|
1
|
+
export { A as AVACUS_ENDPOINTS, a as AuthState, b as AvacusEnvironment, c as BASE_CONNECT_SIGNED_MSG, d as BASE_GAS_SPONSOR_SIGNED_MSG, e as BASE_REDIRECT_SIGNED_MSG, D as DEFAULT_BASE_SIGNED_MESSAGE, H as HttpAdapter, R as RequestOptions, f as ResolvedClientSettings, h as SignMessageFn, i as SnsAuthClient, j as SnsAuthClientOptions, k as SnsAuthTokenPayload, l as SnsAuthenticateParams, m as SnsAvatar, n as SnsCreateUserDeviceParams, o as SnsCreateUserParams, p as SnsCreateUserPayload, q as SnsCreateUserResult, r as SnsCreateUserWithSignatureParams, s as SnsDevice, t as SnsGetNonceParams, u as SnsGetProfilesParams, v as SnsLoginParams, w as SnsLoginResult, x as SnsNonceResponse, y as SnsProfile, S as SnsService, z as SnsServiceName, C as SnsServiceOptions, F as loginWithSns } from './sns-Zwan9DNM.js';
|