@florent-uzio/custody 2.2.0 → 2.4.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.
Files changed (44) hide show
  1. package/dist/index.d.ts +2 -1
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +2 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/models/custody-types.d.ts +565 -338
  6. package/dist/models/custody-types.d.ts.map +1 -1
  7. package/dist/ripple-custody.d.ts +55 -10
  8. package/dist/ripple-custody.d.ts.map +1 -1
  9. package/dist/ripple-custody.js +54 -21
  10. package/dist/ripple-custody.js.map +1 -1
  11. package/dist/services/xrpl/index.d.ts +2 -0
  12. package/dist/services/xrpl/index.d.ts.map +1 -1
  13. package/dist/services/xrpl/index.js +2 -4
  14. package/dist/services/xrpl/index.js.map +1 -1
  15. package/dist/services/xrpl/xrpl.adapters.d.ts +23 -5
  16. package/dist/services/xrpl/xrpl.adapters.d.ts.map +1 -1
  17. package/dist/services/xrpl/xrpl.adapters.js +244 -161
  18. package/dist/services/xrpl/xrpl.adapters.js.map +1 -1
  19. package/dist/services/xrpl/xrpl.builders.d.ts +22 -0
  20. package/dist/services/xrpl/xrpl.builders.d.ts.map +1 -0
  21. package/dist/services/xrpl/xrpl.builders.js +109 -0
  22. package/dist/services/xrpl/xrpl.builders.js.map +1 -0
  23. package/dist/services/xrpl/xrpl.crypto.d.ts +6 -0
  24. package/dist/services/xrpl/xrpl.crypto.d.ts.map +1 -0
  25. package/dist/services/xrpl/xrpl.crypto.js +19 -0
  26. package/dist/services/xrpl/xrpl.crypto.js.map +1 -0
  27. package/dist/services/xrpl/xrpl.http-adapters.d.ts.map +1 -1
  28. package/dist/services/xrpl/xrpl.http-adapters.js +5 -0
  29. package/dist/services/xrpl/xrpl.http-adapters.js.map +1 -1
  30. package/dist/services/xrpl/xrpl.ports.d.ts +7 -1
  31. package/dist/services/xrpl/xrpl.ports.d.ts.map +1 -1
  32. package/dist/services/xrpl/xrpl.service.d.ts +79 -36
  33. package/dist/services/xrpl/xrpl.service.d.ts.map +1 -1
  34. package/dist/services/xrpl/xrpl.service.js +182 -182
  35. package/dist/services/xrpl/xrpl.service.js.map +1 -1
  36. package/dist/services/xrpl/xrpl.types.d.ts +112 -7
  37. package/dist/services/xrpl/xrpl.types.d.ts.map +1 -1
  38. package/dist/services/xrpl/xrpl.types.js +0 -28
  39. package/dist/services/xrpl/xrpl.types.js.map +1 -1
  40. package/dist/services/xrpl/xrpl.validators.d.ts +23 -0
  41. package/dist/services/xrpl/xrpl.validators.d.ts.map +1 -0
  42. package/dist/services/xrpl/xrpl.validators.js +43 -0
  43. package/dist/services/xrpl/xrpl.validators.js.map +1 -0
  44. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
- import type { AccountSet, Clawback, DepositPreauth, MPTokenAuthorize, MPTokenIssuanceCreate, MPTokenIssuanceDestroy, MPTokenIssuanceSet, OfferCreate, Payment, SubmittableTransaction, TrustSet } from "xrpl";
1
+ import type { AccountSet, Batch, BatchSigner, Clawback, DepositPreauth, MPTokenAuthorize, MPTokenIssuanceCreate, MPTokenIssuanceDestroy, MPTokenIssuanceSet, OfferCreate, Payment, SubmittableTransaction, TicketCreate, TrustSet } from "xrpl";
2
2
  import type { components } from "../../models/custody-types.js";
3
3
  import type { XrplLedgerId } from "../../models/ledger-ids.js";
4
4
  import type { Prettify } from "../../type-utils/index.js";
5
5
  import type { DomainUserReference } from "../domain-resolver/index.js";
6
+ import type { Core_IntentResponse } from "../intents/intents.types.js";
6
7
  /**
7
8
  * Minimum set of account fields required to build an XRPL intent.
8
9
  * Consumed by `IntentContext`. Not an API response shape — see
@@ -36,8 +37,23 @@ type Core_XrplOperation_MPTokenIssuanceDestroy = components["schemas"]["Core_Xrp
36
37
  export type CustodyMpTokenIssuanceDestroy = Prettify<Pick<MPTokenIssuanceDestroy, "Account"> & Omit<Core_XrplOperation_MPTokenIssuanceDestroy, "type">>;
37
38
  export type Core_XrplOperation_OfferCreate = components["schemas"]["Core_XrplOperation_OfferCreate"];
38
39
  export type CustodyOfferCreate = Prettify<Pick<OfferCreate, "Account"> & Omit<Core_XrplOperation_OfferCreate, "type">>;
40
+ export type Core_XrplOperation_TicketCreate = components["schemas"]["Core_XrplOperation_TicketCreate"];
41
+ export type CustodyTicketCreate = Prettify<Pick<TicketCreate, "Account"> & Omit<Core_XrplOperation_TicketCreate, "type">>;
39
42
  export type Core_XrplOperation_AccountSet = components["schemas"]["Core_XrplOperation_AccountSet"];
40
43
  export type CustodyAccountSet = Prettify<Pick<AccountSet, "Account"> & Omit<Core_XrplOperation_AccountSet, "type">>;
44
+ export type Core_XrplOperation_Batch = components["schemas"]["Core_XrplOperation_Batch"];
45
+ export type CustodyBatch = Prettify<Pick<Batch, "Account"> & Omit<Core_XrplOperation_Batch, "type">>;
46
+ export type CustodyBatchSigner = CustodyBatch["batchSigners"][number];
47
+ export type CustodyInnerTransaction = CustodyBatch["entries"][number];
48
+ export type CustodyOperation = CustodyInnerTransaction["operation"];
49
+ export type Core_ParticipantSequencing = components["schemas"]["Core_ParticipantSequencing"];
50
+ export type Core_BatchEntry = components["schemas"]["Core_BatchEntry"];
51
+ export type Core_BatchSigner = components["schemas"]["Core_BatchSigner"];
52
+ export type Core_Sequencing = components["schemas"]["Core_Sequencing"];
53
+ export type Core_BatchExecutionMode = components["schemas"]["Core_Xrpl_BatchExecutionMode"];
54
+ export type Core_ApiBatchSigningData = components["schemas"]["Core_ApiBatchSigningData"];
55
+ export type Core_TransactionEstimate_XRPL = components["schemas"]["Core_TransactionEstimate_XRPL"];
56
+ export type Core_IntentDryRunResponse_v0_CreateTransactionOrder = components["schemas"]["Core_IntentDryRunResponse_v0_CreateTransactionOrder"];
41
57
  export type CustodyAccountSetFlag = CustodyAccountSet["setFlag"];
42
58
  export type XrplIntentOptions = {
43
59
  /**
@@ -59,6 +75,10 @@ export type XrplIntentOptions = {
59
75
  * Number of days until the intent expires. Defaults to 1.
60
76
  */
61
77
  expiryDays?: number;
78
+ /**
79
+ * Human-readable description for the intent request (`request.description`).
80
+ */
81
+ description?: string;
62
82
  /**
63
83
  * Custom properties to include in the intent request.
64
84
  */
@@ -117,15 +137,100 @@ export type RawSignAndWaitResult = {
117
137
  /** The transaction with TxnSignature and SigningPubKey set, ready to submit */
118
138
  signedTransaction: SubmittableTransaction;
119
139
  };
120
- export {};
140
+ type BatchSignerLookup = {
141
+ accountId?: never;
142
+ ledgerId?: never;
143
+ };
144
+ type BatchSignerDirect = {
145
+ /** Custody account ID — skips the address lookup when provided with ledgerId */
146
+ accountId: string;
147
+ /** Ledger ID for the account */
148
+ ledgerId: string;
149
+ };
150
+ /**
151
+ * Input for `dryRunBatch` / `proposeBatch`.
152
+ *
153
+ * `Account` is the submitter (pays the outer Batch fee). `entries` mixes
154
+ * `SubmitterOperation` and `ParticipantOperation`; build them by hand with
155
+ * `Core_BatchEntry`, or convert from an autofilled xrpl.js `Batch` with
156
+ * `batchToCustodyInnerTransactions`.
157
+ */
158
+ export type BatchPayloadInput = {
159
+ /** XRPL address of the submitter (the account that pays the outer Batch fee) */
160
+ Account: string;
161
+ /** How the XRP Ledger handles inner-operation failures */
162
+ executionMode: Core_BatchExecutionMode;
163
+ /** Inner operations (SubmitterOperation or ParticipantOperation) */
164
+ entries: Core_BatchEntry[];
165
+ /** Outer Batch sequencing. Defaults to `{ type: "PlatformManaged" }` */
166
+ sequencing?: Core_Sequencing;
167
+ /** Optional last ledger sequence for the outer Batch */
168
+ lastLedgerSequence?: number;
169
+ };
121
170
  /**
122
- * Result of rawSignInnerBatchAndWait.
123
- * Extends RawSignAndWaitResult with batch signer representations.
171
+ * Options for signing the `signingPayload` returned by `dryRunBatch` for an
172
+ * inner account managed by this custody instance.
173
+ *
174
+ * When `accountId` and `ledgerId` are provided, the address-to-account lookup
175
+ * is skipped.
124
176
  */
177
+ export type SignBatchPayloadOptions = XrplIntentOptions & {
178
+ /** Polling options for waiting for the manifest signature */
179
+ polling?: WaitForSignatureOptions;
180
+ } & (BatchSignerLookup | BatchSignerDirect);
125
181
  /**
126
- * Options for rawSignInnerBatch / rawSignInnerBatchAndWait: intent options + polling configuration.
182
+ * Result of `signBatchPayloadAndWait`.
127
183
  *
128
- * When `accountId` and `ledgerId` are provided, the address-to-account lookup is
129
- * skipped, saving an API call.
184
+ * `signature` and `signingPubKey` are uppercase hex. `batchSigner` is the
185
+ * xrpl.js `BatchSigner` shape; `custodyBatchSigner` is the {% PUBLIC_VAR_CUS %}
186
+ * shape — pick whichever the next step needs.
130
187
  */
188
+ export type SignBatchPayloadResult = {
189
+ /** The signature in uppercase hex */
190
+ signature: string;
191
+ /** The compressed secp256k1 public key in uppercase hex */
192
+ signingPubKey: string;
193
+ /** xrpl.js BatchSigner — for inclusion in an xrpl.js Batch.BatchSigners array */
194
+ batchSigner: BatchSigner;
195
+ /** Custody BatchSigner — for inclusion in batchSigners on `proposeBatch` */
196
+ custodyBatchSigner: CustodyBatchSigner;
197
+ };
198
+ /**
199
+ * Serializable handle returned by `signBatchPayload`. Persist these fields
200
+ * (e.g. to a database or queue) and pass them to `getBatchSignature` once the
201
+ * custody instance operator has approved the signature — possibly from a
202
+ * different process.
203
+ */
204
+ export type SignBatchPayloadHandle = {
205
+ /** Manifest ID to poll for the signature */
206
+ payloadId: string;
207
+ /** Domain ID of the signer account */
208
+ domainId: string;
209
+ /** Account ID of the signer account */
210
+ accountId: string;
211
+ /** XRPL address of the signer */
212
+ signerAddress: string;
213
+ /** The compressed secp256k1 public key in uppercase hex */
214
+ signingPubKey: string;
215
+ /** The proposed intent response */
216
+ intentResponse: Core_IntentResponse;
217
+ };
218
+ /**
219
+ * Fields `getBatchSignature` needs to fetch the signature and build the
220
+ * BatchSigner shapes. A `SignBatchPayloadHandle` is a structural superset, so a
221
+ * stored handle can be passed directly.
222
+ */
223
+ export type GetBatchSignatureParams = {
224
+ /** Manifest ID returned by `signBatchPayload` */
225
+ payloadId: string;
226
+ /** Domain ID of the signer account */
227
+ domainId: string;
228
+ /** Account ID of the signer account */
229
+ accountId: string;
230
+ /** XRPL address of the signer */
231
+ signerAddress: string;
232
+ /** The compressed secp256k1 public key in uppercase hex */
233
+ signingPubKey: string;
234
+ };
235
+ export {};
131
236
  //# sourceMappingURL=xrpl.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"xrpl.types.d.ts","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,kBAAkB,EAClB,WAAW,EACX,OAAO,EACP,sBAAsB,EACtB,QAAQ,EACT,MAAM,MAAM,CAAA;AACb,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AACzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAEtE;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,YAAY,CAAA;IACtB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,mBAAmB,GAAG,oBAAoB,CAAA;AAItE,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,4BAA4B,CAAC,CAAA;AAE5F,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC,0BAA0B,EAAE,MAAM,CAAC,CACpE,CAAA;AAID,MAAM,MAAM,2BAA2B,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,6BAA6B,CAAC,CAAA;AAE9F,MAAM,MAAM,gBAAgB,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,GAAG,CAAC,iBAAiB,GAAG,iBAAiB,CAAC,CAAA;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAA;IACrB,iFAAiF;IACjF,WAAW,EAAE,WAAW,CAAA;IACxB,4EAA4E;IAC5E,kBAAkB,EAAE,kBAAkB,CAAA;CACvC,CAAA;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,4CAA4C;IAC5C,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAA;IACrB,mCAAmC;IACnC,cAAc,EAAE,mBAAmB,CAAA;CACpC,CAAA;AAED;;;;GAIG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,iDAAiD;IACjD,SAAS,EAAE,MAAM,CAAA;IACjB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,CAAA;IAChB,uCAAuC;IACvC,SAAS,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAA;IACrB,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA"}
@@ -1,30 +1,2 @@
1
1
  export {};
2
- /**
3
- * Result of rawSignInnerBatchAndWait.
4
- * Extends RawSignAndWaitResult with batch signer representations.
5
- */
6
- // export type RawSignInnerBatchAndWaitResult = RawSignAndWaitResult & {
7
- // /** The batch signer in xrpl.js format */
8
- // batchSigner: BatchSigner
9
- // /** The batch signer in Ripple Custody API format */
10
- // //TODO: delete comment once Batch is supported
11
- // // custodyBatchSigner: CustodyBatchSigner
12
- // }
13
- // type BatchSignerLookup = { accountId?: never; ledgerId?: never }
14
- // type BatchSignerDirect = {
15
- // /** Custody account ID — skips the address lookup when provided with ledgerId */
16
- // accountId: string
17
- // /** Ledger ID for the account */
18
- // ledgerId: string
19
- // }
20
- /**
21
- * Options for rawSignInnerBatch / rawSignInnerBatchAndWait: intent options + polling configuration.
22
- *
23
- * When `accountId` and `ledgerId` are provided, the address-to-account lookup is
24
- * skipped, saving an API call.
25
- */
26
- // export type RawSignInnerBatchOptions = XrplIntentOptions & {
27
- // /** Polling options for waiting for the manifest signature */
28
- // polling?: WaitForSignatureOptions
29
- // } & (BatchSignerLookup | BatchSignerDirect)
30
2
  //# sourceMappingURL=xrpl.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"xrpl.types.js","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.types.ts"],"names":[],"mappings":";AA6NA;;;GAGG;AACH,wEAAwE;AACxE,8CAA8C;AAC9C,6BAA6B;AAC7B,yDAAyD;AACzD,mDAAmD;AACnD,8CAA8C;AAC9C,IAAI;AAEJ,mEAAmE;AACnE,6BAA6B;AAC7B,qFAAqF;AACrF,sBAAsB;AACtB,qCAAqC;AACrC,qBAAqB;AACrB,IAAI;AAEJ;;;;;GAKG;AACH,+DAA+D;AAC/D,kEAAkE;AAClE,sCAAsC;AACtC,8CAA8C"}
1
+ {"version":3,"file":"xrpl.types.js","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import type { BatchPayloadInput } from "./xrpl.types.js";
2
+ /**
3
+ * Validates that a Batch's sequencing is internally consistent, surfacing the
4
+ * rule the Custody server enforces as a local `CustodyError` before the payload
5
+ * is sent (e.g. via `dryRunBatch`).
6
+ *
7
+ * A Batch must be sequenced one of two ways — mixing them is rejected:
8
+ * - **Fully explicit**: the outer Batch and every entry use `AccountSequence`
9
+ * or `Ticket`.
10
+ * - **Fully platform-managed**: the outer Batch and every entry use
11
+ * `PlatformManaged`. This is only possible for a submitter-only Batch, since
12
+ * participant entries are always explicitly sequenced.
13
+ *
14
+ * A frequent cause of a mixed configuration is omitting the outer `sequencing`
15
+ * (which defaults to `PlatformManaged`, matching `buildBatchOperation`) while
16
+ * the entries carry `AccountSequence`/`Ticket` — for example entries produced
17
+ * by `batchToCustodyInnerTransactions`.
18
+ *
19
+ * @param payload - The Batch payload passed to `dryRunBatch` / `proposeBatch`
20
+ * @throws {CustodyError} If the outer Batch and entries mix the two sequencing modes
21
+ */
22
+ export declare function validateBatchSequencing(payload: BatchPayloadInput): void;
23
+ //# sourceMappingURL=xrpl.validators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xrpl.validators.d.ts","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.validators.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,CAwBxE"}
@@ -0,0 +1,43 @@
1
+ import { CustodyError } from "../../models/index.js";
2
+ /**
3
+ * Validates that a Batch's sequencing is internally consistent, surfacing the
4
+ * rule the Custody server enforces as a local `CustodyError` before the payload
5
+ * is sent (e.g. via `dryRunBatch`).
6
+ *
7
+ * A Batch must be sequenced one of two ways — mixing them is rejected:
8
+ * - **Fully explicit**: the outer Batch and every entry use `AccountSequence`
9
+ * or `Ticket`.
10
+ * - **Fully platform-managed**: the outer Batch and every entry use
11
+ * `PlatformManaged`. This is only possible for a submitter-only Batch, since
12
+ * participant entries are always explicitly sequenced.
13
+ *
14
+ * A frequent cause of a mixed configuration is omitting the outer `sequencing`
15
+ * (which defaults to `PlatformManaged`, matching `buildBatchOperation`) while
16
+ * the entries carry `AccountSequence`/`Ticket` — for example entries produced
17
+ * by `batchToCustodyInnerTransactions`.
18
+ *
19
+ * @param payload - The Batch payload passed to `dryRunBatch` / `proposeBatch`
20
+ * @throws {CustodyError} If the outer Batch and entries mix the two sequencing modes
21
+ */
22
+ export function validateBatchSequencing(payload) {
23
+ const outerType = (payload.sequencing ?? { type: "PlatformManaged" }).type;
24
+ const slots = [
25
+ { label: "outer Batch", type: outerType },
26
+ ...payload.entries.map((entry, index) => ({
27
+ label: `entry ${index} (${entry.type})`,
28
+ type: entry.sequencing.type,
29
+ })),
30
+ ];
31
+ const platformManaged = slots.filter((slot) => slot.type === "PlatformManaged");
32
+ const explicit = slots.filter((slot) => slot.type !== "PlatformManaged");
33
+ if (platformManaged.length > 0 && explicit.length > 0) {
34
+ throw new CustodyError({
35
+ reason: "Batch sequencing must be either fully explicit (outer Batch and every entry " +
36
+ "AccountSequence or Ticket) or fully platform-managed (outer Batch and every entry " +
37
+ "PlatformManaged). Mixed configurations are not allowed. " +
38
+ `Platform-managed: ${platformManaged.map((slot) => slot.label).join(", ")}. ` +
39
+ `Explicit: ${explicit.map((slot) => slot.label).join(", ")}.`,
40
+ });
41
+ }
42
+ }
43
+ //# sourceMappingURL=xrpl.validators.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xrpl.validators.js","sourceRoot":"","sources":["../../../src/services/xrpl/xrpl.validators.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAGpD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAA0B;IAChE,MAAM,SAAS,GAAG,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAAA;IAE1E,MAAM,KAAK,GAAG;QACZ,EAAE,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;QACzC,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC;YACxC,KAAK,EAAE,SAAS,KAAK,KAAK,KAAK,CAAC,IAAI,GAAG;YACvC,IAAI,EAAE,KAAK,CAAC,UAAU,CAAC,IAAI;SAC5B,CAAC,CAAC;KACJ,CAAA;IAED,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAA;IAC/E,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,iBAAiB,CAAC,CAAA;IAExE,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,YAAY,CAAC;YACrB,MAAM,EACJ,8EAA8E;gBAC9E,oFAAoF;gBACpF,0DAA0D;gBAC1D,qBAAqB,eAAe,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;gBAC7E,aAAa,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;SAChE,CAAC,CAAA;IACJ,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@florent-uzio/custody",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "An SDK to interact with the Ripple Custody API",
5
5
  "keywords": [
6
6
  "Ripple Custody",