@chipi-stack/backend 13.2.0 → 13.4.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/dist/index.d.mts +1 -42
- package/dist/index.d.ts +1 -42
- package/dist/index.js +0 -104
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -5
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, Currency, ChipiSDKConfig, ExecuteTransactionParams, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, ChipiServerSDKConfig, ChipiBrowserSDKConfig } from '@chipi-stack/types';
|
|
3
3
|
export * from '@chipi-stack/types';
|
|
4
4
|
import { ChipiWallets } from './wallets.mjs';
|
|
5
5
|
import { ChipiTransactions } from './transactions.mjs';
|
|
@@ -7,30 +7,6 @@ import { ChipiSkuPurchases } from './skuPurchases.mjs';
|
|
|
7
7
|
import { ChipiSkus } from './skus.mjs';
|
|
8
8
|
import { C as ChipiClient } from './client-43S3tkH3.mjs';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* User management
|
|
12
|
-
*/
|
|
13
|
-
declare class Users {
|
|
14
|
-
private client;
|
|
15
|
-
constructor(client: ChipiClient);
|
|
16
|
-
/**
|
|
17
|
-
* Get a single SKU by ID
|
|
18
|
-
* @param bearerToken - Authentication token for API calls
|
|
19
|
-
* @param id - SKU ID
|
|
20
|
-
* @returns Promise<Sku> - Single SKU
|
|
21
|
-
*/
|
|
22
|
-
getUser(params: GetUserParams, bearerToken: string): Promise<User & {
|
|
23
|
-
chipiWallets?: WalletData[];
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Create a new user
|
|
27
|
-
* @param bearerToken - Authentication token for API calls
|
|
28
|
-
* @param params - CreateUserParams
|
|
29
|
-
* @returns Promise<User> - Single User
|
|
30
|
-
*/
|
|
31
|
-
createUser(params: CreateUserParams, bearerToken: string): Promise<User>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
10
|
/**
|
|
35
11
|
* Session key management for CHIPI wallets (SNIP-9 compatible).
|
|
36
12
|
*
|
|
@@ -209,7 +185,6 @@ declare class ChipiSDK {
|
|
|
209
185
|
readonly transactions: ChipiTransactions;
|
|
210
186
|
readonly skuPurchases: ChipiSkuPurchases;
|
|
211
187
|
readonly skus: ChipiSkus;
|
|
212
|
-
readonly users: Users;
|
|
213
188
|
readonly sessions: ChipiSessions;
|
|
214
189
|
readonly exchanges: ChipiExchanges;
|
|
215
190
|
constructor(config: ChipiSDKConfig);
|
|
@@ -276,20 +251,6 @@ declare class ChipiSDK {
|
|
|
276
251
|
params: ApproveParams;
|
|
277
252
|
bearerToken?: string;
|
|
278
253
|
}): Promise<string>;
|
|
279
|
-
/**
|
|
280
|
-
* Stake USDC in Vesu protocol
|
|
281
|
-
*/
|
|
282
|
-
stakeVesuUsdc({ params, bearerToken, }: {
|
|
283
|
-
params: StakeVesuUsdcParams;
|
|
284
|
-
bearerToken?: string;
|
|
285
|
-
}): Promise<string>;
|
|
286
|
-
/**
|
|
287
|
-
* Withdraw USDC from Vesu protocol
|
|
288
|
-
*/
|
|
289
|
-
withdrawVesuUsdc({ params, bearerToken, }: {
|
|
290
|
-
params: WithdrawVesuUsdcParams;
|
|
291
|
-
bearerToken?: string;
|
|
292
|
-
}): Promise<string>;
|
|
293
254
|
/**
|
|
294
255
|
* Call any contract method
|
|
295
256
|
*/
|
|
@@ -324,8 +285,6 @@ declare class ChipiSDK {
|
|
|
324
285
|
getSkuPurchase(id: string, bearerToken?: string): Promise<Transaction>;
|
|
325
286
|
getSkuList(params: GetSkuListQuery, bearerToken?: string): Promise<PaginatedResponse<Sku>>;
|
|
326
287
|
getSku(id: string, bearerToken?: string): Promise<Sku>;
|
|
327
|
-
getUser(params: GetUserParams, bearerToken?: string): Promise<User>;
|
|
328
|
-
createUser(params: CreateUserParams, bearerToken?: string): Promise<User>;
|
|
329
288
|
getUsdAmount(currencyAmount: number, currency: Currency, bearerToken?: string): Promise<number>;
|
|
330
289
|
}
|
|
331
290
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _chipi_stack_types from '@chipi-stack/types';
|
|
2
|
-
import {
|
|
2
|
+
import { CreateSessionKeyParams, SessionKeyData, AddSessionKeyParams, RevokeSessionKeyParams, GetSessionDataParams, SessionDataResponse, ExecuteWithSessionParams, Currency, ChipiSDKConfig, ExecuteTransactionParams, TransferParams, ApproveParams, CallAnyContractParams, CreateWalletParams, CreateWalletResponse, RecordSendTransactionParams, Transaction, GetTransactionListQuery, PaginatedResponse, GetWalletParams, GetTokenBalanceParams, GetTokenBalanceResponse, CreateSkuPurchaseParams, GetSkuListQuery, Sku, ChipiServerSDKConfig, ChipiBrowserSDKConfig } from '@chipi-stack/types';
|
|
3
3
|
export * from '@chipi-stack/types';
|
|
4
4
|
import { ChipiWallets } from './wallets.js';
|
|
5
5
|
import { ChipiTransactions } from './transactions.js';
|
|
@@ -7,30 +7,6 @@ import { ChipiSkuPurchases } from './skuPurchases.js';
|
|
|
7
7
|
import { ChipiSkus } from './skus.js';
|
|
8
8
|
import { C as ChipiClient } from './client-43S3tkH3.js';
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* User management
|
|
12
|
-
*/
|
|
13
|
-
declare class Users {
|
|
14
|
-
private client;
|
|
15
|
-
constructor(client: ChipiClient);
|
|
16
|
-
/**
|
|
17
|
-
* Get a single SKU by ID
|
|
18
|
-
* @param bearerToken - Authentication token for API calls
|
|
19
|
-
* @param id - SKU ID
|
|
20
|
-
* @returns Promise<Sku> - Single SKU
|
|
21
|
-
*/
|
|
22
|
-
getUser(params: GetUserParams, bearerToken: string): Promise<User & {
|
|
23
|
-
chipiWallets?: WalletData[];
|
|
24
|
-
}>;
|
|
25
|
-
/**
|
|
26
|
-
* Create a new user
|
|
27
|
-
* @param bearerToken - Authentication token for API calls
|
|
28
|
-
* @param params - CreateUserParams
|
|
29
|
-
* @returns Promise<User> - Single User
|
|
30
|
-
*/
|
|
31
|
-
createUser(params: CreateUserParams, bearerToken: string): Promise<User>;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
10
|
/**
|
|
35
11
|
* Session key management for CHIPI wallets (SNIP-9 compatible).
|
|
36
12
|
*
|
|
@@ -209,7 +185,6 @@ declare class ChipiSDK {
|
|
|
209
185
|
readonly transactions: ChipiTransactions;
|
|
210
186
|
readonly skuPurchases: ChipiSkuPurchases;
|
|
211
187
|
readonly skus: ChipiSkus;
|
|
212
|
-
readonly users: Users;
|
|
213
188
|
readonly sessions: ChipiSessions;
|
|
214
189
|
readonly exchanges: ChipiExchanges;
|
|
215
190
|
constructor(config: ChipiSDKConfig);
|
|
@@ -276,20 +251,6 @@ declare class ChipiSDK {
|
|
|
276
251
|
params: ApproveParams;
|
|
277
252
|
bearerToken?: string;
|
|
278
253
|
}): Promise<string>;
|
|
279
|
-
/**
|
|
280
|
-
* Stake USDC in Vesu protocol
|
|
281
|
-
*/
|
|
282
|
-
stakeVesuUsdc({ params, bearerToken, }: {
|
|
283
|
-
params: StakeVesuUsdcParams;
|
|
284
|
-
bearerToken?: string;
|
|
285
|
-
}): Promise<string>;
|
|
286
|
-
/**
|
|
287
|
-
* Withdraw USDC from Vesu protocol
|
|
288
|
-
*/
|
|
289
|
-
withdrawVesuUsdc({ params, bearerToken, }: {
|
|
290
|
-
params: WithdrawVesuUsdcParams;
|
|
291
|
-
bearerToken?: string;
|
|
292
|
-
}): Promise<string>;
|
|
293
254
|
/**
|
|
294
255
|
* Call any contract method
|
|
295
256
|
*/
|
|
@@ -324,8 +285,6 @@ declare class ChipiSDK {
|
|
|
324
285
|
getSkuPurchase(id: string, bearerToken?: string): Promise<Transaction>;
|
|
325
286
|
getSkuList(params: GetSkuListQuery, bearerToken?: string): Promise<PaginatedResponse<Sku>>;
|
|
326
287
|
getSku(id: string, bearerToken?: string): Promise<Sku>;
|
|
327
|
-
getUser(params: GetUserParams, bearerToken?: string): Promise<User>;
|
|
328
|
-
createUser(params: CreateUserParams, bearerToken?: string): Promise<User>;
|
|
329
288
|
getUsdAmount(currencyAmount: number, currency: Currency, bearerToken?: string): Promise<number>;
|
|
330
289
|
}
|
|
331
290
|
|
package/dist/index.js
CHANGED
|
@@ -840,43 +840,6 @@ var ChipiSkus = class {
|
|
|
840
840
|
});
|
|
841
841
|
}
|
|
842
842
|
};
|
|
843
|
-
var Users = class {
|
|
844
|
-
constructor(client) {
|
|
845
|
-
this.client = client;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Get a single SKU by ID
|
|
849
|
-
* @param bearerToken - Authentication token for API calls
|
|
850
|
-
* @param id - SKU ID
|
|
851
|
-
* @returns Promise<Sku> - Single SKU
|
|
852
|
-
*/
|
|
853
|
-
async getUser(params, bearerToken) {
|
|
854
|
-
const { phone, ...rest } = params;
|
|
855
|
-
const queryParams = {
|
|
856
|
-
...rest,
|
|
857
|
-
phoneCountryCode: phone?.phoneCountryCode?.toString() || void 0,
|
|
858
|
-
phoneNumber: phone?.phoneNumber?.toString() || void 0
|
|
859
|
-
};
|
|
860
|
-
return this.client.get({
|
|
861
|
-
endpoint: `${shared.API_ENDPOINTS.USERS}`,
|
|
862
|
-
params: queryParams,
|
|
863
|
-
bearerToken
|
|
864
|
-
});
|
|
865
|
-
}
|
|
866
|
-
/**
|
|
867
|
-
* Create a new user
|
|
868
|
-
* @param bearerToken - Authentication token for API calls
|
|
869
|
-
* @param params - CreateUserParams
|
|
870
|
-
* @returns Promise<User> - Single User
|
|
871
|
-
*/
|
|
872
|
-
async createUser(params, bearerToken) {
|
|
873
|
-
return this.client.post({
|
|
874
|
-
endpoint: `${shared.API_ENDPOINTS.USERS}`,
|
|
875
|
-
bearerToken,
|
|
876
|
-
body: params
|
|
877
|
-
});
|
|
878
|
-
}
|
|
879
|
-
};
|
|
880
843
|
var ChipiSessions = class {
|
|
881
844
|
constructor(client) {
|
|
882
845
|
this.client = client;
|
|
@@ -1264,15 +1227,12 @@ var ChipiSDK = class {
|
|
|
1264
1227
|
this.transactions = new ChipiTransactions(this.client);
|
|
1265
1228
|
this.skuPurchases = new ChipiSkuPurchases(this.client);
|
|
1266
1229
|
this.skus = new ChipiSkus(this.client);
|
|
1267
|
-
this.users = new Users(this.client);
|
|
1268
1230
|
this.sessions = new ChipiSessions(this.client);
|
|
1269
1231
|
this.exchanges = new ChipiExchanges(this.client);
|
|
1270
1232
|
this.executeTransaction = this.executeTransaction.bind(this);
|
|
1271
1233
|
this.executeTransactionWithSession = this.executeTransactionWithSession.bind(this);
|
|
1272
1234
|
this.transfer = this.transfer.bind(this);
|
|
1273
1235
|
this.approve = this.approve.bind(this);
|
|
1274
|
-
this.stakeVesuUsdc = this.stakeVesuUsdc.bind(this);
|
|
1275
|
-
this.withdrawVesuUsdc = this.withdrawVesuUsdc.bind(this);
|
|
1276
1236
|
this.callAnyContract = this.callAnyContract.bind(this);
|
|
1277
1237
|
this.createWallet = this.createWallet.bind(this);
|
|
1278
1238
|
this.recordSendTransaction = this.recordSendTransaction.bind(this);
|
|
@@ -1381,63 +1341,6 @@ var ChipiSDK = class {
|
|
|
1381
1341
|
bearerToken: this.resolveBearerToken(bearerToken)
|
|
1382
1342
|
});
|
|
1383
1343
|
}
|
|
1384
|
-
/**
|
|
1385
|
-
* Stake USDC in Vesu protocol
|
|
1386
|
-
*/
|
|
1387
|
-
async stakeVesuUsdc({
|
|
1388
|
-
params,
|
|
1389
|
-
bearerToken
|
|
1390
|
-
}) {
|
|
1391
|
-
const { encryptKey, wallet, amount, receiverWallet } = params;
|
|
1392
|
-
const formattedAmount = shared.formatAmount(amount, 6);
|
|
1393
|
-
return this.executeTransaction({
|
|
1394
|
-
params: {
|
|
1395
|
-
encryptKey,
|
|
1396
|
-
wallet,
|
|
1397
|
-
calls: [
|
|
1398
|
-
{
|
|
1399
|
-
contractAddress: shared.CONTRACT_ADDRESSES.USDC_MAINNET,
|
|
1400
|
-
entrypoint: "approve",
|
|
1401
|
-
calldata: [
|
|
1402
|
-
shared.CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
|
|
1403
|
-
formattedAmount,
|
|
1404
|
-
"0x0"
|
|
1405
|
-
]
|
|
1406
|
-
},
|
|
1407
|
-
{
|
|
1408
|
-
contractAddress: shared.CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
|
|
1409
|
-
entrypoint: "deposit",
|
|
1410
|
-
calldata: [formattedAmount, "0x0", receiverWallet]
|
|
1411
|
-
}
|
|
1412
|
-
]
|
|
1413
|
-
},
|
|
1414
|
-
bearerToken: this.resolveBearerToken(bearerToken)
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
/**
|
|
1418
|
-
* Withdraw USDC from Vesu protocol
|
|
1419
|
-
*/
|
|
1420
|
-
async withdrawVesuUsdc({
|
|
1421
|
-
params,
|
|
1422
|
-
bearerToken
|
|
1423
|
-
}) {
|
|
1424
|
-
const { encryptKey, wallet, amount, recipient } = params;
|
|
1425
|
-
const formattedAmount = shared.formatAmount(amount, 6);
|
|
1426
|
-
return this.executeTransaction({
|
|
1427
|
-
params: {
|
|
1428
|
-
encryptKey,
|
|
1429
|
-
wallet,
|
|
1430
|
-
calls: [
|
|
1431
|
-
{
|
|
1432
|
-
contractAddress: shared.CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
|
|
1433
|
-
entrypoint: "withdraw",
|
|
1434
|
-
calldata: [formattedAmount, recipient, "0x0"]
|
|
1435
|
-
}
|
|
1436
|
-
]
|
|
1437
|
-
},
|
|
1438
|
-
bearerToken: this.resolveBearerToken(bearerToken)
|
|
1439
|
-
});
|
|
1440
|
-
}
|
|
1441
1344
|
/**
|
|
1442
1345
|
* Call any contract method
|
|
1443
1346
|
*/
|
|
@@ -1519,13 +1422,6 @@ var ChipiSDK = class {
|
|
|
1519
1422
|
async getSku(id, bearerToken) {
|
|
1520
1423
|
return this.skus.getSku(id, this.resolveBearerToken(bearerToken));
|
|
1521
1424
|
}
|
|
1522
|
-
// USERS
|
|
1523
|
-
async getUser(params, bearerToken) {
|
|
1524
|
-
return this.users.getUser(params, this.resolveBearerToken(bearerToken));
|
|
1525
|
-
}
|
|
1526
|
-
async createUser(params, bearerToken) {
|
|
1527
|
-
return this.users.createUser(params, this.resolveBearerToken(bearerToken));
|
|
1528
|
-
}
|
|
1529
1425
|
async getUsdAmount(currencyAmount, currency, bearerToken) {
|
|
1530
1426
|
return this.exchanges.getUsdAmount(
|
|
1531
1427
|
currencyAmount,
|