@owneraio/finp2p-sdk-js 0.29.18 → 0.29.20
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 +47 -3
- package/lib/OwneraAPI/finp2p-node-api/__tests__/agreements.test.js +48 -5
- package/lib/OwneraAPI/finp2p-node-api/__tests__/agreements.test.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/__tests__/collateral.test.js +6 -5
- package/lib/OwneraAPI/finp2p-node-api/__tests__/collateral.test.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js +32 -0
- package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/agreements.js +31 -8
- package/lib/OwneraAPI/finp2p-node-api/agreements.js.map +1 -1
- package/lib/OwneraAPI/finp2p-node-api/collateral.d.ts +1 -1
- package/lib/OwneraAPI/finp2p-node-api/collateral.js +2 -2
- package/lib/OwneraAPI/oss-api/__tests__/getAgreements.test.js +200 -23
- package/lib/OwneraAPI/oss-api/__tests__/getAgreements.test.js.map +1 -1
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreementAccounts.test.js +54 -1
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreementAccounts.test.js.map +1 -1
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreements.test.js +3 -2
- package/lib/OwneraAPI/oss-api/__tests__/getCollateralAgreements.test.js.map +1 -1
- package/lib/OwneraAPI/oss-api/oss.js +21 -6
- package/lib/OwneraAPI/oss-api/oss.js.map +1 -1
- package/lib/types/Agreements/Agreements.d.ts +8 -0
- package/lib/types/Collateral/Collateral.d.ts +19 -16
- package/lib/types/Oss/Agreements.d.ts +31 -11
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ export type CollateralAgreementRole = 'pledger' | 'receiver' | 'vault-controller
|
|
|
15
15
|
/**
|
|
16
16
|
* Roles that a collateral agreement may expose on reads.
|
|
17
17
|
*
|
|
18
|
-
* collateral-terms/v3
|
|
18
|
+
* collateral-terms/v3 and v4 bind ONE `approver` role to both party orgs: each side approves what the
|
|
19
19
|
* other posts, and the side a report calls may not decide its own list. The node binds it itself:
|
|
20
20
|
* a propose carries no approver field, and approve, reject and `consentRoles` never accept it.
|
|
21
21
|
*
|
|
@@ -25,7 +25,7 @@ export type CollateralAgreementRole = 'pledger' | 'receiver' | 'vault-controller
|
|
|
25
25
|
*/
|
|
26
26
|
export type CollateralAgreementBoundRole = CollateralAgreementRole | 'approver';
|
|
27
27
|
/** The schema bundle an agreement is governed by; it becomes the agreement's termsType */
|
|
28
|
-
export type CollateralDefinitionTemplate = 'collateral-terms/v3';
|
|
28
|
+
export type CollateralDefinitionTemplate = 'collateral-terms/v3' | 'collateral-terms/v4';
|
|
29
29
|
export interface CollateralEligibleAssetTerm {
|
|
30
30
|
assetId: string;
|
|
31
31
|
/** Decimal fraction (0.10 = 10%) */
|
|
@@ -136,8 +136,8 @@ export interface ProposeCollateralAgreementRequest {
|
|
|
136
136
|
validUntil?: number;
|
|
137
137
|
settings?: CollateralOrgSettings;
|
|
138
138
|
/**
|
|
139
|
-
* Defaults to collateral-terms/
|
|
140
|
-
* the called side proposes the priced asset list for attribution approval.
|
|
139
|
+
* Defaults to collateral-terms/v4 in the SDK. v4 runs the v3 flow: reports carry only the
|
|
140
|
+
* nominal amount; the called side proposes the priced asset list for attribution approval.
|
|
141
141
|
*/
|
|
142
142
|
definitionTemplate?: CollateralDefinitionTemplate;
|
|
143
143
|
}
|
|
@@ -182,7 +182,7 @@ export interface CollateralReportAction {
|
|
|
182
182
|
*/
|
|
183
183
|
export type CollateralHaircutApplyMethod = 'reduce-from-price' | 'add-to-total';
|
|
184
184
|
/**
|
|
185
|
-
* Nominal-only `POST /collateral/agreements/{agreementId}/reports` body for collateral-terms/v3.
|
|
185
|
+
* Nominal-only `POST /collateral/agreements/{agreementId}/reports` body for collateral-terms/v3 and v4.
|
|
186
186
|
* The single empty action authors the nominal call; the called side later proposes the priced
|
|
187
187
|
* asset list for approval. The haircut method comes from the agreement's terms.
|
|
188
188
|
*/
|
|
@@ -233,14 +233,14 @@ export interface CollateralAttributionLineValuation {
|
|
|
233
233
|
/** Units after the haircut; the amount the facade transfers */
|
|
234
234
|
finalUnits: string;
|
|
235
235
|
}
|
|
236
|
-
/** One asset and quantity offered by the called side against a v3 nominal report. */
|
|
236
|
+
/** One asset and quantity offered by the called side against a v3/v4 nominal report. */
|
|
237
237
|
export interface CollateralAttributionLine {
|
|
238
238
|
assetId: string;
|
|
239
239
|
/** Units offered, as a decimal string */
|
|
240
240
|
quantity: string;
|
|
241
241
|
metadata: CollateralAttributionLineValuation;
|
|
242
242
|
}
|
|
243
|
-
/** `POST /collateral/reports/{reportId}/attribution-proposals` body (v3
|
|
243
|
+
/** `POST /collateral/reports/{reportId}/attribution-proposals` body (v3 and v4). */
|
|
244
244
|
export interface ProposeCollateralAttributionRequest {
|
|
245
245
|
/** At least one fully valued line */
|
|
246
246
|
lines: [CollateralAttributionLine, ...CollateralAttributionLine[]];
|
|
@@ -431,7 +431,10 @@ export interface RequestCollateralCoverageRecheckResponse {
|
|
|
431
431
|
* conflicts (`NegotiationClosed`, `NegotiationRoundStale`, `SubstitutionAlreadyAgreed`,
|
|
432
432
|
* `NoLiveContainer`, `ReportDispositionInProgress`, `AgreementNotActive`) and HTTP 422 for the rest.
|
|
433
433
|
* `NotPledgingParty`, `NoApprovingParty`, `NotApprover`, `ProposalAlreadyDecided`,
|
|
434
|
-
* `ProposalNotApproved` and `
|
|
434
|
+
* `ProposalNotApproved`, `SingleLegException`, `ReportRejected` and `AssetNotEligible` are all HTTP 422.
|
|
435
|
+
* `ReportRejected` applies to `ProposeAttribution` when any organization rejected the report.
|
|
436
|
+
* `AssetNotEligible` applies when a proposed asset is outside the agreement's nonempty eligible-assets
|
|
437
|
+
* list, on `ProposeAttribution` or approval via `RespondAttributionProposal`.
|
|
435
438
|
*
|
|
436
439
|
* Non-domain errors use the APIErrors envelope (`{ errors: [{ code, message }] }`): HTTP 400/code
|
|
437
440
|
* 1002 for decoding or OAS validation (including an empty array), code 1300 for owner or guard
|
|
@@ -450,21 +453,21 @@ export interface RequestCollateralCoverageRecheckResponse {
|
|
|
450
453
|
* response arrived) and `error.data.error` is the response body: a flat domain code is
|
|
451
454
|
* `error.data.error.code`, an envelope code is `error.data.error.errors[0].code`.
|
|
452
455
|
*/
|
|
453
|
-
export type CollateralDomainErrorCode = 'TermsTemplateMismatch' | 'NoSuchContainer' | 'AmbiguousContainer' | 'NoContainerForParty' | 'CalledPartyNotBound' | 'AgreementNotActive' | 'NoLiveContainer' | 'NotValuationEngine' | 'AgreementNotIdle' | 'ReportEvaluationPending' | 'LastReportIncomplete' | 'ReportNotOpen' | 'NotReportParty' | 'ReportAlreadyAnswered' | 'ReportDispositionInProgress' | 'NegotiationRoundStale' | 'NegotiationClosed' | 'NotExecutableReport' | 'NotNegotiableReport' | 'NotNegotiatedReport' | 'NegotiationKindMismatch' | 'NotThreadOpener' | 'NotOfferingParty' | 'SubstitutionAlreadyAgreed' | 'UnknownSourceAccount' | 'NoDispositionOwed' | 'ReportIdentitiesUnpinned' | 'NotAgreementParticipant' | 'SelfApproval' | 'ExceptionAlreadyResolved' | 'NotPledgingParty' | 'NoApprovingParty' | 'NotApprover' | 'ProposalAlreadyDecided' | 'ProposalNotApproved' | 'SingleLegException';
|
|
456
|
+
export type CollateralDomainErrorCode = 'TermsTemplateMismatch' | 'NoSuchContainer' | 'AmbiguousContainer' | 'NoContainerForParty' | 'CalledPartyNotBound' | 'AgreementNotActive' | 'NoLiveContainer' | 'NotValuationEngine' | 'AgreementNotIdle' | 'ReportEvaluationPending' | 'LastReportIncomplete' | 'ReportNotOpen' | 'NotReportParty' | 'ReportAlreadyAnswered' | 'ReportDispositionInProgress' | 'NegotiationRoundStale' | 'NegotiationClosed' | 'NotExecutableReport' | 'NotNegotiableReport' | 'NotNegotiatedReport' | 'NegotiationKindMismatch' | 'NotThreadOpener' | 'NotOfferingParty' | 'SubstitutionAlreadyAgreed' | 'UnknownSourceAccount' | 'NoDispositionOwed' | 'ReportIdentitiesUnpinned' | 'NotAgreementParticipant' | 'SelfApproval' | 'ExceptionAlreadyResolved' | 'NotPledgingParty' | 'NoApprovingParty' | 'NotApprover' | 'ProposalAlreadyDecided' | 'ProposalNotApproved' | 'SingleLegException' | 'ReportRejected' | 'AssetNotEligible';
|
|
454
457
|
export interface CollateralDomainError {
|
|
455
458
|
code: CollateralDomainErrorCode;
|
|
456
459
|
message: string;
|
|
457
460
|
}
|
|
458
461
|
/**
|
|
459
462
|
* Collateral facade commands: agreement-level (`/collateral/agreements*`) and the report-level
|
|
460
|
-
* dispositions, manual transfer, negotiation, exception and v3 attribution flows
|
|
463
|
+
* dispositions, manual transfer, negotiation, exception and v3/v4 attribution flows
|
|
461
464
|
* (`/collateral/reports*`).
|
|
462
465
|
*
|
|
463
466
|
* Negotiation is round-based: the caller must cite the thread's standing round, and only the org
|
|
464
467
|
* that did NOT author the standing proposal may counter, agree or reject it (the opener withdraws).
|
|
465
468
|
* Requires finp2p-core feat/2685 at or after 885d0b99c.
|
|
466
469
|
*
|
|
467
|
-
* `CreateCollateralReportRequest.deadline`, v3 attribution approval and the report-exception commands (`raiseReportException`,
|
|
470
|
+
* `CreateCollateralReportRequest.deadline`, v3/v4 attribution approval and the report-exception commands (`raiseReportException`,
|
|
468
471
|
* `requestReportManualResolve`, `respondReportManualResolve`, `requestReportCoverageRecheck`) require
|
|
469
472
|
* finp2p-core `feat/attribution-approval` at or after 96b1f18c. An agreement keeps the definition it
|
|
470
473
|
* was proposed with. Exception commands work only while the agreement is in `reportProcessing`
|
|
@@ -481,7 +484,7 @@ export interface Collateral {
|
|
|
481
484
|
getAgreementSettings(agreementId: string, options?: RequestOptions): Promise<CollateralOrgSettingsState>;
|
|
482
485
|
/** Update the calling org's per-agreement settings (an omitted field keeps its stored value). */
|
|
483
486
|
updateAgreementSettings(agreementId: string, request: CollateralOrgSettings, options?: RequestOptions): Promise<CollateralOrgSettingsState>;
|
|
484
|
-
/** Author a nominal margin report (valuation-engine authority) under collateral-terms/v3. */
|
|
487
|
+
/** Author a nominal margin report (valuation-engine authority) under collateral-terms/v3 and v4. */
|
|
485
488
|
createReport(agreementId: string, request: CreateCollateralReportRequest, options?: RequestOptions): Promise<CreateCollateralReportResponse>;
|
|
486
489
|
/** Declare the normal close-out of an agreement. */
|
|
487
490
|
closeout(agreementId: string, request?: CollateralCloseoutRequest, options?: RequestOptions): Promise<CollateralCloseoutResponse>;
|
|
@@ -500,7 +503,7 @@ export interface Collateral {
|
|
|
500
503
|
/**
|
|
501
504
|
* Post one collateral line against a report, returning the execution plan it opened.
|
|
502
505
|
*
|
|
503
|
-
* On v3 the node does not check attribution consent before submitting the transfer. A later
|
|
506
|
+
* On v3 and v4 the node does not check attribution consent before submitting the transfer. A later
|
|
504
507
|
* attribution declaration can therefore be refused after a plan may already have been created and
|
|
505
508
|
* may settle; policy can also reject the transfer before plan creation, and a created plan can fail.
|
|
506
509
|
*/
|
|
@@ -543,19 +546,19 @@ export interface Collateral {
|
|
|
543
546
|
*/
|
|
544
547
|
requestReportCoverageRecheck(reportId: string, request: RequestCollateralCoverageRecheckRequest, options?: RequestOptions): Promise<RequestCollateralCoverageRecheckResponse>;
|
|
545
548
|
/**
|
|
546
|
-
* Offer the fully valued asset list for a v3 report. The caller must be the called side
|
|
549
|
+
* Offer the fully valued asset list for a v3/v4 report. The caller must be the called side
|
|
547
550
|
* (`report.senderOrgId`, pledger or receiver). Forward an Idempotency-Key: an uncached retry
|
|
548
551
|
* creates another proposal.
|
|
549
552
|
*/
|
|
550
553
|
proposeReportAttribution(reportId: string, request: ProposeCollateralAttributionRequest, options?: RequestOptions): Promise<ProposeCollateralAttributionResponse>;
|
|
551
554
|
/**
|
|
552
|
-
* Approve or reject a v3 attribution proposal. The caller must be an org bound to the `approver`
|
|
555
|
+
* Approve or reject a v3/v4 attribution proposal. The caller must be an org bound to the `approver`
|
|
553
556
|
* role and must not be the called side (`report.senderOrgId`), which is refused with `SelfApproval`.
|
|
554
557
|
* The request options are forwarded, including Idempotency-Key.
|
|
555
558
|
*/
|
|
556
559
|
respondReportAttributionProposal(reportId: string, proposalId: string, request: RespondCollateralAttributionProposalRequest, options?: RequestOptions): Promise<RespondCollateralAttributionProposalResponse>;
|
|
557
560
|
/**
|
|
558
|
-
* Close an approved v3 attribution round. The caller must be the called side
|
|
561
|
+
* Close an approved v3/v4 attribution round. The caller must be the called side
|
|
559
562
|
* (`report.senderOrgId`, pledger or receiver). An unapproved proposal returns `ProposalNotApproved`.
|
|
560
563
|
* The request options are forwarded, including Idempotency-Key. The node's `{}` response is
|
|
561
564
|
* discarded and the promise resolves void.
|
|
@@ -223,6 +223,23 @@ export interface AgreementDefinitionOss {
|
|
|
223
223
|
transitions: AgreementDefinitionTransitionOss[];
|
|
224
224
|
allowedEvents: AgreementDefinitionAllowedEventOss[];
|
|
225
225
|
}
|
|
226
|
+
/** One failed provisioning step of a container. `step` and `status` are open strings on the platform. */
|
|
227
|
+
export interface AgreementContainerIssueOss {
|
|
228
|
+
/** 'asset-onboarding' | 'profile-share' today */
|
|
229
|
+
step: string;
|
|
230
|
+
/** Asset id, `network:standard:tokenId` for an unresolved asset, or the participant org id for a share */
|
|
231
|
+
subject: string;
|
|
232
|
+
/** Asset identity; null when the issue is not about an asset */
|
|
233
|
+
network: string | null;
|
|
234
|
+
standard: string | null;
|
|
235
|
+
tokenId: string | null;
|
|
236
|
+
/** 'failed' today */
|
|
237
|
+
status: string;
|
|
238
|
+
errorCode: number | null;
|
|
239
|
+
errorMessage: string | null;
|
|
240
|
+
}
|
|
241
|
+
/** Known registry statuses, with support for future platform values. */
|
|
242
|
+
export type AgreementAccountStatusOss = 'ACTIVE' | 'DEGRADED' | 'ONBOARDING_FAILED' | 'RETIRED' | (string & {});
|
|
226
243
|
/** One entry of an agreement's container accounts registry */
|
|
227
244
|
export interface AgreementAccountOss {
|
|
228
245
|
agreementId: string;
|
|
@@ -236,9 +253,11 @@ export interface AgreementAccountOss {
|
|
|
236
253
|
policyVersion: number;
|
|
237
254
|
servesRoles: string[];
|
|
238
255
|
provisionerRole: string;
|
|
239
|
-
/** Registry entry status (ACTIVE, RETIRED) */
|
|
240
|
-
status:
|
|
256
|
+
/** Registry entry status (ACTIVE, DEGRADED, ONBOARDING_FAILED, RETIRED) */
|
|
257
|
+
status: AgreementAccountStatusOss;
|
|
241
258
|
footprints: AgreementAssetFootprintOss[];
|
|
259
|
+
/** Failed provisioning steps; empty for a healthy container. Requires OSS with owneraio/oss#665. */
|
|
260
|
+
issues: AgreementContainerIssueOss[];
|
|
242
261
|
/** The authored container declaration this entry materializes */
|
|
243
262
|
spec: ContainerSpecOss | null;
|
|
244
263
|
}
|
|
@@ -378,7 +397,8 @@ export interface CollateralContainerOss {
|
|
|
378
397
|
key: string;
|
|
379
398
|
finId: string;
|
|
380
399
|
orgId: string | null;
|
|
381
|
-
status
|
|
400
|
+
/** Registry entry status (ACTIVE, DEGRADED, ONBOARDING_FAILED, RETIRED) */
|
|
401
|
+
status: AgreementAccountStatusOss;
|
|
382
402
|
/** FinId of the dedicated investor; null for shared containers */
|
|
383
403
|
boundParty: string | null;
|
|
384
404
|
}
|
|
@@ -393,7 +413,7 @@ export interface CollateralReportStatusEntryOss {
|
|
|
393
413
|
emitterRole: string | null;
|
|
394
414
|
/** Null today: the facade fold does not populate it yet */
|
|
395
415
|
emitterOrgId: string | null;
|
|
396
|
-
/** Why the engine declared this status: `deadline`, or `plan-failed: <planId> — <reason>` */
|
|
416
|
+
/** Why the engine declared this status: `deadline`, `rejected`, or `plan-failed: <planId> — <reason>` */
|
|
397
417
|
note: string | null;
|
|
398
418
|
timestamp: number | null;
|
|
399
419
|
}
|
|
@@ -500,14 +520,14 @@ export interface CollateralExceptionDetailOss {
|
|
|
500
520
|
export interface CollateralReportExceptionOss {
|
|
501
521
|
exceptionId: string;
|
|
502
522
|
status: CollateralReportExceptionStatusOss;
|
|
503
|
-
/** The role whose side the problem is on, not an allocation of fault; engine-raised v3 exceptions always use `pledger`. */
|
|
523
|
+
/** The role whose side the problem is on, not an allocation of fault; engine-raised v3/v4 exceptions always use `pledger`. */
|
|
504
524
|
blame: string | null;
|
|
505
525
|
reason: string | null;
|
|
506
526
|
/** Org id that raised it */
|
|
507
527
|
raisedBy: string | null;
|
|
508
528
|
/**
|
|
509
529
|
* The legs this exception is about; empty for a report-level exception (OSS serves `[]`). Engine
|
|
510
|
-
* exceptions on v3 carry assetId and quantity without an executionPlanId.
|
|
530
|
+
* exceptions on v3 and v4 carry assetId and quantity without an executionPlanId.
|
|
511
531
|
*/
|
|
512
532
|
details: CollateralExceptionDetailOss[] | null;
|
|
513
533
|
/** The exception's own log event; a manual resolve cites it */
|
|
@@ -545,16 +565,16 @@ export interface CollateralReportCoverageRecheckOss {
|
|
|
545
565
|
sequence: number;
|
|
546
566
|
timestamp: number | null;
|
|
547
567
|
}
|
|
548
|
-
/** One priced asset line offered for approval against a v3 report. */
|
|
568
|
+
/** One priced asset line offered for approval against a v3/v4 report. */
|
|
549
569
|
export interface CollateralAttributionLineOss {
|
|
550
570
|
assetId: string;
|
|
551
571
|
/** Units offered, as a decimal string */
|
|
552
572
|
quantity: string;
|
|
553
573
|
metadata: CollateralReportAssetMetadataOss | null;
|
|
554
574
|
}
|
|
555
|
-
/** The approval state of one proposed v3 attribution list. */
|
|
575
|
+
/** The approval state of one proposed v3/v4 attribution list. */
|
|
556
576
|
export type CollateralReportAttributionProposalStatusOss = 'proposed' | 'approved' | 'rejected';
|
|
557
|
-
/** One priced list offered against a v3 report, with its whole-list approval decision. */
|
|
577
|
+
/** One priced list offered against a v3/v4 report, with its whole-list approval decision. */
|
|
558
578
|
export interface CollateralReportAttributionProposalOss {
|
|
559
579
|
proposalId: string;
|
|
560
580
|
round: number;
|
|
@@ -615,7 +635,7 @@ export interface CollateralReportOss {
|
|
|
615
635
|
/** Oldest first: recorded asks to re-evaluate after late collateral; nothing acts on them yet */
|
|
616
636
|
coverageRechecks: CollateralReportCoverageRecheckOss[] | null;
|
|
617
637
|
executionPlans: CollateralExecutionPlanOss[] | null;
|
|
618
|
-
/** Oldest first: the priced lists offered against this v3 report and their decisions. */
|
|
638
|
+
/** Oldest first: the priced lists offered against this v3/v4 report and their decisions. */
|
|
619
639
|
attributionProposals: CollateralReportAttributionProposalOss[] | null;
|
|
620
640
|
}
|
|
621
641
|
/** The folded collateral agreement view — decoded terms, no base64, no raw events */
|
|
@@ -624,7 +644,7 @@ export interface CollateralAgreementOss {
|
|
|
624
644
|
orgId: string;
|
|
625
645
|
status: string;
|
|
626
646
|
version: number;
|
|
627
|
-
/** The bundle the terms are written against; the SDK authors collateral-terms/v3. */
|
|
647
|
+
/** The bundle the terms are written against; the SDK authors collateral-terms/v3 and v4, defaulting to v4. */
|
|
628
648
|
termsType: string | null;
|
|
629
649
|
/** Roles whose signatures bind the agreement */
|
|
630
650
|
consentRoles: string[] | null;
|