@p2pdotme/sdk 1.1.8 → 1.1.9

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/profile.mjs CHANGED
@@ -478,6 +478,97 @@ var p2pConfigFacetAbi = [
478
478
  }
479
479
  ];
480
480
 
481
+ // src/contracts/abis/p2p-stake-boost-facet.ts
482
+ var p2pStakeBoostFacetAbi = [
483
+ {
484
+ inputs: [{ internalType: "uint256", name: "tokens", type: "uint256" }],
485
+ name: "p2pBoostStake",
486
+ outputs: [],
487
+ stateMutability: "nonpayable",
488
+ type: "function"
489
+ },
490
+ {
491
+ inputs: [{ internalType: "uint256", name: "tokens", type: "uint256" }],
492
+ name: "p2pBoostTopUp",
493
+ outputs: [],
494
+ stateMutability: "nonpayable",
495
+ type: "function"
496
+ },
497
+ {
498
+ inputs: [],
499
+ name: "p2pBoostRequestUnstake",
500
+ outputs: [],
501
+ stateMutability: "nonpayable",
502
+ type: "function"
503
+ },
504
+ {
505
+ inputs: [],
506
+ name: "p2pBoostClaimUnstake",
507
+ outputs: [],
508
+ stateMutability: "nonpayable",
509
+ type: "function"
510
+ },
511
+ {
512
+ inputs: [{ internalType: "address", name: "user", type: "address" }],
513
+ name: "getUserStake",
514
+ outputs: [
515
+ {
516
+ components: [
517
+ { internalType: "uint128", name: "stakedAmount", type: "uint128" },
518
+ { internalType: "uint64", name: "cooldownEnd", type: "uint64" },
519
+ { internalType: "uint8", name: "status", type: "uint8" }
520
+ ],
521
+ internalType: "struct P2PStakeBoostStorage.UserStake",
522
+ name: "",
523
+ type: "tuple"
524
+ }
525
+ ],
526
+ stateMutability: "view",
527
+ type: "function"
528
+ },
529
+ {
530
+ inputs: [{ internalType: "bytes32", name: "currency", type: "bytes32" }],
531
+ name: "getStakeBoostConfig",
532
+ outputs: [
533
+ {
534
+ components: [
535
+ {
536
+ internalType: "uint256",
537
+ name: "tokensPerUsdNumerator",
538
+ type: "uint256"
539
+ },
540
+ {
541
+ internalType: "uint256",
542
+ name: "tokensPerUsdDenominator",
543
+ type: "uint256"
544
+ },
545
+ { internalType: "uint256", name: "maxBoostUsd", type: "uint256" }
546
+ ],
547
+ internalType: "struct P2PStakeBoostStorage.BoostConfig",
548
+ name: "",
549
+ type: "tuple"
550
+ }
551
+ ],
552
+ stateMutability: "view",
553
+ type: "function"
554
+ },
555
+ {
556
+ inputs: [],
557
+ name: "getStakeBoostGlobals",
558
+ outputs: [
559
+ { internalType: "address", name: "p2pToken", type: "address" },
560
+ { internalType: "address", name: "fraudReserve", type: "address" },
561
+ { internalType: "uint256", name: "maxStakeTokens", type: "uint256" },
562
+ { internalType: "uint256", name: "normalCooldown", type: "uint256" },
563
+ { internalType: "uint256", name: "blacklistCooldown", type: "uint256" },
564
+ { internalType: "uint8", name: "tokenDecimals", type: "uint8" },
565
+ { internalType: "uint256", name: "totalStaked", type: "uint256" }
566
+ ],
567
+ stateMutability: "view",
568
+ type: "function"
569
+ }
570
+ ];
571
+
481
572
  // src/contracts/abis/reputation-manager.ts
482
573
  var reputationManagerAbi = [
483
574
  {
@@ -684,14 +775,16 @@ var reputationManagerAbi = [
684
775
  var DIAMOND_ABI = [
685
776
  ...orderFlowFacetAbi,
686
777
  ...orderProcessorFacetAbi,
687
- ...p2pConfigFacetAbi
778
+ ...p2pConfigFacetAbi,
779
+ ...p2pStakeBoostFacetAbi
688
780
  ];
689
781
  var ABIS = {
690
782
  DIAMOND: DIAMOND_ABI,
691
783
  FACETS: {
692
784
  ORDER_FLOW: orderFlowFacetAbi,
693
785
  ORDER_PROCESSOR: orderProcessorFacetAbi,
694
- CONFIG: p2pConfigFacetAbi
786
+ CONFIG: p2pConfigFacetAbi,
787
+ STAKE: p2pStakeBoostFacetAbi
695
788
  },
696
789
  EXTERNAL: {
697
790
  USDC: erc20Abi,
@@ -1259,85 +1352,107 @@ function getPriceConfig(publicClient, diamondAddress, params) {
1259
1352
  );
1260
1353
  }
1261
1354
 
1355
+ // src/contracts/p2p-stake/index.ts
1356
+ import { ResultAsync as ResultAsync5 } from "neverthrow";
1357
+ import { stringToHex as stringToHex3 } from "viem";
1358
+
1359
+ // src/stake/validation.ts
1360
+ import { z as z4 } from "zod";
1361
+ var ZodGetUserStakeParamsSchema = z4.object({
1362
+ user: ZodAddressSchema
1363
+ });
1364
+ var ZodGetStakeBoostConfigParamsSchema = z4.object({
1365
+ currency: ZodCurrencySchema
1366
+ });
1367
+ var ZodGetP2pTokenBalanceParamsSchema = z4.object({
1368
+ address: ZodAddressSchema
1369
+ });
1370
+ var ZodStakeParamsSchema = z4.object({
1371
+ tokens: z4.bigint().positive()
1372
+ });
1373
+ var ZodTopUpParamsSchema = z4.object({
1374
+ tokens: z4.bigint().positive()
1375
+ });
1376
+
1262
1377
  // src/contracts/reputation-manager/writes.ts
1263
1378
  import { Result } from "neverthrow";
1264
1379
  import { encodeFunctionData } from "viem";
1265
1380
 
1266
1381
  // src/zkkyc/validation.ts
1267
- import { z as z4 } from "zod";
1268
- var ZodAnonAadharProofParamsSchema = z4.object({
1269
- nullifierSeed: z4.bigint(),
1270
- nullifier: z4.bigint(),
1271
- timestamp: z4.bigint(),
1272
- signal: z4.bigint(),
1273
- revealArray: z4.tuple([z4.bigint(), z4.bigint(), z4.bigint(), z4.bigint()]),
1274
- packedGroth16Proof: z4.tuple([
1275
- z4.bigint(),
1276
- z4.bigint(),
1277
- z4.bigint(),
1278
- z4.bigint(),
1279
- z4.bigint(),
1280
- z4.bigint(),
1281
- z4.bigint(),
1282
- z4.bigint()
1382
+ import { z as z5 } from "zod";
1383
+ var ZodAnonAadharProofParamsSchema = z5.object({
1384
+ nullifierSeed: z5.bigint(),
1385
+ nullifier: z5.bigint(),
1386
+ timestamp: z5.bigint(),
1387
+ signal: z5.bigint(),
1388
+ revealArray: z5.tuple([z5.bigint(), z5.bigint(), z5.bigint(), z5.bigint()]),
1389
+ packedGroth16Proof: z5.tuple([
1390
+ z5.bigint(),
1391
+ z5.bigint(),
1392
+ z5.bigint(),
1393
+ z5.bigint(),
1394
+ z5.bigint(),
1395
+ z5.bigint(),
1396
+ z5.bigint(),
1397
+ z5.bigint()
1283
1398
  ])
1284
1399
  });
1285
- var ZodSocialVerifyParamsSchema = z4.object({
1286
- _socialName: z4.string(),
1287
- proofs: z4.array(
1288
- z4.object({
1289
- claimInfo: z4.object({
1290
- provider: z4.string(),
1291
- parameters: z4.string(),
1292
- context: z4.string()
1400
+ var ZodSocialVerifyParamsSchema = z5.object({
1401
+ _socialName: z5.string(),
1402
+ proofs: z5.array(
1403
+ z5.object({
1404
+ claimInfo: z5.object({
1405
+ provider: z5.string(),
1406
+ parameters: z5.string(),
1407
+ context: z5.string()
1293
1408
  }),
1294
- signedClaim: z4.object({
1295
- claim: z4.object({
1296
- identifier: z4.string(),
1409
+ signedClaim: z5.object({
1410
+ claim: z5.object({
1411
+ identifier: z5.string(),
1297
1412
  owner: ZodAddressSchema,
1298
- timestampS: z4.number(),
1299
- epoch: z4.number()
1413
+ timestampS: z5.number(),
1414
+ epoch: z5.number()
1300
1415
  }),
1301
- signatures: z4.array(z4.string())
1416
+ signatures: z5.array(z5.string())
1302
1417
  })
1303
1418
  })
1304
1419
  )
1305
1420
  });
1306
- var ZodSolidityVerifierParametersSchema = z4.object({
1307
- version: z4.string().refine((val) => val.startsWith("0x"), {
1421
+ var ZodSolidityVerifierParametersSchema = z5.object({
1422
+ version: z5.string().refine((val) => val.startsWith("0x"), {
1308
1423
  message: "Version must be a hex string"
1309
1424
  }),
1310
- proofVerificationData: z4.object({
1311
- vkeyHash: z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1425
+ proofVerificationData: z5.object({
1426
+ vkeyHash: z5.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1312
1427
  message: "Invalid bytes32 hex string"
1313
1428
  }),
1314
- proof: z4.string().refine((val) => val.startsWith("0x"), {
1429
+ proof: z5.string().refine((val) => val.startsWith("0x"), {
1315
1430
  message: "Proof must be a hex string"
1316
1431
  }),
1317
- publicInputs: z4.array(
1318
- z4.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1432
+ publicInputs: z5.array(
1433
+ z5.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
1319
1434
  message: "Each public input must be a valid bytes32 hex string"
1320
1435
  })
1321
1436
  )
1322
1437
  }),
1323
- committedInputs: z4.string().refine((val) => val.startsWith("0x"), {
1438
+ committedInputs: z5.string().refine((val) => val.startsWith("0x"), {
1324
1439
  message: "Committed inputs must be a hex string"
1325
1440
  }),
1326
- serviceConfig: z4.object({
1327
- validityPeriodInSeconds: z4.number().int().nonnegative(),
1328
- domain: z4.string(),
1329
- scope: z4.string(),
1330
- devMode: z4.boolean()
1441
+ serviceConfig: z5.object({
1442
+ validityPeriodInSeconds: z5.number().int().nonnegative(),
1443
+ domain: z5.string(),
1444
+ scope: z5.string(),
1445
+ devMode: z5.boolean()
1331
1446
  })
1332
1447
  });
1333
- var ZodZkPassportRegisterParamsSchema = z4.object({
1448
+ var ZodZkPassportRegisterParamsSchema = z5.object({
1334
1449
  params: ZodSolidityVerifierParametersSchema,
1335
- isIDCard: z4.boolean()
1450
+ isIDCard: z5.boolean()
1336
1451
  });
1337
1452
 
1338
1453
  // src/contracts/tx-limits/index.ts
1339
- import { ResultAsync as ResultAsync5 } from "neverthrow";
1340
- import { formatUnits, stringToHex as stringToHex3 } from "viem";
1454
+ import { ResultAsync as ResultAsync6 } from "neverthrow";
1455
+ import { formatUnits, stringToHex as stringToHex4 } from "viem";
1341
1456
 
1342
1457
  // src/profile/errors.ts
1343
1458
  var ProfileError = class extends SdkError {
@@ -1348,18 +1463,18 @@ var ProfileError = class extends SdkError {
1348
1463
  };
1349
1464
 
1350
1465
  // src/profile/validation.ts
1351
- import { z as z5 } from "zod";
1352
- var ZodUsdcBalanceParamsSchema = z5.object({
1466
+ import { z as z6 } from "zod";
1467
+ var ZodUsdcBalanceParamsSchema = z6.object({
1353
1468
  address: ZodAddressSchema
1354
1469
  });
1355
- var ZodUsdcAllowanceParamsSchema = z5.object({
1470
+ var ZodUsdcAllowanceParamsSchema = z6.object({
1356
1471
  owner: ZodAddressSchema
1357
1472
  });
1358
- var ZodGetBalancesParamsSchema = z5.object({
1473
+ var ZodGetBalancesParamsSchema = z6.object({
1359
1474
  address: ZodAddressSchema,
1360
1475
  currency: ZodCurrencySchema
1361
1476
  });
1362
- var ZodTxLimitsParamsSchema = z5.object({
1477
+ var ZodTxLimitsParamsSchema = z6.object({
1363
1478
  address: ZodAddressSchema,
1364
1479
  currency: ZodCurrencySchema
1365
1480
  });
@@ -1375,12 +1490,12 @@ function getTxLimits(publicClient, diamondAddress, params) {
1375
1490
  context: { params: data }
1376
1491
  })
1377
1492
  ).asyncAndThen(
1378
- (validated) => ResultAsync5.fromPromise(
1493
+ (validated) => ResultAsync6.fromPromise(
1379
1494
  publicClient.readContract({
1380
1495
  address: diamondAddress,
1381
1496
  abi: ABIS.FACETS.ORDER_FLOW,
1382
1497
  functionName: "userTxLimit",
1383
- args: [validated.address, stringToHex3(validated.currency, { size: 32 })]
1498
+ args: [validated.address, stringToHex4(validated.currency, { size: 32 })]
1384
1499
  }),
1385
1500
  (error) => new ProfileError("Failed to read tx limits", {
1386
1501
  code: "CONTRACT_READ_ERROR",
@@ -1395,7 +1510,7 @@ function getTxLimits(publicClient, diamondAddress, params) {
1395
1510
  }
1396
1511
 
1397
1512
  // src/contracts/usdc/index.ts
1398
- import { ResultAsync as ResultAsync6 } from "neverthrow";
1513
+ import { ResultAsync as ResultAsync7 } from "neverthrow";
1399
1514
  import { erc20Abi as erc20Abi2 } from "viem";
1400
1515
  function getUsdcBalance(publicClient, usdcAddress, params) {
1401
1516
  return validate(
@@ -1407,7 +1522,7 @@ function getUsdcBalance(publicClient, usdcAddress, params) {
1407
1522
  context: { params: data }
1408
1523
  })
1409
1524
  ).asyncAndThen(
1410
- (validated) => ResultAsync6.fromPromise(
1525
+ (validated) => ResultAsync7.fromPromise(
1411
1526
  publicClient.readContract({
1412
1527
  address: usdcAddress,
1413
1528
  abi: ABIS.EXTERNAL.USDC,
@@ -1432,7 +1547,7 @@ function getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params) {
1432
1547
  context: { params: data }
1433
1548
  })
1434
1549
  ).asyncAndThen(
1435
- (validated) => ResultAsync6.fromPromise(
1550
+ (validated) => ResultAsync7.fromPromise(
1436
1551
  publicClient.readContract({
1437
1552
  address: usdcAddress,
1438
1553
  abi: erc20Abi2,
@@ -1449,7 +1564,7 @@ function getUsdcAllowance(publicClient, usdcAddress, diamondAddress, params) {
1449
1564
  }
1450
1565
 
1451
1566
  // src/profile/contracts/actions.ts
1452
- import { ResultAsync as ResultAsync7 } from "neverthrow";
1567
+ import { ResultAsync as ResultAsync8 } from "neverthrow";
1453
1568
  import { formatUnits as formatUnits2 } from "viem";
1454
1569
  function getBalances(publicClient, usdcAddress, diamondAddress, params) {
1455
1570
  return validate(
@@ -1461,7 +1576,7 @@ function getBalances(publicClient, usdcAddress, diamondAddress, params) {
1461
1576
  context: { params: data }
1462
1577
  })
1463
1578
  ).asyncAndThen(
1464
- (validated) => ResultAsync7.combine([
1579
+ (validated) => ResultAsync8.combine([
1465
1580
  getUsdcBalance(publicClient, usdcAddress, {
1466
1581
  address: validated.address
1467
1582
  }),