@sidhujag/sysweb3-keyring 1.0.627 → 2.0.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/CHANGELOG.md +42 -0
- package/README.md +66 -0
- package/cjs/hardware-wallet-manager.js +302 -128
- package/cjs/hardware-wallet-manager.js.map +1 -1
- package/cjs/keyring-core.js +2605 -0
- package/cjs/keyring-core.js.map +1 -0
- package/cjs/keyring-manager.js +31 -2439
- package/cjs/keyring-manager.js.map +1 -1
- package/cjs/ledger/bitcoin_client/lib/appClient.js.map +1 -1
- package/cjs/ledger/host-types.js +10 -0
- package/cjs/ledger/host-types.js.map +1 -0
- package/cjs/ledger/index.js +243 -447
- package/cjs/ledger/index.js.map +1 -1
- package/cjs/ledger/prepare-psbt.js +177 -0
- package/cjs/ledger/prepare-psbt.js.map +1 -0
- package/cjs/software-hd-account.js +23 -0
- package/cjs/software-hd-account.js.map +1 -0
- package/cjs/software.js +74 -0
- package/cjs/software.js.map +1 -0
- package/cjs/storage-core.js +227 -0
- package/cjs/storage-core.js.map +1 -0
- package/cjs/storage.js +15 -210
- package/cjs/storage.js.map +1 -1
- package/cjs/transactions/ethereum.js +176 -39
- package/cjs/transactions/ethereum.js.map +1 -1
- package/cjs/transactions/evm-local-signer.js +11 -1
- package/cjs/transactions/evm-local-signer.js.map +1 -1
- package/cjs/transactions/hardware-psbt.js +159 -0
- package/cjs/transactions/hardware-psbt.js.map +1 -0
- package/cjs/transactions/prepared-evm.js +196 -0
- package/cjs/transactions/prepared-evm.js.map +1 -0
- package/cjs/transactions/syscoin-core.js +651 -0
- package/cjs/transactions/syscoin-core.js.map +1 -0
- package/cjs/transactions/syscoin.js +8 -768
- package/cjs/transactions/syscoin.js.map +1 -1
- package/cjs/trezor/connect.js +243 -0
- package/cjs/trezor/connect.js.map +1 -0
- package/cjs/trezor/index.js +96 -58
- package/cjs/trezor/index.js.map +1 -1
- package/cjs/trezor/witness.js +25 -0
- package/cjs/trezor/witness.js.map +1 -0
- package/cjs/types.js.map +1 -1
- package/cjs/utils/psbt-account-scope.js +5 -3
- package/cjs/utils/psbt-account-scope.js.map +1 -1
- package/esm/errorUtils.js +72 -0
- package/esm/errorUtils.js.map +1 -0
- package/esm/ethers-v6.js +207 -0
- package/esm/ethers-v6.js.map +1 -0
- package/esm/hardware-wallet-manager.js +643 -0
- package/esm/hardware-wallet-manager.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/appClient.js +279 -0
- package/esm/ledger/bitcoin_client/lib/appClient.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/bip32.js +49 -0
- package/esm/ledger/bitcoin_client/lib/bip32.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/buffertools.js +119 -0
- package/esm/ledger/bitcoin_client/lib/buffertools.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/clientCommands.js +269 -0
- package/esm/ledger/bitcoin_client/lib/clientCommands.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkelizedPsbt.js +50 -0
- package/esm/ledger/bitcoin_client/lib/merkelizedPsbt.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkle.js +111 -0
- package/esm/ledger/bitcoin_client/lib/merkle.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/merkleMap.js +42 -0
- package/esm/ledger/bitcoin_client/lib/merkleMap.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/policy.js +68 -0
- package/esm/ledger/bitcoin_client/lib/policy.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/psbtv2.js +645 -0
- package/esm/ledger/bitcoin_client/lib/psbtv2.js.map +1 -0
- package/esm/ledger/bitcoin_client/lib/varint.js +108 -0
- package/esm/ledger/bitcoin_client/lib/varint.js.map +1 -0
- package/esm/ledger/consts.js +4 -0
- package/esm/ledger/consts.js.map +1 -0
- package/esm/ledger/dmk-evm.js +258 -0
- package/esm/ledger/dmk-evm.js.map +1 -0
- package/esm/ledger/dmk-session.js +264 -0
- package/esm/ledger/dmk-session.js.map +1 -0
- package/esm/ledger/dmk-utxo.js +279 -0
- package/esm/ledger/dmk-utxo.js.map +1 -0
- package/esm/ledger/host-types.js +5 -0
- package/esm/ledger/host-types.js.map +1 -0
- package/esm/ledger/index.js +268 -0
- package/esm/ledger/index.js.map +1 -0
- package/esm/ledger/prepare-psbt.js +141 -0
- package/esm/ledger/prepare-psbt.js.map +1 -0
- package/esm/ledger/types.js +2 -0
- package/esm/ledger/types.js.map +1 -0
- package/esm/ledger-host.js +36 -0
- package/esm/ledger-host.js.map +1 -0
- package/esm/private-records.js +153 -0
- package/esm/private-records.js.map +1 -0
- package/esm/providers.js +588 -0
- package/esm/providers.js.map +1 -0
- package/esm/signers.js +28 -0
- package/esm/signers.js.map +1 -0
- package/esm/trezor/connect.js +206 -0
- package/esm/trezor/connect.js.map +1 -0
- package/esm/trezor/index.js +876 -0
- package/esm/trezor/index.js.map +1 -0
- package/esm/trezor/witness.js +21 -0
- package/esm/trezor/witness.js.map +1 -0
- package/esm/types.js +17 -0
- package/esm/types.js.map +1 -0
- package/esm/utils/derivation-paths.js +109 -0
- package/esm/utils/derivation-paths.js.map +1 -0
- package/esm/utils/psbt-account-scope.js +310 -0
- package/esm/utils/psbt-account-scope.js.map +1 -0
- package/package.json +55 -8
- package/types/hardware-wallet-manager.d.ts +12 -19
- package/types/keyring-core.d.ts +263 -0
- package/types/keyring-manager.d.ts +7 -224
- package/types/ledger/bitcoin_client/lib/appClient.d.ts +6 -3
- package/types/ledger/dmk-evm.d.ts +8 -0
- package/types/ledger/dmk-session.d.ts +60 -0
- package/types/ledger/dmk-utxo.d.ts +26 -0
- package/types/ledger/host-types.d.ts +131 -0
- package/types/ledger/index.d.ts +21 -58
- package/types/ledger/prepare-psbt.d.ts +3 -0
- package/types/ledger/types.d.ts +3 -0
- package/types/ledger-host.d.ts +7 -0
- package/types/software-hd-account.d.ts +16 -0
- package/types/software.d.ts +39 -0
- package/types/storage-core.d.ts +22 -0
- package/types/storage.d.ts +1 -4
- package/types/transactions/ethereum.d.ts +17 -7
- package/types/transactions/evm-local-signer.d.ts +3 -1
- package/types/transactions/hardware-psbt.d.ts +7 -0
- package/types/transactions/prepared-evm.d.ts +53 -0
- package/types/transactions/syscoin-core.d.ts +92 -0
- package/types/transactions/syscoin.d.ts +8 -67
- package/types/trezor/connect.d.ts +42 -0
- package/types/trezor/index.d.ts +22 -4
- package/types/trezor/witness.d.ts +3 -0
- package/types/types.d.ts +10 -0
- package/types/utils/psbt-account-scope.d.ts +1 -0
- package/cjs/transactions/__tests__/integration.test.js +0 -237
- package/cjs/transactions/__tests__/integration.test.js.map +0 -1
- package/cjs/transactions/__tests__/syscoin.test.js +0 -361
- package/cjs/transactions/__tests__/syscoin.test.js.map +0 -1
- package/types/transactions/__tests__/integration.test.d.ts +0 -1
- package/types/transactions/__tests__/syscoin.test.d.ts +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export function handleStatusCodeError(statusCode, errorMessage) {
|
|
2
|
+
switch (statusCode) {
|
|
3
|
+
case 400:
|
|
4
|
+
console.error({
|
|
5
|
+
errorMessage,
|
|
6
|
+
message: 'Bad Request: The current provider(RPC) could not understand the request due to invalid syntax.',
|
|
7
|
+
});
|
|
8
|
+
break;
|
|
9
|
+
case 401:
|
|
10
|
+
console.error({
|
|
11
|
+
errorMessage,
|
|
12
|
+
message: 'Unauthorized: The request requires user authentication.',
|
|
13
|
+
});
|
|
14
|
+
break;
|
|
15
|
+
case 403:
|
|
16
|
+
console.error({
|
|
17
|
+
errorMessage,
|
|
18
|
+
message: 'Forbidden: You do not have the necessary permissions for the resource.',
|
|
19
|
+
});
|
|
20
|
+
break;
|
|
21
|
+
case 404:
|
|
22
|
+
console.error({
|
|
23
|
+
errorMessage,
|
|
24
|
+
message: 'Not Found: The requested RPC method could not be found.',
|
|
25
|
+
});
|
|
26
|
+
break;
|
|
27
|
+
case 405:
|
|
28
|
+
console.error({
|
|
29
|
+
errorMessage,
|
|
30
|
+
message: 'Method Not Allowed: The request method is known by the current provider but is not supported by the target resource.',
|
|
31
|
+
});
|
|
32
|
+
break;
|
|
33
|
+
case 408:
|
|
34
|
+
console.error({
|
|
35
|
+
errorMessage,
|
|
36
|
+
message: 'Request Timeout: The current provider(RPC) would like to shut down the unused connection.',
|
|
37
|
+
});
|
|
38
|
+
break;
|
|
39
|
+
case 413:
|
|
40
|
+
console.error({
|
|
41
|
+
errorMessage,
|
|
42
|
+
message: 'Payload Too Large: The request entity is larger than limits defined by the server.',
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
case 429:
|
|
46
|
+
console.error({
|
|
47
|
+
errorMessage,
|
|
48
|
+
message: 'The current RPC provider has a low rate-limit. We are applying a cooldown that will affect Pali performance. Modify the RPC URL in the network settings to resolve this issue.',
|
|
49
|
+
});
|
|
50
|
+
throw {
|
|
51
|
+
errorMessage,
|
|
52
|
+
message: 'The current RPC provider has a low rate-limit. We are applying a cooldown that will affect Pali performance. Modify the RPC URL in the network settings to resolve this issue.',
|
|
53
|
+
};
|
|
54
|
+
case 500:
|
|
55
|
+
console.error({
|
|
56
|
+
errorMessage,
|
|
57
|
+
message: 'Internal Server Error: The current provider(RPC) encountered an unexpected condition that prevented it from fulfilling the request.',
|
|
58
|
+
});
|
|
59
|
+
break;
|
|
60
|
+
case 503:
|
|
61
|
+
console.error({
|
|
62
|
+
errorMessage,
|
|
63
|
+
message: 'Service Unavailable: The current provider(RPC) is not ready to handle the request, possibly due to being down for maintenance or overloaded.',
|
|
64
|
+
});
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
throw {
|
|
68
|
+
message: `Unexpected HTTP status code: ${statusCode}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=errorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorUtils.js","sourceRoot":"","sources":["../../src/errorUtils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,qBA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A8I;aACjJ,CAAC,CAAC;YACH,MAAM;QACR;YACE,MAAM;gBACJ,OAAO,EAAE,gCAAgC,UAAU,EAAE;aACtD,CAAC;IACN,CAAC;AACH,CAAC"}
|
package/esm/ethers-v6.js
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { getAddress } from 'ethers/address';
|
|
2
|
+
import { Contract as EthersContract } from 'ethers/contract';
|
|
3
|
+
import { Signature, keccak256 } from 'ethers/crypto';
|
|
4
|
+
import { JsonRpcProvider } from 'ethers/providers';
|
|
5
|
+
import { Transaction } from 'ethers/transaction';
|
|
6
|
+
import { dataSlice, formatEther as formatEtherBase, formatUnits as formatUnitsBase, hexlify, isHexString, parseEther as ethersParseEther, parseUnits as ethersParseUnits, } from 'ethers/utils';
|
|
7
|
+
export { JsonRpcProvider, getAddress, dataSlice, hexlify, isHexString, keccak256, };
|
|
8
|
+
export const Contract = EthersContract;
|
|
9
|
+
const strip0x = (value) => value.startsWith('0x') || value.startsWith('0X') ? value.slice(2) : value;
|
|
10
|
+
const toBigIntValue = (value) => {
|
|
11
|
+
if (value == null)
|
|
12
|
+
return 0n;
|
|
13
|
+
if (value instanceof BigNumberCompat)
|
|
14
|
+
return value.value;
|
|
15
|
+
if (typeof value === 'bigint')
|
|
16
|
+
return value;
|
|
17
|
+
if (typeof value === 'number')
|
|
18
|
+
return BigInt(Math.trunc(value));
|
|
19
|
+
if (typeof value === 'string') {
|
|
20
|
+
if (value === '')
|
|
21
|
+
return 0n;
|
|
22
|
+
return BigInt(value);
|
|
23
|
+
}
|
|
24
|
+
const hex = value._hex ?? value.hex;
|
|
25
|
+
if (hex)
|
|
26
|
+
return BigInt(hex);
|
|
27
|
+
if (value.toString)
|
|
28
|
+
return BigInt(value.toString());
|
|
29
|
+
return 0n;
|
|
30
|
+
};
|
|
31
|
+
export class BigNumberCompat {
|
|
32
|
+
constructor(value) {
|
|
33
|
+
this._isBigNumber = true;
|
|
34
|
+
this.value = toBigIntValue(value);
|
|
35
|
+
}
|
|
36
|
+
static from(value) {
|
|
37
|
+
return new BigNumberCompat(value);
|
|
38
|
+
}
|
|
39
|
+
static isBigNumber(value) {
|
|
40
|
+
return (value instanceof BigNumberCompat || Boolean(value?._isBigNumber));
|
|
41
|
+
}
|
|
42
|
+
get _hex() {
|
|
43
|
+
return this.toHexString();
|
|
44
|
+
}
|
|
45
|
+
get hex() {
|
|
46
|
+
return this.toHexString();
|
|
47
|
+
}
|
|
48
|
+
add(value) {
|
|
49
|
+
return BigNumberCompat.from(this.value + toBigIntValue(value));
|
|
50
|
+
}
|
|
51
|
+
sub(value) {
|
|
52
|
+
return BigNumberCompat.from(this.value - toBigIntValue(value));
|
|
53
|
+
}
|
|
54
|
+
mul(value) {
|
|
55
|
+
return BigNumberCompat.from(this.value * toBigIntValue(value));
|
|
56
|
+
}
|
|
57
|
+
div(value) {
|
|
58
|
+
return BigNumberCompat.from(this.value / toBigIntValue(value));
|
|
59
|
+
}
|
|
60
|
+
eq(value) {
|
|
61
|
+
return this.value === toBigIntValue(value);
|
|
62
|
+
}
|
|
63
|
+
lt(value) {
|
|
64
|
+
return this.value < toBigIntValue(value);
|
|
65
|
+
}
|
|
66
|
+
gt(value) {
|
|
67
|
+
return this.value > toBigIntValue(value);
|
|
68
|
+
}
|
|
69
|
+
isZero() {
|
|
70
|
+
return this.value === 0n;
|
|
71
|
+
}
|
|
72
|
+
isNegative() {
|
|
73
|
+
return this.value < 0n;
|
|
74
|
+
}
|
|
75
|
+
toBigInt() {
|
|
76
|
+
return this.value;
|
|
77
|
+
}
|
|
78
|
+
toNumber() {
|
|
79
|
+
return Number(this.value);
|
|
80
|
+
}
|
|
81
|
+
toHexString() {
|
|
82
|
+
const sign = this.value < 0n ? '-' : '';
|
|
83
|
+
const abs = this.value < 0n ? -this.value : this.value;
|
|
84
|
+
const hex = abs.toString(16);
|
|
85
|
+
return `${sign}0x${hex.length % 2 ? `0${hex}` : hex}`;
|
|
86
|
+
}
|
|
87
|
+
toString() {
|
|
88
|
+
return this.value.toString();
|
|
89
|
+
}
|
|
90
|
+
toJSON() {
|
|
91
|
+
return {
|
|
92
|
+
type: 'BigNumber',
|
|
93
|
+
hex: this.toHexString(),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export { BigNumberCompat as BigNumber };
|
|
98
|
+
export const Zero = BigNumberCompat.from(0);
|
|
99
|
+
export const parseUnits = (value, unit) => BigNumberCompat.from(ethersParseUnits(value, unit));
|
|
100
|
+
export const parseEther = (value) => BigNumberCompat.from(ethersParseEther(value));
|
|
101
|
+
export const formatUnits = (value, unit) => formatUnitsBase(toBigIntValue(value), unit);
|
|
102
|
+
export const formatEther = (value) => formatEtherBase(toBigIntValue(value));
|
|
103
|
+
export const resolveProperties = async (value) => {
|
|
104
|
+
const entries = await Promise.all(Object.entries(value).map(async ([key, entry]) => [key, await entry]));
|
|
105
|
+
return Object.fromEntries(entries);
|
|
106
|
+
};
|
|
107
|
+
export const shallowCopy = (value) => ({
|
|
108
|
+
...value,
|
|
109
|
+
});
|
|
110
|
+
export const toQuantityHex = (value) => BigNumberCompat.from(value).toHexString();
|
|
111
|
+
export const normalizeTxValue = (value) => {
|
|
112
|
+
if (value == null)
|
|
113
|
+
return value;
|
|
114
|
+
if (value instanceof BigNumberCompat)
|
|
115
|
+
return value.toBigInt();
|
|
116
|
+
if (typeof value === 'bigint')
|
|
117
|
+
return value;
|
|
118
|
+
if (typeof value === 'number') {
|
|
119
|
+
if (!Number.isSafeInteger(value)) {
|
|
120
|
+
throw new Error('unsafe numeric transaction value');
|
|
121
|
+
}
|
|
122
|
+
return BigInt(value);
|
|
123
|
+
}
|
|
124
|
+
if (typeof value === 'string') {
|
|
125
|
+
if (value === '')
|
|
126
|
+
return 0n;
|
|
127
|
+
return value.startsWith('0x') || value.startsWith('0X')
|
|
128
|
+
? BigInt(value)
|
|
129
|
+
: BigInt(value);
|
|
130
|
+
}
|
|
131
|
+
const hex = value._hex ?? value.hex;
|
|
132
|
+
if (hex)
|
|
133
|
+
return BigInt(hex);
|
|
134
|
+
return value;
|
|
135
|
+
};
|
|
136
|
+
export const normalizeTransactionRequest = (tx) => {
|
|
137
|
+
const normalized = { ...tx };
|
|
138
|
+
if (normalized.type != null) {
|
|
139
|
+
normalized.type = Number(normalizeTxValue(normalized.type));
|
|
140
|
+
}
|
|
141
|
+
for (const field of [
|
|
142
|
+
'chainId',
|
|
143
|
+
'gasLimit',
|
|
144
|
+
'gasPrice',
|
|
145
|
+
'maxFeePerGas',
|
|
146
|
+
'maxPriorityFeePerGas',
|
|
147
|
+
'nonce',
|
|
148
|
+
'value',
|
|
149
|
+
]) {
|
|
150
|
+
if (normalized[field] != null)
|
|
151
|
+
normalized[field] = normalizeTxValue(normalized[field]);
|
|
152
|
+
}
|
|
153
|
+
return normalized;
|
|
154
|
+
};
|
|
155
|
+
export const serializeTransaction = (tx, signature) => {
|
|
156
|
+
if (tx.type === 0 && tx.accessList != null) {
|
|
157
|
+
throw new Error('legacy transactions do not support accessList');
|
|
158
|
+
}
|
|
159
|
+
const txForSerialization = { ...tx };
|
|
160
|
+
if (txForSerialization.type == null &&
|
|
161
|
+
txForSerialization.accessList != null &&
|
|
162
|
+
txForSerialization.maxFeePerGas == null &&
|
|
163
|
+
txForSerialization.maxPriorityFeePerGas == null) {
|
|
164
|
+
txForSerialization.type = 1;
|
|
165
|
+
}
|
|
166
|
+
if (txForSerialization.type === 2 &&
|
|
167
|
+
txForSerialization.gasPrice != null &&
|
|
168
|
+
txForSerialization.maxFeePerGas != null) {
|
|
169
|
+
const gasPrice = normalizeTxValue(txForSerialization.gasPrice);
|
|
170
|
+
const maxFeePerGas = normalizeTxValue(txForSerialization.maxFeePerGas);
|
|
171
|
+
if (gasPrice !== maxFeePerGas) {
|
|
172
|
+
throw new Error('mismatch EIP-1559 gasPrice != maxFeePerGas');
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
const transaction = Transaction.from(normalizeTransactionRequest(txForSerialization));
|
|
176
|
+
if (!signature)
|
|
177
|
+
return transaction.unsignedSerialized;
|
|
178
|
+
transaction.signature = Signature.from(signature.v != null
|
|
179
|
+
? {
|
|
180
|
+
r: signature.r,
|
|
181
|
+
s: signature.s,
|
|
182
|
+
v: signature.v,
|
|
183
|
+
}
|
|
184
|
+
: {
|
|
185
|
+
r: signature.r,
|
|
186
|
+
s: signature.s,
|
|
187
|
+
yParity: (signature.recoveryParam ?? 0),
|
|
188
|
+
});
|
|
189
|
+
return transaction.serialized;
|
|
190
|
+
};
|
|
191
|
+
export const arrayify = (value) => Buffer.from(strip0x(hexlify(value)), 'hex');
|
|
192
|
+
export const hexZeroPad = (value, length) => {
|
|
193
|
+
const hex = strip0x(hexlify(value));
|
|
194
|
+
return `0x${hex.padStart(length * 2, '0')}`;
|
|
195
|
+
};
|
|
196
|
+
export const joinSignature = (signature) => Signature.from(signature.v != null
|
|
197
|
+
? {
|
|
198
|
+
r: signature.r,
|
|
199
|
+
s: signature.s,
|
|
200
|
+
v: signature.v,
|
|
201
|
+
}
|
|
202
|
+
: {
|
|
203
|
+
r: signature.r,
|
|
204
|
+
s: signature.s,
|
|
205
|
+
yParity: (signature.recoveryParam ?? 0),
|
|
206
|
+
}).serialized;
|
|
207
|
+
//# sourceMappingURL=ethers-v6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ethers-v6.js","sourceRoot":"","sources":["../../src/ethers-v6.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,eAAe,EAAmB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,WAAW,IAAI,eAAe,EAC9B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