@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/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/orders.cjs +204 -82
- package/dist/orders.cjs.map +1 -1
- package/dist/orders.mjs +183 -61
- package/dist/orders.mjs.map +1 -1
- package/dist/prices.cjs +179 -57
- package/dist/prices.cjs.map +1 -1
- package/dist/prices.mjs +177 -55
- package/dist/prices.mjs.map +1 -1
- package/dist/profile.cjs +191 -69
- package/dist/profile.cjs.map +1 -1
- package/dist/profile.mjs +183 -61
- package/dist/profile.mjs.map +1 -1
- package/dist/react.cjs +579 -100
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +137 -1
- package/dist/react.d.ts +137 -1
- package/dist/react.mjs +545 -67
- package/dist/react.mjs.map +1 -1
- package/dist/stake.cjs +1246 -0
- package/dist/stake.cjs.map +1 -0
- package/dist/stake.d.cts +197 -0
- package/dist/stake.d.ts +197 -0
- package/dist/stake.mjs +1218 -0
- package/dist/stake.mjs.map +1 -0
- package/dist/zkkyc.cjs +102 -2
- package/dist/zkkyc.cjs.map +1 -1
- package/dist/zkkyc.mjs +102 -2
- package/dist/zkkyc.mjs.map +1 -1
- package/package.json +7 -1
package/dist/prices.mjs
CHANGED
|
@@ -478,6 +478,104 @@ 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: [],
|
|
513
|
+
name: "p2pBoostCancelUnstake",
|
|
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
|
+
|
|
481
579
|
// src/contracts/abis/reputation-manager.ts
|
|
482
580
|
var reputationManagerAbi = [
|
|
483
581
|
{
|
|
@@ -684,14 +782,16 @@ var reputationManagerAbi = [
|
|
|
684
782
|
var DIAMOND_ABI = [
|
|
685
783
|
...orderFlowFacetAbi,
|
|
686
784
|
...orderProcessorFacetAbi,
|
|
687
|
-
...p2pConfigFacetAbi
|
|
785
|
+
...p2pConfigFacetAbi,
|
|
786
|
+
...p2pStakeBoostFacetAbi
|
|
688
787
|
];
|
|
689
788
|
var ABIS = {
|
|
690
789
|
DIAMOND: DIAMOND_ABI,
|
|
691
790
|
FACETS: {
|
|
692
791
|
ORDER_FLOW: orderFlowFacetAbi,
|
|
693
792
|
ORDER_PROCESSOR: orderProcessorFacetAbi,
|
|
694
|
-
CONFIG: p2pConfigFacetAbi
|
|
793
|
+
CONFIG: p2pConfigFacetAbi,
|
|
794
|
+
STAKE: p2pStakeBoostFacetAbi
|
|
695
795
|
},
|
|
696
796
|
EXTERNAL: {
|
|
697
797
|
USDC: erc20Abi,
|
|
@@ -1288,105 +1388,127 @@ function getReputationPerUsdcLimit(publicClient, diamondAddress, params) {
|
|
|
1288
1388
|
);
|
|
1289
1389
|
}
|
|
1290
1390
|
|
|
1391
|
+
// src/contracts/p2p-stake/index.ts
|
|
1392
|
+
import { ResultAsync as ResultAsync5 } from "neverthrow";
|
|
1393
|
+
import { stringToHex as stringToHex3 } from "viem";
|
|
1394
|
+
|
|
1395
|
+
// src/stake/validation.ts
|
|
1396
|
+
import { z as z4 } from "zod";
|
|
1397
|
+
var ZodGetUserStakeParamsSchema = z4.object({
|
|
1398
|
+
user: ZodAddressSchema
|
|
1399
|
+
});
|
|
1400
|
+
var ZodGetStakeBoostConfigParamsSchema = z4.object({
|
|
1401
|
+
currency: ZodCurrencySchema
|
|
1402
|
+
});
|
|
1403
|
+
var ZodGetP2pTokenBalanceParamsSchema = z4.object({
|
|
1404
|
+
address: ZodAddressSchema
|
|
1405
|
+
});
|
|
1406
|
+
var ZodStakeParamsSchema = z4.object({
|
|
1407
|
+
tokens: z4.bigint().positive()
|
|
1408
|
+
});
|
|
1409
|
+
var ZodTopUpParamsSchema = z4.object({
|
|
1410
|
+
tokens: z4.bigint().positive()
|
|
1411
|
+
});
|
|
1412
|
+
|
|
1291
1413
|
// src/contracts/reputation-manager/writes.ts
|
|
1292
1414
|
import { Result } from "neverthrow";
|
|
1293
1415
|
import { encodeFunctionData } from "viem";
|
|
1294
1416
|
|
|
1295
1417
|
// src/zkkyc/validation.ts
|
|
1296
|
-
import { z as
|
|
1297
|
-
var ZodAnonAadharProofParamsSchema =
|
|
1298
|
-
nullifierSeed:
|
|
1299
|
-
nullifier:
|
|
1300
|
-
timestamp:
|
|
1301
|
-
signal:
|
|
1302
|
-
revealArray:
|
|
1303
|
-
packedGroth16Proof:
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1418
|
+
import { z as z5 } from "zod";
|
|
1419
|
+
var ZodAnonAadharProofParamsSchema = z5.object({
|
|
1420
|
+
nullifierSeed: z5.bigint(),
|
|
1421
|
+
nullifier: z5.bigint(),
|
|
1422
|
+
timestamp: z5.bigint(),
|
|
1423
|
+
signal: z5.bigint(),
|
|
1424
|
+
revealArray: z5.tuple([z5.bigint(), z5.bigint(), z5.bigint(), z5.bigint()]),
|
|
1425
|
+
packedGroth16Proof: z5.tuple([
|
|
1426
|
+
z5.bigint(),
|
|
1427
|
+
z5.bigint(),
|
|
1428
|
+
z5.bigint(),
|
|
1429
|
+
z5.bigint(),
|
|
1430
|
+
z5.bigint(),
|
|
1431
|
+
z5.bigint(),
|
|
1432
|
+
z5.bigint(),
|
|
1433
|
+
z5.bigint()
|
|
1312
1434
|
])
|
|
1313
1435
|
});
|
|
1314
|
-
var ZodSocialVerifyParamsSchema =
|
|
1315
|
-
_socialName:
|
|
1316
|
-
proofs:
|
|
1317
|
-
|
|
1318
|
-
claimInfo:
|
|
1319
|
-
provider:
|
|
1320
|
-
parameters:
|
|
1321
|
-
context:
|
|
1436
|
+
var ZodSocialVerifyParamsSchema = z5.object({
|
|
1437
|
+
_socialName: z5.string(),
|
|
1438
|
+
proofs: z5.array(
|
|
1439
|
+
z5.object({
|
|
1440
|
+
claimInfo: z5.object({
|
|
1441
|
+
provider: z5.string(),
|
|
1442
|
+
parameters: z5.string(),
|
|
1443
|
+
context: z5.string()
|
|
1322
1444
|
}),
|
|
1323
|
-
signedClaim:
|
|
1324
|
-
claim:
|
|
1325
|
-
identifier:
|
|
1445
|
+
signedClaim: z5.object({
|
|
1446
|
+
claim: z5.object({
|
|
1447
|
+
identifier: z5.string(),
|
|
1326
1448
|
owner: ZodAddressSchema,
|
|
1327
|
-
timestampS:
|
|
1328
|
-
epoch:
|
|
1449
|
+
timestampS: z5.number(),
|
|
1450
|
+
epoch: z5.number()
|
|
1329
1451
|
}),
|
|
1330
|
-
signatures:
|
|
1452
|
+
signatures: z5.array(z5.string())
|
|
1331
1453
|
})
|
|
1332
1454
|
})
|
|
1333
1455
|
)
|
|
1334
1456
|
});
|
|
1335
|
-
var ZodSolidityVerifierParametersSchema =
|
|
1336
|
-
version:
|
|
1457
|
+
var ZodSolidityVerifierParametersSchema = z5.object({
|
|
1458
|
+
version: z5.string().refine((val) => val.startsWith("0x"), {
|
|
1337
1459
|
message: "Version must be a hex string"
|
|
1338
1460
|
}),
|
|
1339
|
-
proofVerificationData:
|
|
1340
|
-
vkeyHash:
|
|
1461
|
+
proofVerificationData: z5.object({
|
|
1462
|
+
vkeyHash: z5.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
|
|
1341
1463
|
message: "Invalid bytes32 hex string"
|
|
1342
1464
|
}),
|
|
1343
|
-
proof:
|
|
1465
|
+
proof: z5.string().refine((val) => val.startsWith("0x"), {
|
|
1344
1466
|
message: "Proof must be a hex string"
|
|
1345
1467
|
}),
|
|
1346
|
-
publicInputs:
|
|
1347
|
-
|
|
1468
|
+
publicInputs: z5.array(
|
|
1469
|
+
z5.string().refine((val) => /^0x[a-fA-F0-9]{64}$/.test(val), {
|
|
1348
1470
|
message: "Each public input must be a valid bytes32 hex string"
|
|
1349
1471
|
})
|
|
1350
1472
|
)
|
|
1351
1473
|
}),
|
|
1352
|
-
committedInputs:
|
|
1474
|
+
committedInputs: z5.string().refine((val) => val.startsWith("0x"), {
|
|
1353
1475
|
message: "Committed inputs must be a hex string"
|
|
1354
1476
|
}),
|
|
1355
|
-
serviceConfig:
|
|
1356
|
-
validityPeriodInSeconds:
|
|
1357
|
-
domain:
|
|
1358
|
-
scope:
|
|
1359
|
-
devMode:
|
|
1477
|
+
serviceConfig: z5.object({
|
|
1478
|
+
validityPeriodInSeconds: z5.number().int().nonnegative(),
|
|
1479
|
+
domain: z5.string(),
|
|
1480
|
+
scope: z5.string(),
|
|
1481
|
+
devMode: z5.boolean()
|
|
1360
1482
|
})
|
|
1361
1483
|
});
|
|
1362
|
-
var ZodZkPassportRegisterParamsSchema =
|
|
1484
|
+
var ZodZkPassportRegisterParamsSchema = z5.object({
|
|
1363
1485
|
params: ZodSolidityVerifierParametersSchema,
|
|
1364
|
-
isIDCard:
|
|
1486
|
+
isIDCard: z5.boolean()
|
|
1365
1487
|
});
|
|
1366
1488
|
|
|
1367
1489
|
// src/contracts/tx-limits/index.ts
|
|
1368
|
-
import { ResultAsync as
|
|
1369
|
-
import { formatUnits, stringToHex as
|
|
1490
|
+
import { ResultAsync as ResultAsync6 } from "neverthrow";
|
|
1491
|
+
import { formatUnits, stringToHex as stringToHex4 } from "viem";
|
|
1370
1492
|
|
|
1371
1493
|
// src/profile/validation.ts
|
|
1372
|
-
import { z as
|
|
1373
|
-
var ZodUsdcBalanceParamsSchema =
|
|
1494
|
+
import { z as z6 } from "zod";
|
|
1495
|
+
var ZodUsdcBalanceParamsSchema = z6.object({
|
|
1374
1496
|
address: ZodAddressSchema
|
|
1375
1497
|
});
|
|
1376
|
-
var ZodUsdcAllowanceParamsSchema =
|
|
1498
|
+
var ZodUsdcAllowanceParamsSchema = z6.object({
|
|
1377
1499
|
owner: ZodAddressSchema
|
|
1378
1500
|
});
|
|
1379
|
-
var ZodGetBalancesParamsSchema =
|
|
1501
|
+
var ZodGetBalancesParamsSchema = z6.object({
|
|
1380
1502
|
address: ZodAddressSchema,
|
|
1381
1503
|
currency: ZodCurrencySchema
|
|
1382
1504
|
});
|
|
1383
|
-
var ZodTxLimitsParamsSchema =
|
|
1505
|
+
var ZodTxLimitsParamsSchema = z6.object({
|
|
1384
1506
|
address: ZodAddressSchema,
|
|
1385
1507
|
currency: ZodCurrencySchema
|
|
1386
1508
|
});
|
|
1387
1509
|
|
|
1388
1510
|
// src/contracts/usdc/index.ts
|
|
1389
|
-
import { ResultAsync as
|
|
1511
|
+
import { ResultAsync as ResultAsync7 } from "neverthrow";
|
|
1390
1512
|
import { erc20Abi as erc20Abi2 } from "viem";
|
|
1391
1513
|
|
|
1392
1514
|
// src/prices/client.ts
|