@zkp2p/sdk 0.1.0-rc.7 → 0.1.0-rc.8
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/README.md +1 -1
- package/dist/index.cjs +147 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +147 -0
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/{vaultUtils-BolNttDV.d.mts → vaultUtils-CZKrvm9v.d.mts} +65 -1
- package/dist/{vaultUtils-BolNttDV.d.ts → vaultUtils-CZKrvm9v.d.ts} +65 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
TypeScript SDK for ZKP2P liquidity providers and integrators.
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Current version: `0.1.0-rc.7`. Includes V1/V2 contract routing, vault/delegated rate-management (DRM) operations, oracle/spread configuration, and indexer helpers.
|
|
9
9
|
|
|
10
10
|
## Who This Is For
|
|
11
11
|
|
package/dist/index.cjs
CHANGED
|
@@ -5445,6 +5445,78 @@ var DEPOSIT_EVENTS_BY_DEPOSITOR_QUERY = (
|
|
|
5445
5445
|
}
|
|
5446
5446
|
`
|
|
5447
5447
|
);
|
|
5448
|
+
var DEPOSIT_FUND_ACTIVITY_FIELDS = `
|
|
5449
|
+
id
|
|
5450
|
+
chainId
|
|
5451
|
+
depositId
|
|
5452
|
+
depositor
|
|
5453
|
+
activityType
|
|
5454
|
+
amount
|
|
5455
|
+
blockNumber
|
|
5456
|
+
timestamp
|
|
5457
|
+
txHash
|
|
5458
|
+
`;
|
|
5459
|
+
var DEPOSIT_DAILY_SNAPSHOT_FIELDS = `
|
|
5460
|
+
id
|
|
5461
|
+
chainId
|
|
5462
|
+
depositId
|
|
5463
|
+
depositor
|
|
5464
|
+
dayTimestamp
|
|
5465
|
+
remainingDeposits
|
|
5466
|
+
outstandingIntentAmount
|
|
5467
|
+
totalAmountTaken
|
|
5468
|
+
totalWithdrawn
|
|
5469
|
+
signaledIntents
|
|
5470
|
+
fulfilledIntents
|
|
5471
|
+
prunedIntents
|
|
5472
|
+
successRateBps
|
|
5473
|
+
dailyVolume
|
|
5474
|
+
dailyPnlUsdCents
|
|
5475
|
+
cumulativeVolume
|
|
5476
|
+
cumulativePnlUsdCents
|
|
5477
|
+
updatedAt
|
|
5478
|
+
`;
|
|
5479
|
+
var DEPOSIT_FUND_ACTIVITIES_QUERY = (
|
|
5480
|
+
/* GraphQL */
|
|
5481
|
+
`
|
|
5482
|
+
query GetDepositFundActivities($depositId: String!) {
|
|
5483
|
+
DepositFundActivity(
|
|
5484
|
+
where: { depositId: { _eq: $depositId } }
|
|
5485
|
+
order_by: { timestamp: desc }
|
|
5486
|
+
) {
|
|
5487
|
+
${DEPOSIT_FUND_ACTIVITY_FIELDS}
|
|
5488
|
+
}
|
|
5489
|
+
}
|
|
5490
|
+
`
|
|
5491
|
+
);
|
|
5492
|
+
var MAKER_FUND_ACTIVITIES_QUERY = (
|
|
5493
|
+
/* GraphQL */
|
|
5494
|
+
`
|
|
5495
|
+
query GetMakerFundActivities($depositor: String!, $limit: Int) {
|
|
5496
|
+
DepositFundActivity(
|
|
5497
|
+
where: { depositor: { _eq: $depositor } }
|
|
5498
|
+
order_by: { timestamp: desc }
|
|
5499
|
+
limit: $limit
|
|
5500
|
+
) {
|
|
5501
|
+
${DEPOSIT_FUND_ACTIVITY_FIELDS}
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
`
|
|
5505
|
+
);
|
|
5506
|
+
var DEPOSIT_DAILY_SNAPSHOTS_QUERY = (
|
|
5507
|
+
/* GraphQL */
|
|
5508
|
+
`
|
|
5509
|
+
query GetDepositDailySnapshots($depositId: String!, $limit: Int) {
|
|
5510
|
+
DepositDailySnapshot(
|
|
5511
|
+
where: { depositId: { _eq: $depositId } }
|
|
5512
|
+
order_by: { dayTimestamp: asc }
|
|
5513
|
+
limit: $limit
|
|
5514
|
+
) {
|
|
5515
|
+
${DEPOSIT_DAILY_SNAPSHOT_FIELDS}
|
|
5516
|
+
}
|
|
5517
|
+
}
|
|
5518
|
+
`
|
|
5519
|
+
);
|
|
5448
5520
|
var FULFILLMENT_AND_PAYMENT_QUERY = (
|
|
5449
5521
|
/* GraphQL */
|
|
5450
5522
|
`
|
|
@@ -5525,6 +5597,7 @@ function convertIndexerDepositToEscrowView(deposit, _chainId, _escrowAddress) {
|
|
|
5525
5597
|
deposit: {
|
|
5526
5598
|
depositor: normalizeAddress2(deposit.depositor),
|
|
5527
5599
|
token: normalizeAddress2(deposit.token),
|
|
5600
|
+
rateManagerId: deposit.rateManagerId ?? null,
|
|
5528
5601
|
depositAmount,
|
|
5529
5602
|
intentAmountRange: {
|
|
5530
5603
|
min: toBigInt(deposit.intentAmountMin),
|
|
@@ -5889,6 +5962,62 @@ var IndexerDepositService = class {
|
|
|
5889
5962
|
intentStatuses: options.intentStatuses
|
|
5890
5963
|
});
|
|
5891
5964
|
}
|
|
5965
|
+
/**
|
|
5966
|
+
* Fetch chronological fund activities for a deposit.
|
|
5967
|
+
*/
|
|
5968
|
+
async fetchDepositFundActivities(compositeDepositId) {
|
|
5969
|
+
try {
|
|
5970
|
+
const result = await this.client.query({
|
|
5971
|
+
query: DEPOSIT_FUND_ACTIVITIES_QUERY,
|
|
5972
|
+
variables: { depositId: compositeDepositId }
|
|
5973
|
+
});
|
|
5974
|
+
return result.DepositFundActivity ?? [];
|
|
5975
|
+
} catch (error) {
|
|
5976
|
+
if (!isSchemaCompatibilityError(error)) {
|
|
5977
|
+
throw error;
|
|
5978
|
+
}
|
|
5979
|
+
return [];
|
|
5980
|
+
}
|
|
5981
|
+
}
|
|
5982
|
+
/**
|
|
5983
|
+
* Fetch fund activities across all deposits for a maker address.
|
|
5984
|
+
*/
|
|
5985
|
+
async fetchMakerFundActivities(depositor, limit = 50) {
|
|
5986
|
+
const normalized = depositor?.trim().toLowerCase();
|
|
5987
|
+
if (!normalized) return [];
|
|
5988
|
+
try {
|
|
5989
|
+
const result = await this.client.query({
|
|
5990
|
+
query: MAKER_FUND_ACTIVITIES_QUERY,
|
|
5991
|
+
variables: { depositor: normalized, limit }
|
|
5992
|
+
});
|
|
5993
|
+
return result.DepositFundActivity ?? [];
|
|
5994
|
+
} catch (error) {
|
|
5995
|
+
if (!isSchemaCompatibilityError(error)) {
|
|
5996
|
+
throw error;
|
|
5997
|
+
}
|
|
5998
|
+
return [];
|
|
5999
|
+
}
|
|
6000
|
+
}
|
|
6001
|
+
/**
|
|
6002
|
+
* Fetch daily snapshots for a deposit, ordered by day ascending.
|
|
6003
|
+
*/
|
|
6004
|
+
async fetchDepositDailySnapshots(compositeDepositId, limit) {
|
|
6005
|
+
try {
|
|
6006
|
+
const result = await this.client.query({
|
|
6007
|
+
query: DEPOSIT_DAILY_SNAPSHOTS_QUERY,
|
|
6008
|
+
variables: {
|
|
6009
|
+
depositId: compositeDepositId,
|
|
6010
|
+
limit: limit ?? null
|
|
6011
|
+
}
|
|
6012
|
+
});
|
|
6013
|
+
return result.DepositDailySnapshot ?? [];
|
|
6014
|
+
} catch (error) {
|
|
6015
|
+
if (!isSchemaCompatibilityError(error)) {
|
|
6016
|
+
throw error;
|
|
6017
|
+
}
|
|
6018
|
+
return [];
|
|
6019
|
+
}
|
|
6020
|
+
}
|
|
5892
6021
|
};
|
|
5893
6022
|
|
|
5894
6023
|
// src/indexer/rateManagerService.ts
|
|
@@ -9014,6 +9143,24 @@ var _Zkp2pClient = class _Zkp2pClient {
|
|
|
9014
9143
|
getOracleConfigUpdates: (rateManagerId, options) => {
|
|
9015
9144
|
return rateManagerService.fetchOracleConfigUpdates(rateManagerId, options);
|
|
9016
9145
|
},
|
|
9146
|
+
/**
|
|
9147
|
+
* Fetches chronological fund activities for a specific deposit.
|
|
9148
|
+
*/
|
|
9149
|
+
getDepositFundActivities: (depositId) => {
|
|
9150
|
+
return service.fetchDepositFundActivities(depositId);
|
|
9151
|
+
},
|
|
9152
|
+
/**
|
|
9153
|
+
* Fetches fund activities across all deposits for a maker address.
|
|
9154
|
+
*/
|
|
9155
|
+
getMakerFundActivities: (depositor, limit) => {
|
|
9156
|
+
return service.fetchMakerFundActivities(depositor, limit);
|
|
9157
|
+
},
|
|
9158
|
+
/**
|
|
9159
|
+
* Fetches daily snapshots for a deposit, ordered by day ascending.
|
|
9160
|
+
*/
|
|
9161
|
+
getDepositDailySnapshots: (depositId, limit) => {
|
|
9162
|
+
return service.fetchDepositDailySnapshots(depositId, limit);
|
|
9163
|
+
},
|
|
9017
9164
|
/**
|
|
9018
9165
|
* Performs a raw GraphQL query against the indexer.
|
|
9019
9166
|
*/
|