@secondlayer/stacks 2.5.1 → 2.6.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/shared/stacks-1wra341e.cjs +146 -0
- package/dist/shared/stacks-1wra341e.cjs.map +15 -0
- package/dist/shared/{stacks-jevhg39n.cjs → stacks-7nf5h3qe.cjs} +16 -12
- package/dist/shared/{stacks-jevhg39n.cjs.map → stacks-7nf5h3qe.cjs.map} +4 -4
- package/dist/shared/{stacks-yq5a5cda.js → stacks-a9cn5ehj.js} +12 -10
- package/dist/shared/{stacks-yq5a5cda.js.map → stacks-a9cn5ehj.js.map} +3 -3
- package/dist/shared/{stacks-7wfdkhj6.cjs → stacks-e7pmsrbs.cjs} +9 -7
- package/dist/shared/{stacks-7wfdkhj6.cjs.map → stacks-e7pmsrbs.cjs.map} +3 -3
- package/dist/shared/{stacks-4z1jhw6y.js → stacks-ffsv2t3t.js} +6 -6
- package/dist/shared/{stacks-4z1jhw6y.js.map → stacks-ffsv2t3t.js.map} +3 -3
- package/dist/shared/{stacks-y8e3gx6w.js → stacks-gxhznn3h.js} +73 -3
- package/dist/shared/stacks-gxhznn3h.js.map +15 -0
- package/dist/shared/{stacks-hyz7zgdk.js → stacks-hr5rg2et.js} +2 -2
- package/dist/shared/{stacks-7wqprfrm.cjs → stacks-hxm7r5ay.cjs} +3 -3
- package/dist/shared/{stacks-7wqprfrm.cjs.map → stacks-hxm7r5ay.cjs.map} +3 -3
- package/dist/shared/{stacks-5th5dffx.js → stacks-yb8xesdm.js} +20 -16
- package/dist/shared/{stacks-5th5dffx.js.map → stacks-yb8xesdm.js.map} +4 -4
- package/dist/src/actions/index.d.cts +133 -120
- package/dist/src/actions/index.d.ts +133 -120
- package/dist/src/actions/index.js +5 -5
- package/dist/src/bns/index.d.cts +13 -0
- package/dist/src/bns/index.d.ts +13 -0
- package/dist/src/bns/index.js +3 -3
- package/dist/src/index.cjs +79 -5
- package/dist/src/index.cjs.map +6 -5
- package/dist/src/index.d.cts +228 -101
- package/dist/src/index.d.ts +228 -101
- package/dist/src/index.js +89 -9
- package/dist/src/index.js.map +6 -5
- package/dist/src/pox/index.d.cts +13 -0
- package/dist/src/pox/index.d.ts +13 -0
- package/dist/src/pox/index.js +3 -3
- package/dist/src/sbtc/index.d.cts +13 -0
- package/dist/src/sbtc/index.d.ts +13 -0
- package/dist/src/sbtc/index.js +3 -3
- package/dist/src/stackingdao/index.d.cts +13 -0
- package/dist/src/stackingdao/index.d.ts +13 -0
- package/dist/src/stackingdao/index.js +3 -3
- package/dist/src/subscriptions/index.d.cts +13 -0
- package/dist/src/subscriptions/index.d.ts +13 -0
- package/dist/src/tools/btc/index.cjs.map +2 -2
- package/dist/src/tools/btc/index.js.map +2 -2
- package/dist/src/tools/index.cjs +44 -14
- package/dist/src/tools/index.cjs.map +8 -7
- package/dist/src/tools/index.d.cts +13 -0
- package/dist/src/tools/index.d.ts +13 -0
- package/dist/src/tools/index.js +44 -14
- package/dist/src/tools/index.js.map +8 -7
- package/dist/src/x402/index.d.cts +13 -0
- package/dist/src/x402/index.d.ts +13 -0
- package/dist/src/x402/index.js +2 -2
- package/package.json +1 -1
- package/dist/shared/stacks-qk8pdyjy.cjs +0 -76
- package/dist/shared/stacks-qk8pdyjy.cjs.map +0 -14
- package/dist/shared/stacks-y8e3gx6w.js.map +0 -14
- /package/dist/shared/{stacks-hyz7zgdk.js.map → stacks-hr5rg2et.js.map} +0 -0
|
@@ -362,6 +362,17 @@ type ProviderAccount = {
|
|
|
362
362
|
publicKey: string
|
|
363
363
|
provider: StacksProvider
|
|
364
364
|
};
|
|
365
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
366
|
+
type NonceManager = {
|
|
367
|
+
consume(params: {
|
|
368
|
+
client: Client
|
|
369
|
+
address: string
|
|
370
|
+
}): Promise<bigint>
|
|
371
|
+
reset(params: {
|
|
372
|
+
client: Client
|
|
373
|
+
address: string
|
|
374
|
+
}): void | Promise<void>
|
|
375
|
+
};
|
|
365
376
|
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
366
377
|
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
367
378
|
/** Options for a transport-level HTTP request. */
|
|
@@ -397,6 +408,8 @@ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>>
|
|
|
397
408
|
account?: Account
|
|
398
409
|
transport: Transport
|
|
399
410
|
request: RequestFn
|
|
411
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
412
|
+
nonceManager?: NonceManager
|
|
400
413
|
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
401
414
|
} & TExtended;
|
|
402
415
|
type SponsorAndBroadcastOptions = {
|
package/dist/src/x402/index.d.ts
CHANGED
|
@@ -362,6 +362,17 @@ type ProviderAccount = {
|
|
|
362
362
|
publicKey: string
|
|
363
363
|
provider: StacksProvider
|
|
364
364
|
};
|
|
365
|
+
/** Allocates mempool-safe sequential nonces across rapid broadcasts from one account. */
|
|
366
|
+
type NonceManager = {
|
|
367
|
+
consume(params: {
|
|
368
|
+
client: Client
|
|
369
|
+
address: string
|
|
370
|
+
}): Promise<bigint>
|
|
371
|
+
reset(params: {
|
|
372
|
+
client: Client
|
|
373
|
+
address: string
|
|
374
|
+
}): void | Promise<void>
|
|
375
|
+
};
|
|
365
376
|
/** Function that sends an HTTP request to a Stacks node API path. */
|
|
366
377
|
type RequestFn = (path: string, options?: RequestOptions) => Promise<any>;
|
|
367
378
|
/** Options for a transport-level HTTP request. */
|
|
@@ -397,6 +408,8 @@ type Client<TExtended extends Record<string, unknown> = Record<string, unknown>>
|
|
|
397
408
|
account?: Account
|
|
398
409
|
transport: Transport
|
|
399
410
|
request: RequestFn
|
|
411
|
+
/** Optional nonce manager for mempool-safe sequential nonces across rapid broadcasts. */
|
|
412
|
+
nonceManager?: NonceManager
|
|
400
413
|
extend: <const TNew extends Record<string, unknown>>(fn: (client: Client<TExtended>) => TNew) => Client<TExtended & TNew> & TNew
|
|
401
414
|
} & TExtended;
|
|
402
415
|
type SponsorAndBroadcastOptions = {
|
package/dist/src/x402/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sponsorTransaction
|
|
3
|
-
} from "../../shared/stacks-
|
|
3
|
+
} from "../../shared/stacks-ffsv2t3t.js";
|
|
4
4
|
import {
|
|
5
5
|
sendTransaction
|
|
6
|
-
} from "../../shared/stacks-
|
|
6
|
+
} from "../../shared/stacks-gxhznn3h.js";
|
|
7
7
|
import"../../shared/stacks-709tra19.js";
|
|
8
8
|
import {
|
|
9
9
|
Pc
|
package/package.json
CHANGED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
// src/actions/public/estimateFee.ts
|
|
2
|
-
async function estimateFee(client, params) {
|
|
3
|
-
const payloadHex = bytesToHex(serializePayload(params.transaction.payload));
|
|
4
|
-
const txHex = bytesToHex(serializeTransaction(params.transaction));
|
|
5
|
-
const data = await client.request("/v2/fees/transaction", {
|
|
6
|
-
method: "POST",
|
|
7
|
-
body: {
|
|
8
|
-
estimated_len: Math.ceil(txHex.length / 2),
|
|
9
|
-
transaction_payload: `0x${payloadHex}`
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
return (data.estimations ?? []).map((e) => ({
|
|
13
|
-
feeRate: e.fee_rate,
|
|
14
|
-
fee: e.fee
|
|
15
|
-
}));
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// src/actions/public/getNonce.ts
|
|
19
|
-
async function getNonce(client, params) {
|
|
20
|
-
const data = await client.request(`/v2/accounts/${params.address}`, {
|
|
21
|
-
method: "GET"
|
|
22
|
-
});
|
|
23
|
-
return BigInt(data.nonce);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// src/errors/transaction.ts
|
|
27
|
-
class TransactionError extends BaseError {
|
|
28
|
-
name = "TransactionError";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
class BroadcastError extends BaseError {
|
|
32
|
-
name = "BroadcastError";
|
|
33
|
-
txid;
|
|
34
|
-
reason;
|
|
35
|
-
constructor(message, options) {
|
|
36
|
-
super(message, options);
|
|
37
|
-
this.txid = options?.txid;
|
|
38
|
-
this.reason = options?.reason;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
class SerializationError extends BaseError {
|
|
43
|
-
name = "SerializationError";
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
class SigningError extends BaseError {
|
|
47
|
-
name = "SigningError";
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// src/actions/wallet/sendTransaction.ts
|
|
51
|
-
async function sendTransaction(client, params) {
|
|
52
|
-
const hex = bytesToHex(serializeTransaction(params.transaction));
|
|
53
|
-
const body = { tx: hex };
|
|
54
|
-
if (params.attachment) {
|
|
55
|
-
body.attachment = typeof params.attachment === "string" ? params.attachment : bytesToHex(params.attachment);
|
|
56
|
-
}
|
|
57
|
-
const data = await client.request("/v2/transactions", {
|
|
58
|
-
method: "POST",
|
|
59
|
-
body
|
|
60
|
-
});
|
|
61
|
-
if (data.error) {
|
|
62
|
-
throw new BroadcastError(data.reason ?? data.error, {
|
|
63
|
-
reason: data.reason
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
const txid = typeof data === "string" ? data.replace(/"/g, "") : data.txid ?? getTransactionId(params.transaction);
|
|
67
|
-
return { txid };
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// src/actions/wallet/utils.ts
|
|
71
|
-
function isProviderAccount(account) {
|
|
72
|
-
return account.type === "provider";
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//# debugId=133EC4FD25ABDD7664756E2164756E21
|
|
76
|
-
//# sourceMappingURL=stacks-qk8pdyjy.cjs.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/actions/public/estimateFee.ts", "../src/actions/public/getNonce.ts", "../src/errors/transaction.ts", "../src/actions/wallet/sendTransaction.ts", "../src/actions/wallet/utils.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport {\n\tserializePayload,\n\tserializeTransaction,\n} from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type EstimateFeeParams = {\n\ttransaction: StacksTransaction;\n};\n\nexport type FeeEstimation = {\n\tfeeRate: number;\n\tfee: number;\n};\n\nexport async function estimateFee(\n\tclient: Client,\n\tparams: EstimateFeeParams,\n): Promise<FeeEstimation[]> {\n\tconst payloadHex = bytesToHex(serializePayload(params.transaction.payload));\n\tconst txHex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst data = await client.request(\"/v2/fees/transaction\", {\n\t\tmethod: \"POST\",\n\t\tbody: {\n\t\t\testimated_len: Math.ceil(txHex.length / 2),\n\t\t\ttransaction_payload: `0x${payloadHex}`,\n\t\t},\n\t});\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\treturn (data.estimations ?? []).map((e: any) => ({\n\t\tfeeRate: e.fee_rate,\n\t\tfee: e.fee,\n\t}));\n}\n",
|
|
6
|
-
"import type { Client } from \"../../clients/types.ts\";\n\nexport type GetNonceParams = {\n\taddress: string;\n};\n\nexport type GetNonceResult = {\n\tnonce: bigint;\n\tpossibleNextNonce: bigint;\n};\n\nexport async function getNonce(\n\tclient: Client,\n\tparams: GetNonceParams,\n): Promise<bigint> {\n\tconst data = await client.request(`/v2/accounts/${params.address}`, {\n\t\tmethod: \"GET\",\n\t});\n\treturn BigInt(data.nonce);\n}\n",
|
|
7
|
-
"import { BaseError } from \"./base.ts\";\n\nexport class TransactionError extends BaseError {\n\toverride name = \"TransactionError\";\n}\n\nexport class BroadcastError extends BaseError {\n\toverride name = \"BroadcastError\";\n\ttxid?: string;\n\treason?: string;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions?: { cause?: Error; txid?: string; reason?: string },\n\t) {\n\t\tsuper(message, options);\n\t\tthis.txid = options?.txid;\n\t\tthis.reason = options?.reason;\n\t}\n}\n\nexport class SerializationError extends BaseError {\n\toverride name = \"SerializationError\";\n}\n\nexport class SigningError extends BaseError {\n\toverride name = \"SigningError\";\n}\n",
|
|
8
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport { BroadcastError } from \"../../errors/transaction.ts\";\nimport { getTransactionId } from \"../../transactions/signer.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { serializeTransaction } from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type SendTransactionParams = {\n\ttransaction: StacksTransaction;\n\tattachment?: Uint8Array | string;\n};\n\nexport type SendTransactionResult = {\n\ttxid: string;\n};\n\n/** Broadcast a signed transaction to the network */\nexport async function sendTransaction(\n\tclient: Client,\n\tparams: SendTransactionParams,\n): Promise<SendTransactionResult> {\n\tconst hex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst body: Record<string, string> = { tx: hex };\n\tif (params.attachment) {\n\t\tbody.attachment =\n\t\t\ttypeof params.attachment === \"string\"\n\t\t\t\t? params.attachment\n\t\t\t\t: bytesToHex(params.attachment);\n\t}\n\n\tconst data = await client.request(\"/v2/transactions\", {\n\t\tmethod: \"POST\",\n\t\tbody,\n\t});\n\n\tif (data.error) {\n\t\tthrow new BroadcastError(data.reason ?? data.error, {\n\t\t\treason: data.reason,\n\t\t});\n\t}\n\n\tconst txid =\n\t\ttypeof data === \"string\"\n\t\t\t? data.replace(/\"/g, \"\")\n\t\t\t: (data.txid ?? getTransactionId(params.transaction));\n\n\treturn { txid };\n}\n",
|
|
9
|
-
"import type { ProviderAccount } from \"../../accounts/types.ts\";\nimport type { Account } from \"../../clients/types.ts\";\n\nexport function isProviderAccount(\n\taccount: Account,\n): account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AA+B,EAAE,IAAI,IAAI;AAAA,EAC/C,IAAI,OAAO,YAAY;AAAA,IACtB,KAAK,aACJ,OAAO,OAAO,eAAe,WAC1B,OAAO,aACP,WAAW,OAAO,UAAU;AAAA,EACjC;AAAA,EAEA,MAAM,OAAO,MAAM,OAAO,QAAQ,oBAAoB;AAAA,IACrD,QAAQ;AAAA,IACR;AAAA,EACD,CAAC;AAAA,EAED,IAAI,KAAK,OAAO;AAAA,IACf,MAAM,IAAI,eAAe,KAAK,UAAU,KAAK,OAAO;AAAA,MACnD,QAAQ,KAAK;AAAA,IACd,CAAC;AAAA,EACF;AAAA,EAEA,MAAM,OACL,OAAO,SAAS,WACb,KAAK,QAAQ,MAAM,EAAE,IACpB,KAAK,QAAQ,iBAAiB,OAAO,WAAW;AAAA,EAErD,OAAO,EAAE,KAAK;AAAA;;;AC5CR,SAAS,iBAAiB,CAChC,SAC6B;AAAA,EAC7B,OAAO,QAAQ,SAAS;AAAA;",
|
|
12
|
-
"debugId": "133EC4FD25ABDD7664756E2164756E21",
|
|
13
|
-
"names": []
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/actions/public/estimateFee.ts", "../src/actions/public/getNonce.ts", "../src/errors/transaction.ts", "../src/actions/wallet/sendTransaction.ts", "../src/actions/wallet/utils.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport {\n\tserializePayload,\n\tserializeTransaction,\n} from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type EstimateFeeParams = {\n\ttransaction: StacksTransaction;\n};\n\nexport type FeeEstimation = {\n\tfeeRate: number;\n\tfee: number;\n};\n\nexport async function estimateFee(\n\tclient: Client,\n\tparams: EstimateFeeParams,\n): Promise<FeeEstimation[]> {\n\tconst payloadHex = bytesToHex(serializePayload(params.transaction.payload));\n\tconst txHex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst data = await client.request(\"/v2/fees/transaction\", {\n\t\tmethod: \"POST\",\n\t\tbody: {\n\t\t\testimated_len: Math.ceil(txHex.length / 2),\n\t\t\ttransaction_payload: `0x${payloadHex}`,\n\t\t},\n\t});\n\n\t// biome-ignore lint/suspicious/noExplicitAny: interop boundary or dynamic-shape value where typing adds friction without runtime safety\n\treturn (data.estimations ?? []).map((e: any) => ({\n\t\tfeeRate: e.fee_rate,\n\t\tfee: e.fee,\n\t}));\n}\n",
|
|
6
|
-
"import type { Client } from \"../../clients/types.ts\";\n\nexport type GetNonceParams = {\n\taddress: string;\n};\n\nexport type GetNonceResult = {\n\tnonce: bigint;\n\tpossibleNextNonce: bigint;\n};\n\nexport async function getNonce(\n\tclient: Client,\n\tparams: GetNonceParams,\n): Promise<bigint> {\n\tconst data = await client.request(`/v2/accounts/${params.address}`, {\n\t\tmethod: \"GET\",\n\t});\n\treturn BigInt(data.nonce);\n}\n",
|
|
7
|
-
"import { BaseError } from \"./base.ts\";\n\nexport class TransactionError extends BaseError {\n\toverride name = \"TransactionError\";\n}\n\nexport class BroadcastError extends BaseError {\n\toverride name = \"BroadcastError\";\n\ttxid?: string;\n\treason?: string;\n\n\tconstructor(\n\t\tmessage: string,\n\t\toptions?: { cause?: Error; txid?: string; reason?: string },\n\t) {\n\t\tsuper(message, options);\n\t\tthis.txid = options?.txid;\n\t\tthis.reason = options?.reason;\n\t}\n}\n\nexport class SerializationError extends BaseError {\n\toverride name = \"SerializationError\";\n}\n\nexport class SigningError extends BaseError {\n\toverride name = \"SigningError\";\n}\n",
|
|
8
|
-
"import type { Client } from \"../../clients/types.ts\";\nimport { BroadcastError } from \"../../errors/transaction.ts\";\nimport { getTransactionId } from \"../../transactions/signer.ts\";\nimport type { StacksTransaction } from \"../../transactions/types.ts\";\nimport { serializeTransaction } from \"../../transactions/wire/serialize.ts\";\nimport { bytesToHex } from \"../../utils/encoding.ts\";\n\nexport type SendTransactionParams = {\n\ttransaction: StacksTransaction;\n\tattachment?: Uint8Array | string;\n};\n\nexport type SendTransactionResult = {\n\ttxid: string;\n};\n\n/** Broadcast a signed transaction to the network */\nexport async function sendTransaction(\n\tclient: Client,\n\tparams: SendTransactionParams,\n): Promise<SendTransactionResult> {\n\tconst hex = bytesToHex(serializeTransaction(params.transaction));\n\n\tconst body: Record<string, string> = { tx: hex };\n\tif (params.attachment) {\n\t\tbody.attachment =\n\t\t\ttypeof params.attachment === \"string\"\n\t\t\t\t? params.attachment\n\t\t\t\t: bytesToHex(params.attachment);\n\t}\n\n\tconst data = await client.request(\"/v2/transactions\", {\n\t\tmethod: \"POST\",\n\t\tbody,\n\t});\n\n\tif (data.error) {\n\t\tthrow new BroadcastError(data.reason ?? data.error, {\n\t\t\treason: data.reason,\n\t\t});\n\t}\n\n\tconst txid =\n\t\ttypeof data === \"string\"\n\t\t\t? data.replace(/\"/g, \"\")\n\t\t\t: (data.txid ?? getTransactionId(params.transaction));\n\n\treturn { txid };\n}\n",
|
|
9
|
-
"import type { ProviderAccount } from \"../../accounts/types.ts\";\nimport type { Account } from \"../../clients/types.ts\";\n\nexport function isProviderAccount(\n\taccount: Account,\n): account is ProviderAccount {\n\treturn account.type === \"provider\";\n}\n"
|
|
10
|
-
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;AAiBA,eAAsB,WAAW,CAChC,QACA,QAC2B;AAAA,EAC3B,MAAM,aAAa,WAAW,iBAAiB,OAAO,YAAY,OAAO,CAAC;AAAA,EAC1E,MAAM,QAAQ,WAAW,qBAAqB,OAAO,WAAW,CAAC;AAAA,EAEjE,MAAM,OAAO,MAAM,OAAO,QAAQ,wBAAwB;AAAA,IACzD,QAAQ;AAAA,IACR,MAAM;AAAA,MACL,eAAe,KAAK,KAAK,MAAM,SAAS,CAAC;AAAA,MACzC,qBAAqB,KAAK;AAAA,IAC3B;AAAA,EACD,CAAC;AAAA,EAGD,QAAQ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