@chipi-stack/backend 13.2.0 → 13.3.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.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { isValidApiKey, ChipiAuthError, STARKNET_NETWORKS, API_VERSIONING, validateErrorResponse, ChipiApiError, handleApiError, WALLET_RPC_ENDPOINTS, WALLET_CLASS_HASHES, API_ENDPOINTS, ChipiTransactionError, formatAmount, SKU_CONTRACTS, CARRIER_IDS, SERVICE_TYPES, ChipiSessionError, SESSION_ERRORS, SESSION_DEFAULTS, SESSION_ENTRYPOINTS, CONTRACT_ADDRESSES } from '@chipi-stack/shared';
1
+ import { isValidApiKey, ChipiAuthError, STARKNET_NETWORKS, API_VERSIONING, validateErrorResponse, ChipiApiError, handleApiError, WALLET_RPC_ENDPOINTS, WALLET_CLASS_HASHES, API_ENDPOINTS, ChipiTransactionError, formatAmount, SKU_CONTRACTS, CARRIER_IDS, SERVICE_TYPES, ChipiSessionError, SESSION_ERRORS, SESSION_DEFAULTS, SESSION_ENTRYPOINTS } from '@chipi-stack/shared';
2
2
  import CryptoES from 'crypto-es';
3
3
  import { RpcProvider, ec, hash, Account, num, CairoCustomEnum, CairoOption, CairoOptionVariant, CallData, cairo, typedData } from 'starknet';
4
4
  import { STARKNET_CONTRACTS } from '@chipi-stack/types';
@@ -834,43 +834,6 @@ var ChipiSkus = class {
834
834
  });
835
835
  }
836
836
  };
837
- var Users = class {
838
- constructor(client) {
839
- this.client = client;
840
- }
841
- /**
842
- * Get a single SKU by ID
843
- * @param bearerToken - Authentication token for API calls
844
- * @param id - SKU ID
845
- * @returns Promise<Sku> - Single SKU
846
- */
847
- async getUser(params, bearerToken) {
848
- const { phone, ...rest } = params;
849
- const queryParams = {
850
- ...rest,
851
- phoneCountryCode: phone?.phoneCountryCode?.toString() || void 0,
852
- phoneNumber: phone?.phoneNumber?.toString() || void 0
853
- };
854
- return this.client.get({
855
- endpoint: `${API_ENDPOINTS.USERS}`,
856
- params: queryParams,
857
- bearerToken
858
- });
859
- }
860
- /**
861
- * Create a new user
862
- * @param bearerToken - Authentication token for API calls
863
- * @param params - CreateUserParams
864
- * @returns Promise<User> - Single User
865
- */
866
- async createUser(params, bearerToken) {
867
- return this.client.post({
868
- endpoint: `${API_ENDPOINTS.USERS}`,
869
- bearerToken,
870
- body: params
871
- });
872
- }
873
- };
874
837
  var ChipiSessions = class {
875
838
  constructor(client) {
876
839
  this.client = client;
@@ -1258,15 +1221,12 @@ var ChipiSDK = class {
1258
1221
  this.transactions = new ChipiTransactions(this.client);
1259
1222
  this.skuPurchases = new ChipiSkuPurchases(this.client);
1260
1223
  this.skus = new ChipiSkus(this.client);
1261
- this.users = new Users(this.client);
1262
1224
  this.sessions = new ChipiSessions(this.client);
1263
1225
  this.exchanges = new ChipiExchanges(this.client);
1264
1226
  this.executeTransaction = this.executeTransaction.bind(this);
1265
1227
  this.executeTransactionWithSession = this.executeTransactionWithSession.bind(this);
1266
1228
  this.transfer = this.transfer.bind(this);
1267
1229
  this.approve = this.approve.bind(this);
1268
- this.stakeVesuUsdc = this.stakeVesuUsdc.bind(this);
1269
- this.withdrawVesuUsdc = this.withdrawVesuUsdc.bind(this);
1270
1230
  this.callAnyContract = this.callAnyContract.bind(this);
1271
1231
  this.createWallet = this.createWallet.bind(this);
1272
1232
  this.recordSendTransaction = this.recordSendTransaction.bind(this);
@@ -1375,63 +1335,6 @@ var ChipiSDK = class {
1375
1335
  bearerToken: this.resolveBearerToken(bearerToken)
1376
1336
  });
1377
1337
  }
1378
- /**
1379
- * Stake USDC in Vesu protocol
1380
- */
1381
- async stakeVesuUsdc({
1382
- params,
1383
- bearerToken
1384
- }) {
1385
- const { encryptKey, wallet, amount, receiverWallet } = params;
1386
- const formattedAmount = formatAmount(amount, 6);
1387
- return this.executeTransaction({
1388
- params: {
1389
- encryptKey,
1390
- wallet,
1391
- calls: [
1392
- {
1393
- contractAddress: CONTRACT_ADDRESSES.USDC_MAINNET,
1394
- entrypoint: "approve",
1395
- calldata: [
1396
- CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
1397
- formattedAmount,
1398
- "0x0"
1399
- ]
1400
- },
1401
- {
1402
- contractAddress: CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
1403
- entrypoint: "deposit",
1404
- calldata: [formattedAmount, "0x0", receiverWallet]
1405
- }
1406
- ]
1407
- },
1408
- bearerToken: this.resolveBearerToken(bearerToken)
1409
- });
1410
- }
1411
- /**
1412
- * Withdraw USDC from Vesu protocol
1413
- */
1414
- async withdrawVesuUsdc({
1415
- params,
1416
- bearerToken
1417
- }) {
1418
- const { encryptKey, wallet, amount, recipient } = params;
1419
- const formattedAmount = formatAmount(amount, 6);
1420
- return this.executeTransaction({
1421
- params: {
1422
- encryptKey,
1423
- wallet,
1424
- calls: [
1425
- {
1426
- contractAddress: CONTRACT_ADDRESSES.VESU_USDC_MAINNET,
1427
- entrypoint: "withdraw",
1428
- calldata: [formattedAmount, recipient, "0x0"]
1429
- }
1430
- ]
1431
- },
1432
- bearerToken: this.resolveBearerToken(bearerToken)
1433
- });
1434
- }
1435
1338
  /**
1436
1339
  * Call any contract method
1437
1340
  */
@@ -1513,13 +1416,6 @@ var ChipiSDK = class {
1513
1416
  async getSku(id, bearerToken) {
1514
1417
  return this.skus.getSku(id, this.resolveBearerToken(bearerToken));
1515
1418
  }
1516
- // USERS
1517
- async getUser(params, bearerToken) {
1518
- return this.users.getUser(params, this.resolveBearerToken(bearerToken));
1519
- }
1520
- async createUser(params, bearerToken) {
1521
- return this.users.createUser(params, this.resolveBearerToken(bearerToken));
1522
- }
1523
1419
  async getUsdAmount(currencyAmount, currency, bearerToken) {
1524
1420
  return this.exchanges.getUsdAmount(
1525
1421
  currencyAmount,