@owneraio/finp2p-sdk-js 0.28.25 → 0.28.41

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 (205) hide show
  1. package/README.md +71 -1
  2. package/lib/OwneraAPI/__tests__/apiErrorShape.test.d.ts +1 -0
  3. package/lib/OwneraAPI/__tests__/apiErrorShape.test.js +264 -0
  4. package/lib/OwneraAPI/__tests__/apiErrorShape.test.js.map +1 -0
  5. package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js +5 -12
  6. package/lib/OwneraAPI/finp2p-node-api/__tests__/approvalsConfig.test.js.map +1 -1
  7. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.d.ts +1 -0
  8. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js +56 -0
  9. package/lib/OwneraAPI/finp2p-node-api/__tests__/createIntentMetadata.test.js.map +1 -0
  10. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.d.ts +1 -0
  11. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js +75 -0
  12. package/lib/OwneraAPI/finp2p-node-api/__tests__/dryRunExecute.test.js.map +1 -0
  13. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.d.ts +1 -0
  14. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js +348 -0
  15. package/lib/OwneraAPI/finp2p-node-api/__tests__/pathEncoding.test.js.map +1 -0
  16. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.d.ts +1 -0
  17. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js +97 -0
  18. package/lib/OwneraAPI/finp2p-node-api/__tests__/rejectIntent.test.js.map +1 -0
  19. package/lib/OwneraAPI/finp2p-node-api/certificates.js +15 -6
  20. package/lib/OwneraAPI/finp2p-node-api/certificates.js.map +1 -1
  21. package/lib/OwneraAPI/finp2p-node-api/custodies.js +13 -2
  22. package/lib/OwneraAPI/finp2p-node-api/custodies.js.map +1 -1
  23. package/lib/OwneraAPI/finp2p-node-api/documents.js +22 -9
  24. package/lib/OwneraAPI/finp2p-node-api/documents.js.map +1 -1
  25. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.d.ts +13 -0
  26. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js +71 -0
  27. package/lib/OwneraAPI/finp2p-node-api/investorAccounts.js.map +1 -0
  28. package/lib/OwneraAPI/finp2p-node-api/ledgers.js +13 -2
  29. package/lib/OwneraAPI/finp2p-node-api/ledgers.js.map +1 -1
  30. package/lib/OwneraAPI/finp2p-node-api/messages.js +12 -3
  31. package/lib/OwneraAPI/finp2p-node-api/messages.js.map +1 -1
  32. package/lib/OwneraAPI/finp2p-node-api/operations.js +37 -15
  33. package/lib/OwneraAPI/finp2p-node-api/operations.js.map +1 -1
  34. package/lib/OwneraAPI/finp2p-node-api/policies.js +14 -5
  35. package/lib/OwneraAPI/finp2p-node-api/policies.js.map +1 -1
  36. package/lib/OwneraAPI/finp2p-node-api/profiles.js +95 -49
  37. package/lib/OwneraAPI/finp2p-node-api/profiles.js.map +1 -1
  38. package/lib/OwneraAPI/finp2p-node-api/tokens.js +20 -0
  39. package/lib/OwneraAPI/finp2p-node-api/tokens.js.map +1 -1
  40. package/lib/OwneraAPI/index.js +2 -0
  41. package/lib/OwneraAPI/index.js.map +1 -1
  42. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.d.ts +1 -0
  43. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js +253 -0
  44. package/lib/OwneraAPI/oss-api/__tests__/buildGraphQLQuery.test.js.map +1 -0
  45. package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js +52 -0
  46. package/lib/OwneraAPI/oss-api/__tests__/getAllExecutionPlans.test.js.map +1 -1
  47. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.d.ts +1 -0
  48. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js +347 -0
  49. package/lib/OwneraAPI/oss-api/__tests__/ossQueryEscaping.test.js.map +1 -0
  50. package/lib/OwneraAPI/oss-api/filterUtils.d.ts +20 -0
  51. package/lib/OwneraAPI/oss-api/filterUtils.js +57 -5
  52. package/lib/OwneraAPI/oss-api/filterUtils.js.map +1 -1
  53. package/lib/OwneraAPI/oss-api/oss.js +188 -75
  54. package/lib/OwneraAPI/oss-api/oss.js.map +1 -1
  55. package/lib/OwneraAPI/oss-api/queryUtils.d.ts +1 -0
  56. package/lib/OwneraAPI/oss-api/queryUtils.js +6 -5
  57. package/lib/OwneraAPI/oss-api/queryUtils.js.map +1 -1
  58. package/lib/OwneraAPI/oss-api/queryValidation.d.ts +3 -1
  59. package/lib/OwneraAPI/oss-api/queryValidation.js +21 -2
  60. package/lib/OwneraAPI/oss-api/queryValidation.js.map +1 -1
  61. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.d.ts +1 -0
  62. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js +42 -0
  63. package/lib/OwneraAPI/payment-adapter-api/__tests__/updateBalance.test.js.map +1 -0
  64. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.d.ts +1 -0
  65. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js +73 -0
  66. package/lib/OwneraAPI/payment-adapter-api/vanilla/__tests__/payouts.test.js.map +1 -0
  67. package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js +23 -11
  68. package/lib/OwneraAPI/payment-adapter-api/vanilla/payouts.js.map +1 -1
  69. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.d.ts +1 -1
  70. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js +3 -1
  71. package/lib/OwneraAPI/payment-adapter-api/vanilla/update-balance.js.map +1 -1
  72. package/lib/OwneraAPI/utils.d.ts +39 -0
  73. package/lib/OwneraAPI/utils.js +125 -73
  74. package/lib/OwneraAPI/utils.js.map +1 -1
  75. package/lib/core/__tests__/consoleLogger.test.d.ts +1 -0
  76. package/lib/core/__tests__/consoleLogger.test.js +269 -0
  77. package/lib/core/__tests__/consoleLogger.test.js.map +1 -0
  78. package/lib/core/__tests__/createAssetNameUniqueness.test.d.ts +1 -0
  79. package/lib/core/__tests__/createAssetNameUniqueness.test.js +95 -0
  80. package/lib/core/__tests__/createAssetNameUniqueness.test.js.map +1 -0
  81. package/lib/core/__tests__/custodianPrecedence.test.d.ts +1 -0
  82. package/lib/core/__tests__/custodianPrecedence.test.js +683 -0
  83. package/lib/core/__tests__/custodianPrecedence.test.js.map +1 -0
  84. package/lib/core/__tests__/executeIntentSettlementAssets.test.d.ts +1 -0
  85. package/lib/core/__tests__/executeIntentSettlementAssets.test.js +128 -0
  86. package/lib/core/__tests__/executeIntentSettlementAssets.test.js.map +1 -0
  87. package/lib/core/__tests__/logException.test.d.ts +1 -0
  88. package/lib/core/__tests__/logException.test.js +49 -0
  89. package/lib/core/__tests__/logException.test.js.map +1 -0
  90. package/lib/core/__tests__/multiplyDecimalStrings.test.d.ts +1 -0
  91. package/lib/core/__tests__/multiplyDecimalStrings.test.js +37 -0
  92. package/lib/core/__tests__/multiplyDecimalStrings.test.js.map +1 -0
  93. package/lib/core/__tests__/settlementExecutionAmount.test.d.ts +1 -0
  94. package/lib/core/__tests__/settlementExecutionAmount.test.js +300 -0
  95. package/lib/core/__tests__/settlementExecutionAmount.test.js.map +1 -0
  96. package/lib/core/asset.js +21 -27
  97. package/lib/core/asset.js.map +1 -1
  98. package/lib/core/custodian.d.ts +30 -0
  99. package/lib/core/custodian.js +49 -0
  100. package/lib/core/custodian.js.map +1 -0
  101. package/lib/core/index.d.ts +1 -0
  102. package/lib/core/index.js +3 -1
  103. package/lib/core/index.js.map +1 -1
  104. package/lib/core/intents/__tests__/intentErrorCode.test.d.ts +1 -0
  105. package/lib/core/intents/__tests__/intentErrorCode.test.js +111 -0
  106. package/lib/core/intents/__tests__/intentErrorCode.test.js.map +1 -0
  107. package/lib/core/intents/__tests__/intentHandleReject.test.d.ts +1 -0
  108. package/lib/core/intents/__tests__/intentHandleReject.test.js +50 -0
  109. package/lib/core/intents/__tests__/intentHandleReject.test.js.map +1 -0
  110. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.d.ts +1 -0
  111. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js +185 -0
  112. package/lib/core/intents/__tests__/loanIntentAdditionalAccounts.test.js.map +1 -0
  113. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.d.ts +1 -0
  114. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js +85 -0
  115. package/lib/core/intents/__tests__/loanIntentCustodianPrecedence.test.js.map +1 -0
  116. package/lib/core/intents/__tests__/loanIntentMetadata.test.d.ts +1 -0
  117. package/lib/core/intents/__tests__/loanIntentMetadata.test.js +81 -0
  118. package/lib/core/intents/__tests__/loanIntentMetadata.test.js.map +1 -0
  119. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.d.ts +1 -0
  120. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js +203 -0
  121. package/lib/core/intents/__tests__/moveIntentSegregatedAccounts.test.js.map +1 -0
  122. package/lib/core/intents/createIntent/createIntent.js +4 -3
  123. package/lib/core/intents/createIntent/createIntent.js.map +1 -1
  124. package/lib/core/intents/createIntent/createMoveIntentReq.d.ts +27 -0
  125. package/lib/core/intents/createIntent/createMoveIntentReq.js +91 -0
  126. package/lib/core/intents/createIntent/createMoveIntentReq.js.map +1 -0
  127. package/lib/core/intents/createIntent/helpers.d.ts +32 -2
  128. package/lib/core/intents/createIntent/helpers.js +78 -1
  129. package/lib/core/intents/createIntent/helpers.js.map +1 -1
  130. package/lib/core/intents/createLoanIntent.js +64 -19
  131. package/lib/core/intents/createLoanIntent.js.map +1 -1
  132. package/lib/core/intents/executeIntent.js +102 -41
  133. package/lib/core/intents/executeIntent.js.map +1 -1
  134. package/lib/core/intents/executeLoanIntent.js +48 -23
  135. package/lib/core/intents/executeLoanIntent.js.map +1 -1
  136. package/lib/core/intents/executeMoveIntent.d.ts +19 -0
  137. package/lib/core/intents/executeMoveIntent.js +134 -0
  138. package/lib/core/intents/executeMoveIntent.js.map +1 -0
  139. package/lib/core/intents/executePrivateIntent.js +46 -13
  140. package/lib/core/intents/executePrivateIntent.js.map +1 -1
  141. package/lib/core/intents/executeRedemptionIntent.d.ts +1 -0
  142. package/lib/core/intents/executeRedemptionIntent.js +23 -9
  143. package/lib/core/intents/executeRedemptionIntent.js.map +1 -1
  144. package/lib/core/intents/executeTransferRequest.d.ts +5 -0
  145. package/lib/core/intents/executeTransferRequest.js +14 -3
  146. package/lib/core/intents/executeTransferRequest.js.map +1 -1
  147. package/lib/core/intents/getIntent.js +18 -0
  148. package/lib/core/intents/getIntent.js.map +1 -1
  149. package/lib/core/intents/index.d.ts +3 -0
  150. package/lib/core/intents/index.js +7 -1
  151. package/lib/core/intents/index.js.map +1 -1
  152. package/lib/core/intents/transfer.js +7 -2
  153. package/lib/core/intents/transfer.js.map +1 -1
  154. package/lib/core/intents/updateMoveIntentReq.d.ts +28 -0
  155. package/lib/core/intents/updateMoveIntentReq.js +94 -0
  156. package/lib/core/intents/updateMoveIntentReq.js.map +1 -0
  157. package/lib/core/intents/utils.d.ts +15 -7
  158. package/lib/core/intents/utils.js +36 -26
  159. package/lib/core/intents/utils.js.map +1 -1
  160. package/lib/core/logger.js +128 -22
  161. package/lib/core/logger.js.map +1 -1
  162. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.d.ts +1 -0
  163. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js +60 -0
  164. package/lib/core/normalizers/__tests__/normalizeOperationResponse.test.js.map +1 -0
  165. package/lib/core/normalizers/normalizeOperationResponse.d.ts +6 -0
  166. package/lib/core/normalizers/normalizeOperationResponse.js +4 -5
  167. package/lib/core/normalizers/normalizeOperationResponse.js.map +1 -1
  168. package/lib/core/sdk.d.ts +4 -0
  169. package/lib/core/sdk.js +2 -2
  170. package/lib/core/sdk.js.map +1 -1
  171. package/lib/core/user.d.ts +2 -2
  172. package/lib/core/user.js +60 -2
  173. package/lib/core/user.js.map +1 -1
  174. package/lib/core/utils.d.ts +17 -1
  175. package/lib/core/utils.js +75 -16
  176. package/lib/core/utils.js.map +1 -1
  177. package/lib/index.d.ts +1 -0
  178. package/lib/index.js +3 -1
  179. package/lib/index.js.map +1 -1
  180. package/lib/types/Core/Intents.d.ts +243 -2
  181. package/lib/types/Core/Intents.js +9 -0
  182. package/lib/types/Core/Intents.js.map +1 -1
  183. package/lib/types/Core/OwneraAPI.d.ts +21 -1
  184. package/lib/types/Core/User.d.ts +62 -4
  185. package/lib/types/InvestorAccounts/InvestorAccounts.d.ts +171 -0
  186. package/lib/types/InvestorAccounts/InvestorAccounts.js +35 -0
  187. package/lib/types/InvestorAccounts/InvestorAccounts.js.map +1 -0
  188. package/lib/types/InvestorAccounts/index.d.ts +1 -0
  189. package/lib/types/InvestorAccounts/index.js +18 -0
  190. package/lib/types/InvestorAccounts/index.js.map +1 -0
  191. package/lib/types/Operations/Operations.d.ts +11 -0
  192. package/lib/types/Oss/Oss.d.ts +18 -1
  193. package/lib/types/Oss/OssSchemas.d.ts +89 -2
  194. package/lib/types/Oss/OssSchemas.js.map +1 -1
  195. package/lib/types/Oss/utils.d.ts +32 -0
  196. package/lib/types/PaymentAdapter/PaymentAdapter.d.ts +7 -0
  197. package/lib/types/PaymentAdapter/index.d.ts +33 -1
  198. package/lib/types/Profiles/Accounts.d.ts +32 -0
  199. package/lib/types/Profiles/Intents.d.ts +58 -3
  200. package/lib/types/Profiles/Profiles.d.ts +71 -2
  201. package/lib/types/Tokens/Tokens.d.ts +111 -1
  202. package/lib/types/index.d.ts +1 -0
  203. package/lib/types/index.js +1 -0
  204. package/lib/types/index.js.map +1 -1
  205. package/package.json +1 -1
@@ -45,6 +45,15 @@ export interface FiatAccount {
45
45
  code: string;
46
46
  }
47
47
  export type PayoutStatus = 'pending' | 'completed' | 'failed';
48
+ /**
49
+ * The execution plan instruction a payout settles. Present only when the payout was
50
+ * raised for a plan's cash leg rather than for a withdrawal, and the handle used to
51
+ * scope a pending payment to a trade and a leg.
52
+ */
53
+ export interface PayoutExecutionContext {
54
+ planId: string;
55
+ instructionSequence: number;
56
+ }
48
57
  export interface Payout {
49
58
  id: string;
50
59
  status: PayoutStatus;
@@ -53,8 +62,31 @@ export interface Payout {
53
62
  asset: FinP2PAccountAssetSchemaOss;
54
63
  quantity: string;
55
64
  timestamp: number;
65
+ /**
66
+ * Operator-supplied external reference for the payment, recorded when the payout was
67
+ * confirmed - e.g. a Swift UETR for a wire the bank executed in its own systems.
68
+ * Becomes the receipt's `transactionDetails.transactionId`.
69
+ */
70
+ externalId?: string;
71
+ /** Set when this payout settles a plan cash leg rather than a withdrawal. */
72
+ executionContext?: PayoutExecutionContext;
56
73
  }
74
+ /**
75
+ * Body of `POST /operator/payouts/{payoutId}`.
76
+ *
77
+ * Field names here are the wire contract, which is not the same as the SDK's
78
+ * caller-facing {@link PaymentAdapterUpdatePayoutRequest}: the adapter reads
79
+ * `description`, not `operatorDescription`.
80
+ */
57
81
  export interface UpdatePayoutRequest {
58
82
  status: PayoutStatus;
59
- operatorDescription: string;
83
+ description?: string;
84
+ /**
85
+ * @deprecated The adapter has never read this field — its operator API reads
86
+ * `description` — so anything sent here was silently discarded. Retained, and still
87
+ * sent alongside `description`, only so this stays a purely additive change for any
88
+ * caller that constructs the body itself. Remove in the next major.
89
+ */
90
+ operatorDescription?: string;
91
+ externalId?: string;
60
92
  }
@@ -3,6 +3,38 @@ export interface FinP2PAsset {
3
3
  assetIdentifierType: typeof assetFinP2PType;
4
4
  resourceId: string;
5
5
  }
6
+ /**
7
+ * Node-shaped FinP2P asset (`finp2pAsset` schema): a resource id plus its
8
+ * CAIP-19 ledger identifier. This is the wire shape the node expects inside a
9
+ * move intent's `destinationAssets` (create and update), as opposed to the
10
+ * SDK-facing {@link FinP2PAsset}. The core create path resolves this from a
11
+ * {@link FinP2PAsset} via `buildCaip19Identifier`; the low-level
12
+ * `updateIntent` forwards it verbatim.
13
+ */
14
+ export interface Caip19FinP2PAsset {
15
+ id: string;
16
+ ledgerIdentifier: {
17
+ /** Always `'CAIP-19'` in practice; typed as string to match the core `buildCaip19Identifier` output. */
18
+ assetIdentifierType: string;
19
+ network: string;
20
+ standard: string;
21
+ tokenId: string;
22
+ };
23
+ }
24
+ /**
25
+ * Node-shaped move destination (`moveDestination` schema): a
26
+ * {@link Caip19FinP2PAsset} plus the optional pre-funded pool that a
27
+ * custody-offered Move's `Transfer` drains into this destination. Supersedes
28
+ * `finp2pAsset` in `moveAsset.destinationAssets` on both create and update.
29
+ *
30
+ * `fromSegregatedAccountOwner` is write-only — it sets the pool owner /
31
+ * Transfer seller and has no counterpart on the OSS read type
32
+ * ({@link MoveDestinationSchemaOss}).
33
+ */
34
+ export interface Caip19MoveDestination extends Caip19FinP2PAsset {
35
+ fromSegregatedAccount?: FinIdAccount;
36
+ fromSegregatedAccountOwner?: string;
37
+ }
6
38
  export interface CryptocurrencyAsset {
7
39
  type: 'cryptocurrency';
8
40
  code: CryptoCurrencyCode;
@@ -1,4 +1,5 @@
1
- import { AssetInstruction, AssetTerm, FinIdAccount, FinP2PAsset, IntentCreationSettlementTerm, SettlementAssetTerm, SettlementInstructionDestinationAccount, SettlementInstructionSourceAccount } from './Accounts';
1
+ import { AssetInstruction, AssetTerm, Caip19FinP2PAsset, Caip19MoveDestination, FinIdAccount, FinP2PAsset, IntentCreationSettlementTerm, SettlementAssetTerm, SettlementInstructionDestinationAccount, SettlementInstructionSourceAccount } from './Accounts';
2
+ import { NetworkAccount } from '../InvestorAccounts';
2
3
  export interface SettlementConditionsRequest {
3
4
  assetId: string;
4
5
  quantity: string;
@@ -15,11 +16,20 @@ export interface PresignedIntentSignaturePolicy {
15
16
  nonce: string;
16
17
  type: 'presignedPolicy';
17
18
  }
19
+ /**
20
+ * Move intent presigned policy. The node's `moveIntent` schema defines
21
+ * `presignedPolicy` as `{ type }` only — no `nonce` (unlike loan/other intents,
22
+ * see {@link PresignedIntentSignaturePolicy}). Sending a `nonce` here risks
23
+ * rejection by the node's strict field validation.
24
+ */
25
+ export interface MovePresignedSignaturePolicy {
26
+ type: 'presignedPolicy';
27
+ }
18
28
  export interface ManualSignaturePolicy {
19
29
  type: 'manualPolicy';
20
30
  }
21
31
  export interface IntentRequestWithType {
22
- type: 'primarySale' | 'buyingIntent' | 'sellingIntent' | 'redemptionIntent' | 'loanIntent' | 'privateOfferIntent';
32
+ type: 'primarySale' | 'buyingIntent' | 'sellingIntent' | 'redemptionIntent' | 'loanIntent' | 'privateOfferIntent' | 'moveIntent';
23
33
  }
24
34
  export interface IntentAsset {
25
35
  assetTerm: AssetTerm;
@@ -151,6 +161,30 @@ export interface ExecuteTransferRequestIntent {
151
161
  observers?: string[];
152
162
  }
153
163
  export type PrivateOfferIntentRequest = PrivateOfferTradeIntentRequest | PrivateOfferIssuanceIntentRequest | TransferRequestIntentRequest;
164
+ /**
165
+ * Move intent asset shape. Declares a single source asset and one-or-more
166
+ * allowed destination assets (migration targets). The SDK's `CreateMoveIntent`
167
+ * accepts either a single destination or a list; both resolve to this
168
+ * `destinationAssets` array.
169
+ *
170
+ * `sourceToSegregatedAccount` is the custody-offered addition: held source
171
+ * tokens are Released to it instead of being burned. Omitted for the
172
+ * issuer-offered path.
173
+ *
174
+ * Both assets are node-shaped ({@link Caip19FinP2PAsset} /
175
+ * {@link Caip19MoveDestination}) — this is the wire payload the create path
176
+ * builds, not the SDK-facing `FinP2PAsset` input.
177
+ */
178
+ export interface MoveIntentAsset {
179
+ sourceAsset: Caip19FinP2PAsset;
180
+ destinationAssets: Caip19MoveDestination[];
181
+ sourceToSegregatedAccount?: FinIdAccount;
182
+ }
183
+ export interface MoveIntentRequest extends IntentRequestWithType {
184
+ type: 'moveIntent';
185
+ asset: MoveIntentAsset;
186
+ signaturePolicy: ManualSignaturePolicy | MovePresignedSignaturePolicy;
187
+ }
154
188
  export interface LoanInstruction {
155
189
  closeDate: number;
156
190
  openDate: number;
@@ -183,12 +217,33 @@ export interface LoanIntent {
183
217
  };
184
218
  settlement: LoanIntentSettlement[];
185
219
  loanInstruction: LoanInstruction;
220
+ additionalAccounts?: Record<string, LoanAdditionalAccount>;
186
221
  signaturePolicy: PresignedIntentSignaturePolicy;
187
222
  }
188
- export type IntentRequest = PrimarySaleIntentRequest | RedemptionIntentRequest | BuyingIntentRequest | SellingIntentRequest | LoanIntent | PrivateOfferIntentRequest;
223
+ /**
224
+ * Node-shaped loan additional account (`additionalAccount` schema), keyed on
225
+ * the intent by the alias a loan policy references. `networkAccount` is the
226
+ * wallet an on-chain leg needs, declared here because the execute payload never
227
+ * names these accounts.
228
+ */
229
+ export interface LoanAdditionalAccount {
230
+ account: {
231
+ asset: Caip19FinP2PAsset;
232
+ account: FinIdAccount;
233
+ networkAccount?: NetworkAccount;
234
+ };
235
+ /** Profile id of the account owner. */
236
+ owner: string;
237
+ }
238
+ export type IntentRequest = PrimarySaleIntentRequest | RedemptionIntentRequest | BuyingIntentRequest | SellingIntentRequest | LoanIntent | PrivateOfferIntentRequest | MoveIntentRequest;
189
239
  export interface IntentCoreRequest {
190
240
  start: number;
191
241
  end: number;
192
242
  intent: IntentRequest;
193
243
  intentId?: string;
244
+ /**
245
+ * Optional custom metadata (node `customMetadata`): a map of non-empty
246
+ * string key/value pairs for tracing/reconciliation, opaque to the Router.
247
+ */
248
+ metadata?: Record<string, string>;
194
249
  }
@@ -2,7 +2,7 @@ import { IdResponse, Operation, RequestOptions } from '../Commons';
2
2
  import { CreateTransferRequest } from '../Core';
3
3
  import { ExecuteTransferRequestIntent, IntentCoreRequest, UpdateTransferRequestIntentRequest } from './Intents';
4
4
  import { CryptoCurrencyCode, Iso4217Code } from '../utils';
5
- import { IntentUpdateSettlementTerm, IntentUpdateAssetTerm, FinIdAccount, FinP2PAsset } from './Accounts';
5
+ import { IntentUpdateSettlementTerm, IntentUpdateAssetTerm, FinIdAccount, FinP2PAsset, Caip19MoveDestination } from './Accounts';
6
6
  import { IntentTypeSchemaOss } from '../Oss';
7
7
  /**
8
8
  * Profiles Interface allow to create, update, share and manage state of different profile instances
@@ -98,6 +98,50 @@ export interface Profiles {
98
98
  *
99
99
  */
100
100
  disableIntent(r: IntentQuery, options?: RequestOptions): Promise<void>;
101
+ /**
102
+ * Cancel Intent
103
+ *
104
+ * @param r
105
+ * @param options
106
+ *
107
+ * @returns
108
+ *
109
+ */
110
+ cancelIntent(r: IntentQuery, options?: RequestOptions): Promise<void>;
111
+ /**
112
+ * Reject Intent
113
+ *
114
+ * `POST /profiles/asset/{assetId}/intent/{intentId}/reject` — the router's explicit
115
+ * reject endpoint (finp2p-core#2649). Terminal, and distinct from cancel: cancel is the
116
+ * CREATOR withdrawing an intent, reject is the RECEIVER refusing one. Both end the
117
+ * intent, and neither can be undone.
118
+ *
119
+ * Who may reject is decided by the router: only the intent's receiver (private offer:
120
+ * the buyer; transfer request: the creditor/debitor of the action; loan: the side that
121
+ * did NOT create it, resolved from `creatorType`), and only while the intent is
122
+ * ACTIVE. Anyone else gets `403 Insufficient permissions`; a non-active intent gets
123
+ * `400 Invalid operation ... intent can only be rejected while active`.
124
+ *
125
+ * `rejectReason` is optional and, when given, must not be blank — the router refuses a
126
+ * whitespace-only reason, so the SDK sends the body only when a non-blank reason is
127
+ * supplied. It is persisted on the intent and readable by the counterparty as
128
+ * `rejectReason` on the OSS intent.
129
+ *
130
+ * Router support: the endpoint exists on finp2p-node master after #2649 and is not in
131
+ * any 0.28.x tag at the time of writing. An older router answers `404` (code 1100,
132
+ * "no matching operation was found"). There is deliberately NO fallback to the legacy
133
+ * `PATCH { status: 'Rejected' }` here: on those routers the PATCH cannot reject a
134
+ * loan intent at all and drops the reason for every other type, so a silent fallback
135
+ * would report success for a rejection the counterparty never learns the reason of.
136
+ * Callers should surface the 404 as "router does not support rejection yet".
137
+ *
138
+ * @param r
139
+ * @param options
140
+ *
141
+ * @returns
142
+ *
143
+ */
144
+ rejectIntent(r: RejectIntentRequest, options?: RequestOptions): Promise<void>;
101
145
  disableIntentTypes(r: IntentTypesRequest, options?: RequestOptions): Promise<void>;
102
146
  enableIntentTypes(r: IntentTypesRequest, options?: RequestOptions): Promise<void>;
103
147
  syncBalance(r: AccountBalanceSyncRequest, options?: RequestOptions): Promise<void>;
@@ -190,7 +234,7 @@ export interface LedgerAssetBinding {
190
234
  bind?: {
191
235
  assetIdentifierType: 'CAIP-19';
192
236
  network: string;
193
- tokenId: string;
237
+ tokenId?: string;
194
238
  standard: string;
195
239
  resourceId?: string;
196
240
  };
@@ -252,6 +296,20 @@ export interface UpdateIntentRequest extends IntentQuery {
252
296
  type: string;
253
297
  settlementTerm?: IntentUpdateSettlementTerm;
254
298
  assetTerm?: IntentUpdateAssetTerm;
299
+ /**
300
+ * Move intent only (`type: 'moveIntent'`). Replaces the intent's allowed
301
+ * destination assets — at least one is required, and the source asset is
302
+ * immutable. Node-shaped {@link Caip19MoveDestination} entries (each
303
+ * optionally carrying a pre-funded pool), forwarded to PATCH verbatim
304
+ * (resolve CAIP-19 before calling, as the create path does).
305
+ */
306
+ destinationAssets?: Caip19MoveDestination[];
307
+ /**
308
+ * Move intent only. New source Release target for custody-offered Move.
309
+ * The node preserves the intent's existing value when this is omitted, so
310
+ * callers must not send a clearing value to mean "unchanged".
311
+ */
312
+ sourceToSegregatedAccount?: FinIdAccount;
255
313
  };
256
314
  status?: string;
257
315
  }
@@ -259,6 +317,17 @@ export interface IntentQuery {
259
317
  assetId: string;
260
318
  intentId: string;
261
319
  }
320
+ /**
321
+ * Reject an intent, optionally saying why. See {@link Profiles.rejectIntent}.
322
+ */
323
+ export interface RejectIntentRequest extends IntentQuery {
324
+ /**
325
+ * Human-readable reason, delivered to the counterparty via the intent's `rejectReason`.
326
+ * Optional; when provided it must not be blank (the router enforces `\S`). The SDK
327
+ * trims it and omits the body entirely when nothing is left.
328
+ */
329
+ rejectReason?: string;
330
+ }
262
331
  export type AssetDenomination = {
263
332
  type: 'fiat';
264
333
  code: Iso4217Code;
@@ -33,6 +33,19 @@ export interface Tokens {
33
33
  *
34
34
  */
35
35
  executeTokenIntent(r: ExecuteRequest, options?: RequestOptions): Promise<ExecuteResponse>;
36
+ /**
37
+ * Predict whether an intent execution would succeed, without executing it.
38
+ *
39
+ * Takes the same request as {@link executeTokenIntent}; the signature is not
40
+ * required. Nothing is persisted.
41
+ *
42
+ * @param r
43
+ * @param options
44
+ *
45
+ * @returns
46
+ *
47
+ */
48
+ dryRunExecuteTokenIntent(r: ExecuteRequest, options?: RequestOptions): Promise<DryRunExecutionPlanResult>;
36
49
  /**
37
50
  * Create transfer and execute it immediately without receiver confirmation/approval
38
51
  *
@@ -250,13 +263,55 @@ export interface TransferRequestIntentExecution {
250
263
  };
251
264
  };
252
265
  }
253
- export type IntentExecutionType = PrimarySaleExecution | BuyingIntentExecution | SellingIntentExecution | RedemptionIntentExecution | LoanIntentExecution | PrivateOfferIntentExecution | TransferRequestIntentExecution;
266
+ /**
267
+ * Node-shaped `moveIntentExecution`: the holder migrates a holding from the
268
+ * move intent's source asset to a chosen destination. `asset` is a
269
+ * `sourceDestinationIntentAsset` — `term` is omitted to move the executor's
270
+ * full holding. Both accounts belong to the executor; assets are node-shaped
271
+ * CAIP-19 identifiers.
272
+ */
273
+ export interface MoveIntentExecution {
274
+ type: 'moveIntentExecution';
275
+ nonce: string;
276
+ owner: string;
277
+ asset: {
278
+ term?: {
279
+ amount: string;
280
+ };
281
+ instruction: {
282
+ sourceAccount: MoveExecutionAssetAccount;
283
+ destinationAccount: MoveExecutionAssetAccount;
284
+ };
285
+ };
286
+ }
287
+ export interface MoveExecutionAssetAccount {
288
+ account: {
289
+ type: string;
290
+ finId: string;
291
+ orgId: string;
292
+ custodian: {
293
+ orgId: string;
294
+ };
295
+ };
296
+ asset: {
297
+ id: string;
298
+ ledgerIdentifier: {
299
+ assetIdentifierType: string;
300
+ network: string;
301
+ standard: string;
302
+ tokenId: string;
303
+ };
304
+ };
305
+ }
306
+ export type IntentExecutionType = PrimarySaleExecution | BuyingIntentExecution | SellingIntentExecution | RedemptionIntentExecution | LoanIntentExecution | PrivateOfferIntentExecution | TransferRequestIntentExecution | MoveIntentExecution;
254
307
  export interface ExecuteRequest {
255
308
  user: string;
256
309
  intentId: string;
257
310
  intent: IntentExecutionType;
258
311
  executionId?: string;
259
312
  observers?: string[];
313
+ /** Optional custom metadata (node `customMetadata`): a map of non-empty strings. */
314
+ metadata?: Record<string, string>;
260
315
  }
261
316
  export interface ExecuteResponse extends Operation {
262
317
  type: 'execution';
@@ -290,3 +345,58 @@ export interface TransferRequest {
290
345
  };
291
346
  };
292
347
  }
348
+ /** Stage at which a dry run determined the intent would not execute. */
349
+ export type DryRunFailureStage = 'requestValidation' | 'policyMatch' | 'translation' | 'participants' | 'capabilities' | 'selfVerification';
350
+ /** Machine-readable outcome class of a dry-run failure. */
351
+ export type DryRunFailureClassification = 'noPolicyMatch' | 'unsupportedIntent' | 'technical' | 'wouldFail';
352
+ export interface DryRunExecutionPlanFailure {
353
+ stage: DryRunFailureStage;
354
+ classification: DryRunFailureClassification;
355
+ code?: number;
356
+ message?: string;
357
+ }
358
+ export interface DryRunCandidatePolicy {
359
+ policyId: string;
360
+ /** Whether this policy was the one selected for the variation. */
361
+ matched: boolean;
362
+ /** Why the policy was rejected; present when `matched` is false. */
363
+ reason?: string;
364
+ }
365
+ export interface DryRunCandidateAsset {
366
+ assetId: string;
367
+ organizationId?: string;
368
+ role: 'main' | 'settlement';
369
+ policies?: DryRunCandidatePolicy[];
370
+ }
371
+ /** One evaluated variation: a combination of assets matched as a unit. */
372
+ export interface DryRunCandidateResult {
373
+ matched: boolean;
374
+ /** Why the combination failed; present when `matched` is false. */
375
+ reason?: string;
376
+ assets?: DryRunCandidateAsset[];
377
+ }
378
+ /**
379
+ * Prediction of an intent execution. When `executable` is true the predicted plan is
380
+ * present and `failure` is absent; when false, `failure` explains why.
381
+ *
382
+ * Treat a negative as reliable and a positive as a prediction: the node's capability
383
+ * checks are deliberately permissive, so an unreachable contributor or an unadvertised
384
+ * capability passes rather than blocks. Good enough to disable an action, not a
385
+ * substitute for authorization.
386
+ */
387
+ export interface DryRunExecutionPlanResult {
388
+ executable: boolean;
389
+ /**
390
+ * The predicted plan, in the operational API's `executionPlan` shape (as returned by
391
+ * GET /execution/{planId}) — deliberately left opaque here rather than typed against
392
+ * the OSS plan shape, which is a different schema. Never persisted.
393
+ */
394
+ plan?: Record<string, unknown>;
395
+ /** Protocol version the predicted plan requires its contributors to support. */
396
+ requiredProtocolVersion?: number;
397
+ /** Non-fatal caveats, e.g. lagging observers or unverified counterparty capabilities. */
398
+ warnings?: string[];
399
+ /** Every evaluated variation; empty for a preview, which evaluates one real contract. */
400
+ candidates?: DryRunCandidateResult[];
401
+ failure?: DryRunExecutionPlanFailure;
402
+ }
@@ -5,6 +5,7 @@ export * from './Certificates';
5
5
  export * from './Commons';
6
6
  export * from './Core';
7
7
  export * from './Documents';
8
+ export * from './InvestorAccounts';
8
9
  export * from './Ledgers';
9
10
  export * from './Messages';
10
11
  export * from './Operations';
@@ -21,6 +21,7 @@ __exportStar(require("./Certificates"), exports);
21
21
  __exportStar(require("./Commons"), exports);
22
22
  __exportStar(require("./Core"), exports);
23
23
  __exportStar(require("./Documents"), exports);
24
+ __exportStar(require("./InvestorAccounts"), exports);
24
25
  __exportStar(require("./Ledgers"), exports);
25
26
  __exportStar(require("./Messages"), exports);
26
27
  __exportStar(require("./Operations"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8CAA4B;AAC5B,yCAAuB;AACvB,iDAA+B;AAC/B,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B;AAC5B,4CAA0B;AAC1B,6CAA2B;AAC3B,+CAA6B;AAC7B,kDAAgC;AAChC,wCAAsB;AACtB,mDAAiC;AACjC,6CAA2B;AAC3B,kDAAgC;AAChC,6CAA2B;AAC3B,6CAA2B;AAC3B,wDAAsC;AACtC,2CAAyB;AACzB,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,8CAA4B;AAC5B,yCAAuB;AACvB,iDAA+B;AAC/B,4CAA0B;AAC1B,yCAAuB;AACvB,8CAA4B;AAC5B,qDAAmC;AACnC,4CAA0B;AAC1B,6CAA2B;AAC3B,+CAA6B;AAC7B,kDAAgC;AAChC,wCAAsB;AACtB,mDAAiC;AACjC,6CAA2B;AAC3B,kDAAgC;AAChC,6CAA2B;AAC3B,6CAA2B;AAC3B,wDAAsC;AACtC,2CAAyB;AACzB,0CAAwB"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@owneraio/finp2p-sdk-js",
3
3
  "main": "lib/index.js",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
- "version": "0.28.25",
5
+ "version": "0.28.41",
6
6
  "homepage": "https://ownera.io/",
7
7
  "scripts": {
8
8
  "build": "yarn clean && tsc",