@invisible-labs/sdk 0.8.0-devnet → 0.10.0-devnet

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.
Files changed (47) hide show
  1. package/README.md +17 -3
  2. package/dist/.invisible-sdk-build-target.json +2 -2
  3. package/dist/{chunk-MZKJU3UA.js → chunk-6AGC3IOB.js} +16 -6
  4. package/dist/chunk-6AGC3IOB.js.map +1 -0
  5. package/dist/{chunk-HJFMDMPY.js → chunk-6AKBRYKO.js} +3 -3
  6. package/dist/{chunk-HJFMDMPY.js.map → chunk-6AKBRYKO.js.map} +1 -1
  7. package/dist/{chunk-DCTYBUY3.js → chunk-AIKC2XQS.js} +3 -3
  8. package/dist/{chunk-DCTYBUY3.js.map → chunk-AIKC2XQS.js.map} +1 -1
  9. package/dist/{chunk-Y7AK6RBV.js → chunk-ANQMIQYS.js} +587 -19
  10. package/dist/chunk-ANQMIQYS.js.map +1 -0
  11. package/dist/{chunk-MPNVF727.js → chunk-DFBH5XLM.js} +569 -78
  12. package/dist/chunk-DFBH5XLM.js.map +1 -0
  13. package/dist/{chunk-EBWTAXNT.js → chunk-EPWTRF5U.js} +3 -3
  14. package/dist/{chunk-EBWTAXNT.js.map → chunk-EPWTRF5U.js.map} +1 -1
  15. package/dist/{chunk-IG6JJFR2.js → chunk-HWRMSK7E.js} +8 -6
  16. package/dist/chunk-HWRMSK7E.js.map +1 -0
  17. package/dist/{chunk-K67FTCQU.js → chunk-JNNVPZEU.js} +3 -3
  18. package/dist/chunk-JNNVPZEU.js.map +1 -0
  19. package/dist/{chunk-QRN46R3F.js → chunk-RWKG7N7I.js} +10 -3
  20. package/dist/chunk-RWKG7N7I.js.map +1 -0
  21. package/dist/coordinator-T2B7253V.js +4 -0
  22. package/dist/{coordinator-E2TS6NR2.js.map → coordinator-T2B7253V.js.map} +1 -1
  23. package/dist/dkgWorker.js +1 -1
  24. package/dist/events.js +3 -3
  25. package/dist/frostRuntime-JESDHN6O.js +4 -0
  26. package/dist/{frostRuntime-6FTPKUCP.js.map → frostRuntime-JESDHN6O.js.map} +1 -1
  27. package/dist/index.d.ts +4 -4
  28. package/dist/index.js +9 -9
  29. package/dist/index.js.map +1 -1
  30. package/dist/lp.d.ts +48 -1
  31. package/dist/lp.js +360 -82
  32. package/dist/lp.js.map +1 -1
  33. package/dist/stats.js +1 -1
  34. package/dist/storage.js +2 -2
  35. package/dist/{types.generated-YhFu9ZBR.d.ts → types.generated-CtMxCo9F.d.ts} +80 -2
  36. package/dist/user.d.ts +25 -11
  37. package/dist/user.js +124 -37
  38. package/dist/user.js.map +1 -1
  39. package/package.json +2 -2
  40. package/dist/chunk-IG6JJFR2.js.map +0 -1
  41. package/dist/chunk-K67FTCQU.js.map +0 -1
  42. package/dist/chunk-MPNVF727.js.map +0 -1
  43. package/dist/chunk-MZKJU3UA.js.map +0 -1
  44. package/dist/chunk-QRN46R3F.js.map +0 -1
  45. package/dist/chunk-Y7AK6RBV.js.map +0 -1
  46. package/dist/coordinator-E2TS6NR2.js +0 -4
  47. package/dist/frostRuntime-6FTPKUCP.js +0 -4
package/dist/lp.d.ts CHANGED
@@ -19,6 +19,12 @@ declare function bytesToHex(bytes: Uint8Array): string;
19
19
  declare function signLpCommandBytes(auth: LpPositionCodeAuth, bytes: Uint8Array): Promise<Uint8Array>;
20
20
 
21
21
  type SourceLiquidityUse = "not_materialized" | "available" | "locked_for_payout" | "pending_finality" | "spent" | "released";
22
+ type LpFeePolicy = {
23
+ readonly version: 1;
24
+ readonly profile: "internal" | "partner";
25
+ readonly commission_bps: 0 | 6000;
26
+ readonly policy_hash: string;
27
+ };
22
28
  type LpWithdrawalMode = "exact" | "max_available";
23
29
  type LpInventoryShard = {
24
30
  kind: "lp";
@@ -34,6 +40,8 @@ type LpInventoryShard = {
34
40
  coolingUntilMs?: number;
35
41
  };
36
42
  type LpPositionView = {
43
+ feePolicy?: LpFeePolicy;
44
+ lpFeePolicyVersion?: 1;
37
45
  id: string;
38
46
  status: "dkg_pending" | "active" | "withdrawing" | "closed";
39
47
  targetShardCount: number;
@@ -41,6 +49,7 @@ type LpPositionView = {
41
49
  refillPublicKey: string;
42
50
  withdrawalCommitment: string;
43
51
  committedLamports: number;
52
+ /** Historical gross fees. With feePolicy, use actorSync.lifetimeEarnedLamports for the LP net entitlement. */
44
53
  earnedLamports: number;
45
54
  refillThreshold: number;
46
55
  shards: LpInventoryShard[];
@@ -53,11 +62,29 @@ type LpRedemptionPermission = {
53
62
  grantRevision: number;
54
63
  observedAtMs: number;
55
64
  };
65
+ type LpEconomicReturnSummary = {
66
+ providerRewardLamports: string;
67
+ sourceExpenseCompensationLamports: string;
68
+ chargedReimbursementLossLamports: string;
69
+ /** Provider reward minus charged losses and policy commission; nominal expense repayments are excluded. */
70
+ netEconomicReturnLamports: string;
71
+ };
56
72
  type LpActorSyncView = {
73
+ feePolicy?: LpFeePolicy;
74
+ feeBasisRevision?: number;
75
+ /** Cumulative assessed plus unassessed surviving confirmed provider-fee basis. */
76
+ grossFeeLamports?: number;
77
+ /** Cumulative assessed commission plus the projected commission on unassessed fees. */
78
+ protocolCommissionLamports?: number;
79
+ /** Cumulative sub-rent commission paid to this LP on full drains instead of the protocol. */
80
+ waivedProtocolCommissionLamports?: number;
81
+ economicReturn?: LpEconomicReturnSummary;
57
82
  lpPositionId: string;
58
83
  status: "idle" | "settling" | "reimbursement_due";
59
84
  sourceLiquidityUse: SourceLiquidityUse;
60
85
  redeemableProjectionAvailable: boolean;
86
+ /** Net LP-owned principal and confirmed fees, including temporarily engaged capital. */
87
+ totalNetFundsLamports?: number;
61
88
  redeemablePrincipalLamports: number;
62
89
  redeemableFeeLamports: number;
63
90
  lifetimeEarnedLamports: number;
@@ -85,6 +112,8 @@ type LpActorSyncView = {
85
112
  updatedAtMs: number;
86
113
  };
87
114
  type LpRedemptionHistoryView = {
115
+ feePolicyHash?: string;
116
+ feeBasisRevision?: number;
88
117
  redemptionId: string;
89
118
  state: "requested" | "match_requested" | "reserved" | "pending" | "confirmed" | "rejected";
90
119
  withdrawalMode?: LpWithdrawalMode;
@@ -122,10 +151,12 @@ type LpPositionCreationIntent = {
122
151
  };
123
152
  type LpCreationAuthorization = {
124
153
  readonly authorizationId: string;
154
+ readonly feePolicy?: LpFeePolicy;
125
155
  };
126
156
  type OpenLpPositionInput = {
127
157
  lpPositionId: string;
128
158
  creationAuthorizationId: string;
159
+ feePolicy?: LpFeePolicy;
129
160
  authPublicKey: number[];
130
161
  refillPublicKey: number[];
131
162
  withdrawalCommitment: number[];
@@ -163,6 +194,8 @@ type FinalizeLpDkgBatchInput = {
163
194
  finalizedAtMs: number;
164
195
  };
165
196
  type LpWithdrawalExecutionView = {
197
+ feePolicyHash?: string;
198
+ feeBasisRevision?: number;
166
199
  withdrawalId: string;
167
200
  txSignatures: string[];
168
201
  acceptedLamports: number;
@@ -226,6 +259,8 @@ type LpCoordinatorClient = LpDkgClient & {
226
259
  earnedFeeLamports: number;
227
260
  withdrawalMode: LpWithdrawalMode;
228
261
  requestedAtMs: number;
262
+ feePolicyHash?: string;
263
+ feeBasisRevision?: number;
229
264
  allowManyToOne?: boolean;
230
265
  }, auth: LpPositionCodeAuth): Promise<LpWithdrawalExecutionView>;
231
266
  };
@@ -235,6 +270,11 @@ interface LpPositionRequestOptions {
235
270
  readonly timeoutMs?: number;
236
271
  }
237
272
 
273
+ /** Invalid optional totals must not discard the position or its authorities. */
274
+ declare function normalizeLpActorSync(sync: LpActorSyncView): LpActorSyncView;
275
+ /** Keep one coherent actor projection when concurrent reads arrive out of order. */
276
+ declare function mergeLpActorSync(previous: LpActorSyncView | undefined, next: LpActorSyncView | undefined): LpActorSyncView | undefined;
277
+
238
278
  declare const LP_REDEMPTION_RECONCILING_MESSAGE = "LP redemption is still settling on the coordinator; it will reconcile from sync";
239
279
  declare const LP_MISSING_POSITION_CODE_MESSAGE = "Save or recover the LP Position Code before using LP funds";
240
280
  declare const LP_FEE_SOURCE_COUNT_UNAVAILABLE_MESSAGE = "LP earned-fee source count is not available; pass allowManyToOne: true to acknowledge many-to-one withdrawal risk";
@@ -302,6 +342,8 @@ interface RefillArgs {
302
342
  readonly workerFactory?: () => Worker;
303
343
  }
304
344
  interface WithdrawalExecution {
345
+ readonly feePolicyHash?: string;
346
+ readonly feeBasisRevision?: number;
305
347
  readonly withdrawalId: string;
306
348
  readonly txSignatures: string[];
307
349
  readonly acceptedLamports?: number;
@@ -309,6 +351,8 @@ interface WithdrawalExecution {
309
351
  readonly acceptedEarnedFeeLamports?: number;
310
352
  }
311
353
  interface LpWithdrawalRecord {
354
+ readonly feePolicyHash?: string;
355
+ readonly feeBasisRevision?: number;
312
356
  readonly redemptionId: string;
313
357
  readonly lpPositionId: string;
314
358
  readonly requestedAt: number;
@@ -322,6 +366,7 @@ interface LpWithdrawalRecord {
322
366
  readonly landedBaselineLamports: number;
323
367
  readonly landedFeeBaselineLamports?: number;
324
368
  readonly redeemedLamports: number;
369
+ readonly networkFeeLossLamports?: number;
325
370
  readonly txSignatures: string[];
326
371
  readonly txSignatureBaseline: string[];
327
372
  readonly coordinatorStateVersion?: number;
@@ -429,6 +474,8 @@ declare const LP_DKG_WORKER_REQUEST_TIMEOUT_MESSAGE = "LP DKG worker request tim
429
474
  declare const LP_DKG_ABORT_CLEANUP_TIMEOUT_MS = 10000;
430
475
  declare function createLpDkgBatch(input: CreateLpDkgBatchInput): Promise<string[]>;
431
476
 
477
+ declare function validateLpPositionFeePolicy(position: LpPositionView, previous?: LpPositionView): void;
478
+
432
479
  declare function createPosition(session: Session, args: CreatePositionArgs): Promise<CreatePositionResult>;
433
480
  declare function recoverPosition(session: Session, args: RecoverPositionArgs): Promise<LpPositionView>;
434
481
  declare function confirmPositionCodeSaved(session: Session, positionId: string): void;
@@ -450,4 +497,4 @@ declare function withdrawFees(session: Session, positionId: string, args: {
450
497
  }): Promise<never>;
451
498
  declare function listPositions(session: Session): Promise<LpPositionView[]>;
452
499
 
453
- export { type CompleteDkgBatchOptions, type CreateLpDkgBatchInput, type CreatePositionArgs, type CreatePositionResult, type FinalizeLpDkgBatchInput, type FundingConfirmationInput, type InitialFundingPlan, LP_COMMAND_REQUEST_TIMEOUT_MS, LP_DKG_ABORT_CLEANUP_TIMEOUT_MS, LP_DKG_ABORT_REQUEST_TIMEOUT_MS, LP_DKG_WORKER_REQUEST_TIMEOUT_MESSAGE, LP_DKG_WORKER_REQUEST_TIMEOUT_MS, LP_FEE_SOURCE_COUNT_UNAVAILABLE_MESSAGE, LP_MISSING_POSITION_CODE_MESSAGE, LP_REDEMPTION_RECONCILING_MESSAGE, type LpActorSyncView, type LpCoordinatorClient, type LpCoordinatorClientOptions, type LpCreationAuthorization, type LpCreationSigner, type LpDkgClient, type LpDkgProgress, type LpInventoryShard, type LpLifecycleClient, type LpLifecycleDkgProgress, type LpLifecycleRuntime, type LpPositionCode, type LpPositionCodeAuth, type LpPositionCreationIntent, type LpPositionRequestOptions, type LpPositionView, type LpRedemptionHistoryView, type LpRedemptionPermission, type LpTopUpRequest, type LpWithdrawalExecutionView, type LpWithdrawalMode, type LpWithdrawalPlanPreview, type LpWithdrawalPlanPreviewArgs, type LpWithdrawalRecord, type OpenLpPositionInput, type RecoverPositionArgs, type RefillArgs, type RefillLpPositionInput, type SourceLiquidityUse, type WaitForTopUpOptions, type WaitForWithdrawalConfirmationOptions, type WithdrawPositionArgs, type WithdrawPositionResult, type WithdrawalConfirmation, type WithdrawalExecution, bytesToHex, completeDkgBatch, confirmPositionCodeSaved, createLpCoordinatorClient, createLpDkgBatch, createLpLifecycleClient, createPosition, defaultLpLifecycleClient, deriveLpPositionCodeAuth, generateLpPositionCode, isLpPositionAuthMissingError, isLpRedemptionReconcilingError, listPositions, normalizeLpPositionCode, prepareInitialFunding, prepareTopUp, previewLpWithdrawalPlan, reconcileFunding, recoverPosition, refill, refreshPosition, signLpCommandBytes, waitForTopUp, waitForWithdrawalConfirmation, withdrawFees, withdrawPosition };
500
+ export { type CompleteDkgBatchOptions, type CreateLpDkgBatchInput, type CreatePositionArgs, type CreatePositionResult, type FinalizeLpDkgBatchInput, type FundingConfirmationInput, type InitialFundingPlan, LP_COMMAND_REQUEST_TIMEOUT_MS, LP_DKG_ABORT_CLEANUP_TIMEOUT_MS, LP_DKG_ABORT_REQUEST_TIMEOUT_MS, LP_DKG_WORKER_REQUEST_TIMEOUT_MESSAGE, LP_DKG_WORKER_REQUEST_TIMEOUT_MS, LP_FEE_SOURCE_COUNT_UNAVAILABLE_MESSAGE, LP_MISSING_POSITION_CODE_MESSAGE, LP_REDEMPTION_RECONCILING_MESSAGE, type LpActorSyncView, type LpCoordinatorClient, type LpCoordinatorClientOptions, type LpCreationAuthorization, type LpCreationSigner, type LpDkgClient, type LpDkgProgress, type LpEconomicReturnSummary, type LpFeePolicy, type LpInventoryShard, type LpLifecycleClient, type LpLifecycleDkgProgress, type LpLifecycleRuntime, type LpPositionCode, type LpPositionCodeAuth, type LpPositionCreationIntent, type LpPositionRequestOptions, type LpPositionView, type LpRedemptionHistoryView, type LpRedemptionPermission, type LpTopUpRequest, type LpWithdrawalExecutionView, type LpWithdrawalMode, type LpWithdrawalPlanPreview, type LpWithdrawalPlanPreviewArgs, type LpWithdrawalRecord, type OpenLpPositionInput, type RecoverPositionArgs, type RefillArgs, type RefillLpPositionInput, type SourceLiquidityUse, type WaitForTopUpOptions, type WaitForWithdrawalConfirmationOptions, type WithdrawPositionArgs, type WithdrawPositionResult, type WithdrawalConfirmation, type WithdrawalExecution, bytesToHex, completeDkgBatch, confirmPositionCodeSaved, createLpCoordinatorClient, createLpDkgBatch, createLpLifecycleClient, createPosition, defaultLpLifecycleClient, deriveLpPositionCodeAuth, generateLpPositionCode, isLpPositionAuthMissingError, isLpRedemptionReconcilingError, listPositions, mergeLpActorSync, normalizeLpActorSync, normalizeLpPositionCode, prepareInitialFunding, prepareTopUp, previewLpWithdrawalPlan, reconcileFunding, recoverPosition, refill, refreshPosition, signLpCommandBytes, validateLpPositionFeePolicy, waitForTopUp, waitForWithdrawalConfirmation, withdrawFees, withdrawPosition };