@p2pdotme/sdk 1.1.8 → 1.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/dist/orders.mjs CHANGED
@@ -485,6 +485,104 @@ var p2pConfigFacetAbi = [
485
485
  }
486
486
  ];
487
487
 
488
+ // src/contracts/abis/p2p-stake-boost-facet.ts
489
+ var p2pStakeBoostFacetAbi = [
490
+ {
491
+ inputs: [{ internalType: "uint256", name: "tokens", type: "uint256" }],
492
+ name: "p2pBoostStake",
493
+ outputs: [],
494
+ stateMutability: "nonpayable",
495
+ type: "function"
496
+ },
497
+ {
498
+ inputs: [{ internalType: "uint256", name: "tokens", type: "uint256" }],
499
+ name: "p2pBoostTopUp",
500
+ outputs: [],
501
+ stateMutability: "nonpayable",
502
+ type: "function"
503
+ },
504
+ {
505
+ inputs: [],
506
+ name: "p2pBoostRequestUnstake",
507
+ outputs: [],
508
+ stateMutability: "nonpayable",
509
+ type: "function"
510
+ },
511
+ {
512
+ inputs: [],
513
+ name: "p2pBoostClaimUnstake",
514
+ outputs: [],
515
+ stateMutability: "nonpayable",
516
+ type: "function"
517
+ },
518
+ {
519
+ inputs: [],
520
+ name: "p2pBoostCancelUnstake",
521
+ outputs: [],
522
+ stateMutability: "nonpayable",
523
+ type: "function"
524
+ },
525
+ {
526
+ inputs: [{ internalType: "address", name: "user", type: "address" }],
527
+ name: "getUserStake",
528
+ outputs: [
529
+ {
530
+ components: [
531
+ { internalType: "uint128", name: "stakedAmount", type: "uint128" },
532
+ { internalType: "uint64", name: "cooldownEnd", type: "uint64" },
533
+ { internalType: "uint8", name: "status", type: "uint8" }
534
+ ],
535
+ internalType: "struct P2PStakeBoostStorage.UserStake",
536
+ name: "",
537
+ type: "tuple"
538
+ }
539
+ ],
540
+ stateMutability: "view",
541
+ type: "function"
542
+ },
543
+ {
544
+ inputs: [{ internalType: "bytes32", name: "currency", type: "bytes32" }],
545
+ name: "getStakeBoostConfig",
546
+ outputs: [
547
+ {
548
+ components: [
549
+ {
550
+ internalType: "uint256",
551
+ name: "tokensPerUsdNumerator",
552
+ type: "uint256"
553
+ },
554
+ {
555
+ internalType: "uint256",
556
+ name: "tokensPerUsdDenominator",
557
+ type: "uint256"
558
+ },
559
+ { internalType: "uint256", name: "maxBoostUsd", type: "uint256" }
560
+ ],
561
+ internalType: "struct P2PStakeBoostStorage.BoostConfig",
562
+ name: "",
563
+ type: "tuple"
564
+ }
565
+ ],
566
+ stateMutability: "view",
567
+ type: "function"
568
+ },
569
+ {
570
+ inputs: [],
571
+ name: "getStakeBoostGlobals",
572
+ outputs: [
573
+ { internalType: "address", name: "p2pToken", type: "address" },
574
+ { internalType: "address", name: "fraudReserve", type: "address" },
575
+ { internalType: "uint256", name: "maxStakeTokens", type: "uint256" },
576
+ { internalType: "uint256", name: "normalCooldown", type: "uint256" },
577
+ { internalType: "uint256", name: "blacklistCooldown", type: "uint256" },
578
+ { internalType: "uint8", name: "tokenDecimals", type: "uint8" },
579
+ { internalType: "uint256", name: "totalStaked", type: "uint256" }
580
+ ],
581
+ stateMutability: "view",
582
+ type: "function"
583
+ }
584
+ ];
585
+
488
586
  // src/contracts/abis/reputation-manager.ts
489
587
  var reputationManagerAbi = [
490
588
  {
@@ -691,14 +789,16 @@ var reputationManagerAbi = [
691
789
  var DIAMOND_ABI = [
692
790
  ...orderFlowFacetAbi,
693
791
  ...orderProcessorFacetAbi,
694
- ...p2pConfigFacetAbi
792
+ ...p2pConfigFacetAbi,
793
+ ...p2pStakeBoostFacetAbi
695
794
  ];
696
795
  var ABIS = {
697
796
  DIAMOND: DIAMOND_ABI,
698
797
  FACETS: {
699
798
  ORDER_FLOW: orderFlowFacetAbi,
700
799
  ORDER_PROCESSOR: orderProcessorFacetAbi,
701
- CONFIG: p2pConfigFacetAbi
800
+ CONFIG: p2pConfigFacetAbi,
801
+ STAKE: p2pStakeBoostFacetAbi
702
802
  },
703
803
  EXTERNAL: {
704
804
  USDC: erc20Abi,
@@ -3376,15 +3476,15 @@ function weierstrassPoints(opts) {
3376
3476
  throw new Error("ProjectivePoint expected");
3377
3477
  }
3378
3478
  const toAffineMemo = memoized((p, iz) => {
3379
- const { px: x, py: y, pz: z9 } = p;
3380
- if (Fp.eql(z9, Fp.ONE))
3479
+ const { px: x, py: y, pz: z10 } = p;
3480
+ if (Fp.eql(z10, Fp.ONE))
3381
3481
  return { x, y };
3382
3482
  const is0 = p.is0();
3383
3483
  if (iz == null)
3384
- iz = is0 ? Fp.ONE : Fp.inv(z9);
3484
+ iz = is0 ? Fp.ONE : Fp.inv(z10);
3385
3485
  const ax = Fp.mul(x, iz);
3386
3486
  const ay = Fp.mul(y, iz);
3387
- const zz = Fp.mul(z9, iz);
3487
+ const zz = Fp.mul(z10, iz);
3388
3488
  if (is0)
3389
3489
  return { x: Fp.ZERO, y: Fp.ZERO };
3390
3490
  if (!Fp.eql(zz, Fp.ONE))
@@ -4379,7 +4479,7 @@ function createSetSellOrderUpiAction(input) {
4379
4479
  }
4380
4480
 
4381
4481
  // src/orders/internal/routing/client.ts
4382
- import { stringToHex as stringToHex6 } from "viem";
4482
+ import { stringToHex as stringToHex7 } from "viem";
4383
4483
 
4384
4484
  // src/contracts/error-messages.ts
4385
4485
  var contractErrorMessages = {
@@ -5162,105 +5262,127 @@ var ZodCurrencyScopedParamsSchema = z6.object({
5162
5262
  currency: ZodCurrencySchema
5163
5263
  });
5164
5264
 
5265
+ // src/contracts/p2p-stake/index.ts
5266
+ import { ResultAsync as ResultAsync8 } from "neverthrow";
5267
+ import { stringToHex as stringToHex5 } from "viem";
5268
+
5269
+ // src/stake/validation.ts
5270
+ import { z as z7 } from "zod";
5271
+ var ZodGetUserStakeParamsSchema = z7.object({
5272
+ user: ZodAddressSchema
5273
+ });
5274
+ var ZodGetStakeBoostConfigParamsSchema = z7.object({
5275
+ currency: ZodCurrencySchema
5276
+ });
5277
+ var ZodGetP2pTokenBalanceParamsSchema = z7.object({
5278
+ address: ZodAddressSchema
5279
+ });
5280
+ var ZodStakeParamsSchema = z7.object({
5281
+ tokens: z7.bigint().positive()
5282
+ });
5283
+ var ZodTopUpParamsSchema = z7.object({
5284
+ tokens: z7.bigint().positive()
5285
+ });
5286
+
5165
5287
  // src/contracts/reputation-manager/writes.ts
5166
5288
  import { Result as Result2 } from "neverthrow";
5167
5289
  import { encodeFunctionData as encodeFunctionData7 } from "viem";
5168
5290
 
5169
5291
  // src/zkkyc/validation.ts
5170
- import { z as z7 } from "zod";
5171
- var ZodAnonAadharProofParamsSchema = z7.object({
5172
- nullifierSeed: z7.bigint(),
5173
- nullifier: z7.bigint(),
5174
- timestamp: z7.bigint(),
5175
- signal: z7.bigint(),
5176
- revealArray: z7.tuple([z7.bigint(), z7.bigint(), z7.bigint(), z7.bigint()]),
5177
- packedGroth16Proof: z7.tuple([
5178
- z7.bigint(),
5179
- z7.bigint(),
5180
- z7.bigint(),
5181
- z7.bigint(),
5182
- z7.bigint(),
5183
- z7.bigint(),
5184
- z7.bigint(),
5185
- z7.bigint()
5292
+ import { z as z8 } from "zod";
5293
+ var ZodAnonAadharProofParamsSchema = z8.object({
5294
+ nullifierSeed: z8.bigint(),
5295
+ nullifier: z8.bigint(),
5296
+ timestamp: z8.bigint(),
5297
+ signal: z8.bigint(),
5298
+ revealArray: z8.tuple([z8.bigint(), z8.bigint(), z8.bigint(), z8.bigint()]),
5299
+ packedGroth16Proof: z8.tuple([
5300
+ z8.bigint(),
5301
+ z8.bigint(),
5302
+ z8.bigint(),
5303
+ z8.bigint(),
5304
+ z8.bigint(),
5305
+ z8.bigint(),
5306
+ z8.bigint(),
5307
+ z8.bigint()
5186
5308
  ])
5187
5309
  });
5188
- var ZodSocialVerifyParamsSchema = z7.object({
5189
- _socialName: z7.string(),
5190
- proofs: z7.array(
5191
- z7.object({
5192
- claimInfo: z7.object({
5193
- provider: z7.string(),
5194
- parameters: z7.string(),
5195
- context: z7.string()
5310
+ var ZodSocialVerifyParamsSchema = z8.object({
5311
+ _socialName: z8.string(),
5312
+ proofs: z8.array(
5313
+ z8.object({
5314
+ claimInfo: z8.object({
5315
+ provider: z8.string(),
5316
+ parameters: z8.string(),
5317
+ context: z8.string()
5196
5318
  }),
5197
- signedClaim: z7.object({
5198
- claim: z7.object({
5199
- identifier: z7.string(),
5319
+ signedClaim: z8.object({
5320
+ claim: z8.object({
5321
+ identifier: z8.string(),
5200
5322
  owner: ZodAddressSchema,
5201
- timestampS: z7.number(),
5202
- epoch: z7.number()
5323
+ timestampS: z8.number(),
5324
+ epoch: z8.number()
5203
5325
  }),
5204
- signatures: z7.array(z7.string())
5326
+ signatures: z8.array(z8.string())
5205
5327
  })
5206
5328
  })
5207
5329
  )
5208
5330
  });
5209
- var ZodSolidityVerifierParametersSchema = z7.object({
5210
- version: z7.string().refine((val) => val.startsWith("0x"), {
5331
+ var ZodSolidityVerifierParametersSchema = z8.object({
5332
+ version: z8.string().refine((val) => val.startsWith("0x"), {
5211
5333
  message: "Version must be a hex string"
5212
5334
  }),
5213
- proofVerificationData: z7.object({
5214
- vkeyHash: z7.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
5335
+ proofVerificationData: z8.object({
5336
+ vkeyHash: z8.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
5215
5337
  message: "Invalid bytes32 hex string"
5216
5338
  }),
5217
- proof: z7.string().refine((val) => val.startsWith("0x"), {
5339
+ proof: z8.string().refine((val) => val.startsWith("0x"), {
5218
5340
  message: "Proof must be a hex string"
5219
5341
  }),
5220
- publicInputs: z7.array(
5221
- z7.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
5342
+ publicInputs: z8.array(
5343
+ z8.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
5222
5344
  message: "Each public input must be a valid bytes32 hex string"
5223
5345
  })
5224
5346
  )
5225
5347
  }),
5226
- committedInputs: z7.string().refine((val) => val.startsWith("0x"), {
5348
+ committedInputs: z8.string().refine((val) => val.startsWith("0x"), {
5227
5349
  message: "Committed inputs must be a hex string"
5228
5350
  }),
5229
- serviceConfig: z7.object({
5230
- validityPeriodInSeconds: z7.number().int().nonnegative(),
5231
- domain: z7.string(),
5232
- scope: z7.string(),
5233
- devMode: z7.boolean()
5351
+ serviceConfig: z8.object({
5352
+ validityPeriodInSeconds: z8.number().int().nonnegative(),
5353
+ domain: z8.string(),
5354
+ scope: z8.string(),
5355
+ devMode: z8.boolean()
5234
5356
  })
5235
5357
  });
5236
- var ZodZkPassportRegisterParamsSchema = z7.object({
5358
+ var ZodZkPassportRegisterParamsSchema = z8.object({
5237
5359
  params: ZodSolidityVerifierParametersSchema,
5238
- isIDCard: z7.boolean()
5360
+ isIDCard: z8.boolean()
5239
5361
  });
5240
5362
 
5241
5363
  // src/contracts/tx-limits/index.ts
5242
- import { ResultAsync as ResultAsync8 } from "neverthrow";
5243
- import { formatUnits, stringToHex as stringToHex5 } from "viem";
5364
+ import { ResultAsync as ResultAsync9 } from "neverthrow";
5365
+ import { formatUnits, stringToHex as stringToHex6 } from "viem";
5244
5366
 
5245
5367
  // src/profile/validation.ts
5246
- import { z as z8 } from "zod";
5247
- var ZodUsdcBalanceParamsSchema = z8.object({
5368
+ import { z as z9 } from "zod";
5369
+ var ZodUsdcBalanceParamsSchema = z9.object({
5248
5370
  address: ZodAddressSchema
5249
5371
  });
5250
- var ZodUsdcAllowanceParamsSchema = z8.object({
5372
+ var ZodUsdcAllowanceParamsSchema = z9.object({
5251
5373
  owner: ZodAddressSchema
5252
5374
  });
5253
- var ZodGetBalancesParamsSchema = z8.object({
5375
+ var ZodGetBalancesParamsSchema = z9.object({
5254
5376
  address: ZodAddressSchema,
5255
5377
  currency: ZodCurrencySchema
5256
5378
  });
5257
- var ZodTxLimitsParamsSchema = z8.object({
5379
+ var ZodTxLimitsParamsSchema = z9.object({
5258
5380
  address: ZodAddressSchema,
5259
5381
  currency: ZodCurrencySchema
5260
5382
  });
5261
5383
 
5262
5384
  // src/contracts/usdc/index.ts
5263
- import { ResultAsync as ResultAsync9 } from "neverthrow";
5385
+ import { ResultAsync as ResultAsync10 } from "neverthrow";
5264
5386
  import { erc20Abi as erc20Abi3 } from "viem";
5265
5387
 
5266
5388
  // src/orders/internal/routing/routing.ts
@@ -5439,7 +5561,7 @@ function createOrderRouter(config) {
5439
5561
  const logger = config.logger ?? noopLogger;
5440
5562
  return {
5441
5563
  selectCircle(params) {
5442
- const currencyHex = stringToHex6(params.currency, { size: 32 });
5564
+ const currencyHex = stringToHex7(params.currency, { size: 32 });
5443
5565
  logger.info("selectCircle started", {
5444
5566
  currency: params.currency,
5445
5567
  user: params.user,