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