@shapeshiftoss/unchained-client 10.14.11 → 10.16.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/.tsbuildinfo +1 -1
- package/dist/cjs/cosmossdk/thorchain/parser/__tests__/thorchain.test.js +1 -1
- package/dist/cjs/cosmossdk/thorchain/parser/rfox.js +1 -1
- package/dist/cjs/evm/arbitrum/parser/index.js +2 -2
- package/dist/cjs/evm/ethereum/parser/index.js +6 -0
- package/dist/cjs/generated/ethereum/apis/V1Api.d.ts +15 -0
- package/dist/cjs/generated/ethereum/apis/V1Api.js +24 -0
- package/dist/cjs/generated/mayachain/apis/V1Api.d.ts +1 -13
- package/dist/cjs/generated/mayachain/apis/V1Api.js +0 -27
- package/dist/cjs/generated/mayachain/models/index.d.ts +0 -2
- package/dist/cjs/generated/mayachain/models/index.js +0 -2
- package/dist/cjs/generated/thorchain/apis/V1Api.d.ts +1 -25
- package/dist/cjs/generated/thorchain/apis/V1Api.js +0 -54
- package/dist/cjs/generated/thorchain/models/index.d.ts +0 -3
- package/dist/cjs/generated/thorchain/models/index.js +0 -3
- package/dist/cjs/tron/__tests__/api.test.d.ts +1 -0
- package/dist/cjs/tron/__tests__/api.test.js +425 -0
- package/dist/cjs/tron/api.d.ts +42 -15
- package/dist/cjs/tron/api.js +222 -78
- package/dist/cjs/tron/types.d.ts +4 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/cosmossdk/thorchain/parser/__tests__/thorchain.test.js +2 -2
- package/dist/esm/cosmossdk/thorchain/parser/rfox.js +2 -2
- package/dist/esm/evm/arbitrum/parser/index.js +3 -3
- package/dist/esm/evm/ethereum/parser/index.js +7 -1
- package/dist/esm/generated/ethereum/apis/V1Api.d.ts +15 -0
- package/dist/esm/generated/ethereum/apis/V1Api.js +24 -0
- package/dist/esm/generated/mayachain/apis/V1Api.d.ts +1 -13
- package/dist/esm/generated/mayachain/apis/V1Api.js +1 -28
- package/dist/esm/generated/mayachain/models/index.d.ts +0 -2
- package/dist/esm/generated/mayachain/models/index.js +0 -2
- package/dist/esm/generated/thorchain/apis/V1Api.d.ts +1 -25
- package/dist/esm/generated/thorchain/apis/V1Api.js +1 -55
- package/dist/esm/generated/thorchain/models/index.d.ts +0 -3
- package/dist/esm/generated/thorchain/models/index.js +0 -3
- package/dist/esm/tron/__tests__/api.test.d.ts +1 -0
- package/dist/esm/tron/__tests__/api.test.js +423 -0
- package/dist/esm/tron/api.d.ts +42 -15
- package/dist/esm/tron/api.js +220 -77
- package/dist/esm/tron/types.d.ts +4 -0
- package/package.json +5 -5
- package/dist/cjs/generated/mayachain/models/AffiliateFee.d.ts +0 -67
- package/dist/cjs/generated/mayachain/models/AffiliateFee.js +0 -63
- package/dist/cjs/generated/mayachain/models/AffiliateFees.d.ts +0 -32
- package/dist/cjs/generated/mayachain/models/AffiliateFees.js +0 -52
- package/dist/cjs/generated/thorchain/models/AffiliateFee.d.ts +0 -67
- package/dist/cjs/generated/thorchain/models/AffiliateFee.js +0 -63
- package/dist/cjs/generated/thorchain/models/AffiliateFees.d.ts +0 -32
- package/dist/cjs/generated/thorchain/models/AffiliateFees.js +0 -52
- package/dist/cjs/generated/thorchain/models/AffiliateRevenue.d.ts +0 -45
- package/dist/cjs/generated/thorchain/models/AffiliateRevenue.js +0 -57
- package/dist/esm/generated/mayachain/models/AffiliateFee.d.ts +0 -67
- package/dist/esm/generated/mayachain/models/AffiliateFee.js +0 -56
- package/dist/esm/generated/mayachain/models/AffiliateFees.d.ts +0 -32
- package/dist/esm/generated/mayachain/models/AffiliateFees.js +0 -45
- package/dist/esm/generated/thorchain/models/AffiliateFee.d.ts +0 -67
- package/dist/esm/generated/thorchain/models/AffiliateFee.js +0 -56
- package/dist/esm/generated/thorchain/models/AffiliateFees.d.ts +0 -32
- package/dist/esm/generated/thorchain/models/AffiliateFees.js +0 -45
- package/dist/esm/generated/thorchain/models/AffiliateRevenue.d.ts +0 -45
- package/dist/esm/generated/thorchain/models/AffiliateRevenue.js +0 -50
package/dist/esm/tron/api.js
CHANGED
|
@@ -1,8 +1,29 @@
|
|
|
1
|
+
import { timeout } from '@shapeshiftoss/utils';
|
|
1
2
|
import { TronWeb } from 'tronweb';
|
|
3
|
+
const PRECISION_READ_TIMEOUT_MS = 10_000;
|
|
4
|
+
const TRON_CALLER_PAYS_ALL = {
|
|
5
|
+
callerPercent: 100,
|
|
6
|
+
originEnergyLimit: 0,
|
|
7
|
+
originEnergyAvailable: 0,
|
|
8
|
+
};
|
|
9
|
+
// java-tron reads a stored zero, which TronGrid omits, as this creator default
|
|
10
|
+
const TRON_CREATOR_DEFAULT_ENERGY_LIMIT = 10_000_000;
|
|
11
|
+
// A deployer's unspent energy moves slowly next to how often the swappers re-estimate
|
|
12
|
+
const TRON_ORIGIN_ENERGY_TTL_MS = 15_000;
|
|
13
|
+
// A deployer can raise the caller's share after deployment, so the split is re-read within the minute
|
|
14
|
+
const TRON_CONTRACT_TTL_MS = 60_000;
|
|
15
|
+
// The deployer covers the rest only out of what they have staked, so a dry deployer (Tether) leaves the caller paying in full
|
|
16
|
+
export const getCallerEnergy = (energyUsed, share) => {
|
|
17
|
+
const originShare = Math.floor((energyUsed * (100 - share.callerPercent)) / 100);
|
|
18
|
+
const originCovered = Math.max(0, Math.min(originShare, share.originEnergyLimit, share.originEnergyAvailable));
|
|
19
|
+
return energyUsed - originCovered;
|
|
20
|
+
};
|
|
2
21
|
export class TronApi {
|
|
3
22
|
rpcUrl;
|
|
4
23
|
apiKey;
|
|
5
24
|
tronWeb = null;
|
|
25
|
+
contracts = new Map();
|
|
26
|
+
originEnergy = new Map();
|
|
6
27
|
requestQueue = Promise.resolve();
|
|
7
28
|
minRequestInterval = 1_500;
|
|
8
29
|
constructor(config) {
|
|
@@ -95,9 +116,12 @@ export class TronApi {
|
|
|
95
116
|
}
|
|
96
117
|
for (const contractAddress of Array.from(discoveredContracts).slice(0, MAX_FALLBACK_CONTRACTS)) {
|
|
97
118
|
await this.throttle();
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
119
|
+
await this.getTrc20Balance({ contractAddress, address: params.pubkey })
|
|
120
|
+
.then(balance => {
|
|
121
|
+
if (balance !== '0')
|
|
122
|
+
tokens.push({ contractAddress, balance });
|
|
123
|
+
})
|
|
124
|
+
.catch(() => undefined);
|
|
101
125
|
}
|
|
102
126
|
}
|
|
103
127
|
catch (fallbackErr) {
|
|
@@ -118,17 +142,67 @@ export class TronApi {
|
|
|
118
142
|
tokens,
|
|
119
143
|
};
|
|
120
144
|
}
|
|
121
|
-
async
|
|
145
|
+
async getTrc20Decimals(params) {
|
|
122
146
|
try {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
147
|
+
const result = await timeout(this.getTronWeb().transactionBuilder.triggerConstantContract(params.contractAddress, 'decimals()', {}, [], params.contractAddress), PRECISION_READ_TIMEOUT_MS, undefined);
|
|
148
|
+
if (!result)
|
|
149
|
+
return;
|
|
150
|
+
const [decimalsHex] = result.constant_result ?? [];
|
|
151
|
+
if (this.isReverted(result) || !decimalsHex)
|
|
152
|
+
return;
|
|
153
|
+
// decimals() is a uint8; anything larger is a contract answering something else
|
|
154
|
+
const decimals = Number(BigInt(`0x${decimalsHex}`));
|
|
155
|
+
return decimals > 255 ? undefined : decimals;
|
|
127
156
|
}
|
|
128
|
-
catch (
|
|
129
|
-
|
|
157
|
+
catch (err) {
|
|
158
|
+
console.error(`[tron] failed to read decimals of ${params.contractAddress}`, err);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async getTrc10Precision(params) {
|
|
163
|
+
try {
|
|
164
|
+
const data = await timeout(fetch(`${this.rpcUrl}/v1/assets/${params.id}`, {
|
|
165
|
+
headers: this.tronGridHeaders,
|
|
166
|
+
signal: AbortSignal.timeout(PRECISION_READ_TIMEOUT_MS),
|
|
167
|
+
}).then(response => response.json()), PRECISION_READ_TIMEOUT_MS, undefined);
|
|
168
|
+
return data?.data?.[0]?.precision;
|
|
169
|
+
}
|
|
170
|
+
catch (err) {
|
|
171
|
+
console.error(`[tron] failed to read precision of trc10 ${params.id}`, err);
|
|
172
|
+
return;
|
|
130
173
|
}
|
|
131
174
|
}
|
|
175
|
+
async getTrc20Balance(params) {
|
|
176
|
+
const result = await this.getTronWeb().transactionBuilder.triggerConstantContract(params.contractAddress, 'balanceOf(address)', {}, [{ type: 'address', value: params.address }], params.address);
|
|
177
|
+
const [balance] = result.constant_result ?? [];
|
|
178
|
+
if (!balance)
|
|
179
|
+
throw new Error('[tron] balanceOf call returned no data');
|
|
180
|
+
return BigInt(`0x${balance}`).toString();
|
|
181
|
+
}
|
|
182
|
+
// A direct selector call - contract().at() would first fetch the ABI, doubling the requests
|
|
183
|
+
async getTrc20Allowance(params) {
|
|
184
|
+
const tronWeb = this.getTronWeb();
|
|
185
|
+
const result = await tronWeb.transactionBuilder.triggerConstantContract(params.contractAddress, 'allowance(address,address)', {}, [
|
|
186
|
+
{ type: 'address', value: params.owner },
|
|
187
|
+
{ type: 'address', value: params.spender },
|
|
188
|
+
], params.owner);
|
|
189
|
+
const [allowance] = result.constant_result ?? [];
|
|
190
|
+
if (!allowance)
|
|
191
|
+
throw new Error('[tron] allowance call returned no data');
|
|
192
|
+
return BigInt(`0x${allowance}`).toString();
|
|
193
|
+
}
|
|
194
|
+
// Accounts exist on-chain only once they have received TRX; a fresh address returns {}
|
|
195
|
+
async isAccountActivated(address) {
|
|
196
|
+
const response = await fetch(`${this.rpcUrl}/wallet/getaccount`, {
|
|
197
|
+
method: 'POST',
|
|
198
|
+
headers: this.tronGridHeaders,
|
|
199
|
+
body: JSON.stringify({ address, visible: true }),
|
|
200
|
+
});
|
|
201
|
+
if (!response.ok)
|
|
202
|
+
throw new Error(`[tron] getaccount failed: ${response.status}`);
|
|
203
|
+
const data = await response.json();
|
|
204
|
+
return !!data.address;
|
|
205
|
+
}
|
|
132
206
|
getTxHistory(_params) {
|
|
133
207
|
throw new Error('Transaction history is not supported for TRON');
|
|
134
208
|
}
|
|
@@ -146,13 +220,11 @@ export class TronApi {
|
|
|
146
220
|
body: JSON.stringify({ value: params.txid, visible: true }),
|
|
147
221
|
}),
|
|
148
222
|
]);
|
|
149
|
-
if (!txResponse.ok)
|
|
223
|
+
if (!txResponse.ok)
|
|
150
224
|
return null;
|
|
151
|
-
}
|
|
152
225
|
const tx = await txResponse.json();
|
|
153
|
-
if (!tx || !tx.txID)
|
|
226
|
+
if (!tx || !tx.txID)
|
|
154
227
|
return null;
|
|
155
|
-
}
|
|
156
228
|
let blockNumber = 0;
|
|
157
229
|
let blockTimeStamp = 0;
|
|
158
230
|
let fee = '0';
|
|
@@ -186,9 +258,8 @@ export class TronApi {
|
|
|
186
258
|
headers: this.tronGridHeaders,
|
|
187
259
|
body: JSON.stringify({ num: params.height }),
|
|
188
260
|
});
|
|
189
|
-
if (!response.ok)
|
|
261
|
+
if (!response.ok)
|
|
190
262
|
return null;
|
|
191
|
-
}
|
|
192
263
|
return await response.json();
|
|
193
264
|
}
|
|
194
265
|
async sendTx(params) {
|
|
@@ -200,9 +271,8 @@ export class TronApi {
|
|
|
200
271
|
throw new Error(result.message || JSON.stringify(result) || 'Failed to broadcast transaction');
|
|
201
272
|
}
|
|
202
273
|
const txid = result.txid || result.transaction?.txID;
|
|
203
|
-
if (!txid)
|
|
274
|
+
if (!txid)
|
|
204
275
|
throw new Error('Transaction ID not found in broadcast result');
|
|
205
|
-
}
|
|
206
276
|
return txid;
|
|
207
277
|
}
|
|
208
278
|
catch (error) {
|
|
@@ -210,69 +280,142 @@ export class TronApi {
|
|
|
210
280
|
}
|
|
211
281
|
}
|
|
212
282
|
async getChainPrices() {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
return
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
283
|
+
const params = await this.getTronWeb().trx.getChainParameters();
|
|
284
|
+
const param = (key) => {
|
|
285
|
+
const value = params.find(p => p.key === key)?.value;
|
|
286
|
+
if (value === undefined)
|
|
287
|
+
throw new Error(`[tron] chain parameter ${key} missing`);
|
|
288
|
+
return value;
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
bandwidthPrice: param('getTransactionFee'),
|
|
292
|
+
energyPrice: param('getEnergyFee'),
|
|
293
|
+
memoFee: param('getMemoFee'),
|
|
294
|
+
};
|
|
223
295
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
296
|
+
// A plain address answers getcontract with {} and pays in full
|
|
297
|
+
async getContractEnergyShare(contractAddress) {
|
|
298
|
+
const contract = await this.getContract(contractAddress);
|
|
299
|
+
if (!contract.origin_address)
|
|
300
|
+
return TRON_CALLER_PAYS_ALL;
|
|
301
|
+
// TronGrid omits zero-valued fields, so a contract whose deployer pays everything carries no percent at all
|
|
302
|
+
const callerPercent = contract.consume_user_resource_percent ?? 0;
|
|
303
|
+
if (callerPercent >= 100)
|
|
304
|
+
return TRON_CALLER_PAYS_ALL;
|
|
305
|
+
return {
|
|
306
|
+
callerPercent,
|
|
307
|
+
originEnergyLimit: contract.origin_energy_limit || TRON_CREATOR_DEFAULT_ENERGY_LIMIT,
|
|
308
|
+
originEnergyAvailable: await this.getOriginEnergyAvailable(contract.origin_address),
|
|
309
|
+
};
|
|
236
310
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
311
|
+
getContract(contractAddress) {
|
|
312
|
+
const cached = this.contracts.get(contractAddress);
|
|
313
|
+
if (cached && Date.now() - cached.readAt < TRON_CONTRACT_TTL_MS)
|
|
314
|
+
return cached.value;
|
|
315
|
+
const value = this.post('/wallet/getcontract', {
|
|
316
|
+
value: contractAddress,
|
|
317
|
+
visible: true,
|
|
318
|
+
})
|
|
319
|
+
.then(body => {
|
|
320
|
+
if (body.Error)
|
|
321
|
+
throw new Error(`[tron] getcontract failed: ${body.Error}`);
|
|
322
|
+
// only a contract record is worth keeping; an empty body is re-read next time
|
|
323
|
+
if (!body.origin_address && this.contracts.get(contractAddress)?.value === value) {
|
|
324
|
+
this.contracts.delete(contractAddress);
|
|
325
|
+
}
|
|
326
|
+
return body;
|
|
327
|
+
})
|
|
328
|
+
.catch(err => {
|
|
329
|
+
if (this.contracts.get(contractAddress)?.value === value) {
|
|
330
|
+
this.contracts.delete(contractAddress);
|
|
331
|
+
}
|
|
332
|
+
throw err;
|
|
333
|
+
});
|
|
334
|
+
this.contracts.set(contractAddress, { readAt: Date.now(), value });
|
|
335
|
+
return value;
|
|
253
336
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
337
|
+
// A failed share lookup prices the simulation as if the caller paid in full, unless the caller must not guess
|
|
338
|
+
async getPricingContext(contractAddress, requireEnergyShare = false) {
|
|
339
|
+
const [{ energyPrice }, share] = await Promise.all([
|
|
340
|
+
this.getChainPrices(),
|
|
341
|
+
this.getContractEnergyShare(contractAddress).catch((error) => {
|
|
342
|
+
if (requireEnergyShare)
|
|
343
|
+
throw error;
|
|
344
|
+
console.warn(`[tron] energy share lookup failed for ${contractAddress}, pricing in full`, error);
|
|
345
|
+
return TRON_CALLER_PAYS_ALL;
|
|
346
|
+
}),
|
|
347
|
+
]);
|
|
348
|
+
return { energyPrice, share };
|
|
349
|
+
}
|
|
350
|
+
getOriginEnergyAvailable(originAddress) {
|
|
351
|
+
const cached = this.originEnergy.get(originAddress);
|
|
352
|
+
if (cached && Date.now() - cached.readAt < TRON_ORIGIN_ENERGY_TTL_MS)
|
|
353
|
+
return cached.value;
|
|
354
|
+
const value = this.post('/wallet/getaccountresource', { address: originAddress, visible: true })
|
|
355
|
+
.then(body => {
|
|
356
|
+
if (body.Error)
|
|
357
|
+
throw new Error(`[tron] getaccountresource failed: ${body.Error}`);
|
|
358
|
+
return Math.max(0, (body.EnergyLimit ?? 0) - (body.EnergyUsed ?? 0));
|
|
359
|
+
})
|
|
360
|
+
.catch(err => {
|
|
361
|
+
if (this.originEnergy.get(originAddress)?.value === value) {
|
|
362
|
+
this.originEnergy.delete(originAddress);
|
|
363
|
+
}
|
|
364
|
+
throw err;
|
|
365
|
+
});
|
|
366
|
+
this.originEnergy.set(originAddress, { readAt: Date.now(), value });
|
|
367
|
+
return value;
|
|
368
|
+
}
|
|
369
|
+
async post(path, body) {
|
|
370
|
+
const response = await fetch(`${this.rpcUrl}${path}`, {
|
|
371
|
+
method: 'POST',
|
|
372
|
+
headers: this.tronGridHeaders,
|
|
373
|
+
body: JSON.stringify(body),
|
|
374
|
+
});
|
|
375
|
+
if (!response.ok)
|
|
376
|
+
throw new Error(`[tron] ${path} failed: ${response.status}`);
|
|
377
|
+
return response.json();
|
|
378
|
+
}
|
|
379
|
+
async estimateTrc20TransferFee(params) {
|
|
380
|
+
const tronWeb = this.getTronWeb();
|
|
381
|
+
const { energyPrice, share } = await this.getPricingContext(params.contractAddress, params.requireEnergyShare);
|
|
382
|
+
const result = await tronWeb.transactionBuilder.triggerConstantContract(params.contractAddress, 'transfer(address,uint256)', {}, [
|
|
383
|
+
{ type: 'address', value: params.to },
|
|
384
|
+
{ type: 'uint256', value: params.amount },
|
|
385
|
+
], params.from);
|
|
386
|
+
const energy = this.getSimulatedEnergy(result, 'trc20 transfer');
|
|
387
|
+
return String(getCallerEnergy(energy, share) * energyPrice);
|
|
388
|
+
}
|
|
389
|
+
async estimateContractCallFee(params) {
|
|
390
|
+
const { energyPrice, share } = await this.getPricingContext(params.contractAddress, params.requireEnergyShare);
|
|
391
|
+
const response = await fetch(`${this.rpcUrl}/wallet/triggerconstantcontract`, {
|
|
392
|
+
method: 'POST',
|
|
393
|
+
headers: { 'Content-Type': 'application/json', ...this.tronGridHeaders },
|
|
394
|
+
body: JSON.stringify({
|
|
395
|
+
owner_address: params.from,
|
|
396
|
+
contract_address: params.contractAddress,
|
|
397
|
+
data: params.data.startsWith('0x') ? params.data.slice(2) : params.data,
|
|
398
|
+
call_value: Number(params.callValue) || 0,
|
|
399
|
+
visible: true,
|
|
400
|
+
}),
|
|
401
|
+
});
|
|
402
|
+
if (!response.ok) {
|
|
403
|
+
throw new Error(`[tron] contract call simulation request failed: ${response.status}`);
|
|
266
404
|
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
405
|
+
const result = await response.json();
|
|
406
|
+
const energy = this.getSimulatedEnergy(result, 'contract call');
|
|
407
|
+
return String(getCallerEnergy(energy, share) * energyPrice);
|
|
408
|
+
}
|
|
409
|
+
// A revert still reports result.result: true - the failure is only visible on the transaction's ret
|
|
410
|
+
isReverted(result) {
|
|
411
|
+
const failed = result.transaction?.ret?.some(ret => ret.ret === 'FAILED');
|
|
412
|
+
return result.result?.result !== true || Boolean(failed);
|
|
413
|
+
}
|
|
414
|
+
// Trusting a revert's partial energy would underestimate
|
|
415
|
+
getSimulatedEnergy(result, label) {
|
|
416
|
+
if (this.isReverted(result) || !result.energy_used) {
|
|
417
|
+
throw new Error(`[tron] ${label} simulation failed: ${result.result?.message ?? 'unknown error'}`);
|
|
276
418
|
}
|
|
419
|
+
return result.energy_used;
|
|
277
420
|
}
|
|
278
421
|
}
|
package/dist/esm/tron/types.d.ts
CHANGED
|
@@ -29,6 +29,9 @@ export interface TronTx {
|
|
|
29
29
|
amount?: number;
|
|
30
30
|
owner_address?: string;
|
|
31
31
|
to_address?: string;
|
|
32
|
+
contract_address?: string;
|
|
33
|
+
call_value?: number;
|
|
34
|
+
data?: string;
|
|
32
35
|
};
|
|
33
36
|
type_url: string;
|
|
34
37
|
};
|
|
@@ -38,6 +41,7 @@ export interface TronTx {
|
|
|
38
41
|
ref_block_hash: string;
|
|
39
42
|
expiration: number;
|
|
40
43
|
timestamp: number;
|
|
44
|
+
fee_limit?: number;
|
|
41
45
|
};
|
|
42
46
|
raw_data_hex: string;
|
|
43
47
|
txID: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/unchained-client",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.16.0",
|
|
4
4
|
"repository": "https://github.com/shapeshift/web",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"bs58": "^5.0.0",
|
|
28
28
|
"ethers": "6.11.1",
|
|
29
29
|
"isomorphic-ws": "^4.0.1",
|
|
30
|
-
"viem": "2.
|
|
30
|
+
"viem": "2.55.11",
|
|
31
31
|
"ws": "^8.17.1",
|
|
32
|
-
"@shapeshiftoss/
|
|
33
|
-
"@shapeshiftoss/
|
|
34
|
-
"@shapeshiftoss/
|
|
32
|
+
"@shapeshiftoss/contracts": "^1.1.0",
|
|
33
|
+
"@shapeshiftoss/caip": "^8.17.2",
|
|
34
|
+
"@shapeshiftoss/utils": "^1.4.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@openapitools/openapi-generator-cli": "^2.5.1"
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mayachain Unchained API
|
|
3
|
-
* Provides access to mayachain chain data.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
* @export
|
|
15
|
-
* @interface AffiliateFee
|
|
16
|
-
*/
|
|
17
|
-
export interface AffiliateFee {
|
|
18
|
-
/**
|
|
19
|
-
*
|
|
20
|
-
* @type {string}
|
|
21
|
-
* @memberof AffiliateFee
|
|
22
|
-
*/
|
|
23
|
-
address?: string;
|
|
24
|
-
/**
|
|
25
|
-
*
|
|
26
|
-
* @type {string}
|
|
27
|
-
* @memberof AffiliateFee
|
|
28
|
-
*/
|
|
29
|
-
amount?: string;
|
|
30
|
-
/**
|
|
31
|
-
*
|
|
32
|
-
* @type {string}
|
|
33
|
-
* @memberof AffiliateFee
|
|
34
|
-
*/
|
|
35
|
-
asset?: string;
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
* @type {string}
|
|
39
|
-
* @memberof AffiliateFee
|
|
40
|
-
*/
|
|
41
|
-
blockHash?: string;
|
|
42
|
-
/**
|
|
43
|
-
*
|
|
44
|
-
* @type {number}
|
|
45
|
-
* @memberof AffiliateFee
|
|
46
|
-
*/
|
|
47
|
-
blockHeight?: number;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @type {number}
|
|
51
|
-
* @memberof AffiliateFee
|
|
52
|
-
*/
|
|
53
|
-
timestamp?: number;
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
* @type {string}
|
|
57
|
-
* @memberof AffiliateFee
|
|
58
|
-
*/
|
|
59
|
-
txId?: string;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Check if a given object implements the AffiliateFee interface.
|
|
63
|
-
*/
|
|
64
|
-
export declare function instanceOfAffiliateFee(value: object): boolean;
|
|
65
|
-
export declare function AffiliateFeeFromJSON(json: any): AffiliateFee;
|
|
66
|
-
export declare function AffiliateFeeFromJSONTyped(json: any, ignoreDiscriminator: boolean): AffiliateFee;
|
|
67
|
-
export declare function AffiliateFeeToJSON(value?: AffiliateFee | null): any;
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
/**
|
|
6
|
-
* Mayachain Unchained API
|
|
7
|
-
* Provides access to mayachain chain data.
|
|
8
|
-
*
|
|
9
|
-
* The version of the OpenAPI document: 1.0.0
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
13
|
-
* https://openapi-generator.tech
|
|
14
|
-
* Do not edit the class manually.
|
|
15
|
-
*/
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AffiliateFeeToJSON = exports.AffiliateFeeFromJSONTyped = exports.AffiliateFeeFromJSON = exports.instanceOfAffiliateFee = void 0;
|
|
18
|
-
const runtime_1 = require("../runtime");
|
|
19
|
-
/**
|
|
20
|
-
* Check if a given object implements the AffiliateFee interface.
|
|
21
|
-
*/
|
|
22
|
-
function instanceOfAffiliateFee(value) {
|
|
23
|
-
let isInstance = true;
|
|
24
|
-
return isInstance;
|
|
25
|
-
}
|
|
26
|
-
exports.instanceOfAffiliateFee = instanceOfAffiliateFee;
|
|
27
|
-
function AffiliateFeeFromJSON(json) {
|
|
28
|
-
return AffiliateFeeFromJSONTyped(json, false);
|
|
29
|
-
}
|
|
30
|
-
exports.AffiliateFeeFromJSON = AffiliateFeeFromJSON;
|
|
31
|
-
function AffiliateFeeFromJSONTyped(json, ignoreDiscriminator) {
|
|
32
|
-
if ((json === undefined) || (json === null)) {
|
|
33
|
-
return json;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
'address': !(0, runtime_1.exists)(json, 'address') ? undefined : json['address'],
|
|
37
|
-
'amount': !(0, runtime_1.exists)(json, 'amount') ? undefined : json['amount'],
|
|
38
|
-
'asset': !(0, runtime_1.exists)(json, 'asset') ? undefined : json['asset'],
|
|
39
|
-
'blockHash': !(0, runtime_1.exists)(json, 'blockHash') ? undefined : json['blockHash'],
|
|
40
|
-
'blockHeight': !(0, runtime_1.exists)(json, 'blockHeight') ? undefined : json['blockHeight'],
|
|
41
|
-
'timestamp': !(0, runtime_1.exists)(json, 'timestamp') ? undefined : json['timestamp'],
|
|
42
|
-
'txId': !(0, runtime_1.exists)(json, 'txId') ? undefined : json['txId'],
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
exports.AffiliateFeeFromJSONTyped = AffiliateFeeFromJSONTyped;
|
|
46
|
-
function AffiliateFeeToJSON(value) {
|
|
47
|
-
if (value === undefined) {
|
|
48
|
-
return undefined;
|
|
49
|
-
}
|
|
50
|
-
if (value === null) {
|
|
51
|
-
return null;
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
'address': value.address,
|
|
55
|
-
'amount': value.amount,
|
|
56
|
-
'asset': value.asset,
|
|
57
|
-
'blockHash': value.blockHash,
|
|
58
|
-
'blockHeight': value.blockHeight,
|
|
59
|
-
'timestamp': value.timestamp,
|
|
60
|
-
'txId': value.txId,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
exports.AffiliateFeeToJSON = AffiliateFeeToJSON;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mayachain Unchained API
|
|
3
|
-
* Provides access to mayachain chain data.
|
|
4
|
-
*
|
|
5
|
-
* The version of the OpenAPI document: 1.0.0
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
-
* https://openapi-generator.tech
|
|
10
|
-
* Do not edit the class manually.
|
|
11
|
-
*/
|
|
12
|
-
import type { AffiliateFee } from './AffiliateFee';
|
|
13
|
-
/**
|
|
14
|
-
* Contains info about affiliate fee history
|
|
15
|
-
* @export
|
|
16
|
-
* @interface AffiliateFees
|
|
17
|
-
*/
|
|
18
|
-
export interface AffiliateFees {
|
|
19
|
-
/**
|
|
20
|
-
* Affiliate fees
|
|
21
|
-
* @type {Array<AffiliateFee>}
|
|
22
|
-
* @memberof AffiliateFees
|
|
23
|
-
*/
|
|
24
|
-
fees: Array<AffiliateFee>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Check if a given object implements the AffiliateFees interface.
|
|
28
|
-
*/
|
|
29
|
-
export declare function instanceOfAffiliateFees(value: object): boolean;
|
|
30
|
-
export declare function AffiliateFeesFromJSON(json: any): AffiliateFees;
|
|
31
|
-
export declare function AffiliateFeesFromJSONTyped(json: any, ignoreDiscriminator: boolean): AffiliateFees;
|
|
32
|
-
export declare function AffiliateFeesToJSON(value?: AffiliateFees | null): any;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// @ts-nocheck
|
|
3
|
-
/* tslint:disable */
|
|
4
|
-
/* eslint-disable */
|
|
5
|
-
/**
|
|
6
|
-
* Mayachain Unchained API
|
|
7
|
-
* Provides access to mayachain chain data.
|
|
8
|
-
*
|
|
9
|
-
* The version of the OpenAPI document: 1.0.0
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
13
|
-
* https://openapi-generator.tech
|
|
14
|
-
* Do not edit the class manually.
|
|
15
|
-
*/
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.AffiliateFeesToJSON = exports.AffiliateFeesFromJSONTyped = exports.AffiliateFeesFromJSON = exports.instanceOfAffiliateFees = void 0;
|
|
18
|
-
const AffiliateFee_1 = require("./AffiliateFee");
|
|
19
|
-
/**
|
|
20
|
-
* Check if a given object implements the AffiliateFees interface.
|
|
21
|
-
*/
|
|
22
|
-
function instanceOfAffiliateFees(value) {
|
|
23
|
-
let isInstance = true;
|
|
24
|
-
isInstance = isInstance && "fees" in value;
|
|
25
|
-
return isInstance;
|
|
26
|
-
}
|
|
27
|
-
exports.instanceOfAffiliateFees = instanceOfAffiliateFees;
|
|
28
|
-
function AffiliateFeesFromJSON(json) {
|
|
29
|
-
return AffiliateFeesFromJSONTyped(json, false);
|
|
30
|
-
}
|
|
31
|
-
exports.AffiliateFeesFromJSON = AffiliateFeesFromJSON;
|
|
32
|
-
function AffiliateFeesFromJSONTyped(json, ignoreDiscriminator) {
|
|
33
|
-
if ((json === undefined) || (json === null)) {
|
|
34
|
-
return json;
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
'fees': (json['fees'].map(AffiliateFee_1.AffiliateFeeFromJSON)),
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
exports.AffiliateFeesFromJSONTyped = AffiliateFeesFromJSONTyped;
|
|
41
|
-
function AffiliateFeesToJSON(value) {
|
|
42
|
-
if (value === undefined) {
|
|
43
|
-
return undefined;
|
|
44
|
-
}
|
|
45
|
-
if (value === null) {
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
48
|
-
return {
|
|
49
|
-
'fees': (value.fees.map(AffiliateFee_1.AffiliateFeeToJSON)),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
exports.AffiliateFeesToJSON = AffiliateFeesToJSON;
|