@florent-uzio/custody 2.1.0 → 2.2.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.
- package/dist/namespaces/intents.d.ts.map +1 -1
- package/dist/namespaces/intents.js +31 -36
- package/dist/namespaces/intents.js.map +1 -1
- package/dist/services/intents/intents.types.d.ts +5 -10
- package/dist/services/intents/intents.types.d.ts.map +1 -1
- package/package.json +2 -1
- package/dist/main.d.ts +0 -2
- package/dist/main.d.ts.map +0 -1
- package/dist/main.helpers.d.ts +0 -2
- package/dist/main.helpers.d.ts.map +0 -1
- package/dist/main.helpers.js +0 -99
- package/dist/main.helpers.js.map +0 -1
- package/dist/main.js +0 -41
- package/dist/main.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/namespaces/intents.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC5B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"intents.d.ts","sourceRoot":"","sources":["../../src/namespaces/intents.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,mCAAmC,EACxC,KAAK,oCAAoC,EACzC,KAAK,kBAAkB,EACvB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC5B,MAAM,sCAAsC,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAgE3D,wBAAgB,aAAa,CAAC,CAAC,EAAE,cAAc;+BAEzB,sBAAsB,KAAG,OAAO,CAAC,mBAAmB,CAAC;+BAGrD,sBAAsB,KAAG,OAAO,CAAC,mBAAmB,CAAC;8BAGtD,qBAAqB,KAAG,OAAO,CAAC,mBAAmB,CAAC;2BAI3D,wBAAwB,UACxB,0BAA0B,KACjC,OAAO,CAAC,kBAAkB,CAAC;4BAGpB,yBAAyB,UACzB,0BAA0B,KACjC,OAAO,CAAC,mBAAmB,CAAC;8BAEd,wBAAwB,KAAG,OAAO,CAAC,yBAAyB,CAAC;sCAIpE,mCAAmC,UACnC,oCAAoC,KAC3C,OAAO,CAAC,yBAAyB,CAAC;kCAG3B,wBAAwB,YACtB,uBAAuB,KAChC,OAAO,CAAC,sBAAsB,CAAC;EAErC"}
|
|
@@ -3,56 +3,51 @@ import { sleep } from "../helpers/index.js";
|
|
|
3
3
|
import { CustodyError } from "../models/index.js";
|
|
4
4
|
import { TERMINAL_STATUSES, } from "../services/intents/intents.types.js";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Wait for an intent to reach a terminal status (Executed, Failed, Expired, or Rejected).
|
|
7
|
+
* Polls the intent status at regular intervals until it completes or max retries is reached.
|
|
8
|
+
*
|
|
9
|
+
* A 404 is treated as "not available yet" (e.g. when called immediately after proposing)
|
|
10
|
+
* and is retried within the same polling loop rather than aborting the wait.
|
|
8
11
|
*/
|
|
9
|
-
async function
|
|
10
|
-
|
|
12
|
+
async function waitForExecution(t, params, options = {}) {
|
|
13
|
+
const { maxRetries = 10, intervalMs = 3000, onStatusCheck } = options;
|
|
14
|
+
let lastIntent;
|
|
11
15
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
12
16
|
try {
|
|
13
|
-
|
|
17
|
+
const intent = await t.get(URLs.getIntent, params);
|
|
18
|
+
lastIntent = intent;
|
|
19
|
+
const status = intent.data.state.status;
|
|
20
|
+
onStatusCheck?.(status, attempt);
|
|
21
|
+
if (TERMINAL_STATUSES.includes(status)) {
|
|
22
|
+
return {
|
|
23
|
+
status,
|
|
24
|
+
isTerminal: true,
|
|
25
|
+
isSuccess: status === "Executed",
|
|
26
|
+
intent,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
14
29
|
}
|
|
15
30
|
catch (error) {
|
|
16
|
-
if (error instanceof CustodyError && error.statusCode === 404) {
|
|
17
|
-
|
|
18
|
-
if (attempt < maxRetries) {
|
|
19
|
-
await sleep(intervalMs);
|
|
20
|
-
}
|
|
21
|
-
continue;
|
|
31
|
+
if (!(error instanceof CustodyError && error.statusCode === 404)) {
|
|
32
|
+
throw error;
|
|
22
33
|
}
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
throw lastError;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Wait for an intent to reach a terminal status (Executed, Failed, Expired, or Rejected).
|
|
30
|
-
* Polls the intent status at regular intervals until it completes or max retries is reached.
|
|
31
|
-
*/
|
|
32
|
-
async function waitForExecution(t, params, options = {}) {
|
|
33
|
-
const { maxRetries = 10, intervalMs = 3000, notFoundRetries = 3, notFoundIntervalMs = 1000, onStatusCheck, } = options;
|
|
34
|
-
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
35
|
-
const intent = await getIntentWithRetry(t, params, notFoundRetries, notFoundIntervalMs);
|
|
36
|
-
const status = intent.data.state.status;
|
|
37
|
-
onStatusCheck?.(status, attempt);
|
|
38
|
-
if (TERMINAL_STATUSES.includes(status)) {
|
|
39
|
-
return {
|
|
40
|
-
status,
|
|
41
|
-
isTerminal: true,
|
|
42
|
-
isSuccess: status === "Executed",
|
|
43
|
-
intent,
|
|
44
|
-
};
|
|
34
|
+
// 404 → the intent is not available yet, keep polling.
|
|
45
35
|
}
|
|
46
36
|
if (attempt < maxRetries) {
|
|
47
37
|
await sleep(intervalMs);
|
|
48
38
|
}
|
|
49
39
|
}
|
|
50
|
-
|
|
40
|
+
// Retries exhausted. If the intent never materialized, surface that as a 404.
|
|
41
|
+
if (!lastIntent) {
|
|
42
|
+
throw new CustodyError({ reason: `Intent ${params.intentId} not found after ${maxRetries} attempts` }, 404);
|
|
43
|
+
}
|
|
44
|
+
// The loop returns early on any terminal status, so the last observed intent is
|
|
45
|
+
// necessarily non-terminal here.
|
|
51
46
|
return {
|
|
52
|
-
status:
|
|
47
|
+
status: lastIntent.data.state.status,
|
|
53
48
|
isTerminal: false,
|
|
54
49
|
isSuccess: false,
|
|
55
|
-
intent:
|
|
50
|
+
intent: lastIntent,
|
|
56
51
|
};
|
|
57
52
|
}
|
|
58
53
|
export function createIntents(t) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.js","sourceRoot":"","sources":["../../src/namespaces/intents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,iBAAiB,GAgBlB,MAAM,sCAAsC,CAAA;AAG7C
|
|
1
|
+
{"version":3,"file":"intents.js","sourceRoot":"","sources":["../../src/namespaces/intents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,EACL,iBAAiB,GA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AM,EAAE,OAAO,CAAC;KAClE,CAAA;AACZ,CAAC"}
|
|
@@ -9,19 +9,14 @@ export declare const PENDING_STATUSES: Core_IntentStatus[];
|
|
|
9
9
|
* Options for waiting for intent execution
|
|
10
10
|
*/
|
|
11
11
|
export type WaitForExecutionOptions = {
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Maximum number of polling attempts (default: 10). Also bounds how long a
|
|
14
|
+
* not-yet-available (404) intent is waited for, since 404s are retried within
|
|
15
|
+
* the same loop.
|
|
16
|
+
*/
|
|
13
17
|
maxRetries?: number;
|
|
14
18
|
/** Interval between polling attempts in milliseconds (default: 3000) */
|
|
15
19
|
intervalMs?: number;
|
|
16
|
-
/**
|
|
17
|
-
* Maximum number of retries when the intent is not found (404).
|
|
18
|
-
* Useful when calling immediately after proposeIntent. (default: 3)
|
|
19
|
-
*/
|
|
20
|
-
notFoundRetries?: number;
|
|
21
|
-
/**
|
|
22
|
-
* Interval between retries when the intent is not found in milliseconds (default: 1000)
|
|
23
|
-
*/
|
|
24
|
-
notFoundIntervalMs?: number;
|
|
25
20
|
/**
|
|
26
21
|
* Callback function called on each status check.
|
|
27
22
|
* Useful for logging or updating UI.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intents.types.d.ts","sourceRoot":"","sources":["../../../src/services/intents/intents.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAG5E,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC,mBAAmB,CAAC,CAAA;AAE1E,yEAAyE;AACzE,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,EAAkD,CAAA;AAEnG,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,EAAE,iBAAiB,EAAsC,CAAA;AAEtF;;GAEG;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.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "An SDK to interact with the Ripple Custody API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ripple Custody",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"generate:custody-types": "npx openapi-typescript ./openapi/Ripple-Custody-v1-OpenAPI.json -o ./src/models/custody-types.ts && prettier --write ./src/models/custody-types.ts",
|
|
41
41
|
"local-release": "changeset version && changeset publish",
|
|
42
42
|
"prepare": "npm run build",
|
|
43
|
+
"release": "changeset publish",
|
|
43
44
|
"prepublishOnly": "npm run build && npm run check-format && npm run test",
|
|
44
45
|
"sort-package": "npx sort-package-json",
|
|
45
46
|
"start": "npm run build && node dist/main.js",
|
package/dist/main.d.ts
DELETED
package/dist/main.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":""}
|
package/dist/main.helpers.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.helpers.d.ts","sourceRoot":"","sources":["../src/main.helpers.ts"],"names":[],"mappings":""}
|
package/dist/main.helpers.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// // import dayjs from "dayjs"
|
|
2
|
-
// import { v4 as uuidv4 } from "uuid"
|
|
3
|
-
// import type { Core_ProposeIntentBody } from "./services/index.js"
|
|
4
|
-
export {};
|
|
5
|
-
// const DOMAIN_ID = "5cd224fe-193e-8bce-c94c-c6c05245e2d1"
|
|
6
|
-
// const ACCOUNT_ID = "a2e100cb-ac0a-4a31-a21f-9e8f803d042c"
|
|
7
|
-
// const CURRENT_USER_ID = "6ac20654-450e-29e4-65e2-1bdecb7db7c4"
|
|
8
|
-
// // const MPT_ID = "00CA8BD6F2582AF39B51725D510C5401ED4495ECFB250591"
|
|
9
|
-
// // Created similar to QA MPT Custody
|
|
10
|
-
// // const MPT_ID = "00CAA9847996B6996CC201292DA40D301CC42E30D25D203D"
|
|
11
|
-
// const MPT_ID = "00CAA9867996B6996CC201292DA40D301CC42E30D25D203D"
|
|
12
|
-
// export const mptPaymentRequest: Core_ProposeIntentBody = {
|
|
13
|
-
// request: {
|
|
14
|
-
// author: {
|
|
15
|
-
// id: CURRENT_USER_ID,
|
|
16
|
-
// domainId: DOMAIN_ID,
|
|
17
|
-
// },
|
|
18
|
-
// expiryAt: "", // dayjs().add(1, "day").toISOString(),
|
|
19
|
-
// targetDomainId: DOMAIN_ID,
|
|
20
|
-
// id: uuidv4(),
|
|
21
|
-
// payload: {
|
|
22
|
-
// id: uuidv4(),
|
|
23
|
-
// ledgerId: "xrpl-testnet-august-2024",
|
|
24
|
-
// accountId: ACCOUNT_ID,
|
|
25
|
-
// parameters: {
|
|
26
|
-
// type: "XRPL",
|
|
27
|
-
// feeStrategy: {
|
|
28
|
-
// priority: "Medium",
|
|
29
|
-
// type: "Priority",
|
|
30
|
-
// },
|
|
31
|
-
// maximumFee: "10000000",
|
|
32
|
-
// memos: [],
|
|
33
|
-
// operation: {
|
|
34
|
-
// destination: {
|
|
35
|
-
// address: "rf4CHK31ruoevVC7RNVWqXAuE1yhzVjq6H",
|
|
36
|
-
// type: "Address",
|
|
37
|
-
// },
|
|
38
|
-
// amount: "100",
|
|
39
|
-
// currency: {
|
|
40
|
-
// issuanceId: MPT_ID,
|
|
41
|
-
// type: "MultiPurposeToken",
|
|
42
|
-
// },
|
|
43
|
-
// type: "Payment",
|
|
44
|
-
// },
|
|
45
|
-
// },
|
|
46
|
-
// description: "MPT Payment",
|
|
47
|
-
// customProperties: {
|
|
48
|
-
// property1: "flo",
|
|
49
|
-
// },
|
|
50
|
-
// type: "v0_CreateTransactionOrder",
|
|
51
|
-
// },
|
|
52
|
-
// description: "MPT Payment Flo",
|
|
53
|
-
// customProperties: {
|
|
54
|
-
// property1: "flo",
|
|
55
|
-
// },
|
|
56
|
-
// type: "Propose",
|
|
57
|
-
// },
|
|
58
|
-
// }
|
|
59
|
-
// export const mptAuthorizeRequest: Core_ProposeIntentBody = {
|
|
60
|
-
// request: {
|
|
61
|
-
// author: {
|
|
62
|
-
// id: CURRENT_USER_ID,
|
|
63
|
-
// domainId: DOMAIN_ID,
|
|
64
|
-
// },
|
|
65
|
-
// expiryAt: "", //dayjs().add(1, "day").toISOString(),
|
|
66
|
-
// targetDomainId: DOMAIN_ID,
|
|
67
|
-
// id: uuidv4(),
|
|
68
|
-
// payload: {
|
|
69
|
-
// id: uuidv4(),
|
|
70
|
-
// ledgerId: "xrpl-testnet-august-2024",
|
|
71
|
-
// accountId: ACCOUNT_ID,
|
|
72
|
-
// parameters: {
|
|
73
|
-
// type: "XRPL",
|
|
74
|
-
// feeStrategy: {
|
|
75
|
-
// priority: "Medium",
|
|
76
|
-
// type: "Priority",
|
|
77
|
-
// },
|
|
78
|
-
// maximumFee: "10000000",
|
|
79
|
-
// memos: [],
|
|
80
|
-
// operation: {
|
|
81
|
-
// issuanceId: MPT_ID,
|
|
82
|
-
// flags: [],
|
|
83
|
-
// type: "MPTokenAuthorize",
|
|
84
|
-
// },
|
|
85
|
-
// },
|
|
86
|
-
// description: "Test MPT Authorize",
|
|
87
|
-
// customProperties: {
|
|
88
|
-
// property1: "flo",
|
|
89
|
-
// },
|
|
90
|
-
// type: "v0_CreateTransactionOrder",
|
|
91
|
-
// },
|
|
92
|
-
// description: "Transfer order creation intent",
|
|
93
|
-
// customProperties: {
|
|
94
|
-
// property1: "flo",
|
|
95
|
-
// },
|
|
96
|
-
// type: "Propose",
|
|
97
|
-
// },
|
|
98
|
-
// }
|
|
99
|
-
//# sourceMappingURL=main.helpers.js.map
|
package/dist/main.helpers.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.helpers.js","sourceRoot":"","sources":["../src/main.helpers.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,sCAAsC;AACtC,oEAAoE;;AAEpE,2DAA2D;AAC3D,4DAA4D;AAC5D,iEAAi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1B,SAAS;AACT,uBAAuB;AACvB,OAAO;AACP,IAAI"}
|
package/dist/main.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import dotenv from "dotenv";
|
|
2
|
-
import { RippleCustody } from "./index.js";
|
|
3
|
-
// # Komainu Instance
|
|
4
|
-
// const API_URL = "https://api.corrstri.kfgldp.m3t4c0.services"
|
|
5
|
-
// const AUTH_URL = "https://auth.corrstri.kfgldp.m3t4c0.services/token"
|
|
6
|
-
// const API_URL = "https://api.metaco.8rey67.m3t4c0.services"
|
|
7
|
-
// const AUTH_URL = "https://auth.metaco.8rey67.m3t4c0.services/token"
|
|
8
|
-
const API_URL = "https://api-harmonize-devbox-xrpl-batch-3am8g5.m3t4c0.cloud";
|
|
9
|
-
const AUTH_URL = "https://auth-harmonize-devbox-xrpl-batch-3am8g5.m3t4c0.cloud/token";
|
|
10
|
-
dotenv.config();
|
|
11
|
-
const main = async () => {
|
|
12
|
-
// const URL = "https://api.metaco.8rey67.m3t4c0.services"
|
|
13
|
-
try {
|
|
14
|
-
const rippleCustody = new RippleCustody({
|
|
15
|
-
authUrl: AUTH_URL,
|
|
16
|
-
apiUrl: API_URL,
|
|
17
|
-
privateKey: process.env.PRIVATE_KEY ?? "",
|
|
18
|
-
publicKey: process.env.PUBLIC_KEY ?? "",
|
|
19
|
-
});
|
|
20
|
-
const DOMAIN = "5cd224fe-193e-8bce-c94c-c6c05245e2d1";
|
|
21
|
-
const domains = await rippleCustody.accounts.findByAddress("r", {
|
|
22
|
-
ledgerId: "xrpl-testnet-august-2024",
|
|
23
|
-
});
|
|
24
|
-
// await rippleCustody.xrpl.batch({
|
|
25
|
-
// Account: "",
|
|
26
|
-
// innerTransactions: [
|
|
27
|
-
// {
|
|
28
|
-
// account:
|
|
29
|
-
// }
|
|
30
|
-
// ]
|
|
31
|
-
// })
|
|
32
|
-
console.dir(domains, { depth: null });
|
|
33
|
-
// console.log(mpt)
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
console.log(error);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
main();
|
|
41
|
-
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C,qBAAqB;AACrB,gEAAgE;AAChE,wEAAwE;AAExE,8DAA8D;AAC9D,sEAAsE;AAEtE,MAAM,OAAO,GAAG,6DAA6D,CAAA;AAC7E,MAAM,QAAQ,GAAG,oEAAoE,CAAA;AAErF,MAAM,CAAC,MAAM,EAAE,CAAA;AAEf,MAAM,IAAI,GAAG,KAAK,IAAI,EAAE;IACtB,0DAA0D;IAC1D,IAAI,CAAC;QACH,MAAM,aAAa,GAAG,IAAI,aAAa,CAAC;YACtC,OAAO,EAAE,QAAQ;YACjB,MAAM,EAAE,OAAO;YACf,UAAU,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,EAAE;YACzC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE;SACxC,CAAC,CAAA;QAEF,MAAM,MAAM,GAAG,sCAAsC,CAAA;QAErD,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,EAAE;YAC9D,QAAQ,EAAE,0BAA0B;SACrC,CAAC,CAAA;QAEF,mCAAmC;QACnC,iBAAiB;QACjB,yBAAyB;QACzB,QAAQ;QACR,iBAAiB;QACjB,QAAQ;QACR,MAAM;QACN,KAAK;QAEL,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QAErC,mBAAmB;IACrB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,aAAa;Q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