@t402/tron 1.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/dist/cjs/exact/client/index.d.ts +90 -0
- package/dist/cjs/exact/client/index.js +172 -0
- package/dist/cjs/exact/client/index.js.map +1 -0
- package/dist/cjs/exact/facilitator/index.d.ts +114 -0
- package/dist/cjs/exact/facilitator/index.js +344 -0
- package/dist/cjs/exact/facilitator/index.js.map +1 -0
- package/dist/cjs/exact/server/index.d.ts +123 -0
- package/dist/cjs/exact/server/index.js +350 -0
- package/dist/cjs/exact/server/index.js.map +1 -0
- package/dist/cjs/index.d.ts +237 -0
- package/dist/cjs/index.js +863 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/signer-BB-HLs-P.d.ts +261 -0
- package/dist/esm/chunk-A2E6FJU3.mjs +98 -0
- package/dist/esm/chunk-A2E6FJU3.mjs.map +1 -0
- package/dist/esm/chunk-CH6GR2VO.mjs +267 -0
- package/dist/esm/chunk-CH6GR2VO.mjs.map +1 -0
- package/dist/esm/chunk-L773HPM3.mjs +202 -0
- package/dist/esm/chunk-L773HPM3.mjs.map +1 -0
- package/dist/esm/chunk-RHOZZ6XV.mjs +285 -0
- package/dist/esm/chunk-RHOZZ6XV.mjs.map +1 -0
- package/dist/esm/exact/client/index.d.mts +90 -0
- package/dist/esm/exact/client/index.mjs +10 -0
- package/dist/esm/exact/client/index.mjs.map +1 -0
- package/dist/esm/exact/facilitator/index.d.mts +114 -0
- package/dist/esm/exact/facilitator/index.mjs +10 -0
- package/dist/esm/exact/facilitator/index.mjs.map +1 -0
- package/dist/esm/exact/server/index.d.mts +123 -0
- package/dist/esm/exact/server/index.mjs +10 -0
- package/dist/esm/exact/server/index.mjs.map +1 -0
- package/dist/esm/index.d.mts +237 -0
- package/dist/esm/index.mjs +113 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/signer-BB-HLs-P.d.mts +261 -0
- package/package.json +97 -0
|
@@ -0,0 +1,863 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
|
|
23
|
+
// src/constants.ts
|
|
24
|
+
var TRON_MAINNET_CAIP2, TRON_NILE_CAIP2, TRON_SHASTA_CAIP2, TRON_NETWORKS, TRON_MAINNET_ENDPOINT, TRON_NILE_ENDPOINT, TRON_SHASTA_ENDPOINT, NETWORK_ENDPOINTS, TRC20_TRANSFER_SELECTOR, TRC20_APPROVE_SELECTOR, TRC20_BALANCE_OF_SELECTOR, DEFAULT_FEE_LIMIT, MIN_FEE_LIMIT, MAX_FEE_LIMIT, SUN_PER_TRX, SCHEME_EXACT, DEFAULT_VALIDITY_DURATION, MIN_VALIDITY_BUFFER, TRON_ADDRESS_PREFIX, TRON_ADDRESS_LENGTH, TRON_ADDRESS_HEX_PREFIX, USDT_ADDRESSES, DEFAULT_USDT_DECIMALS, DEFAULT_TRX_DECIMALS;
|
|
25
|
+
var init_constants = __esm({
|
|
26
|
+
"src/constants.ts"() {
|
|
27
|
+
"use strict";
|
|
28
|
+
TRON_MAINNET_CAIP2 = "tron:mainnet";
|
|
29
|
+
TRON_NILE_CAIP2 = "tron:nile";
|
|
30
|
+
TRON_SHASTA_CAIP2 = "tron:shasta";
|
|
31
|
+
TRON_NETWORKS = [TRON_MAINNET_CAIP2, TRON_NILE_CAIP2, TRON_SHASTA_CAIP2];
|
|
32
|
+
TRON_MAINNET_ENDPOINT = "https://api.trongrid.io";
|
|
33
|
+
TRON_NILE_ENDPOINT = "https://api.nileex.io";
|
|
34
|
+
TRON_SHASTA_ENDPOINT = "https://api.shasta.trongrid.io";
|
|
35
|
+
NETWORK_ENDPOINTS = {
|
|
36
|
+
[TRON_MAINNET_CAIP2]: TRON_MAINNET_ENDPOINT,
|
|
37
|
+
[TRON_NILE_CAIP2]: TRON_NILE_ENDPOINT,
|
|
38
|
+
[TRON_SHASTA_CAIP2]: TRON_SHASTA_ENDPOINT
|
|
39
|
+
};
|
|
40
|
+
TRC20_TRANSFER_SELECTOR = "a9059cbb";
|
|
41
|
+
TRC20_APPROVE_SELECTOR = "095ea7b3";
|
|
42
|
+
TRC20_BALANCE_OF_SELECTOR = "70a08231";
|
|
43
|
+
DEFAULT_FEE_LIMIT = 1e8;
|
|
44
|
+
MIN_FEE_LIMIT = 1e7;
|
|
45
|
+
MAX_FEE_LIMIT = 1e9;
|
|
46
|
+
SUN_PER_TRX = 1e6;
|
|
47
|
+
SCHEME_EXACT = "exact";
|
|
48
|
+
DEFAULT_VALIDITY_DURATION = 3600;
|
|
49
|
+
MIN_VALIDITY_BUFFER = 30;
|
|
50
|
+
TRON_ADDRESS_PREFIX = "T";
|
|
51
|
+
TRON_ADDRESS_LENGTH = 34;
|
|
52
|
+
TRON_ADDRESS_HEX_PREFIX = 65;
|
|
53
|
+
USDT_ADDRESSES = {
|
|
54
|
+
[TRON_MAINNET_CAIP2]: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
|
|
55
|
+
[TRON_NILE_CAIP2]: "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf",
|
|
56
|
+
[TRON_SHASTA_CAIP2]: "TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs"
|
|
57
|
+
};
|
|
58
|
+
DEFAULT_USDT_DECIMALS = 6;
|
|
59
|
+
DEFAULT_TRX_DECIMALS = 6;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// src/tokens.ts
|
|
64
|
+
var tokens_exports = {};
|
|
65
|
+
__export(tokens_exports, {
|
|
66
|
+
TRC20_REGISTRY: () => TRC20_REGISTRY,
|
|
67
|
+
getDefaultToken: () => getDefaultToken,
|
|
68
|
+
getNetworkTokens: () => getNetworkTokens,
|
|
69
|
+
getNetworksForToken: () => getNetworksForToken,
|
|
70
|
+
getSupportedNetworks: () => getSupportedNetworks,
|
|
71
|
+
getTRC20Config: () => getTRC20Config,
|
|
72
|
+
getTokenByAddress: () => getTokenByAddress,
|
|
73
|
+
getUsdtNetworks: () => getUsdtNetworks,
|
|
74
|
+
isNetworkSupported: () => isNetworkSupported
|
|
75
|
+
});
|
|
76
|
+
function getTRC20Config(network, symbol) {
|
|
77
|
+
const registry = TRC20_REGISTRY[network];
|
|
78
|
+
if (!registry) return void 0;
|
|
79
|
+
return registry.tokens[symbol];
|
|
80
|
+
}
|
|
81
|
+
function getNetworkTokens(network) {
|
|
82
|
+
const registry = TRC20_REGISTRY[network];
|
|
83
|
+
if (!registry) return [];
|
|
84
|
+
return Object.values(registry.tokens);
|
|
85
|
+
}
|
|
86
|
+
function getDefaultToken(network) {
|
|
87
|
+
const registry = TRC20_REGISTRY[network];
|
|
88
|
+
return registry?.defaultToken;
|
|
89
|
+
}
|
|
90
|
+
function getTokenByAddress(network, contractAddress) {
|
|
91
|
+
const registry = TRC20_REGISTRY[network];
|
|
92
|
+
if (!registry) return void 0;
|
|
93
|
+
const upperAddress = contractAddress.toUpperCase();
|
|
94
|
+
return Object.values(registry.tokens).find(
|
|
95
|
+
(token) => token.contractAddress.toUpperCase() === upperAddress
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
function getNetworksForToken(symbol) {
|
|
99
|
+
return Object.entries(TRC20_REGISTRY).filter(([_, registry]) => symbol in registry.tokens).map(([network]) => network);
|
|
100
|
+
}
|
|
101
|
+
function getUsdtNetworks() {
|
|
102
|
+
return getNetworksForToken("USDT");
|
|
103
|
+
}
|
|
104
|
+
function isNetworkSupported(network) {
|
|
105
|
+
return network in TRC20_REGISTRY;
|
|
106
|
+
}
|
|
107
|
+
function getSupportedNetworks() {
|
|
108
|
+
return Object.keys(TRC20_REGISTRY);
|
|
109
|
+
}
|
|
110
|
+
var USDT_MAINNET, USDT_NILE, USDT_SHASTA, TRC20_REGISTRY;
|
|
111
|
+
var init_tokens = __esm({
|
|
112
|
+
"src/tokens.ts"() {
|
|
113
|
+
"use strict";
|
|
114
|
+
init_constants();
|
|
115
|
+
USDT_MAINNET = {
|
|
116
|
+
contractAddress: USDT_ADDRESSES[TRON_MAINNET_CAIP2],
|
|
117
|
+
symbol: "USDT",
|
|
118
|
+
name: "Tether USD",
|
|
119
|
+
decimals: DEFAULT_USDT_DECIMALS
|
|
120
|
+
};
|
|
121
|
+
USDT_NILE = {
|
|
122
|
+
contractAddress: USDT_ADDRESSES[TRON_NILE_CAIP2],
|
|
123
|
+
symbol: "USDT",
|
|
124
|
+
name: "Tether USD",
|
|
125
|
+
decimals: DEFAULT_USDT_DECIMALS
|
|
126
|
+
};
|
|
127
|
+
USDT_SHASTA = {
|
|
128
|
+
contractAddress: USDT_ADDRESSES[TRON_SHASTA_CAIP2],
|
|
129
|
+
symbol: "USDT",
|
|
130
|
+
name: "Tether USD",
|
|
131
|
+
decimals: DEFAULT_USDT_DECIMALS
|
|
132
|
+
};
|
|
133
|
+
TRC20_REGISTRY = {
|
|
134
|
+
[TRON_MAINNET_CAIP2]: {
|
|
135
|
+
network: TRON_MAINNET_CAIP2,
|
|
136
|
+
defaultToken: USDT_MAINNET,
|
|
137
|
+
tokens: {
|
|
138
|
+
USDT: USDT_MAINNET
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
[TRON_NILE_CAIP2]: {
|
|
142
|
+
network: TRON_NILE_CAIP2,
|
|
143
|
+
defaultToken: USDT_NILE,
|
|
144
|
+
tokens: {
|
|
145
|
+
USDT: USDT_NILE
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
[TRON_SHASTA_CAIP2]: {
|
|
149
|
+
network: TRON_SHASTA_CAIP2,
|
|
150
|
+
defaultToken: USDT_SHASTA,
|
|
151
|
+
tokens: {
|
|
152
|
+
USDT: USDT_SHASTA
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// src/index.ts
|
|
160
|
+
var src_exports = {};
|
|
161
|
+
__export(src_exports, {
|
|
162
|
+
DEFAULT_FEE_LIMIT: () => DEFAULT_FEE_LIMIT,
|
|
163
|
+
DEFAULT_TRX_DECIMALS: () => DEFAULT_TRX_DECIMALS,
|
|
164
|
+
DEFAULT_USDT_DECIMALS: () => DEFAULT_USDT_DECIMALS,
|
|
165
|
+
DEFAULT_VALIDITY_DURATION: () => DEFAULT_VALIDITY_DURATION,
|
|
166
|
+
ExactTronClientScheme: () => ExactTronScheme,
|
|
167
|
+
ExactTronFacilitatorScheme: () => ExactTronScheme3,
|
|
168
|
+
ExactTronServerScheme: () => ExactTronScheme2,
|
|
169
|
+
MAX_FEE_LIMIT: () => MAX_FEE_LIMIT,
|
|
170
|
+
MIN_FEE_LIMIT: () => MIN_FEE_LIMIT,
|
|
171
|
+
MIN_VALIDITY_BUFFER: () => MIN_VALIDITY_BUFFER,
|
|
172
|
+
NETWORK_ENDPOINTS: () => NETWORK_ENDPOINTS,
|
|
173
|
+
SCHEME_EXACT: () => SCHEME_EXACT,
|
|
174
|
+
SUN_PER_TRX: () => SUN_PER_TRX,
|
|
175
|
+
TRC20_APPROVE_SELECTOR: () => TRC20_APPROVE_SELECTOR,
|
|
176
|
+
TRC20_BALANCE_OF_SELECTOR: () => TRC20_BALANCE_OF_SELECTOR,
|
|
177
|
+
TRC20_REGISTRY: () => TRC20_REGISTRY,
|
|
178
|
+
TRC20_TRANSFER_SELECTOR: () => TRC20_TRANSFER_SELECTOR,
|
|
179
|
+
TRON_ADDRESS_HEX_PREFIX: () => TRON_ADDRESS_HEX_PREFIX,
|
|
180
|
+
TRON_ADDRESS_LENGTH: () => TRON_ADDRESS_LENGTH,
|
|
181
|
+
TRON_ADDRESS_PREFIX: () => TRON_ADDRESS_PREFIX,
|
|
182
|
+
TRON_MAINNET_CAIP2: () => TRON_MAINNET_CAIP2,
|
|
183
|
+
TRON_NETWORKS: () => TRON_NETWORKS,
|
|
184
|
+
TRON_NILE_CAIP2: () => TRON_NILE_CAIP2,
|
|
185
|
+
TRON_SHASTA_CAIP2: () => TRON_SHASTA_CAIP2,
|
|
186
|
+
USDT_ADDRESSES: () => USDT_ADDRESSES,
|
|
187
|
+
addressesEqual: () => addressesEqual,
|
|
188
|
+
calculateExpiration: () => calculateExpiration,
|
|
189
|
+
convertFromSmallestUnits: () => convertFromSmallestUnits,
|
|
190
|
+
convertToSmallestUnits: () => convertToSmallestUnits,
|
|
191
|
+
estimateTransactionFee: () => estimateTransactionFee,
|
|
192
|
+
formatAddress: () => formatAddress,
|
|
193
|
+
generatePaymentReference: () => generatePaymentReference,
|
|
194
|
+
getDefaultToken: () => getDefaultToken,
|
|
195
|
+
getEndpoint: () => getEndpoint,
|
|
196
|
+
getNetworkTokens: () => getNetworkTokens,
|
|
197
|
+
getNetworksForToken: () => getNetworksForToken,
|
|
198
|
+
getSupportedNetworks: () => getSupportedNetworks,
|
|
199
|
+
getTRC20Config: () => getTRC20Config,
|
|
200
|
+
getTokenByAddress: () => getTokenByAddress,
|
|
201
|
+
getUsdtNetworks: () => getUsdtNetworks,
|
|
202
|
+
isNetworkSupported: () => isNetworkSupported,
|
|
203
|
+
isTronNetwork: () => isTronNetwork,
|
|
204
|
+
isValidHex: () => isValidHex,
|
|
205
|
+
normalizeNetwork: () => normalizeNetwork,
|
|
206
|
+
registerExactTronClientScheme: () => registerExactTronScheme,
|
|
207
|
+
registerExactTronFacilitatorScheme: () => registerExactTronScheme3,
|
|
208
|
+
registerExactTronServerScheme: () => registerExactTronScheme2,
|
|
209
|
+
validateTronAddress: () => validateTronAddress
|
|
210
|
+
});
|
|
211
|
+
module.exports = __toCommonJS(src_exports);
|
|
212
|
+
init_constants();
|
|
213
|
+
init_tokens();
|
|
214
|
+
|
|
215
|
+
// src/utils.ts
|
|
216
|
+
init_constants();
|
|
217
|
+
function normalizeNetwork(network) {
|
|
218
|
+
if (TRON_NETWORKS.includes(network)) {
|
|
219
|
+
return network;
|
|
220
|
+
}
|
|
221
|
+
const lower = network.toLowerCase();
|
|
222
|
+
if (lower === "mainnet" || lower === "tron") {
|
|
223
|
+
return "tron:mainnet";
|
|
224
|
+
}
|
|
225
|
+
if (lower === "nile" || lower === "tron-nile") {
|
|
226
|
+
return "tron:nile";
|
|
227
|
+
}
|
|
228
|
+
if (lower === "shasta" || lower === "tron-shasta") {
|
|
229
|
+
return "tron:shasta";
|
|
230
|
+
}
|
|
231
|
+
throw new Error(`Unsupported TRON network: ${network}`);
|
|
232
|
+
}
|
|
233
|
+
function getEndpoint(network) {
|
|
234
|
+
const normalized = normalizeNetwork(network);
|
|
235
|
+
const endpoint = NETWORK_ENDPOINTS[normalized];
|
|
236
|
+
if (!endpoint) {
|
|
237
|
+
throw new Error(`No endpoint configured for network: ${network}`);
|
|
238
|
+
}
|
|
239
|
+
return endpoint;
|
|
240
|
+
}
|
|
241
|
+
function isTronNetwork(network) {
|
|
242
|
+
try {
|
|
243
|
+
normalizeNetwork(network);
|
|
244
|
+
return true;
|
|
245
|
+
} catch {
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
var BASE58_ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
250
|
+
function validateTronAddress(address) {
|
|
251
|
+
if (!address || address.length !== TRON_ADDRESS_LENGTH) {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
if (!address.startsWith(TRON_ADDRESS_PREFIX)) {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
for (const char of address) {
|
|
258
|
+
if (!BASE58_ALPHABET.includes(char)) {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
function addressesEqual(addr1, addr2) {
|
|
265
|
+
if (!addr1 || !addr2) return false;
|
|
266
|
+
return addr1 === addr2;
|
|
267
|
+
}
|
|
268
|
+
function formatAddress(address, options) {
|
|
269
|
+
if (!address) return "";
|
|
270
|
+
if (options?.truncate && address.length > options.truncate * 2 + 3) {
|
|
271
|
+
return `${address.slice(0, options.truncate)}...${address.slice(-options.truncate)}`;
|
|
272
|
+
}
|
|
273
|
+
return address;
|
|
274
|
+
}
|
|
275
|
+
function convertToSmallestUnits(decimalAmount, decimals = DEFAULT_USDT_DECIMALS) {
|
|
276
|
+
const parts = decimalAmount.split(".");
|
|
277
|
+
const wholePart = parts[0] || "0";
|
|
278
|
+
let fractionalPart = parts[1] || "";
|
|
279
|
+
if (fractionalPart.length > decimals) {
|
|
280
|
+
fractionalPart = fractionalPart.slice(0, decimals);
|
|
281
|
+
} else {
|
|
282
|
+
fractionalPart = fractionalPart.padEnd(decimals, "0");
|
|
283
|
+
}
|
|
284
|
+
const result = (wholePart + fractionalPart).replace(/^0+/, "") || "0";
|
|
285
|
+
return result;
|
|
286
|
+
}
|
|
287
|
+
function convertFromSmallestUnits(smallestUnits, decimals = DEFAULT_USDT_DECIMALS) {
|
|
288
|
+
const padded = smallestUnits.padStart(decimals + 1, "0");
|
|
289
|
+
const wholePart = padded.slice(0, -decimals) || "0";
|
|
290
|
+
const fractionalPart = padded.slice(-decimals);
|
|
291
|
+
const trimmedFractional = fractionalPart.replace(/0+$/, "");
|
|
292
|
+
if (trimmedFractional) {
|
|
293
|
+
return `${wholePart}.${trimmedFractional}`;
|
|
294
|
+
}
|
|
295
|
+
return wholePart;
|
|
296
|
+
}
|
|
297
|
+
function generatePaymentReference() {
|
|
298
|
+
const timestamp = Date.now();
|
|
299
|
+
const random = Math.floor(Math.random() * 1e6);
|
|
300
|
+
return `t402_${timestamp}_${random}`;
|
|
301
|
+
}
|
|
302
|
+
function calculateExpiration(validitySeconds) {
|
|
303
|
+
return Date.now() + validitySeconds * 1e3;
|
|
304
|
+
}
|
|
305
|
+
function isValidHex(hex) {
|
|
306
|
+
if (!hex) return false;
|
|
307
|
+
const cleanHex = hex.startsWith("0x") ? hex.slice(2) : hex;
|
|
308
|
+
return /^[0-9a-fA-F]+$/.test(cleanHex);
|
|
309
|
+
}
|
|
310
|
+
function estimateTransactionFee(isActivated = true) {
|
|
311
|
+
const baseFee = 3e7;
|
|
312
|
+
const activationFee = isActivated ? 0 : 1e6;
|
|
313
|
+
return baseFee + activationFee;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// src/exact/client/scheme.ts
|
|
317
|
+
init_constants();
|
|
318
|
+
var ExactTronScheme = class {
|
|
319
|
+
constructor(signer, config) {
|
|
320
|
+
this.scheme = SCHEME_EXACT;
|
|
321
|
+
this.signer = signer;
|
|
322
|
+
this.config = config ?? {};
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Creates a payment payload for a TRC20 transfer
|
|
326
|
+
*
|
|
327
|
+
* @param t402Version - Protocol version (must be 2)
|
|
328
|
+
* @param requirements - Payment requirements from server
|
|
329
|
+
* @returns Payment payload with signed transaction
|
|
330
|
+
*/
|
|
331
|
+
async createPaymentPayload(t402Version, requirements) {
|
|
332
|
+
const network = normalizeNetwork(String(requirements.network));
|
|
333
|
+
if (!requirements.asset) {
|
|
334
|
+
throw new Error("Asset (TRC20 contract address) is required");
|
|
335
|
+
}
|
|
336
|
+
if (!requirements.payTo) {
|
|
337
|
+
throw new Error("PayTo address is required");
|
|
338
|
+
}
|
|
339
|
+
if (!requirements.amount) {
|
|
340
|
+
throw new Error("Amount is required");
|
|
341
|
+
}
|
|
342
|
+
if (!validateTronAddress(requirements.asset)) {
|
|
343
|
+
throw new Error(`Invalid TRC20 contract address: ${requirements.asset}`);
|
|
344
|
+
}
|
|
345
|
+
if (!validateTronAddress(requirements.payTo)) {
|
|
346
|
+
throw new Error(`Invalid payTo address: ${requirements.payTo}`);
|
|
347
|
+
}
|
|
348
|
+
if (!validateTronAddress(this.signer.address)) {
|
|
349
|
+
throw new Error(`Invalid signer address: ${this.signer.address}`);
|
|
350
|
+
}
|
|
351
|
+
const blockInfo = await this.signer.getBlockInfo();
|
|
352
|
+
const expiration = blockInfo.expiration;
|
|
353
|
+
const feeLimit = this.config.feeLimit ?? DEFAULT_FEE_LIMIT;
|
|
354
|
+
const signedTransaction = await this.signer.signTransaction({
|
|
355
|
+
contractAddress: requirements.asset,
|
|
356
|
+
to: requirements.payTo,
|
|
357
|
+
amount: requirements.amount,
|
|
358
|
+
feeLimit,
|
|
359
|
+
expiration
|
|
360
|
+
});
|
|
361
|
+
const authorization = {
|
|
362
|
+
from: this.signer.address,
|
|
363
|
+
to: requirements.payTo,
|
|
364
|
+
contractAddress: requirements.asset,
|
|
365
|
+
amount: requirements.amount,
|
|
366
|
+
expiration,
|
|
367
|
+
refBlockBytes: blockInfo.refBlockBytes,
|
|
368
|
+
refBlockHash: blockInfo.refBlockHash,
|
|
369
|
+
timestamp: Date.now()
|
|
370
|
+
};
|
|
371
|
+
const payload = {
|
|
372
|
+
signedTransaction,
|
|
373
|
+
authorization
|
|
374
|
+
};
|
|
375
|
+
void network;
|
|
376
|
+
return {
|
|
377
|
+
t402Version,
|
|
378
|
+
payload
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
// src/exact/client/register.ts
|
|
384
|
+
function registerExactTronScheme(client, config) {
|
|
385
|
+
const scheme = new ExactTronScheme(config.signer, config.schemeConfig);
|
|
386
|
+
if (config.networks && config.networks.length > 0) {
|
|
387
|
+
config.networks.forEach((network) => {
|
|
388
|
+
client.register(network, scheme);
|
|
389
|
+
});
|
|
390
|
+
} else {
|
|
391
|
+
client.register("tron:*", scheme);
|
|
392
|
+
}
|
|
393
|
+
if (config.policies) {
|
|
394
|
+
config.policies.forEach((policy) => {
|
|
395
|
+
client.registerPolicy(policy);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
return client;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// src/exact/server/scheme.ts
|
|
402
|
+
init_constants();
|
|
403
|
+
init_tokens();
|
|
404
|
+
var ExactTronScheme2 = class {
|
|
405
|
+
constructor(config) {
|
|
406
|
+
this.scheme = SCHEME_EXACT;
|
|
407
|
+
this.moneyParsers = [];
|
|
408
|
+
this.config = config ?? {};
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Register a custom money parser
|
|
412
|
+
*
|
|
413
|
+
* Parsers are tried in registration order. Return null to pass to next parser.
|
|
414
|
+
*
|
|
415
|
+
* @param parser - Money parser function
|
|
416
|
+
* @returns This scheme for chaining
|
|
417
|
+
*/
|
|
418
|
+
registerMoneyParser(parser) {
|
|
419
|
+
this.moneyParsers.push(parser);
|
|
420
|
+
return this;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Parse a price into an asset amount
|
|
424
|
+
*
|
|
425
|
+
* @param price - Price to parse (string, number, or AssetAmount)
|
|
426
|
+
* @param network - Target network
|
|
427
|
+
* @returns Parsed asset amount
|
|
428
|
+
*/
|
|
429
|
+
async parsePrice(price, network) {
|
|
430
|
+
const normalizedNetwork = normalizeNetwork(String(network));
|
|
431
|
+
if (!isNetworkSupported(normalizedNetwork)) {
|
|
432
|
+
throw new Error(`Unsupported network: ${network}`);
|
|
433
|
+
}
|
|
434
|
+
if (typeof price === "object" && price !== null && "amount" in price) {
|
|
435
|
+
const assetAmount = price;
|
|
436
|
+
return {
|
|
437
|
+
amount: assetAmount.amount,
|
|
438
|
+
asset: assetAmount.asset || this.getDefaultAsset(normalizedNetwork),
|
|
439
|
+
extra: assetAmount.extra
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
const decimalAmount = this.parseMoneyToDecimal(price);
|
|
443
|
+
for (const parser of this.moneyParsers) {
|
|
444
|
+
try {
|
|
445
|
+
const result = await parser(decimalAmount, network);
|
|
446
|
+
if (result !== null) {
|
|
447
|
+
return result;
|
|
448
|
+
}
|
|
449
|
+
} catch {
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return this.defaultMoneyConversion(decimalAmount, normalizedNetwork);
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* Enhance payment requirements with scheme-specific data
|
|
457
|
+
*
|
|
458
|
+
* @param requirements - Base payment requirements
|
|
459
|
+
* @param supportedKind - Supported payment kind
|
|
460
|
+
* @param extensionKeys - Extension keys to include
|
|
461
|
+
* @returns Enhanced payment requirements
|
|
462
|
+
*/
|
|
463
|
+
async enhancePaymentRequirements(requirements, supportedKind, extensionKeys) {
|
|
464
|
+
void extensionKeys;
|
|
465
|
+
const network = normalizeNetwork(String(requirements.network));
|
|
466
|
+
let tokenConfig = requirements.asset ? getTRC20Config(network, requirements.asset) || this.getTokenByAddress(network, requirements.asset) : getDefaultToken(network);
|
|
467
|
+
if (!tokenConfig) {
|
|
468
|
+
tokenConfig = getDefaultToken(network);
|
|
469
|
+
}
|
|
470
|
+
const extra = { ...requirements.extra };
|
|
471
|
+
if (tokenConfig) {
|
|
472
|
+
extra.symbol = tokenConfig.symbol;
|
|
473
|
+
extra.name = tokenConfig.name;
|
|
474
|
+
extra.decimals = tokenConfig.decimals;
|
|
475
|
+
}
|
|
476
|
+
if (supportedKind.extra) {
|
|
477
|
+
for (const key of extensionKeys) {
|
|
478
|
+
if (key in supportedKind.extra) {
|
|
479
|
+
extra[key] = supportedKind.extra[key];
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return {
|
|
484
|
+
...requirements,
|
|
485
|
+
asset: tokenConfig?.contractAddress || requirements.asset,
|
|
486
|
+
extra
|
|
487
|
+
};
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Parse money (string/number) to decimal number
|
|
491
|
+
*/
|
|
492
|
+
parseMoneyToDecimal(price) {
|
|
493
|
+
if (typeof price === "number") {
|
|
494
|
+
return price;
|
|
495
|
+
}
|
|
496
|
+
if (typeof price === "string") {
|
|
497
|
+
let cleanPrice = price.trim();
|
|
498
|
+
cleanPrice = cleanPrice.replace(/^\$/, "").trim();
|
|
499
|
+
const parts = cleanPrice.split(/\s+/);
|
|
500
|
+
const numericPart = parts[0];
|
|
501
|
+
const parsed = parseFloat(numericPart);
|
|
502
|
+
if (isNaN(parsed)) {
|
|
503
|
+
throw new Error(`Failed to parse price: ${price}`);
|
|
504
|
+
}
|
|
505
|
+
return parsed;
|
|
506
|
+
}
|
|
507
|
+
throw new Error(`Invalid price type: ${typeof price}`);
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Default money to asset conversion (USDT)
|
|
511
|
+
*/
|
|
512
|
+
defaultMoneyConversion(decimalAmount, network) {
|
|
513
|
+
const tokenConfig = getDefaultToken(network);
|
|
514
|
+
if (!tokenConfig) {
|
|
515
|
+
throw new Error(`No default token for network: ${network}`);
|
|
516
|
+
}
|
|
517
|
+
const amount = convertToSmallestUnits(decimalAmount.toFixed(6), tokenConfig.decimals);
|
|
518
|
+
return {
|
|
519
|
+
amount,
|
|
520
|
+
asset: tokenConfig.contractAddress,
|
|
521
|
+
extra: {
|
|
522
|
+
symbol: tokenConfig.symbol,
|
|
523
|
+
name: tokenConfig.name,
|
|
524
|
+
decimals: tokenConfig.decimals
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Get default asset address for network
|
|
530
|
+
*/
|
|
531
|
+
getDefaultAsset(network) {
|
|
532
|
+
const tokenConfig = getDefaultToken(network);
|
|
533
|
+
if (!tokenConfig) {
|
|
534
|
+
throw new Error(`No default token for network: ${network}`);
|
|
535
|
+
}
|
|
536
|
+
return tokenConfig.contractAddress;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Get token config by contract address
|
|
540
|
+
*/
|
|
541
|
+
getTokenByAddress(network, address) {
|
|
542
|
+
const { getTokenByAddress: getTokenByAddress2 } = (init_tokens(), __toCommonJS(tokens_exports));
|
|
543
|
+
return getTokenByAddress2(network, address);
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
// src/exact/server/register.ts
|
|
548
|
+
function registerExactTronScheme2(server, config = {}) {
|
|
549
|
+
const scheme = new ExactTronScheme2(config.schemeConfig);
|
|
550
|
+
if (config.networks && config.networks.length > 0) {
|
|
551
|
+
config.networks.forEach((network) => {
|
|
552
|
+
server.register(network, scheme);
|
|
553
|
+
});
|
|
554
|
+
} else {
|
|
555
|
+
server.register("tron:*", scheme);
|
|
556
|
+
}
|
|
557
|
+
return server;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// src/exact/facilitator/scheme.ts
|
|
561
|
+
init_constants();
|
|
562
|
+
var ExactTronScheme3 = class {
|
|
563
|
+
constructor(signer, config) {
|
|
564
|
+
this.scheme = SCHEME_EXACT;
|
|
565
|
+
this.caipFamily = "tron:*";
|
|
566
|
+
this.signer = signer;
|
|
567
|
+
this.config = config ?? {};
|
|
568
|
+
}
|
|
569
|
+
/**
|
|
570
|
+
* Get extra data to include in payment requirements
|
|
571
|
+
*/
|
|
572
|
+
getExtra(network) {
|
|
573
|
+
void network;
|
|
574
|
+
if (this.config.canSponsorGas) {
|
|
575
|
+
const addresses = this.signer.getAddresses();
|
|
576
|
+
if (addresses.length > 0) {
|
|
577
|
+
return {
|
|
578
|
+
gasSponsor: addresses[0]
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
return void 0;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Get facilitator addresses that can receive payments
|
|
586
|
+
*/
|
|
587
|
+
getSigners(network) {
|
|
588
|
+
void network;
|
|
589
|
+
return [...this.signer.getAddresses()];
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* Verify a payment payload
|
|
593
|
+
*
|
|
594
|
+
* Performs comprehensive validation:
|
|
595
|
+
* 1. Scheme matching
|
|
596
|
+
* 2. Network matching
|
|
597
|
+
* 3. Payload structure validation
|
|
598
|
+
* 4. Transaction signature verification
|
|
599
|
+
* 5. Authorization expiry check
|
|
600
|
+
* 6. Balance verification
|
|
601
|
+
* 7. Amount sufficiency
|
|
602
|
+
* 8. Recipient matching
|
|
603
|
+
* 9. Contract address matching
|
|
604
|
+
* 10. Account activation check
|
|
605
|
+
*/
|
|
606
|
+
async verify(payload, requirements) {
|
|
607
|
+
const tronPayload = payload.payload;
|
|
608
|
+
const authorization = tronPayload.authorization;
|
|
609
|
+
if (payload.accepted.scheme !== SCHEME_EXACT || requirements.scheme !== SCHEME_EXACT) {
|
|
610
|
+
return {
|
|
611
|
+
isValid: false,
|
|
612
|
+
invalidReason: "unsupported_scheme",
|
|
613
|
+
payer: authorization.from
|
|
614
|
+
};
|
|
615
|
+
}
|
|
616
|
+
let payloadNetwork;
|
|
617
|
+
try {
|
|
618
|
+
payloadNetwork = normalizeNetwork(String(payload.accepted.network));
|
|
619
|
+
const requirementsNetwork = normalizeNetwork(String(requirements.network));
|
|
620
|
+
if (payloadNetwork !== requirementsNetwork) {
|
|
621
|
+
return {
|
|
622
|
+
isValid: false,
|
|
623
|
+
invalidReason: "network_mismatch",
|
|
624
|
+
payer: authorization.from
|
|
625
|
+
};
|
|
626
|
+
}
|
|
627
|
+
} catch {
|
|
628
|
+
return {
|
|
629
|
+
isValid: false,
|
|
630
|
+
invalidReason: "invalid_network",
|
|
631
|
+
payer: authorization.from
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
if (!tronPayload || !tronPayload.signedTransaction || !authorization) {
|
|
635
|
+
return {
|
|
636
|
+
isValid: false,
|
|
637
|
+
invalidReason: "invalid_payload_structure",
|
|
638
|
+
payer: authorization?.from || ""
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
if (!validateTronAddress(authorization.from)) {
|
|
642
|
+
return {
|
|
643
|
+
isValid: false,
|
|
644
|
+
invalidReason: "invalid_sender_address",
|
|
645
|
+
payer: authorization.from
|
|
646
|
+
};
|
|
647
|
+
}
|
|
648
|
+
if (!validateTronAddress(authorization.to)) {
|
|
649
|
+
return {
|
|
650
|
+
isValid: false,
|
|
651
|
+
invalidReason: "invalid_recipient_address",
|
|
652
|
+
payer: authorization.from
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
if (!validateTronAddress(authorization.contractAddress)) {
|
|
656
|
+
return {
|
|
657
|
+
isValid: false,
|
|
658
|
+
invalidReason: "invalid_contract_address",
|
|
659
|
+
payer: authorization.from
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
const verifyResult = await this.signer.verifyTransaction({
|
|
663
|
+
signedTransaction: tronPayload.signedTransaction,
|
|
664
|
+
expectedFrom: authorization.from,
|
|
665
|
+
expectedTransfer: {
|
|
666
|
+
to: authorization.to,
|
|
667
|
+
contractAddress: authorization.contractAddress,
|
|
668
|
+
amount: authorization.amount
|
|
669
|
+
},
|
|
670
|
+
network: payloadNetwork
|
|
671
|
+
});
|
|
672
|
+
if (!verifyResult.valid) {
|
|
673
|
+
return {
|
|
674
|
+
isValid: false,
|
|
675
|
+
invalidReason: verifyResult.reason || "transaction_verification_failed",
|
|
676
|
+
payer: authorization.from
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
const now = Date.now();
|
|
680
|
+
const expirationWithBuffer = authorization.expiration - MIN_VALIDITY_BUFFER * 1e3;
|
|
681
|
+
if (now >= expirationWithBuffer) {
|
|
682
|
+
return {
|
|
683
|
+
isValid: false,
|
|
684
|
+
invalidReason: "authorization_expired",
|
|
685
|
+
payer: authorization.from
|
|
686
|
+
};
|
|
687
|
+
}
|
|
688
|
+
try {
|
|
689
|
+
const balance = await this.signer.getBalance({
|
|
690
|
+
ownerAddress: authorization.from,
|
|
691
|
+
contractAddress: authorization.contractAddress,
|
|
692
|
+
network: payloadNetwork
|
|
693
|
+
});
|
|
694
|
+
if (BigInt(balance) < BigInt(requirements.amount)) {
|
|
695
|
+
return {
|
|
696
|
+
isValid: false,
|
|
697
|
+
invalidReason: "insufficient_balance",
|
|
698
|
+
payer: authorization.from
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
} catch (error) {
|
|
702
|
+
console.warn("Could not verify balance:", error);
|
|
703
|
+
}
|
|
704
|
+
if (BigInt(authorization.amount) < BigInt(requirements.amount)) {
|
|
705
|
+
return {
|
|
706
|
+
isValid: false,
|
|
707
|
+
invalidReason: "insufficient_amount",
|
|
708
|
+
payer: authorization.from
|
|
709
|
+
};
|
|
710
|
+
}
|
|
711
|
+
if (!addressesEqual(authorization.to, requirements.payTo)) {
|
|
712
|
+
return {
|
|
713
|
+
isValid: false,
|
|
714
|
+
invalidReason: "recipient_mismatch",
|
|
715
|
+
payer: authorization.from
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
if (!addressesEqual(authorization.contractAddress, requirements.asset)) {
|
|
719
|
+
return {
|
|
720
|
+
isValid: false,
|
|
721
|
+
invalidReason: "asset_mismatch",
|
|
722
|
+
payer: authorization.from
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
try {
|
|
726
|
+
const isActivated = await this.signer.isActivated(authorization.from, payloadNetwork);
|
|
727
|
+
if (!isActivated) {
|
|
728
|
+
return {
|
|
729
|
+
isValid: false,
|
|
730
|
+
invalidReason: "account_not_activated",
|
|
731
|
+
payer: authorization.from
|
|
732
|
+
};
|
|
733
|
+
}
|
|
734
|
+
} catch (error) {
|
|
735
|
+
console.warn("Could not verify account activation:", error);
|
|
736
|
+
}
|
|
737
|
+
return {
|
|
738
|
+
isValid: true,
|
|
739
|
+
invalidReason: void 0,
|
|
740
|
+
payer: authorization.from
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Settle a verified payment
|
|
745
|
+
*
|
|
746
|
+
* Broadcasts the transaction and waits for confirmation.
|
|
747
|
+
*/
|
|
748
|
+
async settle(payload, requirements) {
|
|
749
|
+
const tronPayload = payload.payload;
|
|
750
|
+
const verifyResult = await this.verify(payload, requirements);
|
|
751
|
+
if (!verifyResult.isValid) {
|
|
752
|
+
return {
|
|
753
|
+
success: false,
|
|
754
|
+
network: payload.accepted.network,
|
|
755
|
+
transaction: "",
|
|
756
|
+
errorReason: verifyResult.invalidReason ?? "verification_failed",
|
|
757
|
+
payer: tronPayload.authorization.from
|
|
758
|
+
};
|
|
759
|
+
}
|
|
760
|
+
try {
|
|
761
|
+
const network = normalizeNetwork(String(payload.accepted.network));
|
|
762
|
+
const txId = await this.signer.broadcastTransaction(
|
|
763
|
+
tronPayload.signedTransaction,
|
|
764
|
+
network
|
|
765
|
+
);
|
|
766
|
+
const confirmation = await this.signer.waitForTransaction({
|
|
767
|
+
txId,
|
|
768
|
+
network,
|
|
769
|
+
timeout: 6e4
|
|
770
|
+
// 60 seconds
|
|
771
|
+
});
|
|
772
|
+
if (!confirmation.success) {
|
|
773
|
+
return {
|
|
774
|
+
success: false,
|
|
775
|
+
network: payload.accepted.network,
|
|
776
|
+
transaction: txId,
|
|
777
|
+
errorReason: confirmation.error || "transaction_not_confirmed",
|
|
778
|
+
payer: tronPayload.authorization.from
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
return {
|
|
782
|
+
success: true,
|
|
783
|
+
transaction: confirmation.txId || txId,
|
|
784
|
+
network: payload.accepted.network,
|
|
785
|
+
payer: tronPayload.authorization.from
|
|
786
|
+
};
|
|
787
|
+
} catch (error) {
|
|
788
|
+
console.error("Failed to settle TRON transaction:", error);
|
|
789
|
+
return {
|
|
790
|
+
success: false,
|
|
791
|
+
network: payload.accepted.network,
|
|
792
|
+
transaction: "",
|
|
793
|
+
errorReason: "transaction_failed",
|
|
794
|
+
payer: tronPayload.authorization.from
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// src/exact/facilitator/register.ts
|
|
801
|
+
function registerExactTronScheme3(facilitator, config) {
|
|
802
|
+
const scheme = new ExactTronScheme3(config.signer, config.schemeConfig);
|
|
803
|
+
if (config.networks && config.networks.length > 0) {
|
|
804
|
+
config.networks.forEach((network) => {
|
|
805
|
+
facilitator.register(network, scheme);
|
|
806
|
+
});
|
|
807
|
+
} else {
|
|
808
|
+
facilitator.register("tron:*", scheme);
|
|
809
|
+
}
|
|
810
|
+
return facilitator;
|
|
811
|
+
}
|
|
812
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
813
|
+
0 && (module.exports = {
|
|
814
|
+
DEFAULT_FEE_LIMIT,
|
|
815
|
+
DEFAULT_TRX_DECIMALS,
|
|
816
|
+
DEFAULT_USDT_DECIMALS,
|
|
817
|
+
DEFAULT_VALIDITY_DURATION,
|
|
818
|
+
ExactTronClientScheme,
|
|
819
|
+
ExactTronFacilitatorScheme,
|
|
820
|
+
ExactTronServerScheme,
|
|
821
|
+
MAX_FEE_LIMIT,
|
|
822
|
+
MIN_FEE_LIMIT,
|
|
823
|
+
MIN_VALIDITY_BUFFER,
|
|
824
|
+
NETWORK_ENDPOINTS,
|
|
825
|
+
SCHEME_EXACT,
|
|
826
|
+
SUN_PER_TRX,
|
|
827
|
+
TRC20_APPROVE_SELECTOR,
|
|
828
|
+
TRC20_BALANCE_OF_SELECTOR,
|
|
829
|
+
TRC20_REGISTRY,
|
|
830
|
+
TRC20_TRANSFER_SELECTOR,
|
|
831
|
+
TRON_ADDRESS_HEX_PREFIX,
|
|
832
|
+
TRON_ADDRESS_LENGTH,
|
|
833
|
+
TRON_ADDRESS_PREFIX,
|
|
834
|
+
TRON_MAINNET_CAIP2,
|
|
835
|
+
TRON_NETWORKS,
|
|
836
|
+
TRON_NILE_CAIP2,
|
|
837
|
+
TRON_SHASTA_CAIP2,
|
|
838
|
+
USDT_ADDRESSES,
|
|
839
|
+
addressesEqual,
|
|
840
|
+
calculateExpiration,
|
|
841
|
+
convertFromSmallestUnits,
|
|
842
|
+
convertToSmallestUnits,
|
|
843
|
+
estimateTransactionFee,
|
|
844
|
+
formatAddress,
|
|
845
|
+
generatePaymentReference,
|
|
846
|
+
getDefaultToken,
|
|
847
|
+
getEndpoint,
|
|
848
|
+
getNetworkTokens,
|
|
849
|
+
getNetworksForToken,
|
|
850
|
+
getSupportedNetworks,
|
|
851
|
+
getTRC20Config,
|
|
852
|
+
getTokenByAddress,
|
|
853
|
+
getUsdtNetworks,
|
|
854
|
+
isNetworkSupported,
|
|
855
|
+
isTronNetwork,
|
|
856
|
+
isValidHex,
|
|
857
|
+
normalizeNetwork,
|
|
858
|
+
registerExactTronClientScheme,
|
|
859
|
+
registerExactTronFacilitatorScheme,
|
|
860
|
+
registerExactTronServerScheme,
|
|
861
|
+
validateTronAddress
|
|
862
|
+
});
|
|
863
|
+
//# sourceMappingURL=index.js.map
|