@p2pdotme/sdk 1.1.7 → 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/country.cjs +18 -1
- package/dist/country.cjs.map +1 -1
- package/dist/country.d.cts +5 -1
- package/dist/country.d.ts +5 -1
- package/dist/country.mjs +17 -1
- package/dist/country.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/orders.cjs +197 -82
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.mjs +176 -61
- package/dist/orders.mjs.map +1 -1
- package/dist/prices.cjs +172 -57
- package/dist/prices.cjs.map +1 -1
- package/dist/prices.mjs +170 -55
- package/dist/prices.mjs.map +1 -1
- package/dist/profile.cjs +184 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.mjs +176 -61
- package/dist/profile.mjs.map +1 -1
- package/dist/qr-parsers.cjs.map +1 -1
- package/dist/qr-parsers.mjs.map +1 -1
- package/dist/react.cjs +545 -100
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +131 -1
- package/dist/react.d.ts +131 -1
- package/dist/react.mjs +511 -67
- package/dist/react.mjs.map +1 -1
- package/dist/stake.cjs +1212 -0
- package/dist/stake.cjs.map +1 -0
- package/dist/stake.d.cts +191 -0
- package/dist/stake.d.ts +191 -0
- package/dist/stake.mjs +1184 -0
- package/dist/stake.mjs.map +1 -0
- package/dist/zkkyc.cjs +95 -2
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.mjs +95 -2
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +7 -1
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:
|
|
3380
|
-
if (Fp.eql(
|
|
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(
|
|
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(
|
|
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
|
|
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
|
|
5171
|
-
var ZodAnonAadharProofParamsSchema =
|
|
5172
|
-
nullifierSeed:
|
|
5173
|
-
nullifier:
|
|
5174
|
-
timestamp:
|
|
5175
|
-
signal:
|
|
5176
|
-
revealArray:
|
|
5177
|
-
packedGroth16Proof:
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
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 =
|
|
5189
|
-
_socialName:
|
|
5190
|
-
proofs:
|
|
5191
|
-
|
|
5192
|
-
claimInfo:
|
|
5193
|
-
provider:
|
|
5194
|
-
parameters:
|
|
5195
|
-
context:
|
|
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:
|
|
5198
|
-
claim:
|
|
5199
|
-
identifier:
|
|
5312
|
+
signedClaim: z8.object({
|
|
5313
|
+
claim: z8.object({
|
|
5314
|
+
identifier: z8.string(),
|
|
5200
5315
|
owner: ZodAddressSchema,
|
|
5201
|
-
timestampS:
|
|
5202
|
-
epoch:
|
|
5316
|
+
timestampS: z8.number(),
|
|
5317
|
+
epoch: z8.number()
|
|
5203
5318
|
}),
|
|
5204
|
-
signatures:
|
|
5319
|
+
signatures: z8.array(z8.string())
|
|
5205
5320
|
})
|
|
5206
5321
|
})
|
|
5207
5322
|
)
|
|
5208
5323
|
});
|
|
5209
|
-
var ZodSolidityVerifierParametersSchema =
|
|
5210
|
-
version:
|
|
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:
|
|
5214
|
-
vkeyHash:
|
|
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:
|
|
5332
|
+
proof: z8.string().refine((val) => val.startsWith("0x"), {
|
|
5218
5333
|
message: "Proof must be a hex string"
|
|
5219
5334
|
}),
|
|
5220
|
-
publicInputs:
|
|
5221
|
-
|
|
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:
|
|
5341
|
+
committedInputs: z8.string().refine((val) => val.startsWith("0x"), {
|
|
5227
5342
|
message: "Committed inputs must be a hex string"
|
|
5228
5343
|
}),
|
|
5229
|
-
serviceConfig:
|
|
5230
|
-
validityPeriodInSeconds:
|
|
5231
|
-
domain:
|
|
5232
|
-
scope:
|
|
5233
|
-
devMode:
|
|
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 =
|
|
5351
|
+
var ZodZkPassportRegisterParamsSchema = z8.object({
|
|
5237
5352
|
params: ZodSolidityVerifierParametersSchema,
|
|
5238
|
-
isIDCard:
|
|
5353
|
+
isIDCard: z8.boolean()
|
|
5239
5354
|
});
|
|
5240
5355
|
|
|
5241
5356
|
// src/contracts/tx-limits/index.ts
|
|
5242
|
-
import { ResultAsync as
|
|
5243
|
-
import { formatUnits, stringToHex as
|
|
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
|
|
5247
|
-
var ZodUsdcBalanceParamsSchema =
|
|
5361
|
+
import { z as z9 } from "zod";
|
|
5362
|
+
var ZodUsdcBalanceParamsSchema = z9.object({
|
|
5248
5363
|
address: ZodAddressSchema
|
|
5249
5364
|
});
|
|
5250
|
-
var ZodUsdcAllowanceParamsSchema =
|
|
5365
|
+
var ZodUsdcAllowanceParamsSchema = z9.object({
|
|
5251
5366
|
owner: ZodAddressSchema
|
|
5252
5367
|
});
|
|
5253
|
-
var ZodGetBalancesParamsSchema =
|
|
5368
|
+
var ZodGetBalancesParamsSchema = z9.object({
|
|
5254
5369
|
address: ZodAddressSchema,
|
|
5255
5370
|
currency: ZodCurrencySchema
|
|
5256
5371
|
});
|
|
5257
|
-
var ZodTxLimitsParamsSchema =
|
|
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
|
|
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 =
|
|
5557
|
+
const currencyHex = stringToHex7(params.currency, { size: 32 });
|
|
5443
5558
|
logger.info("selectCircle started", {
|
|
5444
5559
|
currency: params.currency,
|
|
5445
5560
|
user: params.user,
|