@proofchain/sdk 2.11.1 → 2.12.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/dist/index.js CHANGED
@@ -879,7 +879,7 @@ var WalletClient = class {
879
879
  /**
880
880
  * Bulk create dual wallets for multiple users
881
881
  */
882
- async createDualBulk(userIds, network = "base-sepolia") {
882
+ async createDualBulk(userIds, network = "base-mainnet") {
883
883
  return this.http.post("/wallets/dual/bulk", {
884
884
  user_ids: userIds,
885
885
  network
@@ -1274,13 +1274,13 @@ var EndUsersClient = class {
1274
1274
  * const result = await client.users.ensureWallet('user-123', 'base-mainnet');
1275
1275
  * ```
1276
1276
  */
1277
- async ensureWallet(externalId, network = "base-sepolia") {
1278
- const existingWallets = await this.http.get(
1279
- `/wallets/user/${encodeURIComponent(externalId)}`
1280
- );
1281
- if (existingWallets && existingWallets.length > 0) {
1282
- const eoa = existingWallets.find((w) => w.wallet_type === "eoa");
1283
- const smart = existingWallets.find((w) => w.wallet_type === "smart");
1277
+ async ensureWallet(externalId, network = "base-mainnet") {
1278
+ try {
1279
+ const result = await this.http.get(
1280
+ `/wallets/user/${encodeURIComponent(externalId)}/all`
1281
+ );
1282
+ const eoa = result?.asset_wallets?.[0];
1283
+ const smart = result?.smart_wallets?.[0];
1284
1284
  if (eoa && smart) {
1285
1285
  return {
1286
1286
  user_id: externalId,
@@ -1319,6 +1319,7 @@ var EndUsersClient = class {
1319
1319
  created: true
1320
1320
  };
1321
1321
  }
1322
+ } catch {
1322
1323
  }
1323
1324
  const dual = await this.http.post("/wallets/dual", {
1324
1325
  user_id: externalId,
package/dist/index.mjs CHANGED
@@ -825,7 +825,7 @@ var WalletClient = class {
825
825
  /**
826
826
  * Bulk create dual wallets for multiple users
827
827
  */
828
- async createDualBulk(userIds, network = "base-sepolia") {
828
+ async createDualBulk(userIds, network = "base-mainnet") {
829
829
  return this.http.post("/wallets/dual/bulk", {
830
830
  user_ids: userIds,
831
831
  network
@@ -1220,13 +1220,13 @@ var EndUsersClient = class {
1220
1220
  * const result = await client.users.ensureWallet('user-123', 'base-mainnet');
1221
1221
  * ```
1222
1222
  */
1223
- async ensureWallet(externalId, network = "base-sepolia") {
1224
- const existingWallets = await this.http.get(
1225
- `/wallets/user/${encodeURIComponent(externalId)}`
1226
- );
1227
- if (existingWallets && existingWallets.length > 0) {
1228
- const eoa = existingWallets.find((w) => w.wallet_type === "eoa");
1229
- const smart = existingWallets.find((w) => w.wallet_type === "smart");
1223
+ async ensureWallet(externalId, network = "base-mainnet") {
1224
+ try {
1225
+ const result = await this.http.get(
1226
+ `/wallets/user/${encodeURIComponent(externalId)}/all`
1227
+ );
1228
+ const eoa = result?.asset_wallets?.[0];
1229
+ const smart = result?.smart_wallets?.[0];
1230
1230
  if (eoa && smart) {
1231
1231
  return {
1232
1232
  user_id: externalId,
@@ -1265,6 +1265,7 @@ var EndUsersClient = class {
1265
1265
  created: true
1266
1266
  };
1267
1267
  }
1268
+ } catch {
1268
1269
  }
1269
1270
  const dual = await this.http.post("/wallets/dual", {
1270
1271
  user_id: externalId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proofchain/sdk",
3
- "version": "2.11.1",
3
+ "version": "2.12.1",
4
4
  "description": "Official JavaScript/TypeScript SDK for ProofChain - blockchain-anchored document attestation",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",