@ledgerhq/live-cli 24.15.1-nightly.2 → 24.15.1-nightly.4
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/lib/cli.js +1057 -507
- package/package.json +2 -2
package/lib/cli.js
CHANGED
|
@@ -187,7 +187,7 @@ function getAltStatusMessage(code) {
|
|
|
187
187
|
return "Internal error, please report";
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
var AccountNameRequiredError, AccountNotSupported, AccountAwaitingSendPendingOperations, AmountRequired, BluetoothRequired, BtcUnmatchedApp, CantOpenDevice, CashAddrNotSupported, ClaimRewardsFeesWarning, CurrencyNotSupported, DeviceAppVerifyNotSupported, DeviceGenuineSocketEarlyClose, DeviceNotGenuineError, DeviceOnDashboardExpected, DeviceOnDashboardUnexpected, DeviceInOSUExpected, DeviceHalted, DeviceNameInvalid, DeviceSocketFail, DeviceSocketNoBulkStatus, DeviceNeedsRestart, UnresponsiveDeviceError, DisconnectedDevice, DisconnectedDeviceDuringOperation, DeviceExtractOnboardingStateError, DeviceOnboardingStatePollingError, EnpointConfigError, EthAppPleaseEnableContractData, FeeEstimationFailed, FirmwareNotRecognized, HardResetFail, InvalidXRPTag, InvalidAddress, InvalidNonce, InvalidAddressBecauseDestinationIsAlsoSource, LatestMCUInstalledError, UnknownMCU, LedgerAPIError, LedgerAPIErrorWithMessage, LedgerAPINotAvailable, ManagerAppAlreadyInstalledError, ManagerAppRelyOnBTCError, ManagerAppDepInstallRequired, ManagerAppDepUninstallRequired, ManagerDeviceLockedError, ManagerFirmwareNotEnoughSpaceError, ManagerNotEnoughSpaceError, ManagerUninstallBTCDep, NetworkDown, NetworkError, NoAddressesFound, NotEnoughBalance, NotEnoughBalanceSwap, NotEnoughBalanceToDelegate, NotEnoughBalanceInParentAccount, NotEnoughSpendableBalance, NotEnoughBalanceBecauseDestinationNotCreated, NoAccessToCamera, NotEnoughGas, NotEnoughGasSwap, TronEmptyAccount, MaybeKeepTronAccountAlive, NotSupportedLegacyAddress, GasLessThanEstimate, PriorityFeeTooLow, PriorityFeeTooHigh, PriorityFeeHigherThanMaxFee, MaxFeeTooLow, PasswordsDontMatchError, PasswordIncorrectError, RecommendSubAccountsToEmpty, RecommendUndelegation, TimeoutTagged, UnexpectedBootloader, MCUNotGenuineToDashboard, RecipientRequired, UnavailableTezosOriginatedAccountReceive, UnavailableTezosOriginatedAccountSend, UpdateFetchFileFail, UpdateIncorrectHash, UpdateIncorrectSig, UpdateYourApp, UserRefusedDeviceNameChange, UserRefusedAddress, UserRefusedFirmwareUpdate, UserRefusedAllowManager, UserRefusedOnDevice, PinNotSet, ExpertModeRequired, TransportOpenUserCancelled, TransportInterfaceNotAvailable, TransportRaceCondition, TransportWebUSBGestureRequired, TransactionHasBeenValidatedError, TransportExchangeTimeoutError, DeviceShouldStayInApp, WebsocketConnectionError, WebsocketConnectionFailed, WrongDeviceForAccount, WrongDeviceForAccountPayout, WrongDeviceForAccountRefund, WrongAppForCurrency, ETHAddressNonEIP, CantScanQRCode, FeeNotLoaded, FeeNotLoadedSwap, FeeRequired, FeeTooHigh, PendingOperation, SyncError, PairingFailed, PeerRemovedPairing, GenuineCheckFailed, LedgerAPI4xx, LedgerAPI5xx, FirmwareOrAppUpdateRequired, ReplacementTransactionUnderpriced, OpReturnDataSizeLimit, DustLimit, LanguageNotFound, NoDBPathGiven, DBWrongPassword, DBNotReset, SequenceNumberError, DisabledTransactionBroadcastError, HwTransportErrorType, TransportError, StatusCodes, TransportStatusError, LockedDeviceError;
|
|
190
|
+
var AccountNameRequiredError, AccountNotSupported, AccountAwaitingSendPendingOperations, AmountRequired, BluetoothRequired, BtcUnmatchedApp, CantOpenDevice, CashAddrNotSupported, ClaimRewardsFeesWarning, CurrencyNotSupported, DeviceAppVerifyNotSupported, DeviceGenuineSocketEarlyClose, DeviceNotGenuineError, DeviceOnDashboardExpected, DeviceOnDashboardUnexpected, DeviceInOSUExpected, DeviceHalted, DeviceNameInvalid, DeviceSocketFail, DeviceSocketNoBulkStatus, DeviceNeedsRestart, UnresponsiveDeviceError, DisconnectedDevice, DisconnectedDeviceDuringOperation, DeviceExtractOnboardingStateError, DeviceOnboardingStatePollingError, EnpointConfigError, EthAppPleaseEnableContractData, FeeEstimationFailed, FirmwareNotRecognized, HardResetFail, InvalidXRPTag, InvalidAddress, InvalidNonce, InvalidAddressBecauseDestinationIsAlsoSource, LatestMCUInstalledError, UnknownMCU, LedgerAPIError, LedgerAPIErrorWithMessage, LedgerAPINotAvailable, ManagerAppAlreadyInstalledError, ManagerAppRelyOnBTCError, ManagerAppDepInstallRequired, ManagerAppDepUninstallRequired, ManagerDeviceLockedError, ManagerFirmwareNotEnoughSpaceError, ManagerNotEnoughSpaceError, ManagerUninstallBTCDep, NetworkDown, NetworkError, NoAddressesFound, NotEnoughBalance, NotEnoughBalanceFees, NotEnoughBalanceSwap, NotEnoughBalanceToDelegate, NotEnoughBalanceInParentAccount, NotEnoughSpendableBalance, NotEnoughBalanceBecauseDestinationNotCreated, NoAccessToCamera, NotEnoughGas, NotEnoughGasSwap, TronEmptyAccount, MaybeKeepTronAccountAlive, NotSupportedLegacyAddress, GasLessThanEstimate, PriorityFeeTooLow, PriorityFeeTooHigh, PriorityFeeHigherThanMaxFee, MaxFeeTooLow, PasswordsDontMatchError, PasswordIncorrectError, RecommendSubAccountsToEmpty, RecommendUndelegation, TimeoutTagged, UnexpectedBootloader, MCUNotGenuineToDashboard, RecipientRequired, UnavailableTezosOriginatedAccountReceive, UnavailableTezosOriginatedAccountSend, UpdateFetchFileFail, UpdateIncorrectHash, UpdateIncorrectSig, UpdateYourApp, UserRefusedDeviceNameChange, UserRefusedAddress, UserRefusedFirmwareUpdate, UserRefusedAllowManager, UserRefusedOnDevice, PinNotSet, ExpertModeRequired, TransportOpenUserCancelled, TransportInterfaceNotAvailable, TransportRaceCondition, TransportWebUSBGestureRequired, TransactionHasBeenValidatedError, TransportExchangeTimeoutError, DeviceShouldStayInApp, WebsocketConnectionError, WebsocketConnectionFailed, WrongDeviceForAccount, WrongDeviceForAccountPayout, WrongDeviceForAccountRefund, WrongAppForCurrency, ETHAddressNonEIP, CantScanQRCode, FeeNotLoaded, FeeNotLoadedSwap, FeeRequired, FeeTooHigh, PendingOperation, SyncError, PairingFailed, PeerRemovedPairing, GenuineCheckFailed, LedgerAPI4xx, LedgerAPI5xx, FirmwareOrAppUpdateRequired, ReplacementTransactionUnderpriced, OpReturnDataSizeLimit, DustLimit, LanguageNotFound, NoDBPathGiven, DBWrongPassword, DBNotReset, SequenceNumberError, DisabledTransactionBroadcastError, HwTransportErrorType, TransportError, StatusCodes, TransportStatusError, LockedDeviceError;
|
|
191
191
|
var init_lib_es = __esm({
|
|
192
192
|
"../../libs/ledgerjs/packages/errors/lib-es/index.js"() {
|
|
193
193
|
"use strict";
|
|
@@ -244,6 +244,7 @@ var init_lib_es = __esm({
|
|
|
244
244
|
NetworkError = createCustomErrorClass("NetworkError");
|
|
245
245
|
NoAddressesFound = createCustomErrorClass("NoAddressesFound");
|
|
246
246
|
NotEnoughBalance = createCustomErrorClass("NotEnoughBalance");
|
|
247
|
+
NotEnoughBalanceFees = createCustomErrorClass("NotEnoughBalanceFees");
|
|
247
248
|
NotEnoughBalanceSwap = createCustomErrorClass("NotEnoughBalanceSwap");
|
|
248
249
|
NotEnoughBalanceToDelegate = createCustomErrorClass("NotEnoughBalanceToDelegate");
|
|
249
250
|
NotEnoughBalanceInParentAccount = createCustomErrorClass("NotEnoughBalanceInParentAccount");
|
|
@@ -63794,14 +63795,14 @@ var require_crypto = __commonJS({
|
|
|
63794
63795
|
"../../node_modules/.pnpm/bip32@2.0.6/node_modules/bip32/src/crypto.js"(exports2) {
|
|
63795
63796
|
"use strict";
|
|
63796
63797
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
63797
|
-
var
|
|
63798
|
+
var createHash4 = require_create_hash();
|
|
63798
63799
|
var createHmac3 = require_create_hmac();
|
|
63799
63800
|
function hash1605(buffer2) {
|
|
63800
|
-
const sha256Hash =
|
|
63801
|
+
const sha256Hash = createHash4("sha256").update(buffer2).digest();
|
|
63801
63802
|
try {
|
|
63802
|
-
return
|
|
63803
|
+
return createHash4("rmd160").update(sha256Hash).digest();
|
|
63803
63804
|
} catch (err) {
|
|
63804
|
-
return
|
|
63805
|
+
return createHash4("ripemd160").update(sha256Hash).digest();
|
|
63805
63806
|
}
|
|
63806
63807
|
}
|
|
63807
63808
|
exports2.hash160 = hash1605;
|
|
@@ -64001,11 +64002,11 @@ var require_base = __commonJS({
|
|
|
64001
64002
|
var require_bs58check = __commonJS({
|
|
64002
64003
|
"../../node_modules/.pnpm/bs58check@2.1.2/node_modules/bs58check/index.js"(exports2, module2) {
|
|
64003
64004
|
"use strict";
|
|
64004
|
-
var
|
|
64005
|
+
var createHash4 = require_create_hash();
|
|
64005
64006
|
var bs58checkBase2 = require_base();
|
|
64006
64007
|
function sha256x2(buffer2) {
|
|
64007
|
-
var tmp =
|
|
64008
|
-
return
|
|
64008
|
+
var tmp = createHash4("sha256").update(buffer2).digest();
|
|
64009
|
+
return createHash4("sha256").update(tmp).digest();
|
|
64009
64010
|
}
|
|
64010
64011
|
module2.exports = bs58checkBase2(sha256x2);
|
|
64011
64012
|
}
|
|
@@ -72706,21 +72707,21 @@ var require_crypto2 = __commonJS({
|
|
|
72706
72707
|
"../../node_modules/.pnpm/bitcoinjs-lib@5.2.0/node_modules/bitcoinjs-lib/src/crypto.js"(exports2) {
|
|
72707
72708
|
"use strict";
|
|
72708
72709
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
72709
|
-
var
|
|
72710
|
+
var createHash4 = require_create_hash();
|
|
72710
72711
|
function ripemd1608(buffer2) {
|
|
72711
72712
|
try {
|
|
72712
|
-
return
|
|
72713
|
+
return createHash4("rmd160").update(buffer2).digest();
|
|
72713
72714
|
} catch (err) {
|
|
72714
|
-
return
|
|
72715
|
+
return createHash4("ripemd160").update(buffer2).digest();
|
|
72715
72716
|
}
|
|
72716
72717
|
}
|
|
72717
72718
|
exports2.ripemd160 = ripemd1608;
|
|
72718
72719
|
function sha13(buffer2) {
|
|
72719
|
-
return
|
|
72720
|
+
return createHash4("sha1").update(buffer2).digest();
|
|
72720
72721
|
}
|
|
72721
72722
|
exports2.sha1 = sha13;
|
|
72722
72723
|
function sha25616(buffer2) {
|
|
72723
|
-
return
|
|
72724
|
+
return createHash4("sha256").update(buffer2).digest();
|
|
72724
72725
|
}
|
|
72725
72726
|
exports2.sha256 = sha25616;
|
|
72726
72727
|
function hash1605(buffer2) {
|
|
@@ -104261,8 +104262,8 @@ var require_lib6 = __commonJS({
|
|
|
104261
104262
|
const buffer2 = await crypto36.web.subtle.digest("SHA-256", concatBytes9(...messages));
|
|
104262
104263
|
return new Uint8Array(buffer2);
|
|
104263
104264
|
} else if (crypto36.node) {
|
|
104264
|
-
const { createHash:
|
|
104265
|
-
const hash12 =
|
|
104265
|
+
const { createHash: createHash4 } = crypto36.node;
|
|
104266
|
+
const hash12 = createHash4("sha256");
|
|
104266
104267
|
messages.forEach((m63) => hash12.update(m63));
|
|
104267
104268
|
return Uint8Array.from(hash12.digest());
|
|
104268
104269
|
} else {
|
|
@@ -232335,7 +232336,7 @@ var require_blake2b4 = __commonJS({
|
|
|
232335
232336
|
return n59.toString(16);
|
|
232336
232337
|
}
|
|
232337
232338
|
var Proto = Blake2b;
|
|
232338
|
-
module2.exports = function
|
|
232339
|
+
module2.exports = function createHash4(outlen, key2, salt2, personal, noAssert) {
|
|
232339
232340
|
if (noAssert !== true) {
|
|
232340
232341
|
assert10(outlen >= BYTES_MIN, "outlen must be at least " + BYTES_MIN + ", was given " + outlen);
|
|
232341
232342
|
assert10(outlen <= BYTES_MAX, "outlen must be at most " + BYTES_MAX + ", was given " + outlen);
|
|
@@ -322749,10 +322750,10 @@ var require_server4 = __commonJS({
|
|
|
322749
322750
|
}
|
|
322750
322751
|
}, _callee, this);
|
|
322751
322752
|
}));
|
|
322752
|
-
function
|
|
322753
|
+
function getAccount11(_x) {
|
|
322753
322754
|
return _getAccount2.apply(this, arguments);
|
|
322754
322755
|
}
|
|
322755
|
-
return
|
|
322756
|
+
return getAccount11;
|
|
322756
322757
|
}()
|
|
322757
322758
|
}, {
|
|
322758
322759
|
key: "getHealth",
|
|
@@ -328322,7 +328323,7 @@ var require_blake2b7 = __commonJS({
|
|
|
328322
328323
|
return n59.toString(16);
|
|
328323
328324
|
}
|
|
328324
328325
|
var Proto = Blake2b;
|
|
328325
|
-
module2.exports = function
|
|
328326
|
+
module2.exports = function createHash4(outlen, key2, salt2, personal, noAssert) {
|
|
328326
328327
|
if (noAssert !== true) {
|
|
328327
328328
|
assert10(outlen >= BYTES_MIN, "outlen must be at least " + BYTES_MIN + ", was given " + outlen);
|
|
328328
328329
|
assert10(outlen <= BYTES_MAX, "outlen must be at most " + BYTES_MAX + ", was given " + outlen);
|
|
@@ -352355,11 +352356,11 @@ var require_TonClient4 = __commonJS({
|
|
|
352355
352356
|
*/
|
|
352356
352357
|
async getLastBlock() {
|
|
352357
352358
|
let res = await __classPrivateFieldGet9(this, _TonClient4_axios, "f").get(__classPrivateFieldGet9(this, _TonClient4_endpoint, "f") + "/block/latest", { adapter: __classPrivateFieldGet9(this, _TonClient4_adapter, "f"), timeout: __classPrivateFieldGet9(this, _TonClient4_timeout, "f") });
|
|
352358
|
-
let
|
|
352359
|
-
if (!
|
|
352360
|
-
throw Error("Mailformed response: " +
|
|
352359
|
+
let lastBlock6 = lastBlockCodec.safeParse(res.data);
|
|
352360
|
+
if (!lastBlock6.success) {
|
|
352361
|
+
throw Error("Mailformed response: " + lastBlock6.error.format()._errors.join(", "));
|
|
352361
352362
|
}
|
|
352362
|
-
return
|
|
352363
|
+
return lastBlock6.data;
|
|
352363
352364
|
}
|
|
352364
352365
|
/**
|
|
352365
352366
|
* Get block info
|
|
@@ -394370,7 +394371,7 @@ var require_xrp_codec = __commonJS({
|
|
|
394370
394371
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
394371
394372
|
exports2.isValidClassicAddress = exports2.decodeAccountPublic = exports2.encodeAccountPublic = exports2.encodeNodePublic = exports2.decodeNodePublic = exports2.decodeAddress = exports2.decodeAccountID = exports2.encodeAddress = exports2.encodeAccountID = exports2.decodeSeed = exports2.encodeSeed = exports2.codec = void 0;
|
|
394372
394373
|
var baseCodec = require_src6();
|
|
394373
|
-
var
|
|
394374
|
+
var createHash4 = require_create_hash();
|
|
394374
394375
|
var utils_12 = require_utils40();
|
|
394375
394376
|
var Codec3 = class {
|
|
394376
394377
|
constructor(options21) {
|
|
@@ -394460,7 +394461,7 @@ var require_xrp_codec = __commonJS({
|
|
|
394460
394461
|
var ED25519_SEED = [1, 225, 75];
|
|
394461
394462
|
var codecOptions = {
|
|
394462
394463
|
sha256(bytes8) {
|
|
394463
|
-
return
|
|
394464
|
+
return createHash4("sha256").update(Buffer.from(bytes8)).digest();
|
|
394464
394465
|
},
|
|
394465
394466
|
alphabet: "rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz"
|
|
394466
394467
|
};
|
|
@@ -398896,14 +398897,14 @@ var require_hashes = __commonJS({
|
|
|
398896
398897
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
398897
398898
|
exports2.transactionID = exports2.sha512Half = exports2.Sha512Half = void 0;
|
|
398898
398899
|
var hash_prefixes_1 = require_hash_prefixes();
|
|
398899
|
-
var
|
|
398900
|
+
var createHash4 = require_create_hash();
|
|
398900
398901
|
var hash_256_1 = require_hash_256();
|
|
398901
398902
|
var binary_serializer_1 = require_binary_serializer();
|
|
398902
398903
|
var buffer_1 = require_buffer();
|
|
398903
398904
|
var Sha512Half = class _Sha512Half extends binary_serializer_1.BytesList {
|
|
398904
398905
|
constructor() {
|
|
398905
398906
|
super(...arguments);
|
|
398906
|
-
this.hash =
|
|
398907
|
+
this.hash = createHash4("sha512");
|
|
398907
398908
|
}
|
|
398908
398909
|
/**
|
|
398909
398910
|
* Construct a new Sha512Hash and write bytes this.hash
|
|
@@ -430042,7 +430043,7 @@ var require_lib49 = __commonJS({
|
|
|
430042
430043
|
return payload;
|
|
430043
430044
|
};
|
|
430044
430045
|
Method.prototype._confirmTransaction = function(defer10, result2, payload) {
|
|
430045
|
-
var method2 = this, promiseResolved = false, canUnsubscribe = true, timeoutCount = 0, confirmationCount = 0, intervalId = null, blockHeaderTimeoutId = null,
|
|
430046
|
+
var method2 = this, promiseResolved = false, canUnsubscribe = true, timeoutCount = 0, confirmationCount = 0, intervalId = null, blockHeaderTimeoutId = null, lastBlock6 = null, receiptJSON = "", gasProvided = !!payload.params[0] && typeof payload.params[0] === "object" && payload.params[0].gas ? payload.params[0].gas : null, isContractDeployment = !!payload.params[0] && typeof payload.params[0] === "object" && payload.params[0].data && payload.params[0].from && !payload.params[0].to, hasBytecode = isContractDeployment && payload.params[0].data.length > 2;
|
|
430046
430047
|
var _ethereumCalls = [
|
|
430047
430048
|
new Method({
|
|
430048
430049
|
name: "getBlockByNumber",
|
|
@@ -430120,15 +430121,15 @@ var require_lib49 = __commonJS({
|
|
|
430120
430121
|
var latestBlock = await _ethereumCall.getBlockByNumber("latest");
|
|
430121
430122
|
var latestBlockHash = latestBlock ? latestBlock.hash : null;
|
|
430122
430123
|
if (isPolling) {
|
|
430123
|
-
if (
|
|
430124
|
-
block2 = await _ethereumCall.getBlockByNumber(
|
|
430124
|
+
if (lastBlock6) {
|
|
430125
|
+
block2 = await _ethereumCall.getBlockByNumber(lastBlock6.number + 1);
|
|
430125
430126
|
if (block2) {
|
|
430126
|
-
|
|
430127
|
+
lastBlock6 = block2;
|
|
430127
430128
|
defer10.eventEmitter.emit("confirmation", confirmationCount, receipt, latestBlockHash);
|
|
430128
430129
|
}
|
|
430129
430130
|
} else {
|
|
430130
430131
|
block2 = await _ethereumCall.getBlockByNumber(receipt.blockNumber);
|
|
430131
|
-
|
|
430132
|
+
lastBlock6 = block2;
|
|
430132
430133
|
defer10.eventEmitter.emit("confirmation", confirmationCount, receipt, latestBlockHash);
|
|
430133
430134
|
}
|
|
430134
430135
|
} else {
|
|
@@ -438550,7 +438551,7 @@ var require_hash8 = __commonJS({
|
|
|
438550
438551
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
438551
438552
|
exports2.rlphash = exports2.ripemd160FromArray = exports2.ripemd160FromString = exports2.ripemd160 = exports2.sha256FromArray = exports2.sha256FromString = exports2.sha256 = exports2.keccakFromArray = exports2.keccakFromHexString = exports2.keccakFromString = exports2.keccak256 = exports2.keccak = void 0;
|
|
438552
438553
|
var keccak_1 = require_keccak11();
|
|
438553
|
-
var
|
|
438554
|
+
var createHash4 = require_create_hash();
|
|
438554
438555
|
var externals_1 = require_externals();
|
|
438555
438556
|
var bytes_1 = require_bytes9();
|
|
438556
438557
|
var helpers_1 = require_helpers8();
|
|
@@ -438597,7 +438598,7 @@ var require_hash8 = __commonJS({
|
|
|
438597
438598
|
exports2.keccakFromArray = keccakFromArray;
|
|
438598
438599
|
var _sha2562 = function(a86) {
|
|
438599
438600
|
a86 = (0, bytes_1.toBuffer)(a86);
|
|
438600
|
-
return
|
|
438601
|
+
return createHash4("sha256").update(a86).digest();
|
|
438601
438602
|
};
|
|
438602
438603
|
var sha25616 = function(a86) {
|
|
438603
438604
|
(0, helpers_1.assertIsBuffer)(a86);
|
|
@@ -438616,7 +438617,7 @@ var require_hash8 = __commonJS({
|
|
|
438616
438617
|
exports2.sha256FromArray = sha256FromArray;
|
|
438617
438618
|
var _ripemd1602 = function(a86, padded) {
|
|
438618
438619
|
a86 = (0, bytes_1.toBuffer)(a86);
|
|
438619
|
-
const hash12 =
|
|
438620
|
+
const hash12 = createHash4("rmd160").update(a86).digest();
|
|
438620
438621
|
if (padded === true) {
|
|
438621
438622
|
return (0, bytes_1.setLengthLeft)(hash12, 32);
|
|
438622
438623
|
} else {
|
|
@@ -523375,7 +523376,7 @@ var require_package8 = __commonJS({
|
|
|
523375
523376
|
module2.exports = {
|
|
523376
523377
|
name: "@ledgerhq/live-common",
|
|
523377
523378
|
description: "Common ground for the Ledger Live apps",
|
|
523378
|
-
version: "34.29.0-nightly.
|
|
523379
|
+
version: "34.29.0-nightly.4",
|
|
523379
523380
|
repository: {
|
|
523380
523381
|
type: "git",
|
|
523381
523382
|
url: "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -530176,7 +530177,7 @@ var require_package9 = __commonJS({
|
|
|
530176
530177
|
"package.json"(exports2, module2) {
|
|
530177
530178
|
module2.exports = {
|
|
530178
530179
|
name: "@ledgerhq/live-cli",
|
|
530179
|
-
version: "24.15.1-nightly.
|
|
530180
|
+
version: "24.15.1-nightly.4",
|
|
530180
530181
|
description: "ledger-live CLI version",
|
|
530181
530182
|
repository: {
|
|
530182
530183
|
type: "git",
|
|
@@ -540507,6 +540508,18 @@ var spl_default = [["solana/spl/27g8mtk7vttcchkpasjsddkwwyfoqt6ggeukidvjidd4", "
|
|
|
540507
540508
|
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/data/spl.js
|
|
540508
540509
|
var spl_default2 = spl_default;
|
|
540509
540510
|
|
|
540511
|
+
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/data/apt_coin.json
|
|
540512
|
+
var apt_coin_default = [["aptos/coin/amnis_aptos_coin_0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::amapt_token::amnisapt", "amAPT", "Amnis Aptos Coin", "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::amapt_token::AmnisApt", 8, false], ["aptos/coin/animeswap_coin_0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c::animecoin::ani", "ANI", "AnimeSwap Coin", "0x16fe2df00ea7dde4a63409201f7f4e536bde7bb7335526a35d05111e68aa322c::AnimeCoin::ANI", 8, false], ["aptos/coin/apartment_0x7b7bab2131de3e4f318b4abaa952f7c817b2c3df16c951caca809ac9ca9b650e::apartment::apartment", "APARTMENT", "Apartment", "0x7b7bab2131de3e4f318b4abaa952f7c817b2c3df16c951caca809ac9ca9b650e::APARTMENT::APARTMENT", 8, false], ["aptos/coin/apetos_0xada35ada7e43e2ee1c39633ffccec38b76ce702b4efc2e60b50f63fbe4f710d8::apetos_token::apetoscoin", "APE", "APETOS", "0xada35ada7e43e2ee1c39633ffccec38b76ce702b4efc2e60b50f63fbe4f710d8::apetos_token::ApetosCoin", 8, false], ["aptos/coin/aptos_fomo_0xf891d2e004973430cc2bbbee69f3d0f4adb9c7ae03137b4579f7bb9979283ee6::aptos_fomo::aptos_fomo", "FOMO", "APTOS FOMO", "0xf891d2e004973430cc2bbbee69f3d0f4adb9c7ae03137b4579f7bb9979283ee6::APTOS_FOMO::APTOS_FOMO", 6, false], ["aptos/coin/aptos_launch_token_0xd0b4efb4be7c3508d9a26a9b5405cf9f860d0b9e5fe2f498b90e68b8d2cedd3e::aptos_launch_token::aptoslaunchtoken", "ALT", "Aptos Launch Token", "0xd0b4efb4be7c3508d9a26a9b5405cf9f860d0b9e5fe2f498b90e68b8d2cedd3e::aptos_launch_token::AptosLaunchToken", 8, false], ["aptos/coin/blocto_token_0xfbab9fb68bd2103925317b6a540baa20087b1e7a7a4eb90badee04abb6b5a16f::blt::blt", "BLT", "Blocto Token", "0xfbab9fb68bd2103925317b6a540baa20087b1e7a7a4eb90badee04abb6b5a16f::blt::Blt", 8, false], ["aptos/coin/bluemove_0x27fafcc4e39daac97556af8a803dbb52bcb03f0821898dc845ac54225b9793eb::move_coin::movecoin", "MOVE", "BlueMove", "0x27fafcc4e39daac97556af8a803dbb52bcb03f0821898dc845ac54225b9793eb::move_coin::MoveCoin", 8, false], ["aptos/coin/bubbles_0xd6a49762f6e4f7401ee79be6f5d4111e70db1408966ba1aa204e6e10c9d437ca::bubbles::bubblescoin", "BUBBLES", "BUBBLES", "0xd6a49762f6e4f7401ee79be6f5d4111e70db1408966ba1aa204e6e10c9d437ca::bubbles::BubblesCoin", 8, false], ["aptos/coin/doodoo_0x73eb84966be67e4697fc5ae75173ca6c35089e802650f75422ab49a8729704ec::coin::doodoo", "doodoo", "DooDoo", "0x73eb84966be67e4697fc5ae75173ca6c35089e802650f75422ab49a8729704ec::coin::DooDoo", 8, false], ["aptos/coin/dstapt_0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::stakedaptos", "dstAPT", "dstAPT", "0xd11107bdf0d6d7040c6c0bfbdecb6545191fdf13e8d8d259952f53e1713f61b5::staked_coin::StakedAptos", 8, false], ["aptos/coin/gari_wormhole_0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::t", "whGARI", "Gari (Wormhole)", "0x4def3d3dee27308886f0a3611dd161ce34f977a9a5de4e80b237225923492a2a::coin::T", 8, false], ["aptos/coin/gui_inu_0xe4ccb6d39136469f376242c31b34d10515c8eaaa38092f804db8e08a8f53c5b2::assets_v1::echocoin002", "GUI", "Gui Inu", "0xe4ccb6d39136469f376242c31b34d10515c8eaaa38092f804db8e08a8f53c5b2::assets_v1::EchoCoin002", 6, false], ["aptos/coin/heart_0x7de3fea83cd5ca0e1def27c3f3803af619882db51f34abf30dd04ad12ee6af31::tapos::heart", "HEART", "HEART", "0x7de3fea83cd5ca0e1def27c3f3803af619882db51f34abf30dd04ad12ee6af31::tapos::Heart", 8, false], ["aptos/coin/liquidswap_0x53a30a6e5936c0a4c5140daed34de39d17ca7fcae08f947c02e979cef98a3719::coin::lsd", "LSD", "Liquidswap", "0x53a30a6e5936c0a4c5140daed34de39d17ca7fcae08f947c02e979cef98a3719::coin::LSD", 8, false], ["aptos/coin/mojito_0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f4::coin::mojo", "MOJO", "Mojito", "0x881ac202b1f1e6ad4efcff7a1d0579411533f2502417a19211cfc49751ddb5f4::coin::MOJO", 8, false], ["aptos/coin/moo_moo_0xc5fbbcc4637aeebb4e732767abee8a21f2b0776f73b73e16ce13e7d31d6700da::moomoo::moomoo", "MOOMOO", "MOO MOO", "0xc5fbbcc4637aeebb4e732767abee8a21f2b0776f73b73e16ce13e7d31d6700da::MOOMOO::MOOMOO", 6, false], ["aptos/coin/move_dollar_0x6f986d146e4a90b828d8c12c14b6f4e003fdff11a8eecceceb63744363eaac01::mod_coin::mod", "MOD", "Move Dollar", "0x6f986d146e4a90b828d8c12c14b6f4e003fdff11a8eecceceb63744363eaac01::mod_coin::MOD", 8, false], ["aptos/coin/pancakeswap_token_0x159df6b7689437016108a019fd5bef736bac692b6d4a1f10c941f6fbb9a74ca6::oft::cakeoft", "Cake", "PancakeSwap Token", "0x159df6b7689437016108a019fd5bef736bac692b6d4a1f10c941f6fbb9a74ca6::oft::CakeOFT", 8, false], ["aptos/coin/returd_0xdf3d5eb83df80dfde8ceb1edaa24d8dbc46da6a89ae134a858338e1b86a29e38::coin::returd", "RETuRD", "Returd", "0xdf3d5eb83df80dfde8ceb1edaa24d8dbc46da6a89ae134a858338e1b86a29e38::coin::Returd", 8, false], ["aptos/coin/shrimp_0x55987edfab9a57f69bac759674f139ae473b5e09a9283848c1f87faf6fc1e789::shrimp::shrimpcoin", "SHRIMP", "SHRIMP", "0x55987edfab9a57f69bac759674f139ae473b5e09a9283848c1f87faf6fc1e789::shrimp::ShrimpCoin", 2, false], ["aptos/coin/solana_wormhole_0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::t", "whSOL", "Solana (Wormhole)", "0xdd89c0e695df0692205912fb69fc290418bed0dbe6e4573d744a6d5e6bab6c13::coin::T", 8, false], ["aptos/coin/staked_aptos_coin_0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::stapt_token::stakedapt", "stAPT", "Staked Aptos Coin", "0x111ae3e5bc816a5e63c2da97d0aa3886519e0cd5e4b046659fa35796bd11542a::stapt_token::StakedApt", 8, false], ["aptos/coin/staked_thala_apt_0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::stakedthalaapt", "sthAPT", "Staked Thala APT", "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::StakedThalaAPT", 8, false], ["aptos/coin/tether_usd_celer_0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::usdtcoin", "ceUSDT", "Tether USD (Celer)", "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::UsdtCoin", 6, false], ["aptos/coin/tether_usd_layerzero_0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::usdt", "lzUSDT", "Tether USD (LayerZero)", "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT", 6, false], ["aptos/coin/tether_usd_wormhole_0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::t", "whUSDT", "Tether USD (Wormhole)", "0xa2eda21a58856fda86451436513b867c97eecb4ba099da5775520e0f7492e852::coin::T", 6, false], ["aptos/coin/thala_apt_0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::thalaapt", "thAPT", "Thala APT", "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6::staking::ThalaAPT", 8, false], ["aptos/coin/thala_token_0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::thl", "THL", "Thala Token", "0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL", 8, false], ["aptos/coin/the_loonies_0x268d4a7a2ad93274edf6116f9f20ad8455223a7ab5fc73154f687e7dbc3e3ec6::loon::loon", "LOON", "The Loonies", "0x268d4a7a2ad93274edf6116f9f20ad8455223a7ab5fc73154f687e7dbc3e3ec6::LOON::LOON", 6, false], ["aptos/coin/token_in_0xc32ba5d293577cbb1df390f35b2bc6369a593b736d0865fedec1a2b08565de8e::in_coin::incoin", "TIN", 'Token "IN"', "0xc32ba5d293577cbb1df390f35b2bc6369a593b736d0865fedec1a2b08565de8e::in_coin::InCoin", 8, false], ["aptos/coin/tomarket_0x9d0595765a31f8d56e1d2aafc4d6c76f283c67a074ef8812d8c31bd8252ac2c3::asset::toma", "TOMA", "Tomarket", "0x9d0595765a31f8d56e1d2aafc4d6c76f283c67a074ef8812d8c31bd8252ac2c3::asset::TOMA", 6, false], ["aptos/coin/tortuga_staked_apt_0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::stakedaptoscoin", "tAPT", "Tortuga Staked APT", "0x84d7aeef42d38a5ffc3ccef853e1b82e4958659d16a7de736a29c55fbbeb0114::staked_aptos_coin::StakedAptosCoin", 8, false], ["aptos/coin/uptos_0x4fbed3f8a3fd8a11081c8b6392152a8b0cb14d70d0414586f0c9b858fcd2d6a7::uptos::uptos", "UPTOS", "UPTOS", "0x4fbed3f8a3fd8a11081c8b6392152a8b0cb14d70d0414586f0c9b858fcd2d6a7::UPTOS::UPTOS", 8, false], ["aptos/coin/usd_coin_layerzero_0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::usdc", "lzUSDC", "USD Coin (LayerZero)", "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC", 6, false], ["aptos/coin/usd_coin_wormhole_0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::t", "whUSDC", "USD Coin (Wormhole)", "0x5e156f1207d0ebfa19a9eeff00d62a282278fb8719f4fab3a586a0a2c0fffbea::coin::T", 6, false], ["aptos/coin/wrapped_bnb_celer_0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::bnbcoin", "ceWBNB", "Wrapped BNB (Celer)", "0x8d87a65ba30e09357fa2edea2c80dbac296e5dec2b18287113500b902942929d::celer_coin_manager::BnbCoin", 8, false], ["aptos/coin/wrapped_ether_layerzero_0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::weth", "lzWETH", "Wrapped Ether (LayerZero)", "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH", 6, false], ["aptos/coin/wrapped_ether_wormhole_0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::t", "whWETH", "Wrapped Ether (Wormhole)", "0xcc8a89c8dce9693d354449f1f73e60e14e347417854f029db5bc8e7454008abb::coin::T", 8, false]];
|
|
540513
|
+
|
|
540514
|
+
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/data/apt_coin.js
|
|
540515
|
+
var apt_coin_default2 = apt_coin_default;
|
|
540516
|
+
|
|
540517
|
+
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/data/apt_fungible_asset.json
|
|
540518
|
+
var apt_fungible_asset_default = [["aptos/fungible_asset/amaterasu_0xd0ab8c2f76cd640455db56ca758a9766a966c88f77920347aac1719edab1df5e", "AMA", "Amaterasu", "0xd0ab8c2f76cd640455db56ca758a9766a966c88f77920347aac1719edab1df5e", 8, false], ["aptos/fungible_asset/cellana_0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12", "CELL", "CELLANA", "0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12", 8, false], ["aptos/fungible_asset/mkl_0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab", "MKL", "MKL", "0x878370592f9129e14b76558689a4b570ad22678111df775befbfcbc9fb3d90ab", 6, false], ["aptos/fungible_asset/tether_usd_0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b", "USDT", "Tether USD", "0x357b0b74bc833e95a115ad22604854d6b0fca151cecd94111770e5d6ffc9dc2b", 6, false], ["aptos/fungible_asset/truapt_coin_0xaef6a8c3182e076db72d64324617114cacf9a52f28325edc10b483f7f05da0e7", "TruAPT", "TruAPT coin", "0xaef6a8c3182e076db72d64324617114cacf9a52f28325edc10b483f7f05da0e7", 8, false], ["aptos/fungible_asset/usdc_0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b", "USDC", "USDC", "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b", 6, false]];
|
|
540519
|
+
|
|
540520
|
+
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/data/apt_fungible_asset.js
|
|
540521
|
+
var apt_fungible_asset_default2 = apt_fungible_asset_default;
|
|
540522
|
+
|
|
540510
540523
|
// ../../libs/ledgerjs/packages/cryptoassets/lib-es/tokens.js
|
|
540511
540524
|
var emptyArray = [];
|
|
540512
540525
|
var tokensArray = [];
|
|
@@ -540533,6 +540546,8 @@ addTokens(ton_jetton_default2.map(convertJettonToken));
|
|
|
540533
540546
|
addTokens(filecoin_erc20_default2.map(convertERC20));
|
|
540534
540547
|
addTokens(spl_default2.map(convertSplTokens));
|
|
540535
540548
|
addTokens(tokens3.map(convertERC20));
|
|
540549
|
+
addTokens(apt_coin_default2.map(convertAptCoinTokens));
|
|
540550
|
+
addTokens(apt_fungible_asset_default2.map(convertAptFaTokens));
|
|
540536
540551
|
var defaultTokenListOptions = {
|
|
540537
540552
|
withDelisted: false
|
|
540538
540553
|
};
|
|
@@ -540748,6 +540763,32 @@ function convertSplTokens([id5, network, name3, symbol4, address4, decimals2]) {
|
|
|
540748
540763
|
]
|
|
540749
540764
|
};
|
|
540750
540765
|
}
|
|
540766
|
+
function convertAptosTokens(tokenType, [id5, ticker, name3, address4, decimals2, delisted]) {
|
|
540767
|
+
return {
|
|
540768
|
+
type: "TokenCurrency",
|
|
540769
|
+
id: id5,
|
|
540770
|
+
contractAddress: address4,
|
|
540771
|
+
parentCurrency: getCryptoCurrencyById("aptos"),
|
|
540772
|
+
name: name3,
|
|
540773
|
+
tokenType,
|
|
540774
|
+
ticker,
|
|
540775
|
+
disableCountervalue: false,
|
|
540776
|
+
delisted,
|
|
540777
|
+
units: [
|
|
540778
|
+
{
|
|
540779
|
+
name: name3,
|
|
540780
|
+
code: ticker,
|
|
540781
|
+
magnitude: decimals2
|
|
540782
|
+
}
|
|
540783
|
+
]
|
|
540784
|
+
};
|
|
540785
|
+
}
|
|
540786
|
+
function convertAptCoinTokens(token) {
|
|
540787
|
+
return convertAptosTokens("coin", token);
|
|
540788
|
+
}
|
|
540789
|
+
function convertAptFaTokens(token) {
|
|
540790
|
+
return convertAptosTokens("fungible_asset", token);
|
|
540791
|
+
}
|
|
540751
540792
|
function convertCardanoNativeTokens([parentCurrencyId, policyId, assetName, name3, ticker, decimals2, delisted]) {
|
|
540752
540793
|
const assetId = policyId + assetName;
|
|
540753
540794
|
const parentCurrency = getCryptoCurrencyById(parentCurrencyId);
|
|
@@ -552930,49 +552971,51 @@ function flattenOperationWithInternalsAndNfts(op) {
|
|
|
552930
552971
|
}
|
|
552931
552972
|
return ops;
|
|
552932
552973
|
}
|
|
552974
|
+
var OPERATION_TYPE_IN_FAMILY = ["IN", "REWARD", "REWARD_PAYOUT", "WITHDRAW"];
|
|
552975
|
+
var OPERATION_TYPE_OUT_FAMILY = [
|
|
552976
|
+
"OUT",
|
|
552977
|
+
"REVEAL",
|
|
552978
|
+
"CREATE",
|
|
552979
|
+
"FEES",
|
|
552980
|
+
"DELEGATE",
|
|
552981
|
+
"REDELEGATE",
|
|
552982
|
+
"UNDELEGATE",
|
|
552983
|
+
"OPT_IN",
|
|
552984
|
+
"OPT_OUT",
|
|
552985
|
+
"SLASH",
|
|
552986
|
+
"LOCK",
|
|
552987
|
+
"BURN"
|
|
552988
|
+
];
|
|
552989
|
+
var OPERATION_TYPE_STAKE_FAMILY = [
|
|
552990
|
+
"FREEZE",
|
|
552991
|
+
"UNFREEZE",
|
|
552992
|
+
"UNDELEGATE_RESOURCE",
|
|
552993
|
+
"WITHDRAW_EXPIRE_UNFREEZE",
|
|
552994
|
+
"LEGACY_UNFREEZE",
|
|
552995
|
+
"VOTE",
|
|
552996
|
+
"BOND",
|
|
552997
|
+
"UNBOND",
|
|
552998
|
+
"WITHDRAW_UNBONDED",
|
|
552999
|
+
"SET_CONTROLLER",
|
|
553000
|
+
"NOMINATE",
|
|
553001
|
+
"CHILL",
|
|
553002
|
+
"REVOKE",
|
|
553003
|
+
"APPROVE",
|
|
553004
|
+
"ACTIVATE",
|
|
553005
|
+
"UNLOCK",
|
|
553006
|
+
"STAKE",
|
|
553007
|
+
"UNSTAKE",
|
|
553008
|
+
"WITHDRAW_UNSTAKED"
|
|
553009
|
+
];
|
|
552933
553010
|
function getOperationAmountNumber(op) {
|
|
552934
|
-
|
|
552935
|
-
|
|
552936
|
-
|
|
552937
|
-
|
|
552938
|
-
|
|
552939
|
-
|
|
552940
|
-
case "OUT":
|
|
552941
|
-
case "REVEAL":
|
|
552942
|
-
case "CREATE":
|
|
552943
|
-
case "FEES":
|
|
552944
|
-
case "DELEGATE":
|
|
552945
|
-
case "REDELEGATE":
|
|
552946
|
-
case "UNDELEGATE":
|
|
552947
|
-
case "OPT_IN":
|
|
552948
|
-
case "OPT_OUT":
|
|
552949
|
-
case "SLASH":
|
|
552950
|
-
case "LOCK":
|
|
552951
|
-
case "BURN":
|
|
552952
|
-
return op.value.negated();
|
|
552953
|
-
case "FREEZE":
|
|
552954
|
-
case "UNFREEZE":
|
|
552955
|
-
case "UNDELEGATE_RESOURCE":
|
|
552956
|
-
case "WITHDRAW_EXPIRE_UNFREEZE":
|
|
552957
|
-
case "LEGACY_UNFREEZE":
|
|
552958
|
-
case "VOTE":
|
|
552959
|
-
case "BOND":
|
|
552960
|
-
case "UNBOND":
|
|
552961
|
-
case "WITHDRAW_UNBONDED":
|
|
552962
|
-
case "SET_CONTROLLER":
|
|
552963
|
-
case "NOMINATE":
|
|
552964
|
-
case "CHILL":
|
|
552965
|
-
case "REVOKE":
|
|
552966
|
-
case "APPROVE":
|
|
552967
|
-
case "ACTIVATE":
|
|
552968
|
-
case "UNLOCK":
|
|
552969
|
-
case "STAKE":
|
|
552970
|
-
case "UNSTAKE":
|
|
552971
|
-
case "WITHDRAW_UNSTAKED":
|
|
552972
|
-
return op.fee.negated();
|
|
552973
|
-
default:
|
|
552974
|
-
return new import_bignumber33.BigNumber(0);
|
|
553011
|
+
if (OPERATION_TYPE_IN_FAMILY.includes(op.type)) {
|
|
553012
|
+
return op.value;
|
|
553013
|
+
} else if (OPERATION_TYPE_OUT_FAMILY.includes(op.type)) {
|
|
553014
|
+
return op.value.negated();
|
|
553015
|
+
} else if (OPERATION_TYPE_STAKE_FAMILY.includes(op.type)) {
|
|
553016
|
+
return op.fee.negated();
|
|
552975
553017
|
}
|
|
553018
|
+
return new import_bignumber33.BigNumber(0);
|
|
552976
553019
|
}
|
|
552977
553020
|
function getOperationAmountNumberWithInternals(op) {
|
|
552978
553021
|
return flattenOperationWithInternalsAndNfts(op).reduce((amount, op2) => amount.plus(getOperationAmountNumber(op2)), new import_bignumber33.BigNumber(0));
|
|
@@ -617947,8 +617990,8 @@ var resolver5 = (signerContext3) => {
|
|
|
617947
617990
|
var signer_default = resolver5;
|
|
617948
617991
|
|
|
617949
617992
|
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/getTransactionStatus.js
|
|
617950
|
-
var import_bignumber90 = require("bignumber.js");
|
|
617951
617993
|
init_lib_es();
|
|
617994
|
+
var import_bignumber91 = require("bignumber.js");
|
|
617952
617995
|
|
|
617953
617996
|
// ../../node_modules/.pnpm/@aptos-labs+ts-sdk@1.33.1/node_modules/@aptos-labs/ts-sdk/dist/esm/chunk-6Q2O5G3J.mjs
|
|
617954
617997
|
var s36 = class extends Error {
|
|
@@ -630015,28 +630058,292 @@ var T24 = ((t75) => (t75[t75.Ed25519 = 0] = "Ed25519", t75[t75.MultiEd25519 = 1]
|
|
|
630015
630058
|
var E25 = ((i101) => (i101[i101.Ed25519 = 0] = "Ed25519", i101[i101.Secp256k1Ecdsa = 2] = "Secp256k1Ecdsa", i101))(E25 || {});
|
|
630016
630059
|
var U16 = ((e54) => (e54[e54.DeriveAuid = 251] = "DeriveAuid", e54[e54.DeriveObjectAddressFromObject = 252] = "DeriveObjectAddressFromObject", e54[e54.DeriveObjectAddressFromGuid = 253] = "DeriveObjectAddressFromGuid", e54[e54.DeriveObjectAddressFromSeed = 254] = "DeriveObjectAddressFromSeed", e54[e54.DeriveResourceAccountAddress = 255] = "DeriveResourceAccountAddress", e54))(U16 || {});
|
|
630017
630060
|
|
|
630061
|
+
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/logic.js
|
|
630062
|
+
var import_bignumber90 = __toESM(require("bignumber.js"));
|
|
630063
|
+
|
|
630064
|
+
// ../../libs/coin-modules/coin-aptos/lib-es/constants.js
|
|
630065
|
+
var TX_STATUS;
|
|
630066
|
+
(function(TX_STATUS2) {
|
|
630067
|
+
TX_STATUS2["PENDING"] = "pending";
|
|
630068
|
+
TX_STATUS2["FAIL"] = "fail";
|
|
630069
|
+
TX_STATUS2["SUCCESS"] = "success";
|
|
630070
|
+
})(TX_STATUS || (TX_STATUS = {}));
|
|
630071
|
+
var COIN_TRANSFER_TYPES = [
|
|
630072
|
+
"0x1::aptos_account::transfer",
|
|
630073
|
+
"0x1::aptos_account::transfer_coins",
|
|
630074
|
+
"0x1::coin::transfer"
|
|
630075
|
+
];
|
|
630076
|
+
var FA_TRANSFER_TYPES = ["0x1::primary_fungible_store::transfer"];
|
|
630077
|
+
var BATCH_TRANSFER_TYPES = [
|
|
630078
|
+
"0x1::aptos_account::batch_transfer",
|
|
630079
|
+
"0x1::aptos_account::batch_transfer_coins"
|
|
630080
|
+
];
|
|
630081
|
+
var DELEGATION_POOL_TYPES = [
|
|
630082
|
+
"0x1::delegation_pool::add_stake",
|
|
630083
|
+
"0x1::delegation_pool::withdraw"
|
|
630084
|
+
];
|
|
630085
|
+
var APTOS_ASSET_ID = "0x1::aptos_coin::AptosCoin";
|
|
630086
|
+
var APTOS_COIN_CHANGE = `0x1::coin::CoinStore<${APTOS_ASSET_ID}>`;
|
|
630087
|
+
var APTOS_FUNGIBLE_STORE = "0x1::fungible_asset::FungibleStore";
|
|
630088
|
+
var APTOS_OBJECT_CORE = "0x1::object::ObjectCore";
|
|
630089
|
+
var DIRECTION;
|
|
630090
|
+
(function(DIRECTION2) {
|
|
630091
|
+
DIRECTION2["IN"] = "IN";
|
|
630092
|
+
DIRECTION2["OUT"] = "OUT";
|
|
630093
|
+
DIRECTION2["UNKNOWN"] = "UNKNOWN";
|
|
630094
|
+
})(DIRECTION || (DIRECTION = {}));
|
|
630095
|
+
var SUPPORTED_TOKEN_TYPES = ["coin", "fungible_asset"];
|
|
630096
|
+
|
|
630097
|
+
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/logic.js
|
|
630098
|
+
var DEFAULT_GAS = new import_bignumber90.default(200);
|
|
630099
|
+
var DEFAULT_GAS_PRICE = new import_bignumber90.default(100);
|
|
630100
|
+
var ESTIMATE_GAS_MUL = new import_bignumber90.default(1);
|
|
630101
|
+
var CLEAN_HEX_REGEXP = /^0x0*|^0+/;
|
|
630102
|
+
function isTestnet(currencyId) {
|
|
630103
|
+
return getCryptoCurrencyById(currencyId).isTestnetFor ? true : false;
|
|
630104
|
+
}
|
|
630105
|
+
var getMaxSendBalance = (gas, gasPrice, account3, transaction) => {
|
|
630106
|
+
const tokenAccount = findSubAccountById(account3, transaction?.subAccountId ?? "");
|
|
630107
|
+
const fromTokenAccount = tokenAccount && isTokenAccount(tokenAccount);
|
|
630108
|
+
const totalGas = gas.multipliedBy(gasPrice);
|
|
630109
|
+
return fromTokenAccount ? tokenAccount.spendableBalance : account3.spendableBalance.gt(totalGas) ? account3.spendableBalance.minus(totalGas) : new import_bignumber90.default(0);
|
|
630110
|
+
};
|
|
630111
|
+
function normalizeTransactionOptions(options21) {
|
|
630112
|
+
const check3 = (v56) => (v56 ?? "").toString().trim() ? v56 : void 0;
|
|
630113
|
+
return {
|
|
630114
|
+
maxGasAmount: check3(options21.maxGasAmount),
|
|
630115
|
+
gasUnitPrice: check3(options21.gasUnitPrice)
|
|
630116
|
+
};
|
|
630117
|
+
}
|
|
630118
|
+
var getBlankOperation = (tx, id5) => ({
|
|
630119
|
+
id: "",
|
|
630120
|
+
hash: tx.hash,
|
|
630121
|
+
type: "",
|
|
630122
|
+
value: new import_bignumber90.default(0),
|
|
630123
|
+
fee: new import_bignumber90.default(0),
|
|
630124
|
+
blockHash: tx.block?.hash,
|
|
630125
|
+
blockHeight: tx.block?.height,
|
|
630126
|
+
senders: [],
|
|
630127
|
+
recipients: [],
|
|
630128
|
+
accountId: id5,
|
|
630129
|
+
date: new Date(parseInt(tx.timestamp) / 1e3),
|
|
630130
|
+
extra: { version: tx.version },
|
|
630131
|
+
transactionSequenceNumber: parseInt(tx.sequence_number),
|
|
630132
|
+
hasFailed: false
|
|
630133
|
+
});
|
|
630134
|
+
var convertFunctionPayloadResponseToInputEntryFunctionData = (payload) => ({
|
|
630135
|
+
function: payload.function,
|
|
630136
|
+
typeArguments: payload.type_arguments,
|
|
630137
|
+
functionArguments: payload.arguments
|
|
630138
|
+
});
|
|
630139
|
+
var txsToOps = (info6, id5, txs) => {
|
|
630140
|
+
const { address: address4 } = info6;
|
|
630141
|
+
const ops = [];
|
|
630142
|
+
const opsTokens = [];
|
|
630143
|
+
txs.forEach((tx) => {
|
|
630144
|
+
if (tx !== null) {
|
|
630145
|
+
const op = getBlankOperation(tx, id5);
|
|
630146
|
+
op.fee = new import_bignumber90.default(tx.gas_used).multipliedBy(new import_bignumber90.default(tx.gas_unit_price));
|
|
630147
|
+
const payload = convertFunctionPayloadResponseToInputEntryFunctionData(tx.payload);
|
|
630148
|
+
const function_address = getFunctionAddress(payload);
|
|
630149
|
+
if (!function_address) {
|
|
630150
|
+
return;
|
|
630151
|
+
}
|
|
630152
|
+
const { coin_id, amount_in, amount_out } = getCoinAndAmounts(tx, address4);
|
|
630153
|
+
op.value = calculateAmount(tx.sender, address4, amount_in, amount_out);
|
|
630154
|
+
op.type = compareAddress(tx.sender, address4) ? DIRECTION.OUT : DIRECTION.IN;
|
|
630155
|
+
op.senders.push(tx.sender);
|
|
630156
|
+
op.hasFailed = !tx.success;
|
|
630157
|
+
op.id = encodeOperationId(op.accountId, tx.hash, op.type);
|
|
630158
|
+
processRecipients(payload, address4, op, function_address);
|
|
630159
|
+
if (op.value.isZero()) {
|
|
630160
|
+
op.type = DIRECTION.UNKNOWN;
|
|
630161
|
+
}
|
|
630162
|
+
if (op.type !== DIRECTION.UNKNOWN && coin_id !== null) {
|
|
630163
|
+
if (coin_id === APTOS_ASSET_ID) {
|
|
630164
|
+
ops.push(op);
|
|
630165
|
+
} else {
|
|
630166
|
+
const token = findTokenByAddressInCurrency(coin_id.toLowerCase(), "aptos");
|
|
630167
|
+
if (token !== void 0) {
|
|
630168
|
+
op.accountId = encodeTokenAccountId(id5, token);
|
|
630169
|
+
opsTokens.push(op);
|
|
630170
|
+
if (op.type === DIRECTION.OUT) {
|
|
630171
|
+
ops.push({
|
|
630172
|
+
...op,
|
|
630173
|
+
accountId: decodeTokenAccountId(op.accountId).accountId,
|
|
630174
|
+
value: op.fee,
|
|
630175
|
+
type: "FEES"
|
|
630176
|
+
});
|
|
630177
|
+
}
|
|
630178
|
+
}
|
|
630179
|
+
}
|
|
630180
|
+
}
|
|
630181
|
+
}
|
|
630182
|
+
});
|
|
630183
|
+
return [ops, opsTokens];
|
|
630184
|
+
};
|
|
630185
|
+
function compareAddress(addressA, addressB) {
|
|
630186
|
+
return addressA.replace(CLEAN_HEX_REGEXP, "").toLowerCase() === addressB.replace(CLEAN_HEX_REGEXP, "").toLowerCase();
|
|
630187
|
+
}
|
|
630188
|
+
function getFunctionAddress(payload) {
|
|
630189
|
+
if (payload.function) {
|
|
630190
|
+
const parts = payload.function.split("::");
|
|
630191
|
+
return parts.length === 3 && parts[0].length ? parts[0] : void 0;
|
|
630192
|
+
}
|
|
630193
|
+
return void 0;
|
|
630194
|
+
}
|
|
630195
|
+
function processRecipients(payload, address4, op, function_address) {
|
|
630196
|
+
if ((COIN_TRANSFER_TYPES.includes(payload.function) || DELEGATION_POOL_TYPES.includes(payload.function)) && payload.functionArguments && payload.functionArguments.length > 0 && typeof payload.functionArguments[0] === "string") {
|
|
630197
|
+
op.recipients.push(payload.functionArguments[0].toString());
|
|
630198
|
+
} else if (FA_TRANSFER_TYPES.includes(payload.function) && payload.functionArguments && payload.functionArguments.length > 1 && typeof payload.functionArguments[0] === "object" && typeof payload.functionArguments[1] === "string") {
|
|
630199
|
+
op.recipients.push(payload.functionArguments[1].toString());
|
|
630200
|
+
} else if (BATCH_TRANSFER_TYPES.includes(payload.function) && payload.functionArguments && payload.functionArguments.length > 0 && Array.isArray(payload.functionArguments[0])) {
|
|
630201
|
+
if (!compareAddress(op.senders[0], address4)) {
|
|
630202
|
+
for (const recipient of payload.functionArguments[0]) {
|
|
630203
|
+
if (recipient && compareAddress(recipient.toString(), address4)) {
|
|
630204
|
+
op.recipients.push(recipient.toString());
|
|
630205
|
+
}
|
|
630206
|
+
}
|
|
630207
|
+
}
|
|
630208
|
+
} else {
|
|
630209
|
+
op.recipients.push(function_address);
|
|
630210
|
+
}
|
|
630211
|
+
}
|
|
630212
|
+
function getEventCoinAddress(change2, event, event_name) {
|
|
630213
|
+
const change_data = change2.data;
|
|
630214
|
+
const mr = change_data;
|
|
630215
|
+
if (!(event_name in mr.data)) {
|
|
630216
|
+
return null;
|
|
630217
|
+
}
|
|
630218
|
+
const change_event_data = mr.data[event_name];
|
|
630219
|
+
if (change_event_data.guid.id.addr !== event.guid.account_address || change_event_data.guid.id.creation_num !== event.guid.creation_number) {
|
|
630220
|
+
return null;
|
|
630221
|
+
}
|
|
630222
|
+
const address4 = extractAddress(mr.type);
|
|
630223
|
+
return address4;
|
|
630224
|
+
}
|
|
630225
|
+
function getEventFAAddress(change2, event, _event_name) {
|
|
630226
|
+
const change_data = change2.data;
|
|
630227
|
+
if (change_data.type !== APTOS_FUNGIBLE_STORE) {
|
|
630228
|
+
return null;
|
|
630229
|
+
}
|
|
630230
|
+
const mr = change_data;
|
|
630231
|
+
if (change2.address !== event.data.store) {
|
|
630232
|
+
return null;
|
|
630233
|
+
}
|
|
630234
|
+
return mr.data.metadata.inner;
|
|
630235
|
+
}
|
|
630236
|
+
function getResourceAddress(tx, event, event_name, getAddressProcessor) {
|
|
630237
|
+
for (const change2 of tx.changes) {
|
|
630238
|
+
if (isWriteSetChangeWriteResource(change2)) {
|
|
630239
|
+
const address4 = getAddressProcessor(change2, event, event_name);
|
|
630240
|
+
if (address4 !== null) {
|
|
630241
|
+
return address4;
|
|
630242
|
+
}
|
|
630243
|
+
}
|
|
630244
|
+
}
|
|
630245
|
+
return null;
|
|
630246
|
+
}
|
|
630247
|
+
function isWriteSetChangeWriteResource(change2) {
|
|
630248
|
+
return change2.data !== void 0;
|
|
630249
|
+
}
|
|
630250
|
+
function checkFAOwner(tx, event, user_address) {
|
|
630251
|
+
for (const change2 of tx.changes) {
|
|
630252
|
+
if (isWriteSetChangeWriteResource(change2)) {
|
|
630253
|
+
const storeData = change2.data;
|
|
630254
|
+
if (change2.address == event.data.store && storeData.type == APTOS_OBJECT_CORE && storeData.data.owner == user_address) {
|
|
630255
|
+
return true;
|
|
630256
|
+
}
|
|
630257
|
+
}
|
|
630258
|
+
}
|
|
630259
|
+
return false;
|
|
630260
|
+
}
|
|
630261
|
+
function getCoinAndAmounts(tx, address4) {
|
|
630262
|
+
let coin_id = null;
|
|
630263
|
+
let amount_in = (0, import_bignumber90.default)(0);
|
|
630264
|
+
let amount_out = (0, import_bignumber90.default)(0);
|
|
630265
|
+
tx.events.forEach((event) => {
|
|
630266
|
+
switch (event.type) {
|
|
630267
|
+
case "0x1::coin::WithdrawEvent":
|
|
630268
|
+
if (compareAddress(event.guid.account_address, address4)) {
|
|
630269
|
+
coin_id = getResourceAddress(tx, event, "withdraw_events", getEventCoinAddress);
|
|
630270
|
+
amount_out = amount_out.plus(event.data.amount);
|
|
630271
|
+
}
|
|
630272
|
+
break;
|
|
630273
|
+
case "0x1::coin::DepositEvent":
|
|
630274
|
+
if (compareAddress(event.guid.account_address, address4)) {
|
|
630275
|
+
coin_id = getResourceAddress(tx, event, "deposit_events", getEventCoinAddress);
|
|
630276
|
+
amount_in = amount_in.plus(event.data.amount);
|
|
630277
|
+
}
|
|
630278
|
+
break;
|
|
630279
|
+
case "0x1::fungible_asset::Withdraw":
|
|
630280
|
+
if (checkFAOwner(tx, event, address4)) {
|
|
630281
|
+
coin_id = getResourceAddress(tx, event, "withdraw_events", getEventFAAddress);
|
|
630282
|
+
amount_out = amount_out.plus(event.data.amount);
|
|
630283
|
+
}
|
|
630284
|
+
break;
|
|
630285
|
+
case "0x1::fungible_asset::Deposit":
|
|
630286
|
+
if (checkFAOwner(tx, event, address4)) {
|
|
630287
|
+
coin_id = getResourceAddress(tx, event, "deposit_events", getEventFAAddress);
|
|
630288
|
+
amount_in = amount_in.plus(event.data.amount);
|
|
630289
|
+
}
|
|
630290
|
+
break;
|
|
630291
|
+
case "0x1::transaction_fee::FeeStatement":
|
|
630292
|
+
if (tx.sender === address4) {
|
|
630293
|
+
if (coin_id === null)
|
|
630294
|
+
coin_id = APTOS_ASSET_ID;
|
|
630295
|
+
if (coin_id === APTOS_ASSET_ID) {
|
|
630296
|
+
const fees2 = (0, import_bignumber90.default)(tx.gas_unit_price).times((0, import_bignumber90.default)(tx.gas_used));
|
|
630297
|
+
amount_out = amount_out.plus(fees2);
|
|
630298
|
+
}
|
|
630299
|
+
}
|
|
630300
|
+
break;
|
|
630301
|
+
}
|
|
630302
|
+
});
|
|
630303
|
+
return { coin_id, amount_in, amount_out };
|
|
630304
|
+
}
|
|
630305
|
+
function calculateAmount(sender, address4, amount_in, amount_out) {
|
|
630306
|
+
const is_sender = compareAddress(sender, address4);
|
|
630307
|
+
return is_sender ? amount_out.minus(amount_in) : amount_in.minus(amount_out);
|
|
630308
|
+
}
|
|
630309
|
+
function extractAddress(str) {
|
|
630310
|
+
const match = str.match(/<([^<>]+)>{1}$/);
|
|
630311
|
+
return match ? match[1] : null;
|
|
630312
|
+
}
|
|
630313
|
+
function getTokenAccount(account3, transaction) {
|
|
630314
|
+
const tokenAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
|
|
630315
|
+
const fromTokenAccount = tokenAccount && isTokenAccount(tokenAccount);
|
|
630316
|
+
return fromTokenAccount ? tokenAccount : void 0;
|
|
630317
|
+
}
|
|
630318
|
+
|
|
630018
630319
|
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/getTransactionStatus.js
|
|
630019
630320
|
var getTransactionStatus3 = async (a86, t75) => {
|
|
630020
630321
|
const errors = {};
|
|
630021
630322
|
const warnings3 = {};
|
|
630323
|
+
if (!t75.recipient) {
|
|
630324
|
+
errors.recipient = new RecipientRequired();
|
|
630325
|
+
}
|
|
630326
|
+
if (!l30.isValid({ input: t75.recipient }).valid && !errors.recipient) {
|
|
630327
|
+
errors.recipient = new InvalidAddress("", { currencyName: a86.currency.name });
|
|
630328
|
+
}
|
|
630329
|
+
if (t75.recipient === a86.freshAddress && !errors.recipient) {
|
|
630330
|
+
errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
|
|
630331
|
+
}
|
|
630022
630332
|
if (!t75.fees) {
|
|
630023
630333
|
errors.fees = new FeeNotLoaded();
|
|
630024
630334
|
}
|
|
630025
|
-
const estimatedFees = t75.fees || (0,
|
|
630026
|
-
if (t75.amount.
|
|
630335
|
+
const estimatedFees = t75.fees || (0, import_bignumber91.BigNumber)(0);
|
|
630336
|
+
if (t75.amount.lte(0)) {
|
|
630027
630337
|
errors.amount = new AmountRequired();
|
|
630028
630338
|
}
|
|
630029
|
-
const
|
|
630030
|
-
const
|
|
630031
|
-
|
|
630032
|
-
|
|
630339
|
+
const tokenAccount = getTokenAccount(a86, t75);
|
|
630340
|
+
const amount = t75.useAllAmount ? tokenAccount ? tokenAccount.spendableBalance : a86.spendableBalance.minus(estimatedFees).isLessThan(0) ? (0, import_bignumber91.BigNumber)(0) : a86.spendableBalance.minus(estimatedFees) : t75.amount;
|
|
630341
|
+
const totalSpent = tokenAccount ? amount : amount.plus(estimatedFees);
|
|
630342
|
+
if (tokenAccount && t75.errors?.maxGasAmount == "GasInsufficientBalance" && !errors.amount) {
|
|
630343
|
+
errors.amount = new NotEnoughBalanceFees();
|
|
630033
630344
|
}
|
|
630034
|
-
if (!
|
|
630035
|
-
errors.
|
|
630036
|
-
} else if (l30.isValid({ input: t75.recipient }).valid === false && !errors.recipient) {
|
|
630037
|
-
errors.recipient = new InvalidAddress("", { currencyName: a86.currency.name });
|
|
630038
|
-
} else if (t75.recipient === a86.freshAddress && !errors.recipient) {
|
|
630039
|
-
errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
|
|
630345
|
+
if (tokenAccount ? tokenAccount.spendableBalance.isLessThan(totalSpent) || a86.spendableBalance.isLessThan(estimatedFees) : a86.spendableBalance.isLessThan(totalSpent) && !errors.amount) {
|
|
630346
|
+
errors.amount = new NotEnoughBalance();
|
|
630040
630347
|
}
|
|
630041
630348
|
return Promise.resolve({
|
|
630042
630349
|
errors,
|
|
@@ -642669,182 +642976,6 @@ setVerbosity(globalThis.__DEV__ !== false ? "log" : "silent");
|
|
|
642669
642976
|
var import_bignumber92 = __toESM(require("bignumber.js"));
|
|
642670
642977
|
var import_isUndefined = __toESM(require("lodash/isUndefined"));
|
|
642671
642978
|
|
|
642672
|
-
// ../../libs/coin-modules/coin-aptos/lib-es/constants.js
|
|
642673
|
-
var TX_STATUS;
|
|
642674
|
-
(function(TX_STATUS2) {
|
|
642675
|
-
TX_STATUS2["PENDING"] = "pending";
|
|
642676
|
-
TX_STATUS2["FAIL"] = "fail";
|
|
642677
|
-
TX_STATUS2["SUCCESS"] = "success";
|
|
642678
|
-
})(TX_STATUS || (TX_STATUS = {}));
|
|
642679
|
-
var WRITE_RESOURCE = "write_resource";
|
|
642680
|
-
var TRANSFER_TYPES = [
|
|
642681
|
-
"0x1::aptos_account::transfer",
|
|
642682
|
-
"0x1::aptos_account::transfer_coins",
|
|
642683
|
-
"0x1::coin::transfer"
|
|
642684
|
-
];
|
|
642685
|
-
var BATCH_TRANSFER_TYPES = [
|
|
642686
|
-
"0x1::aptos_account::batch_transfer",
|
|
642687
|
-
"0x1::aptos_account::batch_transfer_coins"
|
|
642688
|
-
];
|
|
642689
|
-
var DELEGATION_POOL_TYPES = [
|
|
642690
|
-
"0x1::delegation_pool::add_stake",
|
|
642691
|
-
"0x1::delegation_pool::withdraw"
|
|
642692
|
-
];
|
|
642693
|
-
var APTOS_ASSET_ID = "0x1::aptos_coin::AptosCoin";
|
|
642694
|
-
var APTOS_COIN_CHANGE = `0x1::coin::CoinStore<${APTOS_ASSET_ID}>`;
|
|
642695
|
-
var DIRECTION;
|
|
642696
|
-
(function(DIRECTION2) {
|
|
642697
|
-
DIRECTION2["IN"] = "IN";
|
|
642698
|
-
DIRECTION2["OUT"] = "OUT";
|
|
642699
|
-
DIRECTION2["UNKNOWN"] = "UNKNOWN";
|
|
642700
|
-
})(DIRECTION || (DIRECTION = {}));
|
|
642701
|
-
|
|
642702
|
-
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/logic.js
|
|
642703
|
-
var import_bignumber91 = __toESM(require("bignumber.js"));
|
|
642704
|
-
var DEFAULT_GAS = new import_bignumber91.default(200);
|
|
642705
|
-
var DEFAULT_GAS_PRICE = new import_bignumber91.default(100);
|
|
642706
|
-
var ESTIMATE_GAS_MUL = new import_bignumber91.default(1);
|
|
642707
|
-
var CLEAN_HEX_REGEXP = /^0x0*|^0+/;
|
|
642708
|
-
function isTestnet(currencyId) {
|
|
642709
|
-
return getCryptoCurrencyById(currencyId).isTestnetFor ? true : false;
|
|
642710
|
-
}
|
|
642711
|
-
var getMaxSendBalance = (amount, gas, gasPrice) => {
|
|
642712
|
-
const totalGas = gas.multipliedBy(gasPrice);
|
|
642713
|
-
return amount.gt(totalGas) ? amount.minus(totalGas) : new import_bignumber91.default(0);
|
|
642714
|
-
};
|
|
642715
|
-
function normalizeTransactionOptions(options21) {
|
|
642716
|
-
const check3 = (v56) => (v56 ?? "").toString().trim() ? v56 : void 0;
|
|
642717
|
-
return {
|
|
642718
|
-
maxGasAmount: check3(options21.maxGasAmount),
|
|
642719
|
-
gasUnitPrice: check3(options21.gasUnitPrice)
|
|
642720
|
-
};
|
|
642721
|
-
}
|
|
642722
|
-
var getBlankOperation = (tx, id5) => ({
|
|
642723
|
-
id: "",
|
|
642724
|
-
hash: tx.hash,
|
|
642725
|
-
type: "",
|
|
642726
|
-
value: new import_bignumber91.default(0),
|
|
642727
|
-
fee: new import_bignumber91.default(0),
|
|
642728
|
-
blockHash: tx.block?.hash,
|
|
642729
|
-
blockHeight: tx.block?.height,
|
|
642730
|
-
senders: [],
|
|
642731
|
-
recipients: [],
|
|
642732
|
-
accountId: id5,
|
|
642733
|
-
date: new Date(parseInt(tx.timestamp) / 1e3),
|
|
642734
|
-
extra: { version: tx.version },
|
|
642735
|
-
transactionSequenceNumber: parseInt(tx.sequence_number),
|
|
642736
|
-
hasFailed: false
|
|
642737
|
-
});
|
|
642738
|
-
var convertFunctionPayloadResponseToInputEntryFunctionData = (payload) => ({
|
|
642739
|
-
function: payload.function,
|
|
642740
|
-
typeArguments: payload.type_arguments,
|
|
642741
|
-
functionArguments: payload.arguments
|
|
642742
|
-
});
|
|
642743
|
-
var txsToOps = (info6, id5, txs) => {
|
|
642744
|
-
const { address: address4 } = info6;
|
|
642745
|
-
const ops = [];
|
|
642746
|
-
txs.forEach((tx) => {
|
|
642747
|
-
if (tx !== null) {
|
|
642748
|
-
const op = getBlankOperation(tx, id5);
|
|
642749
|
-
op.fee = new import_bignumber91.default(tx.gas_used).multipliedBy(new import_bignumber91.default(tx.gas_unit_price));
|
|
642750
|
-
const payload = convertFunctionPayloadResponseToInputEntryFunctionData(tx.payload);
|
|
642751
|
-
const function_address = getFunctionAddress(payload);
|
|
642752
|
-
if (!function_address) {
|
|
642753
|
-
return;
|
|
642754
|
-
}
|
|
642755
|
-
const { amount_in, amount_out } = getAptosAmounts(tx, address4);
|
|
642756
|
-
op.value = calculateAmount(tx.sender, address4, op.fee, amount_in, amount_out);
|
|
642757
|
-
op.type = compareAddress(tx.sender, address4) ? DIRECTION.OUT : DIRECTION.IN;
|
|
642758
|
-
op.senders.push(tx.sender);
|
|
642759
|
-
processRecipients(payload, address4, op, function_address);
|
|
642760
|
-
if (op.value.isZero()) {
|
|
642761
|
-
op.type = DIRECTION.UNKNOWN;
|
|
642762
|
-
}
|
|
642763
|
-
op.hasFailed = !tx.success;
|
|
642764
|
-
op.id = encodeOperationId(id5, tx.hash, op.type);
|
|
642765
|
-
if (op.type !== DIRECTION.UNKNOWN)
|
|
642766
|
-
ops.push(op);
|
|
642767
|
-
}
|
|
642768
|
-
});
|
|
642769
|
-
return ops;
|
|
642770
|
-
};
|
|
642771
|
-
function compareAddress(addressA, addressB) {
|
|
642772
|
-
return addressA.replace(CLEAN_HEX_REGEXP, "").toLowerCase() === addressB.replace(CLEAN_HEX_REGEXP, "").toLowerCase();
|
|
642773
|
-
}
|
|
642774
|
-
function getFunctionAddress(payload) {
|
|
642775
|
-
if (payload.function) {
|
|
642776
|
-
const parts = payload.function.split("::");
|
|
642777
|
-
return parts.length === 3 && parts[0].length ? parts[0] : void 0;
|
|
642778
|
-
}
|
|
642779
|
-
return void 0;
|
|
642780
|
-
}
|
|
642781
|
-
function processRecipients(payload, address4, op, function_address) {
|
|
642782
|
-
if ((TRANSFER_TYPES.includes(payload.function) || DELEGATION_POOL_TYPES.includes(payload.function)) && payload.functionArguments && payload.functionArguments.length > 0 && typeof payload.functionArguments[0] === "string") {
|
|
642783
|
-
op.recipients.push(payload.functionArguments[0].toString());
|
|
642784
|
-
} else if (BATCH_TRANSFER_TYPES.includes(payload.function) && payload.functionArguments && payload.functionArguments.length > 0 && Array.isArray(payload.functionArguments[0])) {
|
|
642785
|
-
if (!compareAddress(op.senders[0], address4)) {
|
|
642786
|
-
for (const recipient of payload.functionArguments[0]) {
|
|
642787
|
-
if (recipient && compareAddress(recipient.toString(), address4)) {
|
|
642788
|
-
op.recipients.push(recipient.toString());
|
|
642789
|
-
}
|
|
642790
|
-
}
|
|
642791
|
-
}
|
|
642792
|
-
} else {
|
|
642793
|
-
op.recipients.push(function_address);
|
|
642794
|
-
}
|
|
642795
|
-
}
|
|
642796
|
-
function checkWriteSets(tx, event, event_name) {
|
|
642797
|
-
return tx.changes.some((change2) => {
|
|
642798
|
-
return isChangeOfAptos(change2, event, event_name);
|
|
642799
|
-
});
|
|
642800
|
-
}
|
|
642801
|
-
function isChangeOfAptos(writeSetChange, event, event_name) {
|
|
642802
|
-
if (writeSetChange.type !== WRITE_RESOURCE) {
|
|
642803
|
-
return false;
|
|
642804
|
-
}
|
|
642805
|
-
if (!("data" in writeSetChange)) {
|
|
642806
|
-
return false;
|
|
642807
|
-
}
|
|
642808
|
-
const change_data = writeSetChange.data;
|
|
642809
|
-
if (!("type" in change_data)) {
|
|
642810
|
-
return false;
|
|
642811
|
-
}
|
|
642812
|
-
const mr = change_data;
|
|
642813
|
-
if (mr.type !== APTOS_COIN_CHANGE) {
|
|
642814
|
-
return false;
|
|
642815
|
-
}
|
|
642816
|
-
const change_event_data = mr.data[event_name];
|
|
642817
|
-
return change_event_data.guid.id.addr === event.guid.account_address && change_event_data.guid.id.creation_num === event.guid.creation_number;
|
|
642818
|
-
}
|
|
642819
|
-
function getAptosAmounts(tx, address4) {
|
|
642820
|
-
let amount_in = new import_bignumber91.default(0);
|
|
642821
|
-
let amount_out = new import_bignumber91.default(0);
|
|
642822
|
-
tx.events.forEach((event) => {
|
|
642823
|
-
if (compareAddress(event.guid.account_address, address4)) {
|
|
642824
|
-
switch (event.type) {
|
|
642825
|
-
case "0x1::coin::WithdrawEvent":
|
|
642826
|
-
if (checkWriteSets(tx, event, "withdraw_events")) {
|
|
642827
|
-
amount_out = amount_out.plus(event.data.amount);
|
|
642828
|
-
}
|
|
642829
|
-
break;
|
|
642830
|
-
case "0x1::coin::DepositEvent":
|
|
642831
|
-
if (checkWriteSets(tx, event, "deposit_events")) {
|
|
642832
|
-
amount_in = amount_in.plus(event.data.amount);
|
|
642833
|
-
}
|
|
642834
|
-
break;
|
|
642835
|
-
}
|
|
642836
|
-
}
|
|
642837
|
-
});
|
|
642838
|
-
return { amount_in, amount_out };
|
|
642839
|
-
}
|
|
642840
|
-
function calculateAmount(sender, address4, fee, amount_in, amount_out) {
|
|
642841
|
-
const is_sender = compareAddress(sender, address4);
|
|
642842
|
-
if (is_sender) {
|
|
642843
|
-
amount_out = amount_out.plus(fee);
|
|
642844
|
-
}
|
|
642845
|
-
return is_sender ? amount_out.minus(amount_in) : amount_in.minus(amount_out);
|
|
642846
|
-
}
|
|
642847
|
-
|
|
642848
642979
|
// ../../libs/coin-modules/coin-aptos/lib-es/api/graphql/queries.js
|
|
642849
642980
|
var GetDelegatedStakingActivities = gql`
|
|
642850
642981
|
query getDelegatedStakingActivities($delegatorAddress: String) {
|
|
@@ -642863,8 +642994,8 @@ var GetDelegatedStakingActivities = gql`
|
|
|
642863
642994
|
`;
|
|
642864
642995
|
var GetAccountTransactionsData = gql`
|
|
642865
642996
|
query GetAccountTransactionsData($address: String, $limit: Int) {
|
|
642866
|
-
|
|
642867
|
-
where: {
|
|
642997
|
+
account_transactions(
|
|
642998
|
+
where: { account_address: { _eq: $address } }
|
|
642868
642999
|
order_by: { transaction_version: desc }
|
|
642869
643000
|
limit: $limit
|
|
642870
643001
|
) {
|
|
@@ -642875,8 +643006,8 @@ var GetAccountTransactionsData = gql`
|
|
|
642875
643006
|
`;
|
|
642876
643007
|
var GetAccountTransactionsDataGt = gql`
|
|
642877
643008
|
query GetAccountTransactionsDataGt($address: String, $limit: Int, $gt: bigint) {
|
|
642878
|
-
|
|
642879
|
-
where: {
|
|
643009
|
+
account_transactions(
|
|
643010
|
+
where: { account_address: { _eq: $address }, transaction_version: { _gt: $gt } }
|
|
642880
643011
|
order_by: { transaction_version: desc }
|
|
642881
643012
|
limit: $limit
|
|
642882
643013
|
) {
|
|
@@ -642887,8 +643018,8 @@ var GetAccountTransactionsDataGt = gql`
|
|
|
642887
643018
|
`;
|
|
642888
643019
|
var GetAccountTransactionsDataLt = gql`
|
|
642889
643020
|
query GetAccountTransactionsDataLt($address: String, $limit: Int, $lt: bigint) {
|
|
642890
|
-
|
|
642891
|
-
where: {
|
|
643021
|
+
account_transactions(
|
|
643022
|
+
where: { account_address: { _eq: $address }, transaction_version: { _lt: $lt } }
|
|
642892
643023
|
order_by: { transaction_version: desc }
|
|
642893
643024
|
limit: $limit
|
|
642894
643025
|
) {
|
|
@@ -642928,7 +643059,7 @@ var AptosAPI = class {
|
|
|
642928
643059
|
}
|
|
642929
643060
|
async getAccountInfo(address4, startAt) {
|
|
642930
643061
|
const [balance, transactions3, blockHeight] = await Promise.all([
|
|
642931
|
-
this.
|
|
643062
|
+
this.getCoinBalance(address4, APTOS_ASSET_ID),
|
|
642932
643063
|
this.fetchTransactions(address4, startAt),
|
|
642933
643064
|
this.getHeight()
|
|
642934
643065
|
]);
|
|
@@ -642985,12 +643116,21 @@ var AptosAPI = class {
|
|
|
642985
643116
|
});
|
|
642986
643117
|
return pendingTx.data.hash;
|
|
642987
643118
|
}
|
|
642988
|
-
async getBalance(address4) {
|
|
643119
|
+
async getBalance(address4, token) {
|
|
643120
|
+
let balance = new import_bignumber92.default(0);
|
|
643121
|
+
if (token.tokenType === "coin") {
|
|
643122
|
+
balance = await this.getCoinBalance(address4, token.contractAddress);
|
|
643123
|
+
} else {
|
|
643124
|
+
balance = await this.getFABalance(address4, token.contractAddress);
|
|
643125
|
+
}
|
|
643126
|
+
return balance;
|
|
643127
|
+
}
|
|
643128
|
+
async getCoinBalance(address4, contract_address) {
|
|
642989
643129
|
try {
|
|
642990
643130
|
const [balanceStr] = await this.aptosClient.view({
|
|
642991
643131
|
payload: {
|
|
642992
643132
|
function: "0x1::coin::balance",
|
|
642993
|
-
typeArguments: [
|
|
643133
|
+
typeArguments: [contract_address],
|
|
642994
643134
|
functionArguments: [address4]
|
|
642995
643135
|
}
|
|
642996
643136
|
});
|
|
@@ -643000,6 +643140,21 @@ var AptosAPI = class {
|
|
|
643000
643140
|
return new import_bignumber92.default(0);
|
|
643001
643141
|
}
|
|
643002
643142
|
}
|
|
643143
|
+
async getFABalance(address4, contract_address) {
|
|
643144
|
+
try {
|
|
643145
|
+
const [balanceStr] = await this.aptosClient.view({
|
|
643146
|
+
payload: {
|
|
643147
|
+
function: "0x1::primary_fungible_store::balance",
|
|
643148
|
+
typeArguments: ["0x1::object::ObjectCore"],
|
|
643149
|
+
functionArguments: [address4, contract_address]
|
|
643150
|
+
}
|
|
643151
|
+
});
|
|
643152
|
+
const balance = parseInt(balanceStr, 10);
|
|
643153
|
+
return new import_bignumber92.default(balance);
|
|
643154
|
+
} catch (_17) {
|
|
643155
|
+
return new import_bignumber92.default(0);
|
|
643156
|
+
}
|
|
643157
|
+
}
|
|
643003
643158
|
async fetchTransactions(address4, gt2) {
|
|
643004
643159
|
if (!address4) {
|
|
643005
643160
|
return [];
|
|
@@ -643017,7 +643172,7 @@ var AptosAPI = class {
|
|
|
643017
643172
|
},
|
|
643018
643173
|
fetchPolicy: "network-only"
|
|
643019
643174
|
});
|
|
643020
|
-
return Promise.all(queryResponse.data.
|
|
643175
|
+
return Promise.all(queryResponse.data.account_transactions.map(({ transaction_version }) => {
|
|
643021
643176
|
return this.richItemByVersion(transaction_version);
|
|
643022
643177
|
}));
|
|
643023
643178
|
}
|
|
@@ -643057,16 +643212,41 @@ var import_bignumber93 = __toESM(require("bignumber.js"));
|
|
|
643057
643212
|
|
|
643058
643213
|
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/buildTransaction.js
|
|
643059
643214
|
var buildTransaction = async (account3, transaction, aptosClient2) => {
|
|
643060
|
-
const
|
|
643215
|
+
const subAccount = findSubAccountById(account3, transaction.subAccountId ?? "");
|
|
643216
|
+
const txPayload = getPayload(subAccount, transaction);
|
|
643061
643217
|
const txOptions = normalizeTransactionOptions(transaction.options);
|
|
643062
643218
|
const tx = await aptosClient2.generateTransaction(account3.freshAddress, txPayload, txOptions);
|
|
643063
643219
|
return tx;
|
|
643064
643220
|
};
|
|
643065
|
-
var getPayload = (
|
|
643221
|
+
var getPayload = (tokenAccount, transaction) => {
|
|
643222
|
+
if (tokenAccount && isTokenAccount(tokenAccount)) {
|
|
643223
|
+
const { tokenType } = tokenAccount.token;
|
|
643224
|
+
if (!SUPPORTED_TOKEN_TYPES.includes(tokenType)) {
|
|
643225
|
+
throw new Error(`Token type ${tokenType} not supported`);
|
|
643226
|
+
}
|
|
643227
|
+
if (tokenType === "fungible_asset") {
|
|
643228
|
+
return {
|
|
643229
|
+
function: `0x1::primary_fungible_store::transfer`,
|
|
643230
|
+
typeArguments: ["0x1::fungible_asset::Metadata"],
|
|
643231
|
+
functionArguments: [
|
|
643232
|
+
tokenAccount.token.contractAddress,
|
|
643233
|
+
transaction.recipient,
|
|
643234
|
+
transaction.amount.toString()
|
|
643235
|
+
]
|
|
643236
|
+
};
|
|
643237
|
+
}
|
|
643238
|
+
if (tokenType === "coin") {
|
|
643239
|
+
return {
|
|
643240
|
+
function: `0x1::aptos_account::transfer_coins`,
|
|
643241
|
+
typeArguments: [tokenAccount.token.contractAddress],
|
|
643242
|
+
functionArguments: [transaction.recipient, transaction.amount.toString()]
|
|
643243
|
+
};
|
|
643244
|
+
}
|
|
643245
|
+
}
|
|
643066
643246
|
return {
|
|
643067
643247
|
function: "0x1::aptos_account::transfer_coins",
|
|
643068
643248
|
typeArguments: [APTOS_ASSET_ID],
|
|
643069
|
-
functionArguments: [
|
|
643249
|
+
functionArguments: [transaction.recipient, transaction.amount.toString()]
|
|
643070
643250
|
};
|
|
643071
643251
|
};
|
|
643072
643252
|
var buildTransaction_default = buildTransaction;
|
|
@@ -643096,9 +643276,10 @@ var getFee = async (account3, transaction, aptosClient2) => {
|
|
|
643096
643276
|
gasLimit = new import_bignumber93.default(completedTx.gas_used).multipliedBy(ESTIMATE_GAS_MUL);
|
|
643097
643277
|
gasPrice = new import_bignumber93.default(completedTx.gas_unit_price);
|
|
643098
643278
|
const expectedGas = gasPrice.multipliedBy(gasLimit);
|
|
643099
|
-
|
|
643100
|
-
|
|
643101
|
-
|
|
643279
|
+
if (!completedTx.success) {
|
|
643280
|
+
if (completedTx.vm_status.includes("MAX_GAS_UNITS_BELOW_MIN_TRANSACTION_GAS_UNITS")) {
|
|
643281
|
+
res.errors.maxGasAmount = "GasInsufficientBalance";
|
|
643282
|
+
} else if (!completedTx.vm_status.includes("INSUFFICIENT_BALANCE") && !completedTx.vm_status.includes("0x203ed")) {
|
|
643102
643283
|
throw Error(`Simulation failed with following error: ${completedTx.vm_status}`);
|
|
643103
643284
|
}
|
|
643104
643285
|
}
|
|
@@ -643112,7 +643293,10 @@ var getFee = async (account3, transaction, aptosClient2) => {
|
|
|
643112
643293
|
}
|
|
643113
643294
|
return res;
|
|
643114
643295
|
};
|
|
643115
|
-
var CACHE = makeLRUCache(getFee, (account3, transaction) =>
|
|
643296
|
+
var CACHE = makeLRUCache(getFee, (account3, transaction) => {
|
|
643297
|
+
const tokenAccount = getTokenAccount(account3, transaction);
|
|
643298
|
+
return `${tokenAccount ? tokenAccount.id : account3.id}-${transaction.amount.toString()}}`;
|
|
643299
|
+
}, seconds(30));
|
|
643116
643300
|
var getEstimatedGas = async (account3, transaction, aptosClient2) => {
|
|
643117
643301
|
return await CACHE(account3, transaction, aptosClient2);
|
|
643118
643302
|
};
|
|
@@ -643128,7 +643312,7 @@ var estimateMaxSpendable3 = async ({ account: account3, parentAccount, transacti
|
|
|
643128
643312
|
maxGasAmount = (0, import_bignumber94.BigNumber)(estimate.maxGasAmount);
|
|
643129
643313
|
gasUnitPrice = (0, import_bignumber94.BigNumber)(estimate.gasUnitPrice);
|
|
643130
643314
|
}
|
|
643131
|
-
return getMaxSendBalance(
|
|
643315
|
+
return getMaxSendBalance(maxGasAmount, gasUnitPrice, mainAccount, transaction);
|
|
643132
643316
|
};
|
|
643133
643317
|
var estimateMaxSpendable_default = estimateMaxSpendable3;
|
|
643134
643318
|
|
|
@@ -643146,11 +643330,11 @@ var prepareTransaction3 = async (account3, transaction) => {
|
|
|
643146
643330
|
}
|
|
643147
643331
|
const aptosClient2 = new AptosAPI(account3.currency.id);
|
|
643148
643332
|
if (transaction.useAllAmount) {
|
|
643149
|
-
transaction.amount = getMaxSendBalance(
|
|
643333
|
+
transaction.amount = getMaxSendBalance(new import_bignumber95.default(DEFAULT_GAS), new import_bignumber95.default(DEFAULT_GAS_PRICE), account3, transaction);
|
|
643150
643334
|
}
|
|
643151
643335
|
const { fees: fees2, estimate, errors } = await getEstimatedGas(account3, transaction, aptosClient2);
|
|
643152
643336
|
if (transaction.useAllAmount) {
|
|
643153
|
-
transaction.amount = getMaxSendBalance(
|
|
643337
|
+
transaction.amount = getMaxSendBalance((0, import_bignumber95.default)(estimate.maxGasAmount), (0, import_bignumber95.default)(estimate.gasUnitPrice), account3, transaction);
|
|
643154
643338
|
}
|
|
643155
643339
|
transaction.fees = fees2;
|
|
643156
643340
|
transaction.options = estimate;
|
|
@@ -643175,6 +643359,86 @@ var createTransaction3 = () => ({
|
|
|
643175
643359
|
var createTransaction_default2 = createTransaction3;
|
|
643176
643360
|
|
|
643177
643361
|
// ../../libs/coin-modules/coin-aptos/lib-es/bridge/synchronisation.js
|
|
643362
|
+
var updatableSubAccountProperties2 = [
|
|
643363
|
+
{ name: "balance", isOps: false },
|
|
643364
|
+
{ name: "spendableBalance", isOps: false },
|
|
643365
|
+
{ name: "balanceHistoryCache", isOps: false },
|
|
643366
|
+
{ name: "operations", isOps: true },
|
|
643367
|
+
{ name: "pendingOperations", isOps: true }
|
|
643368
|
+
];
|
|
643369
|
+
var mergeSubAccounts2 = (initialAccount, newSubAccounts) => {
|
|
643370
|
+
const oldSubAccounts = initialAccount?.subAccounts;
|
|
643371
|
+
if (!oldSubAccounts) {
|
|
643372
|
+
return newSubAccounts;
|
|
643373
|
+
}
|
|
643374
|
+
const oldSubAccountsById = {};
|
|
643375
|
+
for (const oldSubAccount of oldSubAccounts) {
|
|
643376
|
+
oldSubAccountsById[oldSubAccount.id] = oldSubAccount;
|
|
643377
|
+
}
|
|
643378
|
+
const newSubAccountsToAdd = [];
|
|
643379
|
+
for (const newSubAccount of newSubAccounts) {
|
|
643380
|
+
const duplicatedAccount = oldSubAccountsById[newSubAccount.id];
|
|
643381
|
+
if (!duplicatedAccount) {
|
|
643382
|
+
newSubAccountsToAdd.push(newSubAccount);
|
|
643383
|
+
continue;
|
|
643384
|
+
}
|
|
643385
|
+
const updates7 = {};
|
|
643386
|
+
for (const { name: name3, isOps } of updatableSubAccountProperties2) {
|
|
643387
|
+
if (!isOps) {
|
|
643388
|
+
if (newSubAccount[name3] !== duplicatedAccount[name3]) {
|
|
643389
|
+
updates7[name3] = newSubAccount[name3];
|
|
643390
|
+
}
|
|
643391
|
+
} else {
|
|
643392
|
+
updates7[name3] = mergeOps(duplicatedAccount[name3], newSubAccount[name3]) || [];
|
|
643393
|
+
}
|
|
643394
|
+
}
|
|
643395
|
+
updates7.operationsCount = updates7.operations?.length || duplicatedAccount?.operations?.length || 0;
|
|
643396
|
+
oldSubAccountsById[newSubAccount.id] = {
|
|
643397
|
+
...duplicatedAccount,
|
|
643398
|
+
...updates7
|
|
643399
|
+
};
|
|
643400
|
+
}
|
|
643401
|
+
const updatedSubAccounts = Object.values(oldSubAccountsById);
|
|
643402
|
+
return [...updatedSubAccounts, ...newSubAccountsToAdd];
|
|
643403
|
+
};
|
|
643404
|
+
var getSubAccountShape2 = async (currency24, address4, parentId, token, operations) => {
|
|
643405
|
+
const aptosClient2 = new AptosAPI(currency24.id);
|
|
643406
|
+
const tokenAccountId = encodeTokenAccountId(parentId, token);
|
|
643407
|
+
const balance = await aptosClient2.getBalance(address4, token);
|
|
643408
|
+
const firstOperation = operations.sort((a86, b23) => b23.date.getTime() - a86.date.getTime()).at(operations.length - 1);
|
|
643409
|
+
return {
|
|
643410
|
+
type: "TokenAccount",
|
|
643411
|
+
id: tokenAccountId,
|
|
643412
|
+
parentId,
|
|
643413
|
+
token,
|
|
643414
|
+
balance,
|
|
643415
|
+
spendableBalance: balance,
|
|
643416
|
+
creationDate: firstOperation?.date || /* @__PURE__ */ new Date(0),
|
|
643417
|
+
operations,
|
|
643418
|
+
operationsCount: operations.length,
|
|
643419
|
+
pendingOperations: [],
|
|
643420
|
+
balanceHistoryCache: emptyHistoryCache,
|
|
643421
|
+
swapHistory: []
|
|
643422
|
+
};
|
|
643423
|
+
};
|
|
643424
|
+
var getSubAccounts2 = async (infos, address4, accountId2, lastTokenOperations) => {
|
|
643425
|
+
const { currency: currency24 } = infos;
|
|
643426
|
+
const operationsByToken = lastTokenOperations.reduce((acc, operation) => {
|
|
643427
|
+
const { token } = decodeTokenAccountId(operation.accountId);
|
|
643428
|
+
if (!token)
|
|
643429
|
+
return acc;
|
|
643430
|
+
if (!acc.has(token)) {
|
|
643431
|
+
acc.set(token, []);
|
|
643432
|
+
}
|
|
643433
|
+
acc.get(token)?.push(operation);
|
|
643434
|
+
return acc;
|
|
643435
|
+
}, /* @__PURE__ */ new Map());
|
|
643436
|
+
const subAccountsPromises = [];
|
|
643437
|
+
for (const [token, ops] of operationsByToken.entries()) {
|
|
643438
|
+
subAccountsPromises.push(getSubAccountShape2(currency24, address4, accountId2, token, ops));
|
|
643439
|
+
}
|
|
643440
|
+
return Promise.all(subAccountsPromises);
|
|
643441
|
+
};
|
|
643178
643442
|
var getAccountShape3 = async (info6) => {
|
|
643179
643443
|
const { address: address4, initialAccount, currency: currency24, derivationMode, rest } = info6;
|
|
643180
643444
|
const publicKey3 = rest?.publicKey || initialAccount && decodeAccountId(initialAccount.id).xpubOrAddress;
|
|
@@ -643187,11 +643451,17 @@ var getAccountShape3 = async (info6) => {
|
|
|
643187
643451
|
});
|
|
643188
643452
|
const xpub = initialAccount?.xpub || publicKey3 || "";
|
|
643189
643453
|
const oldOperations = initialAccount?.operations || [];
|
|
643190
|
-
const startAt = oldOperations[0]?.extra?.version;
|
|
643191
643454
|
const aptosClient2 = new AptosAPI(currency24.id);
|
|
643192
|
-
const { balance, transactions: transactions3, blockHeight } = await aptosClient2.getAccountInfo(address4
|
|
643193
|
-
const newOperations = txsToOps(info6, accountId2, transactions3);
|
|
643455
|
+
const { balance, transactions: transactions3, blockHeight } = await aptosClient2.getAccountInfo(address4);
|
|
643456
|
+
const [newOperations, tokenOperations] = txsToOps(info6, accountId2, transactions3);
|
|
643194
643457
|
const operations = mergeOps(oldOperations, newOperations);
|
|
643458
|
+
const newSubAccounts = await getSubAccounts2(info6, address4, accountId2, tokenOperations);
|
|
643459
|
+
const shouldSyncFromScratch = initialAccount === void 0;
|
|
643460
|
+
const subAccounts = shouldSyncFromScratch ? newSubAccounts : mergeSubAccounts2(initialAccount, newSubAccounts);
|
|
643461
|
+
operations.forEach((op) => {
|
|
643462
|
+
const subOperations = inferSubOperations(op.hash, subAccounts);
|
|
643463
|
+
op.subOperations = subOperations.length === 1 ? subOperations : subOperations.filter((op2) => !!op2.blockHash);
|
|
643464
|
+
});
|
|
643195
643465
|
const shape = {
|
|
643196
643466
|
type: "Account",
|
|
643197
643467
|
id: accountId2,
|
|
@@ -643201,7 +643471,8 @@ var getAccountShape3 = async (info6) => {
|
|
|
643201
643471
|
operations,
|
|
643202
643472
|
operationsCount: operations.length,
|
|
643203
643473
|
blockHeight,
|
|
643204
|
-
lastSyncDate: /* @__PURE__ */ new Date()
|
|
643474
|
+
lastSyncDate: /* @__PURE__ */ new Date(),
|
|
643475
|
+
subAccounts
|
|
643205
643476
|
};
|
|
643206
643477
|
return shape;
|
|
643207
643478
|
};
|
|
@@ -643253,11 +643524,12 @@ var buildSignOperation3 = (signerContext3) => ({ account: account3, transaction,
|
|
|
643253
643524
|
senders.push(account3.freshAddress);
|
|
643254
643525
|
recipients.push(transaction.recipient);
|
|
643255
643526
|
}
|
|
643527
|
+
const subAccount = !!transaction.subAccountId && findSubAccountById(account3, transaction.subAccountId);
|
|
643256
643528
|
const operation = {
|
|
643257
643529
|
id: encodeOperationId(accountId2, hash12, type5),
|
|
643258
643530
|
hash: hash12,
|
|
643259
643531
|
type: type5,
|
|
643260
|
-
value:
|
|
643532
|
+
value: subAccount ? fee : transaction.amount.plus(fee),
|
|
643261
643533
|
fee,
|
|
643262
643534
|
extra,
|
|
643263
643535
|
blockHash: null,
|
|
@@ -643266,7 +643538,19 @@ var buildSignOperation3 = (signerContext3) => ({ account: account3, transaction,
|
|
|
643266
643538
|
recipients,
|
|
643267
643539
|
accountId: accountId2,
|
|
643268
643540
|
date: /* @__PURE__ */ new Date(),
|
|
643269
|
-
transactionSequenceNumber: Number(rawTx.sequence_number)
|
|
643541
|
+
transactionSequenceNumber: Number(rawTx.sequence_number),
|
|
643542
|
+
subOperations: subAccount ? [
|
|
643543
|
+
{
|
|
643544
|
+
id: encodeOperationId(subAccount.id, "", "OUT"),
|
|
643545
|
+
type: "OUT",
|
|
643546
|
+
accountId: transaction.subAccountId,
|
|
643547
|
+
senders: [account3.freshAddress],
|
|
643548
|
+
recipients: [transaction.recipient],
|
|
643549
|
+
value: transaction.amount,
|
|
643550
|
+
fee,
|
|
643551
|
+
date: /* @__PURE__ */ new Date()
|
|
643552
|
+
}
|
|
643553
|
+
] : []
|
|
643270
643554
|
};
|
|
643271
643555
|
o56.next({
|
|
643272
643556
|
type: "signed",
|
|
@@ -765705,13 +765989,13 @@ function buildAssociatedTokenAccountInstruction(payer, associatedToken, owner, m
|
|
|
765705
765989
|
});
|
|
765706
765990
|
}
|
|
765707
765991
|
|
|
765708
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
765992
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/index.js
|
|
765709
765993
|
init_lib_es();
|
|
765710
765994
|
|
|
765711
765995
|
// ../../libs/coin-modules/coin-solana/lib-es/helpers/token.js
|
|
765712
765996
|
var import_bignumber214 = __toESM(require("bignumber.js"));
|
|
765713
765997
|
|
|
765714
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
765998
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/program/constants.js
|
|
765715
765999
|
var PARSED_PROGRAMS = {
|
|
765716
766000
|
SPL_ASSOCIATED_TOKEN_ACCOUNT: "spl-associated-token-account",
|
|
765717
766001
|
BPF_LOADER: "bpf-loader",
|
|
@@ -765759,7 +766043,7 @@ function calculateToken2022TransferFees({ transferAmount, transferFeeConfigState
|
|
|
765759
766043
|
};
|
|
765760
766044
|
}
|
|
765761
766045
|
|
|
765762
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766046
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/index.js
|
|
765763
766047
|
var LATEST_BLOCKHASH_MOCK = "EEbZs6DmDyDjucyYbo3LwVJU7pQYuVopYcYTSEZXskW3";
|
|
765764
766048
|
var remapErrors = (e54) => {
|
|
765765
766049
|
throw new NetworkError(e54 instanceof Error ? e54.message : "Unknown Solana error");
|
|
@@ -765907,7 +766191,7 @@ function getChainAPI(config4, logger49) {
|
|
|
765907
766191
|
};
|
|
765908
766192
|
}
|
|
765909
766193
|
|
|
765910
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766194
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/cached.js
|
|
765911
766195
|
var import_object_hash = __toESM(require_object_hash());
|
|
765912
766196
|
var cacheKeyAddress = (address4) => address4;
|
|
765913
766197
|
var cacheKeyEmpty = () => "";
|
|
@@ -766079,7 +766363,7 @@ function isSignaturesForAddressResponse(value6) {
|
|
|
766079
766363
|
return isUnknownObject(value6) && typeof value6.id === "string" && Array.isArray(value6.result) && value6.result.every(isConfirmedSignatureInfo);
|
|
766080
766364
|
}
|
|
766081
766365
|
|
|
766082
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766366
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/queued.js
|
|
766083
766367
|
function queued(api8, delayBetweenRuns = 100) {
|
|
766084
766368
|
const q10 = asyncQueue({
|
|
766085
766369
|
delayBetweenRuns
|
|
@@ -766099,7 +766383,7 @@ function queued(api8, delayBetweenRuns = 100) {
|
|
|
766099
766383
|
return proxy2;
|
|
766100
766384
|
}
|
|
766101
766385
|
|
|
766102
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766386
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/traced.js
|
|
766103
766387
|
init_lib_es2();
|
|
766104
766388
|
function traced(api8) {
|
|
766105
766389
|
const state = {
|
|
@@ -766172,7 +766456,7 @@ function formatMsg({ reqId, msg, duration }) {
|
|
|
766172
766456
|
// ../../libs/coin-modules/coin-solana/lib-es/prepareTransaction.js
|
|
766173
766457
|
init_lib_es();
|
|
766174
766458
|
|
|
766175
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766459
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/web3.js
|
|
766176
766460
|
var import_bignumber217 = __toESM(require("bignumber.js"));
|
|
766177
766461
|
var import_chunk3 = __toESM(require("lodash/chunk"));
|
|
766178
766462
|
var import_uniq = __toESM(require("lodash/uniq"));
|
|
@@ -766689,16 +766973,16 @@ function refine(struct21, name3, refiner) {
|
|
|
766689
766973
|
});
|
|
766690
766974
|
}
|
|
766691
766975
|
|
|
766692
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766976
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/validators/index.js
|
|
766693
766977
|
var ParsedInfo = type2({
|
|
766694
766978
|
type: string3(),
|
|
766695
766979
|
info: any2()
|
|
766696
766980
|
});
|
|
766697
766981
|
|
|
766698
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766982
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/validators/pubkey.js
|
|
766699
766983
|
var PublicKeyFromString2 = coerce5(instance2(PublicKey4), string3(), (value6) => new PublicKey4(value6));
|
|
766700
766984
|
|
|
766701
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766985
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/validators/bignum.js
|
|
766702
766986
|
var import_bignumber216 = require("bignumber.js");
|
|
766703
766987
|
var BigNumFromString = coerce5(instance2(import_bignumber216.BigNumber), string3(), (value6) => {
|
|
766704
766988
|
if (typeof value6 === "string")
|
|
@@ -766711,7 +766995,7 @@ var BigNumFromNumber = coerce5(instance2(import_bignumber216.BigNumber), number6
|
|
|
766711
766995
|
throw new Error("invalid big num");
|
|
766712
766996
|
});
|
|
766713
766997
|
|
|
766714
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
766998
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/account/stake.js
|
|
766715
766999
|
var StakeAccountType = enums(["uninitialized", "initialized", "delegated", "rewardsPool"]);
|
|
766716
767000
|
var StakeMeta = type2({
|
|
766717
767001
|
rentExemptReserve: BigNumFromString,
|
|
@@ -766750,7 +767034,7 @@ var StakeAccount = type2({
|
|
|
766750
767034
|
info: StakeAccountInfo
|
|
766751
767035
|
});
|
|
766752
767036
|
|
|
766753
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
767037
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/account/tokenExtensions.js
|
|
766754
767038
|
var DefaultAccountState = enums(["initialized", "frozen"]);
|
|
766755
767039
|
var TokenAccountExtensionType = enums([
|
|
766756
767040
|
"transferFeeAmount",
|
|
@@ -767020,7 +767304,7 @@ var MintExtensions = array2(union2([
|
|
|
767020
767304
|
]));
|
|
767021
767305
|
var ExtensionType2 = union2([TokenAccountExtensionType, MintExtensionType]);
|
|
767022
767306
|
|
|
767023
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
767307
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/account/token.js
|
|
767024
767308
|
var TokenAccountType = enums(["mint", "account", "multisig"]);
|
|
767025
767309
|
var AccountState2 = enums(["initialized", "uninitialized", "frozen"]);
|
|
767026
767310
|
var TokenAmount = type2({
|
|
@@ -767060,7 +767344,7 @@ var TokenAccount = type2({
|
|
|
767060
767344
|
info: any2()
|
|
767061
767345
|
});
|
|
767062
767346
|
|
|
767063
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
767347
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/account/vote.js
|
|
767064
767348
|
var VoteAccountType = enums(["vote"]);
|
|
767065
767349
|
var AuthorizedVoter = type2({
|
|
767066
767350
|
authorizedVoter: PublicKeyFromString2,
|
|
@@ -767099,7 +767383,7 @@ var VoteAccount = type2({
|
|
|
767099
767383
|
info: VoteAccountInfo
|
|
767100
767384
|
});
|
|
767101
767385
|
|
|
767102
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
767386
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/account/parser.js
|
|
767103
767387
|
function parseMintAccountInfo(info6) {
|
|
767104
767388
|
return create3(info6, MintAccountInfo);
|
|
767105
767389
|
}
|
|
@@ -767165,7 +767449,7 @@ function onThrowReturnError(fn3) {
|
|
|
767165
767449
|
}
|
|
767166
767450
|
}
|
|
767167
767451
|
|
|
767168
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
767452
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/web3.js
|
|
767169
767453
|
var MEMO_PROGRAM_ID = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";
|
|
767170
767454
|
function toTokenAccountWithInfo(onChainAcc) {
|
|
767171
767455
|
const parsedInfo = onChainAcc.account.data.parsed.info;
|
|
@@ -768397,7 +768681,7 @@ function getCurrentSolanaPreloadData(currency24) {
|
|
|
768397
768681
|
return data6;
|
|
768398
768682
|
}
|
|
768399
768683
|
|
|
768400
|
-
// ../../libs/coin-modules/coin-solana/lib-es/validator-app/index.js
|
|
768684
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/validator-app/index.js
|
|
768401
768685
|
var import_fp2 = require("lodash/fp");
|
|
768402
768686
|
var MAX_VALIDATORS_NB = 1e3;
|
|
768403
768687
|
var URLS = {
|
|
@@ -768549,7 +768833,7 @@ var import_groupBy4 = __toESM(require("lodash/groupBy"));
|
|
|
768549
768833
|
var import_head = __toESM(require("lodash/head"));
|
|
768550
768834
|
var import_compact4 = __toESM(require("lodash/compact"));
|
|
768551
768835
|
|
|
768552
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
768836
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/token/types.js
|
|
768553
768837
|
var TokenAmountUi = type2({
|
|
768554
768838
|
amount: string3(),
|
|
768555
768839
|
decimals: number6(),
|
|
@@ -768859,7 +769143,7 @@ var IX_TITLES = {
|
|
|
768859
769143
|
transferCheckedWithFee: "Transfer With Fee (Checked)"
|
|
768860
769144
|
};
|
|
768861
769145
|
|
|
768862
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769146
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/token/index.js
|
|
768863
769147
|
function parseSplTokenInstruction(ix) {
|
|
768864
769148
|
const parsed2 = create3(ix.parsed, ParsedInfo);
|
|
768865
769149
|
const { type: rawType, info: info6 } = parsed2;
|
|
@@ -768873,7 +769157,7 @@ function parseSplTokenInstruction(ix) {
|
|
|
768873
769157
|
};
|
|
768874
769158
|
}
|
|
768875
769159
|
|
|
768876
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769160
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/associated-token-account/types.js
|
|
768877
769161
|
var AssociateInfo = type2({
|
|
768878
769162
|
account: PublicKeyFromString2,
|
|
768879
769163
|
mint: PublicKeyFromString2,
|
|
@@ -768887,7 +769171,7 @@ var IX_TITLES2 = {
|
|
|
768887
769171
|
associate: "Associate"
|
|
768888
769172
|
};
|
|
768889
769173
|
|
|
768890
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769174
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/associated-token-account/index.js
|
|
768891
769175
|
function parseAssociatedTokenAccountInstruction(ix) {
|
|
768892
769176
|
const parsed2 = create3(ix.parsed, ParsedInfo);
|
|
768893
769177
|
const type5 = "associate";
|
|
@@ -768900,7 +769184,7 @@ function parseAssociatedTokenAccountInstruction(ix) {
|
|
|
768900
769184
|
};
|
|
768901
769185
|
}
|
|
768902
769186
|
|
|
768903
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769187
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/memo/index.js
|
|
768904
769188
|
function parseSplMemoInstruction(ix) {
|
|
768905
769189
|
return {
|
|
768906
769190
|
title: "Save",
|
|
@@ -768911,7 +769195,7 @@ function parseSplMemoInstruction(ix) {
|
|
|
768911
769195
|
};
|
|
768912
769196
|
}
|
|
768913
769197
|
|
|
768914
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769198
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/stake/types.js
|
|
768915
769199
|
var InitializeInfo = type2({
|
|
768916
769200
|
stakeAccount: PublicKeyFromString2,
|
|
768917
769201
|
authorized: type2({
|
|
@@ -768986,7 +769270,7 @@ var IX_TITLES3 = {
|
|
|
768986
769270
|
merge: "Merge"
|
|
768987
769271
|
};
|
|
768988
769272
|
|
|
768989
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769273
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/stake/index.js
|
|
768990
769274
|
function parseStakeInstruction(ix) {
|
|
768991
769275
|
const parsed2 = create3(ix.parsed, ParsedInfo);
|
|
768992
769276
|
const { type: rawType, info: info6 } = parsed2;
|
|
@@ -769000,7 +769284,7 @@ function parseStakeInstruction(ix) {
|
|
|
769000
769284
|
};
|
|
769001
769285
|
}
|
|
769002
769286
|
|
|
769003
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769287
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/system/types.js
|
|
769004
769288
|
var CreateAccountInfo = type2({
|
|
769005
769289
|
source: PublicKeyFromString2,
|
|
769006
769290
|
newAccount: PublicKeyFromString2,
|
|
@@ -769113,7 +769397,7 @@ var IX_TITLES4 = {
|
|
|
769113
769397
|
transferWithSeed: "Transfer With Seed"
|
|
769114
769398
|
};
|
|
769115
769399
|
|
|
769116
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769400
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/instruction/system/index.js
|
|
769117
769401
|
function parseSystemInstruction(ix) {
|
|
769118
769402
|
const parsed2 = create3(ix.parsed, ParsedInfo);
|
|
769119
769403
|
const { type: rawType, info: info6 } = parsed2;
|
|
@@ -769127,7 +769411,7 @@ function parseSystemInstruction(ix) {
|
|
|
769127
769411
|
};
|
|
769128
769412
|
}
|
|
769129
769413
|
|
|
769130
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769414
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/program/parser.js
|
|
769131
769415
|
var parse11 = (ix) => {
|
|
769132
769416
|
if ("parsed" in ix) {
|
|
769133
769417
|
switch (ix.program) {
|
|
@@ -769210,10 +769494,10 @@ function unknown4() {
|
|
|
769210
769494
|
var coinConfig9 = config_default();
|
|
769211
769495
|
var config_default5 = coinConfig9;
|
|
769212
769496
|
|
|
769213
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769497
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/stake-activation/rpc.js
|
|
769214
769498
|
var import_bignumber222 = require("bignumber.js");
|
|
769215
769499
|
|
|
769216
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769500
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/stake-activation/delegation.js
|
|
769217
769501
|
var import_bignumber221 = __toESM(require("bignumber.js"));
|
|
769218
769502
|
function getStakeHistoryEntry(epoch, stakeHistory) {
|
|
769219
769503
|
for (const entry of stakeHistory) {
|
|
@@ -769323,7 +769607,7 @@ function getStakeActivatingAndDeactivating(delegation, targetEpoch, stakeHistory
|
|
|
769323
769607
|
}
|
|
769324
769608
|
}
|
|
769325
769609
|
|
|
769326
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
769610
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/chain/stake-activation/rpc.js
|
|
769327
769611
|
var import_compact3 = __toESM(require("lodash/compact"));
|
|
769328
769612
|
function getStakeActivationState({ activating, deactivating, effective }) {
|
|
769329
769613
|
if (deactivating.gt(0)) {
|
|
@@ -770309,7 +770593,7 @@ function assignFromTokenAccountRaw(tokenAccountRaw, tokenAccount) {
|
|
|
770309
770593
|
}
|
|
770310
770594
|
}
|
|
770311
770595
|
|
|
770312
|
-
// ../../libs/coin-modules/coin-solana/lib-es/
|
|
770596
|
+
// ../../libs/coin-modules/coin-solana/lib-es/network/nft/index.js
|
|
770313
770597
|
var getNftMetadata2 = async (input, params) => {
|
|
770314
770598
|
const { data: data6 } = await network_default({
|
|
770315
770599
|
method: "POST",
|
|
@@ -773305,8 +773589,8 @@ var utils3 = {
|
|
|
773305
773589
|
const buffer2 = await crypto31.web.subtle.digest("SHA-256", concatBytes8(...messages));
|
|
773306
773590
|
return new Uint8Array(buffer2);
|
|
773307
773591
|
} else if (crypto31.node) {
|
|
773308
|
-
const { createHash:
|
|
773309
|
-
const hash12 =
|
|
773592
|
+
const { createHash: createHash4 } = crypto31.node;
|
|
773593
|
+
const hash12 = createHash4("sha256");
|
|
773310
773594
|
messages.forEach((m63) => hash12.update(m63));
|
|
773311
773595
|
return Uint8Array.from(hash12.digest());
|
|
773312
773596
|
} else {
|
|
@@ -797246,7 +797530,7 @@ var getAccountShape16 = async (info6, { blacklistedTokenIds }) => {
|
|
|
797246
797530
|
const newOps = (0, import_flatMap18.default)(newTxs.transactions, mapTxToOps5(accountId2, address4, newTxs.address_book));
|
|
797247
797531
|
const newJettonOps = (0, import_flatMap18.default)(newJettonTxs, mapJettonTxToOps(accountId2, address4, newTxs.address_book));
|
|
797248
797532
|
const operations = shouldSyncFromScratch ? newOps : mergeOps(oldOps, newOps);
|
|
797249
|
-
const subAccounts = await
|
|
797533
|
+
const subAccounts = await getSubAccounts3(info6, accountId2, newJettonOps, blacklistedTokenIds, shouldSyncFromScratch);
|
|
797250
797534
|
const toReturn = {
|
|
797251
797535
|
id: accountId2,
|
|
797252
797536
|
balance: new import_bignumber260.default(balance),
|
|
@@ -797260,7 +797544,7 @@ var getAccountShape16 = async (info6, { blacklistedTokenIds }) => {
|
|
|
797260
797544
|
};
|
|
797261
797545
|
return toReturn;
|
|
797262
797546
|
};
|
|
797263
|
-
var
|
|
797547
|
+
var getSubAccountShape3 = async (info6, parentId, token, ops, shouldSyncFromScratch) => {
|
|
797264
797548
|
const walletsInfo = await fetchJettonWallets({
|
|
797265
797549
|
address: info6.address,
|
|
797266
797550
|
jettonMaster: token.contractAddress
|
|
@@ -797290,7 +797574,7 @@ var getSubAccountShape2 = async (info6, parentId, token, ops, shouldSyncFromScra
|
|
|
797290
797574
|
// Address of the jetton wallet contract that holds the token balance and handles transfers
|
|
797291
797575
|
};
|
|
797292
797576
|
};
|
|
797293
|
-
async function
|
|
797577
|
+
async function getSubAccounts3(info6, accountId2, newOps, blacklistedTokenIds = [], shouldSyncFromScratch) {
|
|
797294
797578
|
const opsPerToken = newOps.reduce((acc, op) => {
|
|
797295
797579
|
const { accountId: tokenAccountId } = decodeOperationId(op.id);
|
|
797296
797580
|
const { token } = decodeTokenAccountId(tokenAccountId);
|
|
@@ -797303,7 +797587,7 @@ async function getSubAccounts2(info6, accountId2, newOps, blacklistedTokenIds =
|
|
|
797303
797587
|
}, /* @__PURE__ */ new Map());
|
|
797304
797588
|
const subAccountsPromises = [];
|
|
797305
797589
|
for (const [token, ops] of opsPerToken.entries()) {
|
|
797306
|
-
subAccountsPromises.push(
|
|
797590
|
+
subAccountsPromises.push(getSubAccountShape3(info6, accountId2, token, ops, shouldSyncFromScratch));
|
|
797307
797591
|
}
|
|
797308
797592
|
return Promise.all(subAccountsPromises);
|
|
797309
797593
|
}
|
|
@@ -797997,54 +798281,149 @@ var claimRewardTronTransaction = async (account3) => {
|
|
|
797997
798281
|
return result2;
|
|
797998
798282
|
};
|
|
797999
798283
|
|
|
798000
|
-
// ../../libs/coin-modules/coin-tron/lib-es/bridge/broadcast.js
|
|
798001
|
-
var broadcast22 = async ({ signedOperation: { signature: signature3, operation, rawData } }) => {
|
|
798002
|
-
const transaction = {
|
|
798003
|
-
raw_data: rawData,
|
|
798004
|
-
txID: operation.hash,
|
|
798005
|
-
signature: [signature3]
|
|
798006
|
-
};
|
|
798007
|
-
await broadcastTron(transaction);
|
|
798008
|
-
return operation;
|
|
798009
|
-
};
|
|
798010
|
-
var broadcast_default3 = broadcast22;
|
|
798011
|
-
|
|
798012
|
-
// ../../libs/coin-modules/coin-tron/lib-es/bridge/createTransaction.js
|
|
798013
|
-
var import_bignumber263 = __toESM(require("bignumber.js"));
|
|
798014
|
-
var createTransaction21 = () => ({
|
|
798015
|
-
family: "tron",
|
|
798016
|
-
amount: new import_bignumber263.default(0),
|
|
798017
|
-
useAllAmount: false,
|
|
798018
|
-
mode: "send",
|
|
798019
|
-
duration: 3,
|
|
798020
|
-
recipient: "",
|
|
798021
|
-
networkInfo: null,
|
|
798022
|
-
resource: null,
|
|
798023
|
-
votes: []
|
|
798024
|
-
});
|
|
798025
|
-
var createTransaction_default6 = createTransaction21;
|
|
798026
|
-
|
|
798027
|
-
// ../../libs/coin-modules/coin-tron/lib-es/bridge/estimateMaxSpendable.js
|
|
798028
|
-
var import_bignumber268 = __toESM(require("bignumber.js"));
|
|
798029
|
-
|
|
798030
|
-
// ../../libs/coin-modules/coin-tron/lib-es/bridge/getEstimateFees.js
|
|
798031
|
-
var import_bignumber267 = __toESM(require("bignumber.js"));
|
|
798032
|
-
|
|
798033
|
-
// ../../libs/coin-modules/coin-tron/lib-es/logic/constants.js
|
|
798034
|
-
var import_bignumber264 = require("bignumber.js");
|
|
798035
|
-
var ONE_TRX = new import_bignumber264.BigNumber(1e6);
|
|
798036
|
-
var STANDARD_FEES_NATIVE = new import_bignumber264.BigNumber(2e3);
|
|
798037
|
-
var ACTIVATION_FEES = ONE_TRX.multipliedBy(1.1);
|
|
798038
|
-
var ACTIVATION_FEES_TRC_20 = ONE_TRX.multipliedBy(27.6009);
|
|
798039
|
-
var STANDARD_FEES_TRC_20 = ONE_TRX.multipliedBy(13.7409);
|
|
798040
|
-
|
|
798041
|
-
// ../../libs/coin-modules/coin-tron/lib-es/bridge/utils.js
|
|
798042
|
-
var import_bignumber266 = require("bignumber.js");
|
|
798043
|
-
|
|
798044
798284
|
// ../../libs/coin-modules/coin-tron/lib-es/logic/utils.js
|
|
798045
|
-
var
|
|
798285
|
+
var import_bignumber263 = __toESM(require("bignumber.js"));
|
|
798286
|
+
var import_crypto44 = require("crypto");
|
|
798046
798287
|
var import_get2 = __toESM(require("lodash/get"));
|
|
798047
798288
|
var import_tronweb2 = __toESM(require_TronWeb_node());
|
|
798289
|
+
async function decodeTransaction(rawTx) {
|
|
798290
|
+
const { Transaction: Transaction7 } = globalThis.TronWebProto;
|
|
798291
|
+
const transaction = Transaction7.raw.deserializeBinary(Buffer.from(rawTx, "hex"));
|
|
798292
|
+
return {
|
|
798293
|
+
txID: (0, import_crypto44.createHash)("sha256").update(Buffer.from(rawTx, "hex")).digest("hex"),
|
|
798294
|
+
raw_data: convertTxFromRaw(transaction),
|
|
798295
|
+
raw_data_hex: rawTx
|
|
798296
|
+
};
|
|
798297
|
+
}
|
|
798298
|
+
function convertTxFromRaw(tx) {
|
|
798299
|
+
let transactionRawData = {
|
|
798300
|
+
ref_block_bytes: convertBufferToHex(tx.getRefBlockBytes()),
|
|
798301
|
+
ref_block_hash: convertBufferToHex(tx.getRefBlockHash()),
|
|
798302
|
+
expiration: tx.getExpiration(),
|
|
798303
|
+
contract: tx.getContractList().map(convertContractFromRaw),
|
|
798304
|
+
timestamp: tx.getTimestamp()
|
|
798305
|
+
};
|
|
798306
|
+
if (tx.getRefBlockNum()) {
|
|
798307
|
+
transactionRawData = {
|
|
798308
|
+
...transactionRawData,
|
|
798309
|
+
ref_block_num: tx.getRefBlockNum()
|
|
798310
|
+
};
|
|
798311
|
+
}
|
|
798312
|
+
if (tx.getFeeLimit()) {
|
|
798313
|
+
transactionRawData = {
|
|
798314
|
+
...transactionRawData,
|
|
798315
|
+
fee_limit: tx.getFeeLimit()
|
|
798316
|
+
};
|
|
798317
|
+
}
|
|
798318
|
+
if (tx.getData()) {
|
|
798319
|
+
transactionRawData = {
|
|
798320
|
+
...transactionRawData,
|
|
798321
|
+
data: tx.getData()
|
|
798322
|
+
};
|
|
798323
|
+
}
|
|
798324
|
+
if (tx.getScripts()) {
|
|
798325
|
+
transactionRawData = {
|
|
798326
|
+
...transactionRawData,
|
|
798327
|
+
scripts: tx.getScripts()
|
|
798328
|
+
};
|
|
798329
|
+
}
|
|
798330
|
+
return transactionRawData;
|
|
798331
|
+
}
|
|
798332
|
+
function convertContractFromRaw(contract) {
|
|
798333
|
+
const contractType = convertNumberToContractType(contract.getType());
|
|
798334
|
+
const value6 = contractType.convertFunction?.(contract);
|
|
798335
|
+
if (!value6) {
|
|
798336
|
+
throw new Error(`Missing deserializer for this contract: "${contract.getParameter().getTypeUrl()}"`);
|
|
798337
|
+
}
|
|
798338
|
+
return {
|
|
798339
|
+
type: contractType.name,
|
|
798340
|
+
parameter: {
|
|
798341
|
+
value: value6,
|
|
798342
|
+
type_url: contract.getParameter().getTypeUrl()
|
|
798343
|
+
}
|
|
798344
|
+
};
|
|
798345
|
+
}
|
|
798346
|
+
function convertTransferContractFromRaw(contract) {
|
|
798347
|
+
const { TransferContract } = globalThis.TronWebProto;
|
|
798348
|
+
const transferContract = TransferContract.deserializeBinary(contract.getParameter().getValue());
|
|
798349
|
+
return {
|
|
798350
|
+
amount: transferContract.getAmount(),
|
|
798351
|
+
owner_address: convertBufferToHex(transferContract.getOwnerAddress()),
|
|
798352
|
+
to_address: convertBufferToHex(transferContract.getToAddress())
|
|
798353
|
+
};
|
|
798354
|
+
}
|
|
798355
|
+
function convertTransferAssetContractFromRaw(contract) {
|
|
798356
|
+
const { TransferAssetContract } = globalThis.TronWebProto;
|
|
798357
|
+
const transferContract = TransferAssetContract.deserializeBinary(contract.getParameter().getValue());
|
|
798358
|
+
return {
|
|
798359
|
+
amount: transferContract.getAmount(),
|
|
798360
|
+
asset_name: convertBufferToString(transferContract.getAssetName()),
|
|
798361
|
+
owner_address: convertBufferToHex(transferContract.getOwnerAddress()),
|
|
798362
|
+
to_address: convertBufferToHex(transferContract.getToAddress())
|
|
798363
|
+
};
|
|
798364
|
+
}
|
|
798365
|
+
function convertTriggerSmartContractFromRaw(contract) {
|
|
798366
|
+
const { TriggerSmartContract } = globalThis.TronWebProto;
|
|
798367
|
+
const transferContract = TriggerSmartContract.deserializeBinary(contract.getParameter().getValue());
|
|
798368
|
+
return {
|
|
798369
|
+
data: convertBufferToHex(transferContract.getData()),
|
|
798370
|
+
owner_address: convertBufferToHex(transferContract.getOwnerAddress()),
|
|
798371
|
+
contract_address: convertBufferToHex(transferContract.getContractAddress())
|
|
798372
|
+
};
|
|
798373
|
+
}
|
|
798374
|
+
var CONTRACT_TYPE = {
|
|
798375
|
+
0: { name: "AccountCreateContract" },
|
|
798376
|
+
1: { name: "TransferContract", convertFunction: convertTransferContractFromRaw },
|
|
798377
|
+
// Transfer TRX
|
|
798378
|
+
2: { name: "TransferAssetContract", convertFunction: convertTransferAssetContractFromRaw },
|
|
798379
|
+
// Transfer TRC-10
|
|
798380
|
+
3: { name: "VoteAssetContract" },
|
|
798381
|
+
4: { name: "VoteWitnessContract" },
|
|
798382
|
+
5: { name: "WitnessCreateContract" },
|
|
798383
|
+
6: { name: "AssetIssueContract" },
|
|
798384
|
+
8: { name: "WitnessUpdateContract" },
|
|
798385
|
+
9: { name: "ParticipateAssetIssueContract" },
|
|
798386
|
+
10: { name: "AccountUpdateContract" },
|
|
798387
|
+
11: { name: "FreezeBalanceContract" },
|
|
798388
|
+
12: { name: "UnfreezeBalanceContract" },
|
|
798389
|
+
13: { name: "WithdrawBalanceContract" },
|
|
798390
|
+
14: { name: "UnfreezeAssetContract" },
|
|
798391
|
+
15: { name: "UpdateAssetContract" },
|
|
798392
|
+
16: { name: "ProposalCreateContract" },
|
|
798393
|
+
17: { name: "ProposalApproveContract" },
|
|
798394
|
+
18: { name: "ProposalDeleteContract" },
|
|
798395
|
+
19: { name: "SetAccountIdContract" },
|
|
798396
|
+
20: { name: "CustomContract" },
|
|
798397
|
+
30: { name: "CreateSmartContract" },
|
|
798398
|
+
31: { name: "TriggerSmartContract", convertFunction: convertTriggerSmartContractFromRaw },
|
|
798399
|
+
// Transfer TRC-20
|
|
798400
|
+
32: { name: "GetContract" },
|
|
798401
|
+
33: { name: "UpdateSettingContract" },
|
|
798402
|
+
41: { name: "ExchangeCreateContract" },
|
|
798403
|
+
42: { name: "ExchangeInjectContract" },
|
|
798404
|
+
43: { name: "ExchangeWithdrawContract" },
|
|
798405
|
+
44: { name: "ExchangeTransactionContract" },
|
|
798406
|
+
45: { name: "UpdateEnergyLimitContract" },
|
|
798407
|
+
46: { name: "AccountPermissionUpdateContract" },
|
|
798408
|
+
48: { name: "ClearABIContract" },
|
|
798409
|
+
49: { name: "UpdateBrokerageContract" },
|
|
798410
|
+
51: { name: "ShieldedTransferContract" },
|
|
798411
|
+
52: { name: "MarketSellAssetContract" },
|
|
798412
|
+
53: { name: "MarketCancelOrderContract" },
|
|
798413
|
+
54: { name: "FreezeBalanceV2Contract" },
|
|
798414
|
+
55: { name: "UnfreezeBalanceV2Contract" },
|
|
798415
|
+
56: { name: "WithdrawExpireUnfreezeContract" },
|
|
798416
|
+
57: { name: "DelegateResourceContract" },
|
|
798417
|
+
58: { name: "UnDelegateResourceContract" },
|
|
798418
|
+
59: { name: "CancelAllUnfreezeV2Contract" }
|
|
798419
|
+
};
|
|
798420
|
+
var convertNumberToContractType = (value6) => CONTRACT_TYPE[value6];
|
|
798421
|
+
function convertBufferToHex(address4) {
|
|
798422
|
+
return import_tronweb2.default.utils.bytes.byteArray2hexStr(address4).toLowerCase();
|
|
798423
|
+
}
|
|
798424
|
+
function convertBufferToString(address4) {
|
|
798425
|
+
return import_tronweb2.default.utils.bytes.bytesToString(address4);
|
|
798426
|
+
}
|
|
798048
798427
|
function getTronResources(acc) {
|
|
798049
798428
|
const delegatedFrozenBandwidth = (0, import_get2.default)(acc, "delegated_frozenV2_balance_for_bandwidth", void 0);
|
|
798050
798429
|
const delegatedFrozenEnergy = (0, import_get2.default)(acc, "account_resource.delegated_frozenV2_balance_for_energy", void 0);
|
|
@@ -798053,16 +798432,16 @@ function getTronResources(acc) {
|
|
|
798053
798432
|
const legacyFrozenEnergy = (0, import_get2.default)(acc, "account_resource.frozen_balance_for_energy", void 0);
|
|
798054
798433
|
const legacyFrozen = {
|
|
798055
798434
|
bandwidth: legacyFrozenBandwidth ? {
|
|
798056
|
-
amount: new
|
|
798435
|
+
amount: new import_bignumber263.default(legacyFrozenBandwidth.frozen_balance),
|
|
798057
798436
|
expiredAt: new Date(legacyFrozenBandwidth.expire_time)
|
|
798058
798437
|
} : void 0,
|
|
798059
798438
|
energy: legacyFrozenEnergy ? {
|
|
798060
|
-
amount: new
|
|
798439
|
+
amount: new import_bignumber263.default(legacyFrozenEnergy.frozen_balance),
|
|
798061
798440
|
expiredAt: new Date(legacyFrozenEnergy.expire_time)
|
|
798062
798441
|
} : void 0
|
|
798063
798442
|
};
|
|
798064
798443
|
const { frozenEnergy, frozenBandwidth } = frozenBalances.reduce((accum, cur) => {
|
|
798065
|
-
const amount = new
|
|
798444
|
+
const amount = new import_bignumber263.default(cur?.amount ?? 0);
|
|
798066
798445
|
if (cur.type === "ENERGY") {
|
|
798067
798446
|
accum.frozenEnergy = accum.frozenEnergy.plus(amount);
|
|
798068
798447
|
} else if (cur.type === void 0) {
|
|
@@ -798070,19 +798449,19 @@ function getTronResources(acc) {
|
|
|
798070
798449
|
}
|
|
798071
798450
|
return accum;
|
|
798072
798451
|
}, {
|
|
798073
|
-
frozenEnergy: new
|
|
798074
|
-
frozenBandwidth: new
|
|
798452
|
+
frozenEnergy: new import_bignumber263.default(0),
|
|
798453
|
+
frozenBandwidth: new import_bignumber263.default(0)
|
|
798075
798454
|
});
|
|
798076
798455
|
const unFrozenBalances = (0, import_get2.default)(acc, "unfrozenV2", []);
|
|
798077
798456
|
const unFrozen = unFrozenBalances ? unFrozenBalances.reduce((accum, cur) => {
|
|
798078
798457
|
if (cur && cur.type === "ENERGY") {
|
|
798079
798458
|
accum.energy.push({
|
|
798080
|
-
amount: new
|
|
798459
|
+
amount: new import_bignumber263.default(cur.unfreeze_amount),
|
|
798081
798460
|
expireTime: new Date(cur.unfreeze_expire_time)
|
|
798082
798461
|
});
|
|
798083
798462
|
} else if (cur) {
|
|
798084
798463
|
accum.bandwidth.push({
|
|
798085
|
-
amount: new
|
|
798464
|
+
amount: new import_bignumber263.default(cur.unfreeze_amount),
|
|
798086
798465
|
expireTime: new Date(cur.unfreeze_expire_time)
|
|
798087
798466
|
});
|
|
798088
798467
|
}
|
|
@@ -798098,13 +798477,13 @@ function getTronResources(acc) {
|
|
|
798098
798477
|
};
|
|
798099
798478
|
const delegatedFrozen = {
|
|
798100
798479
|
bandwidth: delegatedFrozenBandwidth ? {
|
|
798101
|
-
amount: new
|
|
798480
|
+
amount: new import_bignumber263.default(delegatedFrozenBandwidth)
|
|
798102
798481
|
} : void 0,
|
|
798103
798482
|
energy: delegatedFrozenEnergy ? {
|
|
798104
|
-
amount: new
|
|
798483
|
+
amount: new import_bignumber263.default(delegatedFrozenEnergy)
|
|
798105
798484
|
} : void 0
|
|
798106
798485
|
};
|
|
798107
|
-
const tronPower = new
|
|
798486
|
+
const tronPower = new import_bignumber263.default((0, import_get2.default)(frozen, "bandwidth.amount", 0)).plus((0, import_get2.default)(frozen, "energy.amount", 0)).plus((0, import_get2.default)(delegatedFrozen, "bandwidth.amount", 0)).plus((0, import_get2.default)(delegatedFrozen, "energy.amount", 0)).plus((0, import_get2.default)(legacyFrozen, "energy.amount", 0)).plus((0, import_get2.default)(legacyFrozen, "bandwidth.amount", 0)).dividedBy(1e6).integerValue(import_bignumber263.default.ROUND_FLOOR).toNumber();
|
|
798108
798487
|
const votes2 = (0, import_get2.default)(acc, "votes", []).map((v56) => ({
|
|
798109
798488
|
address: v56.vote_address,
|
|
798110
798489
|
voteCount: v56.vote_count
|
|
@@ -798121,7 +798500,72 @@ function getTronResources(acc) {
|
|
|
798121
798500
|
};
|
|
798122
798501
|
}
|
|
798123
798502
|
|
|
798503
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/broadcast.js
|
|
798504
|
+
async function broadcast22(transaction) {
|
|
798505
|
+
if (typeof transaction === "string") {
|
|
798506
|
+
const { rawTx, signature: signature3 } = extractTxAndSignature(transaction);
|
|
798507
|
+
const { txID, raw_data } = await decodeTransaction(rawTx);
|
|
798508
|
+
const signedTxPayload = {
|
|
798509
|
+
txID,
|
|
798510
|
+
raw_data,
|
|
798511
|
+
raw_data_hex: rawTx,
|
|
798512
|
+
signature: [signature3]
|
|
798513
|
+
};
|
|
798514
|
+
return broadcastTron(signedTxPayload);
|
|
798515
|
+
} else {
|
|
798516
|
+
return broadcastTron(transaction);
|
|
798517
|
+
}
|
|
798518
|
+
}
|
|
798519
|
+
function extractTxAndSignature(transaction) {
|
|
798520
|
+
const txLength = parseInt(transaction.slice(0, 4), 16);
|
|
798521
|
+
const rawTx = transaction.slice(4, txLength + 4);
|
|
798522
|
+
const signature3 = transaction.slice(4 + txLength);
|
|
798523
|
+
return { rawTx, signature: signature3 };
|
|
798524
|
+
}
|
|
798525
|
+
|
|
798526
|
+
// ../../libs/coin-modules/coin-tron/lib-es/bridge/broadcast.js
|
|
798527
|
+
var broadcast23 = async ({ signedOperation: { signature: signature3, operation, rawData } }) => {
|
|
798528
|
+
const transaction = {
|
|
798529
|
+
raw_data: rawData,
|
|
798530
|
+
txID: operation.hash,
|
|
798531
|
+
signature: [signature3]
|
|
798532
|
+
};
|
|
798533
|
+
await broadcast22(transaction);
|
|
798534
|
+
return operation;
|
|
798535
|
+
};
|
|
798536
|
+
var broadcast_default3 = broadcast23;
|
|
798537
|
+
|
|
798538
|
+
// ../../libs/coin-modules/coin-tron/lib-es/bridge/createTransaction.js
|
|
798539
|
+
var import_bignumber264 = __toESM(require("bignumber.js"));
|
|
798540
|
+
var createTransaction21 = () => ({
|
|
798541
|
+
family: "tron",
|
|
798542
|
+
amount: new import_bignumber264.default(0),
|
|
798543
|
+
useAllAmount: false,
|
|
798544
|
+
mode: "send",
|
|
798545
|
+
duration: 3,
|
|
798546
|
+
recipient: "",
|
|
798547
|
+
networkInfo: null,
|
|
798548
|
+
resource: null,
|
|
798549
|
+
votes: []
|
|
798550
|
+
});
|
|
798551
|
+
var createTransaction_default6 = createTransaction21;
|
|
798552
|
+
|
|
798553
|
+
// ../../libs/coin-modules/coin-tron/lib-es/bridge/estimateMaxSpendable.js
|
|
798554
|
+
var import_bignumber270 = __toESM(require("bignumber.js"));
|
|
798555
|
+
|
|
798556
|
+
// ../../libs/coin-modules/coin-tron/lib-es/bridge/getEstimateFees.js
|
|
798557
|
+
var import_bignumber269 = __toESM(require("bignumber.js"));
|
|
798558
|
+
|
|
798559
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/constants.js
|
|
798560
|
+
var import_bignumber265 = require("bignumber.js");
|
|
798561
|
+
var ONE_TRX = new import_bignumber265.BigNumber(1e6);
|
|
798562
|
+
var STANDARD_FEES_NATIVE = new import_bignumber265.BigNumber(2e3);
|
|
798563
|
+
var ACTIVATION_FEES = ONE_TRX.multipliedBy(1.1);
|
|
798564
|
+
var ACTIVATION_FEES_TRC_20 = ONE_TRX.multipliedBy(27.6009);
|
|
798565
|
+
var STANDARD_FEES_TRC_20 = ONE_TRX.multipliedBy(13.7409);
|
|
798566
|
+
|
|
798124
798567
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/utils.js
|
|
798568
|
+
var import_bignumber266 = require("bignumber.js");
|
|
798125
798569
|
var parentTx = [
|
|
798126
798570
|
"TransferContract",
|
|
798127
798571
|
"VoteWitnessContract",
|
|
@@ -798308,6 +798752,43 @@ function isAccountEmpty3({ tronResources }) {
|
|
|
798308
798752
|
return tronResources.bandwidth.freeLimit.eq(0);
|
|
798309
798753
|
}
|
|
798310
798754
|
|
|
798755
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/craftTransaction.js
|
|
798756
|
+
var import_bignumber267 = __toESM(require("bignumber.js"));
|
|
798757
|
+
|
|
798758
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/estimateFees.js
|
|
798759
|
+
async function estimateFees4(transactionIntent) {
|
|
798760
|
+
if (transactionIntent.asset && transactionIntent.asset.standard === "trc20") {
|
|
798761
|
+
return BigInt(ACTIVATION_FEES_TRC_20.toString());
|
|
798762
|
+
} else {
|
|
798763
|
+
return BigInt(STANDARD_FEES_NATIVE.toString());
|
|
798764
|
+
}
|
|
798765
|
+
}
|
|
798766
|
+
|
|
798767
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/getBalance.js
|
|
798768
|
+
var import_bignumber268 = __toESM(require("bignumber.js"));
|
|
798769
|
+
|
|
798770
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/getAccount.js
|
|
798771
|
+
async function getAccount8(address4) {
|
|
798772
|
+
return await fetchTronAccount(address4);
|
|
798773
|
+
}
|
|
798774
|
+
|
|
798775
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/getBalance.js
|
|
798776
|
+
function computeBalanceBridge(account3) {
|
|
798777
|
+
const tronResources = getTronResources(account3);
|
|
798778
|
+
const spendableBalance = account3.balance ? new import_bignumber268.default(account3.balance) : new import_bignumber268.default(0);
|
|
798779
|
+
const balance = spendableBalance.plus(tronResources.frozen.bandwidth ? tronResources.frozen.bandwidth.amount : new import_bignumber268.default(0)).plus(tronResources.frozen.energy ? tronResources.frozen.energy.amount : new import_bignumber268.default(0)).plus(tronResources.delegatedFrozen.bandwidth ? tronResources.delegatedFrozen.bandwidth.amount : new import_bignumber268.default(0)).plus(tronResources.delegatedFrozen.energy ? tronResources.delegatedFrozen.energy.amount : new import_bignumber268.default(0)).plus(tronResources.unFrozen.energy ? tronResources.unFrozen.energy.reduce((accum, cur) => {
|
|
798780
|
+
return accum.plus(cur.amount);
|
|
798781
|
+
}, new import_bignumber268.default(0)) : new import_bignumber268.default(0)).plus(tronResources.unFrozen.bandwidth ? tronResources.unFrozen.bandwidth.reduce((accum, cur) => {
|
|
798782
|
+
return accum.plus(cur.amount);
|
|
798783
|
+
}, new import_bignumber268.default(0)) : new import_bignumber268.default(0)).plus(tronResources.legacyFrozen.bandwidth ? tronResources.legacyFrozen.bandwidth.amount : new import_bignumber268.default(0)).plus(tronResources.legacyFrozen.energy ? tronResources.legacyFrozen.energy.amount : new import_bignumber268.default(0));
|
|
798784
|
+
return balance;
|
|
798785
|
+
}
|
|
798786
|
+
|
|
798787
|
+
// ../../libs/coin-modules/coin-tron/lib-es/logic/lastBlock.js
|
|
798788
|
+
async function lastBlock4() {
|
|
798789
|
+
return await getLastBlock4();
|
|
798790
|
+
}
|
|
798791
|
+
|
|
798311
798792
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/getEstimateFees.js
|
|
798312
798793
|
var getFeesFromBandwidth = (account3, transaction) => {
|
|
798313
798794
|
const { freeUsed, freeLimit, gainedUsed, gainedLimit } = extractBandwidthInfo(transaction.networkInfo);
|
|
@@ -798316,30 +798797,38 @@ var getFeesFromBandwidth = (account3, transaction) => {
|
|
|
798316
798797
|
if (available.lt(estimatedBandwidthCost)) {
|
|
798317
798798
|
return STANDARD_FEES_NATIVE;
|
|
798318
798799
|
}
|
|
798319
|
-
return new
|
|
798800
|
+
return new import_bignumber269.default(0);
|
|
798320
798801
|
};
|
|
798321
798802
|
var getFeesFromAccountActivation = async (account3, transaction, tokenAccount) => {
|
|
798322
|
-
const recipientAccounts = await
|
|
798803
|
+
const recipientAccounts = await getAccount8(transaction.recipient);
|
|
798323
798804
|
const recipientAccount2 = recipientAccounts[0];
|
|
798324
798805
|
const { gainedUsed, gainedLimit } = extractBandwidthInfo(transaction.networkInfo);
|
|
798325
798806
|
const available = gainedLimit.minus(gainedUsed);
|
|
798326
798807
|
const estimatedBandwidthCost = getEstimatedBlockSize(account3, transaction);
|
|
798327
798808
|
const hasTRC20 = Boolean(tokenAccount && recipientAccount2?.trc20?.some((trc20) => tokenAccount.token.contractAddress in trc20));
|
|
798328
798809
|
if (!recipientAccount2 && !hasTRC20 && available.lt(estimatedBandwidthCost)) {
|
|
798329
|
-
if (tokenAccount && tokenAccount.token.tokenType === "trc20") {
|
|
798330
|
-
return ACTIVATION_FEES_TRC_20;
|
|
798331
|
-
}
|
|
798332
798810
|
if (!tokenAccount) {
|
|
798333
798811
|
return ACTIVATION_FEES;
|
|
798334
798812
|
}
|
|
798813
|
+
const transactionIntent = {
|
|
798814
|
+
type: transaction.mode,
|
|
798815
|
+
sender: account3.freshAddress,
|
|
798816
|
+
recipient: transaction.recipient,
|
|
798817
|
+
amount: BigInt(transaction.amount.toString()),
|
|
798818
|
+
asset: tokenAccount?.token.tokenType === "trc20" ? { standard: "trc20", contractAddress: tokenAccount.token.contractAddress } : { standard: "trc10", tokenId: tokenAccount?.token.id }
|
|
798819
|
+
};
|
|
798820
|
+
if (tokenAccount && tokenAccount.token.tokenType === "trc20") {
|
|
798821
|
+
const estimatedFees = await estimateFees4(transactionIntent);
|
|
798822
|
+
return new import_bignumber269.default(estimatedFees.toString());
|
|
798823
|
+
}
|
|
798335
798824
|
}
|
|
798336
798825
|
if (tokenAccount && tokenAccount.token.tokenType === "trc20") {
|
|
798337
798826
|
return STANDARD_FEES_TRC_20;
|
|
798338
798827
|
}
|
|
798339
|
-
return new
|
|
798828
|
+
return new import_bignumber269.default(0);
|
|
798340
798829
|
};
|
|
798341
798830
|
var getEstimatedFees11 = async (account3, transaction, tokenAccount) => {
|
|
798342
|
-
const feesFromAccountActivation = transaction.mode === "send" ? await getFeesFromAccountActivation(account3, transaction, tokenAccount) : new
|
|
798831
|
+
const feesFromAccountActivation = transaction.mode === "send" ? await getFeesFromAccountActivation(account3, transaction, tokenAccount) : new import_bignumber269.default(0);
|
|
798343
798832
|
if (feesFromAccountActivation.gt(0)) {
|
|
798344
798833
|
return feesFromAccountActivation;
|
|
798345
798834
|
}
|
|
@@ -798356,15 +798845,15 @@ var estimateMaxSpendable19 = async ({ account: account3, parentAccount, transact
|
|
|
798356
798845
|
subAccountId: account3.type === "Account" ? null : account3.id,
|
|
798357
798846
|
...transaction,
|
|
798358
798847
|
recipient: transaction?.recipient || "0x0000000000000000000000000000000000000000",
|
|
798359
|
-
amount: new
|
|
798848
|
+
amount: new import_bignumber270.default(0)
|
|
798360
798849
|
}, account3.type === "TokenAccount" ? account3 : void 0);
|
|
798361
|
-
return account3.type === "Account" ?
|
|
798850
|
+
return account3.type === "Account" ? import_bignumber270.default.max(0, account3.spendableBalance.minus(fees2)) : account3.balance;
|
|
798362
798851
|
};
|
|
798363
798852
|
var estimateMaxSpendable_default4 = estimateMaxSpendable19;
|
|
798364
798853
|
|
|
798365
798854
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/getTransactionStatus.js
|
|
798366
798855
|
init_lib_es();
|
|
798367
|
-
var
|
|
798856
|
+
var import_bignumber271 = __toESM(require("bignumber.js"));
|
|
798368
798857
|
var import_sumBy2 = __toESM(require("lodash/sumBy"));
|
|
798369
798858
|
var getTransactionStatus19 = async (acc, transaction) => {
|
|
798370
798859
|
const errors = {};
|
|
@@ -798390,9 +798879,9 @@ var getTransactionStatus19 = async (acc, transaction) => {
|
|
|
798390
798879
|
}
|
|
798391
798880
|
if (mode === "unfreeze") {
|
|
798392
798881
|
const { bandwidth, energy } = acc.tronResources.frozen;
|
|
798393
|
-
if (resource === "BANDWIDTH" && transaction.amount.gt(bandwidth?.amount || new
|
|
798882
|
+
if (resource === "BANDWIDTH" && transaction.amount.gt(bandwidth?.amount || new import_bignumber271.default(0))) {
|
|
798394
798883
|
errors.resource = new TronNoFrozenForBandwidth();
|
|
798395
|
-
} else if (resource === "ENERGY" && transaction.amount.gt(energy?.amount || new
|
|
798884
|
+
} else if (resource === "ENERGY" && transaction.amount.gt(energy?.amount || new import_bignumber271.default(0))) {
|
|
798396
798885
|
errors.resource = new TronNoFrozenForEnergy();
|
|
798397
798886
|
}
|
|
798398
798887
|
}
|
|
@@ -798473,10 +798962,10 @@ var getTransactionStatus19 = async (acc, transaction) => {
|
|
|
798473
798962
|
});
|
|
798474
798963
|
}
|
|
798475
798964
|
}
|
|
798476
|
-
const estimatedFees = Object.entries(errors).length > 0 ? new
|
|
798477
|
-
const balance = account3.type === "Account" ?
|
|
798965
|
+
const estimatedFees = Object.entries(errors).length > 0 ? new import_bignumber271.default(0) : await getEstimateFees_default(acc, transaction, tokenAccount);
|
|
798966
|
+
const balance = account3.type === "Account" ? import_bignumber271.default.max(0, account3.spendableBalance.minus(estimatedFees)) : account3.balance;
|
|
798478
798967
|
const amount = useAllAmount ? balance : transaction.amount;
|
|
798479
|
-
const amountSpent = ["send", "freeze", "undelegateResource"].includes(mode) ? amount : new
|
|
798968
|
+
const amountSpent = ["send", "freeze", "undelegateResource"].includes(mode) ? amount : new import_bignumber271.default(0);
|
|
798480
798969
|
if (mode === "freeze" && amount.lt(ONE_TRX)) {
|
|
798481
798970
|
errors.amount = new TronInvalidFreezeAmount();
|
|
798482
798971
|
}
|
|
@@ -798490,7 +798979,7 @@ var getTransactionStatus19 = async (acc, transaction) => {
|
|
|
798490
798979
|
} else if (amount.gt(balance)) {
|
|
798491
798980
|
errors.amount = new NotEnoughBalance();
|
|
798492
798981
|
}
|
|
798493
|
-
const energy = acc.tronResources && acc.tronResources.energy || new
|
|
798982
|
+
const energy = acc.tronResources && acc.tronResources.energy || new import_bignumber271.default(0);
|
|
798494
798983
|
if (account3.type === "TokenAccount" && account3.token.tokenType === "trc20" && energy.lt(47619)) {
|
|
798495
798984
|
const contractUserEnergyConsumption = await getContractUserEnergyRatioConsumption(account3.token.contractAddress);
|
|
798496
798985
|
if (contractUserEnergyConsumption > 0) {
|
|
@@ -798553,7 +799042,7 @@ var prepareTransaction20 = async (account3, transaction) => {
|
|
|
798553
799042
|
};
|
|
798554
799043
|
|
|
798555
799044
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/serialization.js
|
|
798556
|
-
var
|
|
799045
|
+
var import_bignumber272 = require("bignumber.js");
|
|
798557
799046
|
|
|
798558
799047
|
// ../../libs/coin-modules/coin-tron/lib-es/types/bridge.js
|
|
798559
799048
|
function isTrongridExtraTxInfo(op) {
|
|
@@ -798655,48 +799144,48 @@ var fromTronResourcesRaw = ({ frozen, unFrozen, delegatedFrozen, legacyFrozen, v
|
|
|
798655
799144
|
return {
|
|
798656
799145
|
frozen: {
|
|
798657
799146
|
bandwidth: frozenBandwidth ? {
|
|
798658
|
-
amount: new
|
|
799147
|
+
amount: new import_bignumber272.BigNumber(frozenBandwidth.amount)
|
|
798659
799148
|
} : void 0,
|
|
798660
799149
|
energy: frozenEnergy ? {
|
|
798661
|
-
amount: new
|
|
799150
|
+
amount: new import_bignumber272.BigNumber(frozenEnergy.amount)
|
|
798662
799151
|
} : void 0
|
|
798663
799152
|
},
|
|
798664
799153
|
delegatedFrozen: {
|
|
798665
799154
|
bandwidth: delegatedFrozenBandwidth ? {
|
|
798666
|
-
amount: new
|
|
799155
|
+
amount: new import_bignumber272.BigNumber(delegatedFrozenBandwidth.amount)
|
|
798667
799156
|
} : void 0,
|
|
798668
799157
|
energy: delegatedFrozenEnergy ? {
|
|
798669
|
-
amount: new
|
|
799158
|
+
amount: new import_bignumber272.BigNumber(delegatedFrozenEnergy.amount)
|
|
798670
799159
|
} : void 0
|
|
798671
799160
|
},
|
|
798672
799161
|
unFrozen: {
|
|
798673
799162
|
bandwidth: unFrozenBandwidth ? unFrozenBandwidth.map((entry) => {
|
|
798674
|
-
return { amount: new
|
|
799163
|
+
return { amount: new import_bignumber272.BigNumber(entry.amount), expireTime: new Date(entry.expireTime) };
|
|
798675
799164
|
}) : void 0,
|
|
798676
799165
|
energy: unFrozenEnergy ? unFrozenEnergy.map((entry) => {
|
|
798677
|
-
return { amount: new
|
|
799166
|
+
return { amount: new import_bignumber272.BigNumber(entry.amount), expireTime: new Date(entry.expireTime) };
|
|
798678
799167
|
}) : void 0
|
|
798679
799168
|
},
|
|
798680
799169
|
legacyFrozen: {
|
|
798681
799170
|
bandwidth: legacyFrozenBandwidth ? {
|
|
798682
|
-
amount: new
|
|
799171
|
+
amount: new import_bignumber272.BigNumber(legacyFrozenBandwidth.amount),
|
|
798683
799172
|
expiredAt: new Date(legacyFrozenBandwidth.expiredAt)
|
|
798684
799173
|
} : void 0,
|
|
798685
799174
|
energy: legacyFrozenEnergy ? {
|
|
798686
|
-
amount: new
|
|
799175
|
+
amount: new import_bignumber272.BigNumber(legacyFrozenEnergy.amount),
|
|
798687
799176
|
expiredAt: new Date(legacyFrozenEnergy.expiredAt)
|
|
798688
799177
|
} : void 0
|
|
798689
799178
|
},
|
|
798690
799179
|
votes: votes2,
|
|
798691
799180
|
tronPower,
|
|
798692
|
-
energy: new
|
|
799181
|
+
energy: new import_bignumber272.BigNumber(energy),
|
|
798693
799182
|
bandwidth: {
|
|
798694
|
-
freeUsed: new
|
|
798695
|
-
freeLimit: new
|
|
798696
|
-
gainedUsed: new
|
|
798697
|
-
gainedLimit: new
|
|
799183
|
+
freeUsed: new import_bignumber272.BigNumber(bandwidth.freeUsed),
|
|
799184
|
+
freeLimit: new import_bignumber272.BigNumber(bandwidth.freeLimit),
|
|
799185
|
+
gainedUsed: new import_bignumber272.BigNumber(bandwidth.gainedUsed),
|
|
799186
|
+
gainedLimit: new import_bignumber272.BigNumber(bandwidth.gainedLimit)
|
|
798698
799187
|
},
|
|
798699
|
-
unwithdrawnReward: new
|
|
799188
|
+
unwithdrawnReward: new import_bignumber272.BigNumber(unwithdrawnReward),
|
|
798700
799189
|
lastWithdrawnRewardDate: lastWithdrawnRewardDate ? new Date(lastWithdrawnRewardDate) : void 0,
|
|
798701
799190
|
lastVotedDate: lastVotedDate ? new Date(lastVotedDate) : void 0,
|
|
798702
799191
|
cacheTransactionInfoById
|
|
@@ -798719,16 +799208,16 @@ function fromOperationExtraRaw6(extraRaw) {
|
|
|
798719
799208
|
return extra;
|
|
798720
799209
|
}
|
|
798721
799210
|
if (extraRaw.frozenAmount) {
|
|
798722
|
-
extra.frozenAmount = new
|
|
799211
|
+
extra.frozenAmount = new import_bignumber272.BigNumber(extraRaw.frozenAmount);
|
|
798723
799212
|
}
|
|
798724
799213
|
if (extraRaw.unfreezeAmount) {
|
|
798725
|
-
extra.unfreezeAmount = new
|
|
799214
|
+
extra.unfreezeAmount = new import_bignumber272.BigNumber(extraRaw.unfreezeAmount);
|
|
798726
799215
|
}
|
|
798727
799216
|
if (extraRaw.votes) {
|
|
798728
799217
|
extra.votes = extraRaw.votes;
|
|
798729
799218
|
}
|
|
798730
799219
|
if (extraRaw.unDelegatedAmount) {
|
|
798731
|
-
extra.unDelegatedAmount = new
|
|
799220
|
+
extra.unDelegatedAmount = new import_bignumber272.BigNumber(extraRaw.unDelegatedAmount);
|
|
798732
799221
|
}
|
|
798733
799222
|
if (extraRaw.receiverAddress) {
|
|
798734
799223
|
extra.receiverAddress = extraRaw.receiverAddress;
|
|
@@ -798759,21 +799248,21 @@ function toOperationExtraRaw6(extra) {
|
|
|
798759
799248
|
}
|
|
798760
799249
|
|
|
798761
799250
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/signOperation.js
|
|
798762
|
-
var
|
|
799251
|
+
var import_bignumber274 = __toESM(require("bignumber.js"));
|
|
798763
799252
|
var import_rxjs139 = require("rxjs");
|
|
798764
799253
|
|
|
798765
799254
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/buildOptimisticOperation.js
|
|
798766
|
-
var
|
|
799255
|
+
var import_bignumber273 = __toESM(require("bignumber.js"));
|
|
798767
799256
|
var import_get3 = __toESM(require("lodash/get"));
|
|
798768
799257
|
var getValue6 = (account3, subAccount, transaction, fee) => {
|
|
798769
799258
|
switch (transaction.mode) {
|
|
798770
799259
|
case "send":
|
|
798771
|
-
return subAccount ? fee : new
|
|
799260
|
+
return subAccount ? fee : new import_bignumber273.default(transaction.amount || 0).plus(fee);
|
|
798772
799261
|
case "claimReward": {
|
|
798773
|
-
return account3.tronResources ? account3.tronResources.unwithdrawnReward : new
|
|
799262
|
+
return account3.tronResources ? account3.tronResources.unwithdrawnReward : new import_bignumber273.default(0);
|
|
798774
799263
|
}
|
|
798775
799264
|
default:
|
|
798776
|
-
return new
|
|
799265
|
+
return new import_bignumber273.default(0);
|
|
798777
799266
|
}
|
|
798778
799267
|
};
|
|
798779
799268
|
var getExtra3 = (account3, transaction, resource) => {
|
|
@@ -798797,7 +799286,7 @@ var getExtra3 = (account3, transaction, resource) => {
|
|
|
798797
799286
|
};
|
|
798798
799287
|
case "legacyUnfreeze":
|
|
798799
799288
|
return {
|
|
798800
|
-
unfreezeAmount: (0, import_get3.default)(account3.tronResources, `frozen.${resource.toLocaleLowerCase()}.amount`, new
|
|
799289
|
+
unfreezeAmount: (0, import_get3.default)(account3.tronResources, `frozen.${resource.toLocaleLowerCase()}.amount`, new import_bignumber273.default(0))
|
|
798801
799290
|
};
|
|
798802
799291
|
default:
|
|
798803
799292
|
return void 0;
|
|
@@ -798827,8 +799316,8 @@ var buildOptimisticOperation17 = (account3, subAccount, transaction, fee, hash12
|
|
|
798827
799316
|
id: encodeOperationId(subAccount.id, hash12, "OUT"),
|
|
798828
799317
|
hash: hash12,
|
|
798829
799318
|
type: "OUT",
|
|
798830
|
-
value: transaction.useAllAmount && subAccount ? subAccount.balance : new
|
|
798831
|
-
fee: new
|
|
799319
|
+
value: transaction.useAllAmount && subAccount ? subAccount.balance : new import_bignumber273.default(transaction.amount || 0),
|
|
799320
|
+
fee: new import_bignumber273.default(0),
|
|
798832
799321
|
blockHash: null,
|
|
798833
799322
|
blockHeight: null,
|
|
798834
799323
|
senders: [account3.freshAddress],
|
|
@@ -798847,7 +799336,7 @@ var buildSignOperation20 = (signerContext3) => ({ account: account3, transaction
|
|
|
798847
799336
|
async function main2() {
|
|
798848
799337
|
const subAccount = transaction.subAccountId && account3.subAccounts ? account3.subAccounts.find((sa) => sa.id === transaction.subAccountId) : void 0;
|
|
798849
799338
|
const fee = await getEstimateFees_default(account3, transaction, subAccount);
|
|
798850
|
-
const balance = subAccount ? subAccount.balance :
|
|
799339
|
+
const balance = subAccount ? subAccount.balance : import_bignumber274.default.max(0, account3.spendableBalance.minus(fee));
|
|
798851
799340
|
if (transaction.useAllAmount) {
|
|
798852
799341
|
transaction = { ...transaction };
|
|
798853
799342
|
transaction.amount = balance;
|
|
@@ -798908,22 +799397,6 @@ var import_bignumber275 = __toESM(require("bignumber.js"));
|
|
|
798908
799397
|
var import_compact6 = __toESM(require("lodash/compact"));
|
|
798909
799398
|
var import_get4 = __toESM(require("lodash/get"));
|
|
798910
799399
|
|
|
798911
|
-
// ../../libs/coin-modules/coin-tron/lib-es/logic/craftTransaction.js
|
|
798912
|
-
var import_bignumber273 = __toESM(require("bignumber.js"));
|
|
798913
|
-
|
|
798914
|
-
// ../../libs/coin-modules/coin-tron/lib-es/logic/getBalance.js
|
|
798915
|
-
var import_bignumber274 = __toESM(require("bignumber.js"));
|
|
798916
|
-
function computeBalanceBridge(account3) {
|
|
798917
|
-
const tronResources = getTronResources(account3);
|
|
798918
|
-
const spendableBalance = account3.balance ? new import_bignumber274.default(account3.balance) : new import_bignumber274.default(0);
|
|
798919
|
-
const balance = spendableBalance.plus(tronResources.frozen.bandwidth ? tronResources.frozen.bandwidth.amount : new import_bignumber274.default(0)).plus(tronResources.frozen.energy ? tronResources.frozen.energy.amount : new import_bignumber274.default(0)).plus(tronResources.delegatedFrozen.bandwidth ? tronResources.delegatedFrozen.bandwidth.amount : new import_bignumber274.default(0)).plus(tronResources.delegatedFrozen.energy ? tronResources.delegatedFrozen.energy.amount : new import_bignumber274.default(0)).plus(tronResources.unFrozen.energy ? tronResources.unFrozen.energy.reduce((accum, cur) => {
|
|
798920
|
-
return accum.plus(cur.amount);
|
|
798921
|
-
}, new import_bignumber274.default(0)) : new import_bignumber274.default(0)).plus(tronResources.unFrozen.bandwidth ? tronResources.unFrozen.bandwidth.reduce((accum, cur) => {
|
|
798922
|
-
return accum.plus(cur.amount);
|
|
798923
|
-
}, new import_bignumber274.default(0)) : new import_bignumber274.default(0)).plus(tronResources.legacyFrozen.bandwidth ? tronResources.legacyFrozen.bandwidth.amount : new import_bignumber274.default(0)).plus(tronResources.legacyFrozen.energy ? tronResources.legacyFrozen.energy.amount : new import_bignumber274.default(0));
|
|
798924
|
-
return balance;
|
|
798925
|
-
}
|
|
798926
|
-
|
|
798927
799400
|
// ../../libs/coin-modules/coin-tron/lib-es/logic/pagination.js
|
|
798928
799401
|
function getOperationsPageSize(accountId2, syncConfig) {
|
|
798929
799402
|
const { paginationConfig } = syncConfig;
|
|
@@ -798943,8 +799416,8 @@ function getOperationsPageSize(accountId2, syncConfig) {
|
|
|
798943
799416
|
// ../../libs/coin-modules/coin-tron/lib-es/bridge/synchronization.js
|
|
798944
799417
|
var PREFER_PENDING_OPERATIONS_UNTIL_BLOCK_VALIDATION = 35;
|
|
798945
799418
|
var getAccountShape17 = async ({ initialAccount, currency: currency24, address: address4, derivationMode }, syncConfig) => {
|
|
798946
|
-
const { height: blockHeight } = await
|
|
798947
|
-
const tronAcc = await
|
|
799419
|
+
const { height: blockHeight } = await lastBlock4();
|
|
799420
|
+
const tronAcc = await getAccount8(address4);
|
|
798948
799421
|
const accountId2 = encodeAccountId({
|
|
798949
799422
|
type: "js",
|
|
798950
799423
|
version: "2",
|
|
@@ -799025,7 +799498,7 @@ var getAccountShape17 = async ({ initialAccount, currency: currency24, address:
|
|
|
799025
799498
|
return sub;
|
|
799026
799499
|
}));
|
|
799027
799500
|
const filteredInitialSubAccounts = (initialAccount?.subAccounts || []).filter((subAccount) => !blacklistedTokenIds.includes(subAccount.token.id));
|
|
799028
|
-
const mergedSubAccounts =
|
|
799501
|
+
const mergedSubAccounts = mergeSubAccounts3(subAccounts, filteredInitialSubAccounts);
|
|
799029
799502
|
const subOutOperationsWithFee = subAccounts.flatMap((s67) => s67.operations).filter((o56) => o56.type === "OUT" && o56.fee.isGreaterThan(0)).map((o56) => ({
|
|
799030
799503
|
...o56,
|
|
799031
799504
|
accountId: accountId2,
|
|
@@ -799062,7 +799535,7 @@ var postSync5 = (initial, parent) => {
|
|
|
799062
799535
|
parent.subAccounts && parent.subAccounts.forEach(evictRecentOpsIfPending);
|
|
799063
799536
|
return parent;
|
|
799064
799537
|
};
|
|
799065
|
-
var
|
|
799538
|
+
var mergeSubAccounts3 = (subAccounts1, subAccounts2) => {
|
|
799066
799539
|
const existingIds = new Set(subAccounts1.map((subAccount) => subAccount.id));
|
|
799067
799540
|
const filteredSubAccounts2 = subAccounts2.map((subAccount) => {
|
|
799068
799541
|
if (existingIds.has(subAccount.id)) {
|
|
@@ -800100,7 +800573,7 @@ var RLPError = class _RLPError extends Error {
|
|
|
800100
800573
|
};
|
|
800101
800574
|
|
|
800102
800575
|
// ../../node_modules/.pnpm/thor-devkit@2.0.9/node_modules/thor-devkit/esm/secp256k1.js
|
|
800103
|
-
var
|
|
800576
|
+
var import_crypto45 = require("crypto");
|
|
800104
800577
|
var import_elliptic4 = __toESM(require_elliptic());
|
|
800105
800578
|
var import_buffer22 = require("buffer");
|
|
800106
800579
|
var curve = new import_elliptic4.ec("secp256k1");
|
|
@@ -800115,7 +800588,7 @@ function isValidMessageHash(hash12) {
|
|
|
800115
800588
|
var secp256k16;
|
|
800116
800589
|
(function(secp256k19) {
|
|
800117
800590
|
function generatePrivateKey2(rng4) {
|
|
800118
|
-
rng4 = rng4 !== null && rng4 !== void 0 ? rng4 : () => (0,
|
|
800591
|
+
rng4 = rng4 !== null && rng4 !== void 0 ? rng4 : () => (0, import_crypto45.randomBytes)(32);
|
|
800119
800592
|
for (; ; ) {
|
|
800120
800593
|
const privKey = rng4();
|
|
800121
800594
|
if (isValidPrivateKey(privKey)) {
|
|
@@ -800713,7 +801186,7 @@ var import_bignumber278 = __toESM(require("bignumber.js"));
|
|
|
800713
801186
|
// ../../libs/coin-modules/coin-vechain/lib-es/network/sdk.js
|
|
800714
801187
|
var import_bignumber277 = __toESM(require("bignumber.js"));
|
|
800715
801188
|
var BASE_URL3 = getEnv("API_VECHAIN_THOREST");
|
|
800716
|
-
var
|
|
801189
|
+
var getAccount9 = async (address4) => {
|
|
800717
801190
|
const { data: data6 } = await network_default({
|
|
800718
801191
|
method: "GET",
|
|
800719
801192
|
url: `${BASE_URL3}/accounts/${address4}`
|
|
@@ -800865,7 +801338,7 @@ var padAddress = (address4) => {
|
|
|
800865
801338
|
|
|
800866
801339
|
// ../../libs/coin-modules/coin-vechain/lib-es/common-logic/transaction-utils.js
|
|
800867
801340
|
var import_bignumber279 = __toESM(require("bignumber.js"));
|
|
800868
|
-
var
|
|
801341
|
+
var import_crypto46 = __toESM(require("crypto"));
|
|
800869
801342
|
|
|
800870
801343
|
// ../../libs/coin-modules/coin-vechain/lib-es/contracts/abis/params.js
|
|
800871
801344
|
var set2 = {
|
|
@@ -800931,7 +801404,7 @@ var params_default = {
|
|
|
800931
801404
|
// ../../libs/coin-modules/coin-vechain/lib-es/common-logic/transaction-utils.js
|
|
800932
801405
|
var GAS_COEFFICIENT = 15e3;
|
|
800933
801406
|
var generateNonce = () => {
|
|
800934
|
-
const randBuffer =
|
|
801407
|
+
const randBuffer = import_crypto46.default.randomBytes(Math.ceil(4));
|
|
800935
801408
|
if (!randBuffer)
|
|
800936
801409
|
throw Error("Failed to generate random hex");
|
|
800937
801410
|
return `${HEX_PREFIX}${randBuffer.toString("hex").substring(0, 8)}`;
|
|
@@ -801166,7 +801639,7 @@ var getAccountShape18 = async (info6) => {
|
|
|
801166
801639
|
xpubOrAddress: address4,
|
|
801167
801640
|
derivationMode
|
|
801168
801641
|
});
|
|
801169
|
-
const { balance, energy } = await
|
|
801642
|
+
const { balance, energy } = await getAccount9(address4);
|
|
801170
801643
|
const blockHeight = await getLastBlockHeight();
|
|
801171
801644
|
const newOperations = await getOperations4(accountId2, address4, startAt);
|
|
801172
801645
|
const vthoAccountId = encodeTokenAccountId(accountId2, findTokenById("vechain/vip180/vtho"));
|
|
@@ -801275,7 +801748,7 @@ var buildSignOperation21 = (signerContext3) => ({ account: account3, transaction
|
|
|
801275
801748
|
});
|
|
801276
801749
|
|
|
801277
801750
|
// ../../libs/coin-modules/coin-vechain/lib-es/bridge/broadcast.js
|
|
801278
|
-
var
|
|
801751
|
+
var broadcast24 = async ({ signedOperation: { signature: signature3, operation, rawData } }) => {
|
|
801279
801752
|
const transaction = new Transaction5(rawData.body);
|
|
801280
801753
|
transaction.signature = Buffer.from(signature3, "hex");
|
|
801281
801754
|
const hash12 = await submit2(transaction);
|
|
@@ -801332,7 +801805,7 @@ function buildAccountBridge20(signerContext3) {
|
|
|
801332
801805
|
sync: sync17,
|
|
801333
801806
|
receive: receive16,
|
|
801334
801807
|
signOperation: signOperation3,
|
|
801335
|
-
broadcast:
|
|
801808
|
+
broadcast: broadcast24,
|
|
801336
801809
|
getSerializedAddressParameters
|
|
801337
801810
|
};
|
|
801338
801811
|
}
|
|
@@ -801768,7 +802241,7 @@ async function rpcCall(method2, params = {}) {
|
|
|
801768
802241
|
}
|
|
801769
802242
|
|
|
801770
802243
|
// ../../libs/coin-modules/coin-xrp/lib-es/logic/broadcast.js
|
|
801771
|
-
async function
|
|
802244
|
+
async function broadcast25(signature3) {
|
|
801772
802245
|
const submittedPayment = await submit3(signature3);
|
|
801773
802246
|
if (submittedPayment.engine_result !== "tesSUCCESS" && submittedPayment.engine_result !== "terQUEUED") {
|
|
801774
802247
|
throw new Error(submittedPayment.engine_result_message);
|
|
@@ -801880,7 +802353,7 @@ var remapError = (error2) => {
|
|
|
801880
802353
|
}
|
|
801881
802354
|
return error2;
|
|
801882
802355
|
};
|
|
801883
|
-
async function
|
|
802356
|
+
async function estimateFees5(networkInfo) {
|
|
801884
802357
|
if (!networkInfo) {
|
|
801885
802358
|
try {
|
|
801886
802359
|
const info6 = await getServerInfos();
|
|
@@ -802024,8 +802497,8 @@ var convertToCoreOperation = (address4) => (operation) => {
|
|
|
802024
802497
|
};
|
|
802025
802498
|
|
|
802026
802499
|
// ../../libs/coin-modules/coin-xrp/lib-es/bridge/broadcast.js
|
|
802027
|
-
var
|
|
802028
|
-
const hash12 = await
|
|
802500
|
+
var broadcast26 = async ({ signedOperation: { signature: signature3, operation } }) => {
|
|
802501
|
+
const hash12 = await broadcast25(signature3);
|
|
802029
802502
|
return patchOperationWithHash(operation, hash12);
|
|
802030
802503
|
};
|
|
802031
802504
|
|
|
@@ -802103,7 +802576,7 @@ var getTransactionStatus21 = async (account3, transaction) => {
|
|
|
802103
802576
|
|
|
802104
802577
|
// ../../libs/coin-modules/coin-xrp/lib-es/bridge/prepareTransaction.js
|
|
802105
802578
|
var prepareTransaction22 = async (_account, transaction) => {
|
|
802106
|
-
const { networkInfo } = await
|
|
802579
|
+
const { networkInfo } = await estimateFees5(transaction.networkInfo);
|
|
802107
802580
|
const fee = transaction.fee || networkInfo.serverFee;
|
|
802108
802581
|
if (transaction.networkInfo !== networkInfo || transaction.fee !== fee) {
|
|
802109
802582
|
return { ...transaction, networkInfo, fee };
|
|
@@ -802290,7 +802763,7 @@ function createBridges22(signerContext3, coinConfig16) {
|
|
|
802290
802763
|
sync: sync21,
|
|
802291
802764
|
receive: receive16,
|
|
802292
802765
|
signOperation: signOperation3,
|
|
802293
|
-
broadcast:
|
|
802766
|
+
broadcast: broadcast26,
|
|
802294
802767
|
getSerializedAddressParameters
|
|
802295
802768
|
};
|
|
802296
802769
|
return {
|
|
@@ -808390,7 +808863,7 @@ async function withApi2(execute2) {
|
|
|
808390
808863
|
return result2;
|
|
808391
808864
|
}
|
|
808392
808865
|
var getBalanceCached = makeLRUCache(({ api: api8, owner }) => api8.getBalance({ owner }), (params) => params.owner, minutes(1));
|
|
808393
|
-
var
|
|
808866
|
+
var getAccount10 = async (addr) => withApi2(async (api8) => {
|
|
808394
808867
|
const balance = await getBalanceCached({ api: api8, owner: addr });
|
|
808395
808868
|
return {
|
|
808396
808869
|
blockHeight: BLOCK_HEIGHT * 2,
|
|
@@ -808524,7 +808997,7 @@ var loadOperation = async (params) => {
|
|
|
808524
808997
|
|
|
808525
808998
|
// ../../libs/coin-modules/coin-sui/lib-es/network/index.js
|
|
808526
808999
|
var network_default3 = {
|
|
808527
|
-
getAccount:
|
|
809000
|
+
getAccount: getAccount10,
|
|
808528
809001
|
getOperations: getOperations5,
|
|
808529
809002
|
paymentInfo: paymentInfo3,
|
|
808530
809003
|
createTransaction: createTransaction24,
|
|
@@ -808540,13 +809013,13 @@ async function craftTransaction5(address4, extractExtrinsicArg3) {
|
|
|
808540
809013
|
}
|
|
808541
809014
|
|
|
808542
809015
|
// ../../libs/coin-modules/coin-sui/lib-es/logic/estimateFees.js
|
|
808543
|
-
async function
|
|
809016
|
+
async function estimateFees6(sender, transaction) {
|
|
808544
809017
|
const { gasBudget } = await network_default3.paymentInfo(sender, transaction);
|
|
808545
809018
|
return BigInt(gasBudget);
|
|
808546
809019
|
}
|
|
808547
809020
|
|
|
808548
809021
|
// ../../libs/coin-modules/coin-sui/lib-es/logic/broadcast.js
|
|
808549
|
-
async function
|
|
809022
|
+
async function broadcast27(unsigned2, serializedSignature) {
|
|
808550
809023
|
const result2 = await network_default3.executeTransactionBlock({
|
|
808551
809024
|
transactionBlock: unsigned2,
|
|
808552
809025
|
signature: serializedSignature,
|
|
@@ -808558,9 +809031,9 @@ async function broadcast26(unsigned2, serializedSignature) {
|
|
|
808558
809031
|
}
|
|
808559
809032
|
|
|
808560
809033
|
// ../../libs/coin-modules/coin-sui/lib-es/bridge/broadcast.js
|
|
808561
|
-
var
|
|
809034
|
+
var broadcast28 = async ({ signedOperation }) => {
|
|
808562
809035
|
const { operation, rawData: { unsigned: unsigned2, serializedSignature } } = signedOperation;
|
|
808563
|
-
const hash12 = await
|
|
809036
|
+
const hash12 = await broadcast27(unsigned2, serializedSignature);
|
|
808564
809037
|
return patchOperationWithHash(operation, hash12);
|
|
808565
809038
|
};
|
|
808566
809039
|
|
|
@@ -808633,7 +809106,7 @@ async function getEstimatedFees12({ account: account3, transaction }) {
|
|
|
808633
809106
|
})
|
|
808634
809107
|
// Remove fees if present since we are fetching fees
|
|
808635
809108
|
};
|
|
808636
|
-
const fees2 = await
|
|
809109
|
+
const fees2 = await estimateFees6(account3.freshAddress, t75);
|
|
808637
809110
|
return new import_bignumber295.BigNumber(fees2.toString());
|
|
808638
809111
|
}
|
|
808639
809112
|
|
|
@@ -811155,7 +811628,7 @@ var getAccountShape20 = async (info6) => {
|
|
|
811155
811628
|
xpubOrAddress: address4,
|
|
811156
811629
|
derivationMode
|
|
811157
811630
|
});
|
|
811158
|
-
const { blockHeight, balance } = await
|
|
811631
|
+
const { blockHeight, balance } = await getAccount10(address4);
|
|
811159
811632
|
let operations = [];
|
|
811160
811633
|
try {
|
|
811161
811634
|
const startAtIn = latestHash(oldOperations, "IN");
|
|
@@ -811209,7 +811682,7 @@ function buildAccountBridge21(signerContext3) {
|
|
|
811209
811682
|
sync: sync18,
|
|
811210
811683
|
receive: receive16,
|
|
811211
811684
|
signOperation: signOperation3,
|
|
811212
|
-
broadcast:
|
|
811685
|
+
broadcast: broadcast28,
|
|
811213
811686
|
assignFromAccountRaw: assignFromAccountRaw12,
|
|
811214
811687
|
assignToAccountRaw: assignToAccountRaw12,
|
|
811215
811688
|
fromOperationExtraRaw: fromOperationExtraRaw7,
|
|
@@ -812412,7 +812885,7 @@ var parseSigningResponse = (response, chainId, isModern) => {
|
|
|
812412
812885
|
};
|
|
812413
812886
|
|
|
812414
812887
|
// ../../libs/ledger-live-common/lib-es/families/celo/broadcast.js
|
|
812415
|
-
var
|
|
812888
|
+
var broadcast29 = async ({ signedOperation: { operation, signature: signature3 } }) => {
|
|
812416
812889
|
const kit4 = celoKit();
|
|
812417
812890
|
const { transactionHash } = await kit4.web3.eth.sendSignedTransaction(signature3);
|
|
812418
812891
|
return patchOperationWithHash(operation, transactionHash);
|
|
@@ -812527,7 +813000,7 @@ var accountBridge = {
|
|
|
812527
813000
|
sync: sync19,
|
|
812528
813001
|
receive: receive2,
|
|
812529
813002
|
signOperation,
|
|
812530
|
-
broadcast:
|
|
813003
|
+
broadcast: broadcast29,
|
|
812531
813004
|
assignFromAccountRaw: assignFromAccountRaw13,
|
|
812532
813005
|
assignToAccountRaw: assignToAccountRaw13,
|
|
812533
813006
|
fromOperationExtraRaw: fromOperationExtraRaw8,
|
|
@@ -815076,7 +815549,7 @@ var sync20 = (initialAccount) => new import_rxjs148.Observable((o56) => {
|
|
|
815076
815549
|
syncTimeouts[accountId2] = null;
|
|
815077
815550
|
};
|
|
815078
815551
|
});
|
|
815079
|
-
var
|
|
815552
|
+
var broadcast30 = ({ signedOperation }) => Promise.resolve(signedOperation.operation);
|
|
815080
815553
|
var signOperation2 = ({ account: account3, transaction }) => new import_rxjs148.Observable((o56) => {
|
|
815081
815554
|
let cancelled = false;
|
|
815082
815555
|
async function main2() {
|
|
@@ -815247,7 +815720,7 @@ var accountBridge2 = {
|
|
|
815247
815720
|
assignFromAccountRaw,
|
|
815248
815721
|
initAccount,
|
|
815249
815722
|
signOperation: signOperation2,
|
|
815250
|
-
broadcast:
|
|
815723
|
+
broadcast: broadcast30,
|
|
815251
815724
|
getSerializedAddressParameters
|
|
815252
815725
|
};
|
|
815253
815726
|
var currencyBridge2 = {
|
|
@@ -815401,7 +815874,7 @@ var accountBridge3 = {
|
|
|
815401
815874
|
sync: sync20,
|
|
815402
815875
|
receive: receive4,
|
|
815403
815876
|
signOperation: signOperation2,
|
|
815404
|
-
broadcast:
|
|
815877
|
+
broadcast: broadcast30,
|
|
815405
815878
|
getSerializedAddressParameters
|
|
815406
815879
|
};
|
|
815407
815880
|
var currencyBridge3 = {
|
|
@@ -815523,7 +815996,7 @@ var accountBridge4 = {
|
|
|
815523
815996
|
sync: sync20,
|
|
815524
815997
|
receive: receive5,
|
|
815525
815998
|
signOperation: signOperation2,
|
|
815526
|
-
broadcast:
|
|
815999
|
+
broadcast: broadcast30,
|
|
815527
816000
|
getSerializedAddressParameters
|
|
815528
816001
|
};
|
|
815529
816002
|
var currencyBridge4 = {
|
|
@@ -815644,7 +816117,7 @@ var accountBridge5 = {
|
|
|
815644
816117
|
sync: sync20,
|
|
815645
816118
|
receive: receive6,
|
|
815646
816119
|
signOperation: signOperation2,
|
|
815647
|
-
broadcast:
|
|
816120
|
+
broadcast: broadcast30,
|
|
815648
816121
|
estimateMaxSpendable: estimateMaxSpendable27,
|
|
815649
816122
|
getSerializedAddressParameters
|
|
815650
816123
|
};
|
|
@@ -815730,7 +816203,7 @@ var accountBridge6 = {
|
|
|
815730
816203
|
sync: sync20,
|
|
815731
816204
|
receive: receive7,
|
|
815732
816205
|
signOperation: signOperation2,
|
|
815733
|
-
broadcast:
|
|
816206
|
+
broadcast: broadcast30,
|
|
815734
816207
|
assignFromAccountRaw: assignFromAccountRaw4,
|
|
815735
816208
|
assignToAccountRaw: assignToAccountRaw4,
|
|
815736
816209
|
getSerializedAddressParameters
|
|
@@ -815849,7 +816322,7 @@ var accountBridge7 = {
|
|
|
815849
816322
|
sync: sync20,
|
|
815850
816323
|
receive: receive8,
|
|
815851
816324
|
signOperation: signOperation2,
|
|
815852
|
-
broadcast:
|
|
816325
|
+
broadcast: broadcast30,
|
|
815853
816326
|
getSerializedAddressParameters
|
|
815854
816327
|
};
|
|
815855
816328
|
var currencyBridge7 = {
|
|
@@ -815916,7 +816389,7 @@ var accountBridge8 = {
|
|
|
815916
816389
|
sync: sync20,
|
|
815917
816390
|
receive: receive9,
|
|
815918
816391
|
signOperation: signOperation2,
|
|
815919
|
-
broadcast:
|
|
816392
|
+
broadcast: broadcast30,
|
|
815920
816393
|
getSerializedAddressParameters
|
|
815921
816394
|
};
|
|
815922
816395
|
var currencyBridge8 = {
|
|
@@ -815992,7 +816465,7 @@ var accountBridge9 = {
|
|
|
815992
816465
|
assignToAccountRaw: assignToAccountRaw6,
|
|
815993
816466
|
assignFromAccountRaw: assignFromAccountRaw6,
|
|
815994
816467
|
signOperation: signOperation2,
|
|
815995
|
-
broadcast:
|
|
816468
|
+
broadcast: broadcast30,
|
|
815996
816469
|
getSerializedAddressParameters
|
|
815997
816470
|
};
|
|
815998
816471
|
var currencyBridge9 = {
|
|
@@ -816076,7 +816549,7 @@ var accountBridge10 = {
|
|
|
816076
816549
|
assignToAccountRaw: assignToAccountRaw8,
|
|
816077
816550
|
assignFromAccountRaw: assignFromAccountRaw8,
|
|
816078
816551
|
signOperation: signOperation2,
|
|
816079
|
-
broadcast:
|
|
816552
|
+
broadcast: broadcast30,
|
|
816080
816553
|
getSerializedAddressParameters
|
|
816081
816554
|
};
|
|
816082
816555
|
var preload11 = () => {
|
|
@@ -817224,7 +817697,7 @@ var accountBridge11 = {
|
|
|
817224
817697
|
sync: sync20,
|
|
817225
817698
|
receive: receive12,
|
|
817226
817699
|
signOperation: signOperation2,
|
|
817227
|
-
broadcast:
|
|
817700
|
+
broadcast: broadcast30,
|
|
817228
817701
|
estimateMaxSpendable: estimateMaxSpendable33,
|
|
817229
817702
|
getSerializedAddressParameters
|
|
817230
817703
|
};
|
|
@@ -817359,7 +817832,7 @@ var accountBridge12 = {
|
|
|
817359
817832
|
sync: sync20,
|
|
817360
817833
|
receive: receive13,
|
|
817361
817834
|
signOperation: signOperation2,
|
|
817362
|
-
broadcast:
|
|
817835
|
+
broadcast: broadcast30,
|
|
817363
817836
|
getSerializedAddressParameters
|
|
817364
817837
|
};
|
|
817365
817838
|
var currencyBridge12 = {
|
|
@@ -817445,7 +817918,7 @@ var accountBridge13 = {
|
|
|
817445
817918
|
sync: sync20,
|
|
817446
817919
|
receive: receive14,
|
|
817447
817920
|
signOperation: signOperation2,
|
|
817448
|
-
broadcast:
|
|
817921
|
+
broadcast: broadcast30,
|
|
817449
817922
|
getSerializedAddressParameters
|
|
817450
817923
|
};
|
|
817451
817924
|
var currencyBridge13 = {
|
|
@@ -817552,7 +818025,7 @@ var accountBridge14 = {
|
|
|
817552
818025
|
sync: sync20,
|
|
817553
818026
|
receive: receive15,
|
|
817554
818027
|
signOperation: signOperation2,
|
|
817555
|
-
broadcast:
|
|
818028
|
+
broadcast: broadcast30,
|
|
817556
818029
|
getSerializedAddressParameters
|
|
817557
818030
|
};
|
|
817558
818031
|
var currencyBridge14 = {
|
|
@@ -820244,6 +820717,12 @@ var appConfig = {
|
|
|
820244
820717
|
default: {
|
|
820245
820718
|
minVersion: "2.4.5"
|
|
820246
820719
|
}
|
|
820720
|
+
},
|
|
820721
|
+
config_nanoapp_aptos: {
|
|
820722
|
+
type: "object",
|
|
820723
|
+
default: {
|
|
820724
|
+
minVersion: "0.8.12"
|
|
820725
|
+
}
|
|
820247
820726
|
}
|
|
820248
820727
|
};
|
|
820249
820728
|
|
|
@@ -822475,7 +822954,7 @@ var acceptTransaction3 = deviceActionFlow({
|
|
|
822475
822954
|
button: SpeculosButton2.RIGHT
|
|
822476
822955
|
},
|
|
822477
822956
|
{
|
|
822478
|
-
title: "Transaction",
|
|
822957
|
+
title: "Transaction Type",
|
|
822479
822958
|
button: SpeculosButton2.RIGHT
|
|
822480
822959
|
},
|
|
822481
822960
|
{
|
|
@@ -822483,21 +822962,53 @@ var acceptTransaction3 = deviceActionFlow({
|
|
|
822483
822962
|
button: SpeculosButton2.RIGHT
|
|
822484
822963
|
},
|
|
822485
822964
|
{
|
|
822486
|
-
title: "
|
|
822965
|
+
title: "Amount",
|
|
822966
|
+
button: SpeculosButton2.RIGHT
|
|
822967
|
+
},
|
|
822968
|
+
{
|
|
822969
|
+
title: "To (1/2)",
|
|
822970
|
+
button: SpeculosButton2.RIGHT
|
|
822971
|
+
},
|
|
822972
|
+
{
|
|
822973
|
+
title: "To (2/2)",
|
|
822974
|
+
button: SpeculosButton2.RIGHT
|
|
822975
|
+
},
|
|
822976
|
+
{
|
|
822977
|
+
title: "Gas Fee",
|
|
822978
|
+
button: SpeculosButton2.RIGHT
|
|
822979
|
+
},
|
|
822980
|
+
{
|
|
822981
|
+
title: "Approve",
|
|
822982
|
+
button: SpeculosButton2.BOTH
|
|
822983
|
+
}
|
|
822984
|
+
]
|
|
822985
|
+
});
|
|
822986
|
+
var acceptTokenTransaction = deviceActionFlow({
|
|
822987
|
+
steps: [
|
|
822988
|
+
{
|
|
822989
|
+
title: "Review",
|
|
822487
822990
|
button: SpeculosButton2.RIGHT
|
|
822488
822991
|
},
|
|
822489
822992
|
{
|
|
822490
|
-
title: "
|
|
822993
|
+
title: "Transaction Type",
|
|
822491
822994
|
button: SpeculosButton2.RIGHT
|
|
822492
822995
|
},
|
|
822493
822996
|
{
|
|
822494
|
-
title: "
|
|
822997
|
+
title: "Function",
|
|
822495
822998
|
button: SpeculosButton2.RIGHT
|
|
822496
822999
|
},
|
|
822497
823000
|
{
|
|
822498
823001
|
title: "Amount",
|
|
822499
823002
|
button: SpeculosButton2.RIGHT
|
|
822500
823003
|
},
|
|
823004
|
+
{
|
|
823005
|
+
title: "To (1/2)",
|
|
823006
|
+
button: SpeculosButton2.RIGHT
|
|
823007
|
+
},
|
|
823008
|
+
{
|
|
823009
|
+
title: "To (2/2)",
|
|
823010
|
+
button: SpeculosButton2.RIGHT
|
|
823011
|
+
},
|
|
822501
823012
|
{
|
|
822502
823013
|
title: "Gas Fee",
|
|
822503
823014
|
button: SpeculosButton2.RIGHT
|
|
@@ -822520,7 +823031,7 @@ var aptosSpecs = {
|
|
|
822520
823031
|
appName: "Aptos"
|
|
822521
823032
|
},
|
|
822522
823033
|
genericDeviceAction: acceptTransaction3,
|
|
822523
|
-
testTimeout:
|
|
823034
|
+
testTimeout: 2 * 60 * 1e3,
|
|
822524
823035
|
minViableAmount: MIN_SAFE,
|
|
822525
823036
|
transactionCheck: ({ maxSpendable }) => {
|
|
822526
823037
|
(0, import_invariant73.default)(maxSpendable.gt(MIN_SAFE), "balance is too low");
|
|
@@ -822574,9 +823085,48 @@ var aptosSpecs = {
|
|
|
822574
823085
|
test: ({ account: account3 }) => {
|
|
822575
823086
|
botTest("account spendable balance is zero", () => (0, import_expect3.default)(account3.spendableBalance.toString()).toBe("0"));
|
|
822576
823087
|
}
|
|
823088
|
+
},
|
|
823089
|
+
{
|
|
823090
|
+
name: "Send ~50% of token amount",
|
|
823091
|
+
feature: "tokens",
|
|
823092
|
+
maxRun: 1,
|
|
823093
|
+
deviceAction: acceptTokenTransaction,
|
|
823094
|
+
transaction: ({ account: account3, bridge: bridge26, siblings, maxSpendable }) => {
|
|
823095
|
+
(0, import_invariant73.default)(maxSpendable.gt(MIN_SAFE), "Balance is too low");
|
|
823096
|
+
const senderTokenAcc = findTokenSubAccountWithBalance(account3);
|
|
823097
|
+
(0, import_invariant73.default)(senderTokenAcc, "Sender token account with available balance not found");
|
|
823098
|
+
const sibling = pickSiblings(siblings, maxAccount2);
|
|
823099
|
+
const recipientTokenAcc = findTokenSubAccountWithBalance(sibling);
|
|
823100
|
+
(0, import_invariant73.default)(recipientTokenAcc, "Receiver token account with available balance not found");
|
|
823101
|
+
const amount = senderTokenAcc.spendableBalance.div(2).integerValue();
|
|
823102
|
+
const recipient = sibling.freshAddress;
|
|
823103
|
+
const transaction = bridge26.createTransaction(account3);
|
|
823104
|
+
const subAccountId = senderTokenAcc.id;
|
|
823105
|
+
return {
|
|
823106
|
+
transaction,
|
|
823107
|
+
updates: [{ subAccountId }, { recipient }, { amount }]
|
|
823108
|
+
};
|
|
823109
|
+
},
|
|
823110
|
+
test: (input) => {
|
|
823111
|
+
expectTokenAccountCorrectBalanceChange(input);
|
|
823112
|
+
}
|
|
822577
823113
|
}
|
|
822578
823114
|
]
|
|
822579
823115
|
};
|
|
823116
|
+
function findTokenSubAccountWithBalance(account3) {
|
|
823117
|
+
return account3.subAccounts?.find((acc) => acc.type === "TokenAccount" && acc.balance.gt(0));
|
|
823118
|
+
}
|
|
823119
|
+
function expectTokenAccountCorrectBalanceChange({ account: account3, accountBeforeTransaction, status, transaction }) {
|
|
823120
|
+
const tokenAccId = transaction.subAccountId;
|
|
823121
|
+
if (!tokenAccId)
|
|
823122
|
+
throw new Error("Wrong subAccountId");
|
|
823123
|
+
const tokenAccAfterTx = account3.subAccounts?.find((acc) => acc.id === tokenAccId);
|
|
823124
|
+
const tokenAccBeforeTx = accountBeforeTransaction.subAccounts?.find((acc) => acc.id === tokenAccId);
|
|
823125
|
+
if (!tokenAccAfterTx || !tokenAccBeforeTx) {
|
|
823126
|
+
throw new Error("Token sub accounts not found!");
|
|
823127
|
+
}
|
|
823128
|
+
botTest("Token balance decreased with operation", () => (0, import_expect3.default)(tokenAccAfterTx.balance.toString()).toBe(tokenAccBeforeTx.balance.minus(status.amount).toString()));
|
|
823129
|
+
}
|
|
822580
823130
|
var bot_specs_default = {
|
|
822581
823131
|
aptosSpecs
|
|
822582
823132
|
};
|
|
@@ -827055,7 +827605,7 @@ var solana = {
|
|
|
827055
827605
|
deviceAction: acceptTransferTokensWithATACreationTransaction,
|
|
827056
827606
|
transaction: ({ account: account3, bridge: bridge26, siblings, maxSpendable }) => {
|
|
827057
827607
|
(0, import_invariant87.default)(maxSpendable.gt(0), "balance is 0");
|
|
827058
|
-
const senderTokenAcc =
|
|
827608
|
+
const senderTokenAcc = findTokenSubAccountWithBalance2(account3);
|
|
827059
827609
|
(0, import_invariant87.default)(senderTokenAcc, "Sender token account with available balance not found");
|
|
827060
827610
|
const token = senderTokenAcc.token;
|
|
827061
827611
|
const siblingWithoutToken = siblings.find((acc) => !findTokenSubAccount(acc, token.id));
|
|
@@ -827075,7 +827625,7 @@ var solana = {
|
|
|
827075
827625
|
};
|
|
827076
827626
|
},
|
|
827077
827627
|
test: (input) => {
|
|
827078
|
-
|
|
827628
|
+
expectTokenAccountCorrectBalanceChange2(input);
|
|
827079
827629
|
}
|
|
827080
827630
|
},
|
|
827081
827631
|
{
|
|
@@ -827085,7 +827635,7 @@ var solana = {
|
|
|
827085
827635
|
deviceAction: acceptTransferTokensTransaction,
|
|
827086
827636
|
transaction: ({ account: account3, bridge: bridge26, siblings, maxSpendable }) => {
|
|
827087
827637
|
(0, import_invariant87.default)(maxSpendable.gt(0), "balance is 0");
|
|
827088
|
-
const senderTokenAcc =
|
|
827638
|
+
const senderTokenAcc = findTokenSubAccountWithBalance2(account3);
|
|
827089
827639
|
(0, import_invariant87.default)(senderTokenAcc, "Sender token account with available balance not found");
|
|
827090
827640
|
const token = senderTokenAcc.token;
|
|
827091
827641
|
const siblingTokenAccount = siblings.find((acc) => findTokenSubAccount(acc, token.id));
|
|
@@ -827100,7 +827650,7 @@ var solana = {
|
|
|
827100
827650
|
};
|
|
827101
827651
|
},
|
|
827102
827652
|
test: (input) => {
|
|
827103
|
-
|
|
827653
|
+
expectTokenAccountCorrectBalanceChange2(input);
|
|
827104
827654
|
}
|
|
827105
827655
|
},
|
|
827106
827656
|
{
|
|
@@ -827237,7 +827787,7 @@ function expectCorrectBalanceChange2(input) {
|
|
|
827237
827787
|
const { account: account3, operation, accountBeforeTransaction } = input;
|
|
827238
827788
|
botTest("account balance decreased with operation value", () => (0, import_expect15.default)(account3.balance.toNumber()).toBe(accountBeforeTransaction.balance.minus(operation.value).toNumber()));
|
|
827239
827789
|
}
|
|
827240
|
-
function
|
|
827790
|
+
function expectTokenAccountCorrectBalanceChange2({ account: account3, accountBeforeTransaction, status, transaction }) {
|
|
827241
827791
|
const tokenAccId = transaction.subAccountId;
|
|
827242
827792
|
if (!tokenAccId)
|
|
827243
827793
|
throw new Error("Wrong transaction!");
|
|
@@ -827271,7 +827821,7 @@ function expectSourceBalanceChangeWithTxFee({ transaction, account: account3, ac
|
|
|
827271
827821
|
function findTokenSubAccount(account3, tokenId) {
|
|
827272
827822
|
return account3.subAccounts?.find((acc) => acc.type === "TokenAccount" && acc.token.id === tokenId);
|
|
827273
827823
|
}
|
|
827274
|
-
function
|
|
827824
|
+
function findTokenSubAccountWithBalance2(account3) {
|
|
827275
827825
|
return account3.subAccounts?.find((acc) => acc.type === "TokenAccount" && acc.balance.gt(0));
|
|
827276
827826
|
}
|
|
827277
827827
|
function findTokenAccountWithExtensionAndBalance(account3, extension) {
|
|
@@ -836022,7 +836572,7 @@ async function generateCustomLockScreenImageFormat(hexImage, compressImage, padI
|
|
|
836022
836572
|
}
|
|
836023
836573
|
|
|
836024
836574
|
// src/commands/device/customLockScreenFetchAndRestore.ts
|
|
836025
|
-
var
|
|
836575
|
+
var import_crypto48 = __toESM(require("crypto"));
|
|
836026
836576
|
var exec3 = async (opts) => {
|
|
836027
836577
|
const { fileInput, device: deviceId = "", deviceModelId } = opts;
|
|
836028
836578
|
if (!isCustomLockScreenSupported(deviceModelId)) {
|
|
@@ -836038,7 +836588,7 @@ var exec3 = async (opts) => {
|
|
|
836038
836588
|
getScreenSpecs(clsSupportedDeviceModelId)
|
|
836039
836589
|
);
|
|
836040
836590
|
await new Promise(async () => {
|
|
836041
|
-
const hash12 =
|
|
836591
|
+
const hash12 = import_crypto48.default.createHash("sha256").update(hexImage).digest("hex");
|
|
836042
836592
|
console.log("Computing hash for input file");
|
|
836043
836593
|
console.log(hash12);
|
|
836044
836594
|
console.log("Extracting hash from device");
|
|
@@ -842090,12 +842640,12 @@ var SoftwareDevice = class {
|
|
|
842090
842640
|
if (stream10[stream10.length - 1].commands.length === 0) {
|
|
842091
842641
|
throw new Error("Cannot sign an empty block");
|
|
842092
842642
|
}
|
|
842093
|
-
const
|
|
842094
|
-
|
|
842643
|
+
const lastBlock6 = stream10[stream10.length - 1];
|
|
842644
|
+
lastBlock6.issuer = this.keyPair.publicKey;
|
|
842095
842645
|
const resolved = await CommandStreamResolver.resolve(stream10.slice(0, stream10.length - 1));
|
|
842096
842646
|
let sharedKey = null;
|
|
842097
|
-
for (let commandIndex = 0; commandIndex <
|
|
842098
|
-
const command4 =
|
|
842647
|
+
for (let commandIndex = 0; commandIndex < lastBlock6.commands.length; commandIndex++) {
|
|
842648
|
+
const command4 = lastBlock6.commands[commandIndex];
|
|
842099
842649
|
switch (command4.getType()) {
|
|
842100
842650
|
case CommandType.Seed: {
|
|
842101
842651
|
sharedKey = this.generateSharedKey();
|
|
@@ -842146,9 +842696,9 @@ var SoftwareDevice = class {
|
|
|
842146
842696
|
}
|
|
842147
842697
|
}
|
|
842148
842698
|
}
|
|
842149
|
-
const signature3 = signCommandBlock(
|
|
842150
|
-
|
|
842151
|
-
return
|
|
842699
|
+
const signature3 = signCommandBlock(lastBlock6, (await this.getPublicKey()).publicKey, this.keyPair.privateKey).signature;
|
|
842700
|
+
lastBlock6.signature = signature3;
|
|
842701
|
+
return lastBlock6;
|
|
842152
842702
|
}
|
|
842153
842703
|
async readKey(tree, path4) {
|
|
842154
842704
|
const event = await tree.getPublishKeyEvent(this.keyPair.publicKey, path4);
|