@t402/tron 2.3.1 → 2.5.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 (41) hide show
  1. package/README.md +39 -30
  2. package/dist/cjs/exact/client/index.d.ts +2 -2
  3. package/dist/cjs/exact/client/index.js +1 -0
  4. package/dist/cjs/exact/client/index.js.map +1 -1
  5. package/dist/cjs/exact/facilitator/index.d.ts +1 -1
  6. package/dist/cjs/exact/facilitator/index.js +1 -0
  7. package/dist/cjs/exact/facilitator/index.js.map +1 -1
  8. package/dist/cjs/exact/server/index.js +1 -0
  9. package/dist/cjs/exact/server/index.js.map +1 -1
  10. package/dist/cjs/index.d.ts +4 -2
  11. package/dist/cjs/index.js +63 -1
  12. package/dist/cjs/index.js.map +1 -1
  13. package/dist/cjs/{signer-BB-HLs-P.d.ts → signer-iuJaSShT.d.ts} +1 -1
  14. package/dist/cjs/upto/index.d.ts +82 -0
  15. package/dist/cjs/upto/index.js +89 -0
  16. package/dist/cjs/upto/index.js.map +1 -0
  17. package/dist/esm/{chunk-5QY7AVRU.mjs → chunk-64IMOFLN.mjs} +5 -3
  18. package/dist/esm/{chunk-5QY7AVRU.mjs.map → chunk-64IMOFLN.mjs.map} +1 -1
  19. package/dist/esm/{chunk-NP4MIP3N.mjs → chunk-C6ANAART.mjs} +5 -3
  20. package/dist/esm/{chunk-NP4MIP3N.mjs.map → chunk-C6ANAART.mjs.map} +1 -1
  21. package/dist/esm/{chunk-5HUXHQSQ.mjs → chunk-COESQEG6.mjs} +5 -3
  22. package/dist/esm/{chunk-5HUXHQSQ.mjs.map → chunk-COESQEG6.mjs.map} +1 -1
  23. package/dist/esm/{chunk-MTL3FNSQ.mjs → chunk-JZLCALMX.mjs} +3 -7
  24. package/dist/esm/chunk-JZLCALMX.mjs.map +1 -0
  25. package/dist/esm/chunk-NSSMTXJJ.mjs +8 -0
  26. package/dist/esm/chunk-NSSMTXJJ.mjs.map +1 -0
  27. package/dist/esm/chunk-YHPIW52A.mjs +62 -0
  28. package/dist/esm/chunk-YHPIW52A.mjs.map +1 -0
  29. package/dist/esm/exact/client/index.d.mts +2 -2
  30. package/dist/esm/exact/client/index.mjs +3 -2
  31. package/dist/esm/exact/facilitator/index.d.mts +1 -1
  32. package/dist/esm/exact/facilitator/index.mjs +3 -2
  33. package/dist/esm/exact/server/index.mjs +3 -2
  34. package/dist/esm/index.d.mts +4 -2
  35. package/dist/esm/index.mjs +11 -4
  36. package/dist/esm/{signer-BB-HLs-P.d.mts → signer-iuJaSShT.d.mts} +1 -1
  37. package/dist/esm/upto/index.d.mts +82 -0
  38. package/dist/esm/upto/index.mjs +10 -0
  39. package/dist/esm/upto/index.mjs.map +1 -0
  40. package/package.json +22 -12
  41. package/dist/esm/chunk-MTL3FNSQ.mjs.map +0 -1
@@ -0,0 +1,82 @@
1
+ /**
2
+ * TRON Up-To Payment Types
3
+ *
4
+ * Type definitions for TRON TRC-20 upto (approve + transferFrom) payment payloads.
5
+ * The upto scheme allows clients to authorize payments up to a maximum amount,
6
+ * with the actual settlement amount determined at settlement time.
7
+ */
8
+ /**
9
+ * Authorization metadata for a TRON TRC-20 approve transaction.
10
+ *
11
+ * Contains all information needed to verify the approval without
12
+ * parsing the signed transaction.
13
+ */
14
+ type UptoTronAuthorization = {
15
+ /** Token owner address (T-prefix base58check) */
16
+ owner: string;
17
+ /** Approved spender address - facilitator (T-prefix base58check) */
18
+ spender: string;
19
+ /** TRC-20 contract address (T-prefix base58check) */
20
+ contractAddress: string;
21
+ /** Maximum approved amount in smallest units (as string for large numbers) */
22
+ maxAmount: string;
23
+ /** Transaction expiration timestamp (milliseconds since epoch) */
24
+ expiration: number;
25
+ /** Reference block bytes (hex string) */
26
+ refBlockBytes: string;
27
+ /** Reference block hash (hex string) */
28
+ refBlockHash: string;
29
+ /** Transaction timestamp (milliseconds since epoch) */
30
+ timestamp: number;
31
+ };
32
+ /**
33
+ * TRON upto payment payload.
34
+ *
35
+ * Contains the signed approve transaction ready for broadcast
36
+ * along with authorization metadata for verification.
37
+ */
38
+ type UptoTronPayload = {
39
+ /** Hex-encoded signed approve transaction */
40
+ signedTransaction: string;
41
+ /** Approve transaction authorization metadata */
42
+ authorization: UptoTronAuthorization;
43
+ /** Unique nonce for replay protection (hex string) */
44
+ paymentNonce: string;
45
+ };
46
+ /**
47
+ * Extra fields for TRON upto payment requirements.
48
+ *
49
+ * Included in the PaymentRequirements.extra field to communicate
50
+ * upto-specific parameters to the client.
51
+ */
52
+ type UptoTronExtra = {
53
+ /** Maximum payment amount authorized */
54
+ maxAmount?: string;
55
+ /** Minimum acceptable settlement amount */
56
+ minAmount?: string;
57
+ /** Billing unit (e.g., "token", "request", "second") */
58
+ unit?: string;
59
+ /** Price per unit in smallest denomination */
60
+ unitPrice?: string;
61
+ /** Facilitator address that will be approved as spender */
62
+ spenderAddress?: string;
63
+ };
64
+ /**
65
+ * Type guard to check if unknown data is an UptoTronPayload.
66
+ *
67
+ * Validates the presence and types of all required fields including
68
+ * nested authorization fields.
69
+ *
70
+ * @param data - Unknown data to check
71
+ * @returns True if data matches the UptoTronPayload structure
72
+ */
73
+ declare function isUptoTronPayload(data: unknown): data is UptoTronPayload;
74
+ /**
75
+ * Type guard to check if unknown data is an UptoTronExtra.
76
+ *
77
+ * @param data - Unknown data to check
78
+ * @returns True if data matches the UptoTronExtra structure
79
+ */
80
+ declare function isUptoTronExtra(data: unknown): data is UptoTronExtra;
81
+
82
+ export { type UptoTronAuthorization, type UptoTronExtra, type UptoTronPayload, isUptoTronExtra, isUptoTronPayload };
@@ -0,0 +1,10 @@
1
+ import {
2
+ isUptoTronExtra,
3
+ isUptoTronPayload
4
+ } from "../chunk-YHPIW52A.mjs";
5
+ import "../chunk-NSSMTXJJ.mjs";
6
+ export {
7
+ isUptoTronExtra,
8
+ isUptoTronPayload
9
+ };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t402/tron",
3
- "version": "2.3.1",
3
+ "version": "2.5.0",
4
4
  "main": "./dist/cjs/index.js",
5
5
  "module": "./dist/esm/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
@@ -18,25 +18,25 @@
18
18
  "repository": "https://github.com/t402-io/t402",
19
19
  "description": "t402 Payment Protocol TRON Implementation",
20
20
  "devDependencies": {
21
- "@eslint/js": "^9.24.0",
22
- "@types/node": "^22.13.4",
23
- "@typescript-eslint/eslint-plugin": "^8.29.1",
24
- "@typescript-eslint/parser": "^8.29.1",
21
+ "@eslint/js": "^9.39.2",
22
+ "@types/node": "^25.2.2",
23
+ "@typescript-eslint/eslint-plugin": "^8.55.0",
24
+ "@typescript-eslint/parser": "^8.55.0",
25
25
  "eslint": "^9.24.0",
26
26
  "eslint-plugin-import": "^2.31.0",
27
- "eslint-plugin-jsdoc": "^50.6.9",
28
- "eslint-plugin-prettier": "^5.2.6",
27
+ "eslint-plugin-jsdoc": "^62.5.4",
28
+ "eslint-plugin-prettier": "^5.5.5",
29
29
  "glob": "^13.0.0",
30
- "prettier": "3.5.2",
31
- "tsup": "^8.4.0",
30
+ "prettier": "3.8.1",
31
+ "tsup": "^8.5.1",
32
32
  "tsx": "^4.21.0",
33
- "typescript": "^5.7.3",
33
+ "typescript": "^5.9.3",
34
34
  "vite": "^7.3.1",
35
- "vite-tsconfig-paths": "^5.1.4",
35
+ "vite-tsconfig-paths": "^6.1.0",
36
36
  "vitest": "^3.2.4"
37
37
  },
38
38
  "dependencies": {
39
- "@t402/core": "2.3.1"
39
+ "@t402/core": "2.5.0"
40
40
  },
41
41
  "exports": {
42
42
  ".": {
@@ -78,6 +78,16 @@
78
78
  "types": "./dist/cjs/exact/facilitator/index.d.ts",
79
79
  "default": "./dist/cjs/exact/facilitator/index.js"
80
80
  }
81
+ },
82
+ "./upto": {
83
+ "import": {
84
+ "types": "./dist/esm/upto/index.d.mts",
85
+ "default": "./dist/esm/upto/index.mjs"
86
+ },
87
+ "require": {
88
+ "types": "./dist/cjs/upto/index.d.ts",
89
+ "default": "./dist/cjs/upto/index.js"
90
+ }
81
91
  }
82
92
  },
83
93
  "files": [
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/constants.ts","../../src/utils.ts"],"sourcesContent":["/**\n * TRON Network Constants\n *\n * Network identifiers, endpoints, and configuration for TRON blockchain.\n */\n\n// =============================================================================\n// Network Identifiers (CAIP-2 Format)\n// =============================================================================\n\n/** TRON Mainnet CAIP-2 identifier */\nexport const TRON_MAINNET_CAIP2 = 'tron:mainnet'\n\n/** TRON Nile Testnet CAIP-2 identifier */\nexport const TRON_NILE_CAIP2 = 'tron:nile'\n\n/** TRON Shasta Testnet CAIP-2 identifier */\nexport const TRON_SHASTA_CAIP2 = 'tron:shasta'\n\n/** All supported TRON networks */\nexport const TRON_NETWORKS = [TRON_MAINNET_CAIP2, TRON_NILE_CAIP2, TRON_SHASTA_CAIP2] as const\n\n/** TRON network type */\nexport type TronNetwork = (typeof TRON_NETWORKS)[number]\n\n// =============================================================================\n// RPC Endpoints\n// =============================================================================\n\n/** TRON Mainnet API endpoint (TronGrid) */\nexport const TRON_MAINNET_ENDPOINT = 'https://api.trongrid.io'\n\n/** TRON Nile Testnet API endpoint */\nexport const TRON_NILE_ENDPOINT = 'https://api.nileex.io'\n\n/** TRON Shasta Testnet API endpoint */\nexport const TRON_SHASTA_ENDPOINT = 'https://api.shasta.trongrid.io'\n\n/** Network to endpoint mapping */\nexport const NETWORK_ENDPOINTS: Record<string, string> = {\n [TRON_MAINNET_CAIP2]: TRON_MAINNET_ENDPOINT,\n [TRON_NILE_CAIP2]: TRON_NILE_ENDPOINT,\n [TRON_SHASTA_CAIP2]: TRON_SHASTA_ENDPOINT,\n}\n\n// =============================================================================\n// TRC20 Contract Operations\n// =============================================================================\n\n/** TRC20 transfer function selector (transfer(address,uint256)) */\nexport const TRC20_TRANSFER_SELECTOR = 'a9059cbb'\n\n/** TRC20 approve function selector (approve(address,uint256)) */\nexport const TRC20_APPROVE_SELECTOR = '095ea7b3'\n\n/** TRC20 balanceOf function selector (balanceOf(address)) */\nexport const TRC20_BALANCE_OF_SELECTOR = '70a08231'\n\n// =============================================================================\n// Gas and Fee Constants\n// =============================================================================\n\n/** Default fee limit for TRC20 transfers (in SUN, 1 TRX = 1,000,000 SUN) */\nexport const DEFAULT_FEE_LIMIT = 100_000_000 // 100 TRX\n\n/** Minimum fee limit for TRC20 transfers */\nexport const MIN_FEE_LIMIT = 10_000_000 // 10 TRX\n\n/** Maximum fee limit for TRC20 transfers */\nexport const MAX_FEE_LIMIT = 1_000_000_000 // 1000 TRX\n\n/** SUN per TRX (1 TRX = 1,000,000 SUN) */\nexport const SUN_PER_TRX = 1_000_000\n\n// =============================================================================\n// Scheme Constants\n// =============================================================================\n\n/** Payment scheme identifier */\nexport const SCHEME_EXACT = 'exact'\n\n/** Default transaction validity duration in seconds (1 hour) */\nexport const DEFAULT_VALIDITY_DURATION = 3600\n\n/** Minimum validity buffer for verification (30 seconds) */\nexport const MIN_VALIDITY_BUFFER = 30\n\n// =============================================================================\n// Address Constants\n// =============================================================================\n\n/** TRON address prefix (base58check) */\nexport const TRON_ADDRESS_PREFIX = 'T'\n\n/** TRON address length (base58check format) */\nexport const TRON_ADDRESS_LENGTH = 34\n\n/** TRON address hex prefix (0x41 in decimal = 65) */\nexport const TRON_ADDRESS_HEX_PREFIX = 0x41\n\n// =============================================================================\n// USDT Contract Addresses\n// =============================================================================\n\n/** USDT TRC20 contract addresses by network */\nexport const USDT_ADDRESSES: Record<string, string> = {\n [TRON_MAINNET_CAIP2]: 'TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t',\n [TRON_NILE_CAIP2]: 'TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf',\n [TRON_SHASTA_CAIP2]: 'TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs',\n}\n\n// =============================================================================\n// Token Decimals\n// =============================================================================\n\n/** Default decimals for USDT */\nexport const DEFAULT_USDT_DECIMALS = 6\n\n/** Default decimals for TRX */\nexport const DEFAULT_TRX_DECIMALS = 6\n","/**\n * TRON Utility Functions\n *\n * Address validation, amount conversion, and network utilities.\n */\n\nimport {\n TRON_NETWORKS,\n TRON_ADDRESS_LENGTH,\n TRON_ADDRESS_PREFIX,\n NETWORK_ENDPOINTS,\n DEFAULT_USDT_DECIMALS,\n} from './constants.js'\nimport type { TronNetwork } from './constants.js'\n\n// =============================================================================\n// Network Utilities\n// =============================================================================\n\n/**\n * Normalize network identifier to CAIP-2 format\n *\n * @param network - Network identifier (e.g., \"tron:mainnet\", \"mainnet\")\n * @returns Normalized CAIP-2 identifier\n * @throws Error if network is not supported\n */\nexport function normalizeNetwork(network: string): TronNetwork {\n // Already in correct format\n if (TRON_NETWORKS.includes(network as TronNetwork)) {\n return network as TronNetwork\n }\n\n // Handle shorthand formats\n const lower = network.toLowerCase()\n if (lower === 'mainnet' || lower === 'tron') {\n return 'tron:mainnet'\n }\n if (lower === 'nile' || lower === 'tron-nile') {\n return 'tron:nile'\n }\n if (lower === 'shasta' || lower === 'tron-shasta') {\n return 'tron:shasta'\n }\n\n throw new Error(`Unsupported TRON network: ${network}`)\n}\n\n/**\n * Get RPC endpoint for a network\n *\n * @param network - CAIP-2 network identifier\n * @returns RPC endpoint URL\n * @throws Error if network is not supported\n */\nexport function getEndpoint(network: string): string {\n const normalized = normalizeNetwork(network)\n const endpoint = NETWORK_ENDPOINTS[normalized]\n if (!endpoint) {\n throw new Error(`No endpoint configured for network: ${network}`)\n }\n return endpoint\n}\n\n/**\n * Check if a network identifier is a TRON network\n *\n * @param network - Network identifier\n * @returns true if TRON network\n */\nexport function isTronNetwork(network: string): boolean {\n try {\n normalizeNetwork(network)\n return true\n } catch {\n return false\n }\n}\n\n// =============================================================================\n// Address Utilities\n// =============================================================================\n\n/**\n * Base58 alphabet for TRON addresses\n */\nconst BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'\n\n/**\n * Validate a TRON address\n *\n * TRON addresses are:\n * - Base58check encoded\n * - 34 characters long\n * - Start with 'T' (mainnet) or 'A'/'4' (testnet - rare)\n *\n * @param address - Address to validate\n * @returns true if valid TRON address\n */\nexport function validateTronAddress(address: string): boolean {\n // Check length\n if (!address || address.length !== TRON_ADDRESS_LENGTH) {\n return false\n }\n\n // Check prefix (mainnet addresses start with T)\n if (!address.startsWith(TRON_ADDRESS_PREFIX)) {\n return false\n }\n\n // Check base58 characters\n for (const char of address) {\n if (!BASE58_ALPHABET.includes(char)) {\n return false\n }\n }\n\n return true\n}\n\n/**\n * Compare two TRON addresses for equality\n *\n * Handles case-insensitivity and different formats.\n *\n * @param addr1 - First address\n * @param addr2 - Second address\n * @returns true if addresses are equal\n */\nexport function addressesEqual(addr1: string, addr2: string): boolean {\n if (!addr1 || !addr2) return false\n\n // TRON addresses are case-sensitive in base58, but we normalize for comparison\n // This handles potential mixed-case issues from different sources\n return addr1 === addr2\n}\n\n/**\n * Format a TRON address for display\n *\n * @param address - Address to format\n * @param options - Formatting options\n * @returns Formatted address\n */\nexport function formatAddress(\n address: string,\n options?: {\n /** Truncate to first/last N characters */\n truncate?: number\n },\n): string {\n if (!address) return ''\n\n if (options?.truncate && address.length > options.truncate * 2 + 3) {\n return `${address.slice(0, options.truncate)}...${address.slice(-options.truncate)}`\n }\n\n return address\n}\n\n// =============================================================================\n// Amount Utilities\n// =============================================================================\n\n/**\n * Convert decimal amount to smallest units\n *\n * @param decimalAmount - Amount as decimal string (e.g., \"1.50\")\n * @param decimals - Token decimals (default: 6 for USDT)\n * @returns Amount in smallest units as string\n */\nexport function convertToSmallestUnits(\n decimalAmount: string,\n decimals: number = DEFAULT_USDT_DECIMALS,\n): string {\n const parts = decimalAmount.split('.')\n const wholePart = parts[0] || '0'\n let fractionalPart = parts[1] || ''\n\n // Pad or truncate fractional part to match decimals\n if (fractionalPart.length > decimals) {\n fractionalPart = fractionalPart.slice(0, decimals)\n } else {\n fractionalPart = fractionalPart.padEnd(decimals, '0')\n }\n\n // Combine and remove leading zeros\n const result = (wholePart + fractionalPart).replace(/^0+/, '') || '0'\n return result\n}\n\n/**\n * Convert smallest units to decimal amount\n *\n * @param smallestUnits - Amount in smallest units as string\n * @param decimals - Token decimals (default: 6 for USDT)\n * @returns Amount as decimal string\n */\nexport function convertFromSmallestUnits(\n smallestUnits: string,\n decimals: number = DEFAULT_USDT_DECIMALS,\n): string {\n const padded = smallestUnits.padStart(decimals + 1, '0')\n const wholePart = padded.slice(0, -decimals) || '0'\n const fractionalPart = padded.slice(-decimals)\n\n // Remove trailing zeros from fractional part\n let end = fractionalPart.length\n while (end > 0 && fractionalPart[end - 1] === '0') end--\n const trimmedFractional = fractionalPart.slice(0, end)\n\n if (trimmedFractional) {\n return `${wholePart}.${trimmedFractional}`\n }\n return wholePart\n}\n\n// =============================================================================\n// Transaction Utilities\n// =============================================================================\n\n/**\n * Generate a unique memo/reference for payment tracking\n *\n * @returns Unique reference string\n */\nexport function generatePaymentReference(): string {\n const timestamp = Date.now()\n const random = Math.floor(Math.random() * 1000000)\n return `t402_${timestamp}_${random}`\n}\n\n/**\n * Calculate transaction expiration time\n *\n * @param validitySeconds - Validity duration in seconds\n * @returns Expiration timestamp in milliseconds\n */\nexport function calculateExpiration(validitySeconds: number): number {\n return Date.now() + validitySeconds * 1000\n}\n\n/**\n * Validate a hex string\n *\n * @param hex - String to validate\n * @returns true if valid hex string\n */\nexport function isValidHex(hex: string): boolean {\n if (!hex) return false\n // Remove 0x prefix if present\n const cleanHex = hex.startsWith('0x') ? hex.slice(2) : hex\n return /^[0-9a-fA-F]+$/.test(cleanHex)\n}\n\n/**\n * Estimate transaction fee\n *\n * Note: Actual fees depend on energy/bandwidth consumption.\n * This provides a conservative estimate.\n *\n * @param isActivated - Whether recipient account is activated\n * @returns Estimated fee in SUN\n */\nexport function estimateTransactionFee(isActivated: boolean = true): number {\n // TRC20 transfer typically costs ~15-30 TRX in energy\n // New account activation adds ~1 TRX\n const baseFee = 30_000_000 // 30 TRX\n const activationFee = isActivated ? 0 : 1_000_000 // 1 TRX\n return baseFee + activationFee\n}\n"],"mappings":";;;;;AAWO,IAAM,qBAAqB;AAG3B,IAAM,kBAAkB;AAGxB,IAAM,oBAAoB;AAG1B,IAAM,gBAAgB,CAAC,oBAAoB,iBAAiB,iBAAiB;AAU7E,IAAM,wBAAwB;AAG9B,IAAM,qBAAqB;AAG3B,IAAM,uBAAuB;AAG7B,IAAM,oBAA4C;AAAA,EACvD,CAAC,kBAAkB,GAAG;AAAA,EACtB,CAAC,eAAe,GAAG;AAAA,EACnB,CAAC,iBAAiB,GAAG;AACvB;AAOO,IAAM,0BAA0B;AAGhC,IAAM,yBAAyB;AAG/B,IAAM,4BAA4B;AAOlC,IAAM,oBAAoB;AAG1B,IAAM,gBAAgB;AAGtB,IAAM,gBAAgB;AAGtB,IAAM,cAAc;AAOpB,IAAM,eAAe;AAGrB,IAAM,4BAA4B;AAGlC,IAAM,sBAAsB;AAO5B,IAAM,sBAAsB;AAG5B,IAAM,sBAAsB;AAG5B,IAAM,0BAA0B;AAOhC,IAAM,iBAAyC;AAAA,EACpD,CAAC,kBAAkB,GAAG;AAAA,EACtB,CAAC,eAAe,GAAG;AAAA,EACnB,CAAC,iBAAiB,GAAG;AACvB;AAOO,IAAM,wBAAwB;AAG9B,IAAM,uBAAuB;;;AC7F7B,SAAS,iBAAiB,SAA8B;AAE7D,MAAI,cAAc,SAAS,OAAsB,GAAG;AAClD,WAAO;AAAA,EACT;AAGA,QAAM,QAAQ,QAAQ,YAAY;AAClC,MAAI,UAAU,aAAa,UAAU,QAAQ;AAC3C,WAAO;AAAA,EACT;AACA,MAAI,UAAU,UAAU,UAAU,aAAa;AAC7C,WAAO;AAAA,EACT;AACA,MAAI,UAAU,YAAY,UAAU,eAAe;AACjD,WAAO;AAAA,EACT;AAEA,QAAM,IAAI,MAAM,6BAA6B,OAAO,E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