@ecency/wallets 1.4.35 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.d.ts +177 -44
- package/dist/browser/index.js +247 -5
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +251 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +245 -5
- package/dist/node/index.mjs.map +1 -1
- package/package.json +3 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -1172,51 +1172,11 @@ declare function getSpkMarketsQueryOptions(): _tanstack_react_query.OmitKeyof<_t
|
|
|
1172
1172
|
};
|
|
1173
1173
|
};
|
|
1174
1174
|
|
|
1175
|
-
declare function
|
|
1176
|
-
|
|
1177
|
-
title: string;
|
|
1178
|
-
price: number;
|
|
1179
|
-
accountBalance: number;
|
|
1180
|
-
layer: string;
|
|
1181
|
-
parts: {
|
|
1182
|
-
name: string;
|
|
1183
|
-
balance: number;
|
|
1184
|
-
}[];
|
|
1185
|
-
}, Error, {
|
|
1186
|
-
name: string;
|
|
1187
|
-
title: string;
|
|
1188
|
-
price: number;
|
|
1189
|
-
accountBalance: number;
|
|
1190
|
-
layer: string;
|
|
1191
|
-
parts: {
|
|
1192
|
-
name: string;
|
|
1193
|
-
balance: number;
|
|
1194
|
-
}[];
|
|
1195
|
-
}, (string | undefined)[]>, "queryFn"> & {
|
|
1196
|
-
queryFn?: _tanstack_react_query.QueryFunction<{
|
|
1197
|
-
name: string;
|
|
1198
|
-
title: string;
|
|
1199
|
-
price: number;
|
|
1200
|
-
accountBalance: number;
|
|
1201
|
-
layer: string;
|
|
1202
|
-
parts: {
|
|
1203
|
-
name: string;
|
|
1204
|
-
balance: number;
|
|
1205
|
-
}[];
|
|
1206
|
-
}, (string | undefined)[], never> | undefined;
|
|
1175
|
+
declare function getSpkWalletQueryOptions(username?: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<SpkApiWallet, Error, SpkApiWallet, (string | undefined)[]>, "queryFn"> & {
|
|
1176
|
+
queryFn?: _tanstack_react_query.QueryFunction<SpkApiWallet, (string | undefined)[], never> | undefined;
|
|
1207
1177
|
} & {
|
|
1208
1178
|
queryKey: (string | undefined)[] & {
|
|
1209
|
-
[dataTagSymbol]:
|
|
1210
|
-
name: string;
|
|
1211
|
-
title: string;
|
|
1212
|
-
price: number;
|
|
1213
|
-
accountBalance: number;
|
|
1214
|
-
layer: string;
|
|
1215
|
-
parts: {
|
|
1216
|
-
name: string;
|
|
1217
|
-
balance: number;
|
|
1218
|
-
}[];
|
|
1219
|
-
};
|
|
1179
|
+
[dataTagSymbol]: SpkApiWallet;
|
|
1220
1180
|
[dataTagErrorSymbol]: Error;
|
|
1221
1181
|
};
|
|
1222
1182
|
};
|
|
@@ -1288,6 +1248,170 @@ interface HiveEngineMetric {
|
|
|
1288
1248
|
timestamp: number;
|
|
1289
1249
|
}
|
|
1290
1250
|
|
|
1251
|
+
interface HiveEngineTokenStatus {
|
|
1252
|
+
symbol: string;
|
|
1253
|
+
pending_token: number;
|
|
1254
|
+
precision: number;
|
|
1255
|
+
}
|
|
1256
|
+
|
|
1257
|
+
interface HiveEngineTokenInfo {
|
|
1258
|
+
highestBid: string;
|
|
1259
|
+
lastDayPrice: string;
|
|
1260
|
+
lastDayPriceExpiration: number;
|
|
1261
|
+
lastPrice: string;
|
|
1262
|
+
lowestAsk: string;
|
|
1263
|
+
priceChangeHive: string;
|
|
1264
|
+
priceChangePercent: string;
|
|
1265
|
+
symbol: string;
|
|
1266
|
+
volume: string;
|
|
1267
|
+
volumeExpiration: number;
|
|
1268
|
+
}
|
|
1269
|
+
|
|
1270
|
+
interface Token {
|
|
1271
|
+
issuer: string;
|
|
1272
|
+
symbol: string;
|
|
1273
|
+
name: string;
|
|
1274
|
+
metadata: string;
|
|
1275
|
+
precision: number;
|
|
1276
|
+
maxSupply: string;
|
|
1277
|
+
supply: string;
|
|
1278
|
+
circulatingSupply: string;
|
|
1279
|
+
stakingEnabled: boolean;
|
|
1280
|
+
unstakingCooldown: number;
|
|
1281
|
+
delegationEnabled: boolean;
|
|
1282
|
+
undelegationCooldown: number;
|
|
1283
|
+
numberTransactions: number;
|
|
1284
|
+
totalStaked: string;
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
interface TokenMetadata {
|
|
1288
|
+
desc: string;
|
|
1289
|
+
url: string;
|
|
1290
|
+
icon: string;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
/**
|
|
1294
|
+
* Get all Hive Engine tokens with optional filtering by account and symbol
|
|
1295
|
+
* @param account - Optional account to filter tokens by
|
|
1296
|
+
* @param symbol - Optional symbol to filter tokens by
|
|
1297
|
+
*/
|
|
1298
|
+
declare function getAllHiveEngineTokensQueryOptions(account?: string, symbol?: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<HiveEngineTokenInfo[], Error, HiveEngineTokenInfo[], readonly ["assets", "hive-engine", "all-tokens", string | undefined, string | undefined]>, "queryFn"> & {
|
|
1299
|
+
queryFn?: _tanstack_react_query.QueryFunction<HiveEngineTokenInfo[], readonly ["assets", "hive-engine", "all-tokens", string | undefined, string | undefined], never> | undefined;
|
|
1300
|
+
} & {
|
|
1301
|
+
queryKey: readonly ["assets", "hive-engine", "all-tokens", string | undefined, string | undefined] & {
|
|
1302
|
+
[dataTagSymbol]: HiveEngineTokenInfo[];
|
|
1303
|
+
[dataTagErrorSymbol]: Error;
|
|
1304
|
+
};
|
|
1305
|
+
};
|
|
1306
|
+
|
|
1307
|
+
interface Options$1 {
|
|
1308
|
+
fractionDigits?: number;
|
|
1309
|
+
prefix?: string;
|
|
1310
|
+
suffix?: string;
|
|
1311
|
+
}
|
|
1312
|
+
declare function formattedNumber(value: number | string, options?: Options$1 | undefined): string;
|
|
1313
|
+
|
|
1314
|
+
interface HiveEngineTokenProps {
|
|
1315
|
+
symbol: string;
|
|
1316
|
+
name: string;
|
|
1317
|
+
icon: string;
|
|
1318
|
+
precision: number;
|
|
1319
|
+
stakingEnabled: boolean;
|
|
1320
|
+
delegationEnabled: boolean;
|
|
1321
|
+
balance: string;
|
|
1322
|
+
stake: string;
|
|
1323
|
+
delegationsIn: string;
|
|
1324
|
+
delegationsOut: string;
|
|
1325
|
+
usdValue: number;
|
|
1326
|
+
}
|
|
1327
|
+
declare class HiveEngineToken {
|
|
1328
|
+
symbol: string;
|
|
1329
|
+
name?: string;
|
|
1330
|
+
icon?: string;
|
|
1331
|
+
precision?: number;
|
|
1332
|
+
stakingEnabled?: boolean;
|
|
1333
|
+
delegationEnabled?: boolean;
|
|
1334
|
+
balance: number;
|
|
1335
|
+
stake: number;
|
|
1336
|
+
stakedBalance: number;
|
|
1337
|
+
delegationsIn: number;
|
|
1338
|
+
delegationsOut: number;
|
|
1339
|
+
usdValue: number;
|
|
1340
|
+
constructor(props: HiveEngineTokenProps);
|
|
1341
|
+
hasDelegations: () => boolean;
|
|
1342
|
+
delegations: () => string;
|
|
1343
|
+
staked: () => string;
|
|
1344
|
+
balanced: () => string;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
interface DynamicProps {
|
|
1348
|
+
base: number;
|
|
1349
|
+
quote: number;
|
|
1350
|
+
}
|
|
1351
|
+
/**
|
|
1352
|
+
* Get token balances with USD values
|
|
1353
|
+
* @param account - Account to get balances for
|
|
1354
|
+
* @param dynamicProps - Dynamic props with base/quote for price calculation
|
|
1355
|
+
* @param allTokens - All token metrics for price info
|
|
1356
|
+
*/
|
|
1357
|
+
declare function getHiveEngineBalancesWithUsdQueryOptions(account: string, dynamicProps?: DynamicProps, allTokens?: HiveEngineTokenInfo[]): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<HiveEngineToken[], Error, HiveEngineToken[], readonly ["assets", "hive-engine", "balances-with-usd", string, DynamicProps | undefined, HiveEngineTokenInfo[] | undefined]>, "queryFn"> & {
|
|
1358
|
+
queryFn?: _tanstack_react_query.QueryFunction<HiveEngineToken[], readonly ["assets", "hive-engine", "balances-with-usd", string, DynamicProps | undefined, HiveEngineTokenInfo[] | undefined], never> | undefined;
|
|
1359
|
+
} & {
|
|
1360
|
+
queryKey: readonly ["assets", "hive-engine", "balances-with-usd", string, DynamicProps | undefined, HiveEngineTokenInfo[] | undefined] & {
|
|
1361
|
+
[dataTagSymbol]: HiveEngineToken[];
|
|
1362
|
+
[dataTagErrorSymbol]: Error;
|
|
1363
|
+
};
|
|
1364
|
+
};
|
|
1365
|
+
|
|
1366
|
+
declare function getHiveEngineTokenGeneralInfoQueryOptions(username?: string, symbol?: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<{
|
|
1367
|
+
name: string;
|
|
1368
|
+
title: string;
|
|
1369
|
+
price: number;
|
|
1370
|
+
accountBalance: number;
|
|
1371
|
+
layer: string;
|
|
1372
|
+
parts: {
|
|
1373
|
+
name: string;
|
|
1374
|
+
balance: number;
|
|
1375
|
+
}[];
|
|
1376
|
+
}, Error, {
|
|
1377
|
+
name: string;
|
|
1378
|
+
title: string;
|
|
1379
|
+
price: number;
|
|
1380
|
+
accountBalance: number;
|
|
1381
|
+
layer: string;
|
|
1382
|
+
parts: {
|
|
1383
|
+
name: string;
|
|
1384
|
+
balance: number;
|
|
1385
|
+
}[];
|
|
1386
|
+
}, (string | undefined)[]>, "queryFn"> & {
|
|
1387
|
+
queryFn?: _tanstack_react_query.QueryFunction<{
|
|
1388
|
+
name: string;
|
|
1389
|
+
title: string;
|
|
1390
|
+
price: number;
|
|
1391
|
+
accountBalance: number;
|
|
1392
|
+
layer: string;
|
|
1393
|
+
parts: {
|
|
1394
|
+
name: string;
|
|
1395
|
+
balance: number;
|
|
1396
|
+
}[];
|
|
1397
|
+
}, (string | undefined)[], never> | undefined;
|
|
1398
|
+
} & {
|
|
1399
|
+
queryKey: (string | undefined)[] & {
|
|
1400
|
+
[dataTagSymbol]: {
|
|
1401
|
+
name: string;
|
|
1402
|
+
title: string;
|
|
1403
|
+
price: number;
|
|
1404
|
+
accountBalance: number;
|
|
1405
|
+
layer: string;
|
|
1406
|
+
parts: {
|
|
1407
|
+
name: string;
|
|
1408
|
+
balance: number;
|
|
1409
|
+
}[];
|
|
1410
|
+
};
|
|
1411
|
+
[dataTagErrorSymbol]: Error;
|
|
1412
|
+
};
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1291
1415
|
declare function getHiveEngineTokensMetadataQueryOptions(tokens: string[]): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<HiveEngineTokenMetadataResponse[], Error, HiveEngineTokenMetadataResponse[], readonly ["assets", "hive-engine", "metadata-list", string[]]>, "queryFn"> & {
|
|
1292
1416
|
queryFn?: _tanstack_react_query.QueryFunction<HiveEngineTokenMetadataResponse[], readonly ["assets", "hive-engine", "metadata-list", string[]], never> | undefined;
|
|
1293
1417
|
} & {
|
|
@@ -1333,6 +1457,15 @@ declare function getHiveEngineTokensBalancesQueryOptions(username: string): _tan
|
|
|
1333
1457
|
};
|
|
1334
1458
|
};
|
|
1335
1459
|
|
|
1460
|
+
declare function getHiveEngineUnclaimedRewardsQueryOptions(username: string | undefined): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<HiveEngineTokenStatus[], Error, HiveEngineTokenStatus[], (string | undefined)[]>, "queryFn"> & {
|
|
1461
|
+
queryFn?: _tanstack_react_query.QueryFunction<HiveEngineTokenStatus[], (string | undefined)[], never> | undefined;
|
|
1462
|
+
} & {
|
|
1463
|
+
queryKey: (string | undefined)[] & {
|
|
1464
|
+
[dataTagSymbol]: HiveEngineTokenStatus[];
|
|
1465
|
+
[dataTagErrorSymbol]: Error;
|
|
1466
|
+
};
|
|
1467
|
+
};
|
|
1468
|
+
|
|
1336
1469
|
interface DelegateEnginePayload<T extends HiveBasedAssetSignType> {
|
|
1337
1470
|
from: string;
|
|
1338
1471
|
to: string;
|
|
@@ -1814,4 +1947,4 @@ declare function buildExternalTx(currency: EcencyWalletCurrency, tx: ExternalTxP
|
|
|
1814
1947
|
|
|
1815
1948
|
declare function getBoundFetch(): typeof fetch;
|
|
1816
1949
|
|
|
1817
|
-
export { type AccountPointsResponse, type Asset, AssetOperation, type AuthorReward, type CancelTransferFromSavings, type ClaimRewardBalance, type CollateralizedConvert, type CommentBenefactor, type CommentPayoutUpdate, type CommentReward, type CurationReward, type DelegateEnginePayload, type DelegateVestingShares, type DelegatedVestingShare, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type EffectiveCommentVote, type ExternalTxParams, type ExternalWalletBalance, type FillCollateralizedConvertRequest, type FillConvertRequest, type FillOrder, type FillRecurrentTransfers, type FillVestingWithdraw, type GeneralAssetInfo, type GeneralAssetTransaction, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, type HiveAuthBroadcastHandler, type HiveAuthKeyType, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, type HiveEngineTokenBalance, type HiveEngineTokenMetadataResponse, type HiveEngineTransaction, type HiveKeyDerivation, type HiveMarketMetric, type HiveOperationFilter, type HiveOperationFilterKey, type HiveOperationFilterValue, type HiveOperationGroup, type HiveOperationName, type HiveRole, type HiveTransaction, type HiveWithdrawRoute, type Interest, type LimitOrderCancel, type LimitOrderCreate, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type ProducerReward, type ProposalPay, type ReceivedVestingShare, type RecurrentTransfers, type ReturnVestingDelegation, type SetWithdrawRoute, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type Transfer, type TransferEnginePayload, type TransferPayload, type TransferToSavings, type TransferToVesting, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, type UpdateProposalVotes, type VisionPortfolioResponse, type VisionPortfolioWalletItem, type VoteProxy, type WithdrawVesting, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, resolveHiveOperationFilters, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
|
1950
|
+
export { type AccountPointsResponse, type Asset, AssetOperation, type AuthorReward, type CancelTransferFromSavings, type ClaimRewardBalance, type CollateralizedConvert, type CommentBenefactor, type CommentPayoutUpdate, type CommentReward, type CurationReward, type DelegateEnginePayload, type DelegateVestingShares, type DelegatedVestingShare, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type EffectiveCommentVote, type ExternalTxParams, type ExternalWalletBalance, type FillCollateralizedConvertRequest, type FillConvertRequest, type FillOrder, type FillRecurrentTransfers, type FillVestingWithdraw, type GeneralAssetInfo, type GeneralAssetTransaction, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, type HiveAuthBroadcastHandler, type HiveAuthKeyType, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, HiveEngineToken, type HiveEngineTokenBalance, type HiveEngineTokenInfo, type HiveEngineTokenMetadataResponse, type HiveEngineTokenStatus, type HiveEngineTransaction, type HiveKeyDerivation, type HiveMarketMetric, type HiveOperationFilter, type HiveOperationFilterKey, type HiveOperationFilterValue, type HiveOperationGroup, type HiveOperationName, type HiveRole, type HiveTransaction, type HiveWithdrawRoute, type Interest, type LimitOrderCancel, type LimitOrderCreate, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type ProducerReward, type ProposalPay, type ReceivedVestingShare, type RecurrentTransfers, type ReturnVestingDelegation, type SetWithdrawRoute, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type Token, type TokenMetadata, type Transfer, type TransferEnginePayload, type TransferPayload, type TransferToSavings, type TransferToVesting, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, type UpdateProposalVotes, type VisionPortfolioResponse, type VisionPortfolioWalletItem, type VoteProxy, type WithdrawVesting, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, formattedNumber, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllHiveEngineTokensQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineBalancesWithUsdQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHiveEngineUnclaimedRewardsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getSpkWalletQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, resolveHiveOperationFilters, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
package/dist/browser/index.js
CHANGED
|
@@ -14,13 +14,16 @@ import { cryptoUtils } from '@hiveio/dhive/lib/crypto';
|
|
|
14
14
|
import { Memo } from '@hiveio/dhive/lib/memo';
|
|
15
15
|
import dayjs from 'dayjs';
|
|
16
16
|
import hs from 'hivesigner';
|
|
17
|
+
import numeral from 'numeral';
|
|
17
18
|
import * as R from 'remeda';
|
|
18
19
|
|
|
19
20
|
var __defProp = Object.defineProperty;
|
|
21
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
20
22
|
var __export = (target, all) => {
|
|
21
23
|
for (var name in all)
|
|
22
24
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
25
|
};
|
|
26
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
24
27
|
|
|
25
28
|
// src/internal/scrypt-guard.ts
|
|
26
29
|
var globalLike = globalThis;
|
|
@@ -1901,6 +1904,221 @@ function getLarynxPowerAssetGeneralInfoQueryOptions(username) {
|
|
|
1901
1904
|
}
|
|
1902
1905
|
});
|
|
1903
1906
|
}
|
|
1907
|
+
function getAllHiveEngineTokensQueryOptions(account, symbol) {
|
|
1908
|
+
return queryOptions({
|
|
1909
|
+
queryKey: ["assets", "hive-engine", "all-tokens", account, symbol],
|
|
1910
|
+
queryFn: async () => {
|
|
1911
|
+
try {
|
|
1912
|
+
const response = await fetch(
|
|
1913
|
+
`${CONFIG.privateApiHost}/private-api/engine-api`,
|
|
1914
|
+
{
|
|
1915
|
+
method: "POST",
|
|
1916
|
+
body: JSON.stringify({
|
|
1917
|
+
jsonrpc: "2.0",
|
|
1918
|
+
method: "find",
|
|
1919
|
+
params: {
|
|
1920
|
+
contract: "market",
|
|
1921
|
+
table: "metrics",
|
|
1922
|
+
query: {
|
|
1923
|
+
...symbol && { symbol },
|
|
1924
|
+
...account && { account }
|
|
1925
|
+
}
|
|
1926
|
+
},
|
|
1927
|
+
id: 1
|
|
1928
|
+
}),
|
|
1929
|
+
headers: { "Content-type": "application/json" }
|
|
1930
|
+
}
|
|
1931
|
+
);
|
|
1932
|
+
const data = await response.json();
|
|
1933
|
+
return data.result;
|
|
1934
|
+
} catch (e) {
|
|
1935
|
+
return [];
|
|
1936
|
+
}
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
}
|
|
1940
|
+
function formattedNumber(value, options2 = void 0) {
|
|
1941
|
+
let opts = {
|
|
1942
|
+
fractionDigits: 3,
|
|
1943
|
+
prefix: "",
|
|
1944
|
+
suffix: ""
|
|
1945
|
+
};
|
|
1946
|
+
if (options2) {
|
|
1947
|
+
opts = { ...opts, ...options2 };
|
|
1948
|
+
}
|
|
1949
|
+
const { fractionDigits, prefix, suffix } = opts;
|
|
1950
|
+
let format4 = "0,0";
|
|
1951
|
+
if (fractionDigits) {
|
|
1952
|
+
format4 += "." + "0".repeat(fractionDigits);
|
|
1953
|
+
}
|
|
1954
|
+
let out = "";
|
|
1955
|
+
if (prefix) out += prefix + " ";
|
|
1956
|
+
const av = Math.abs(parseFloat(value.toString())) < 1e-4 ? 0 : value;
|
|
1957
|
+
out += numeral(av).format(format4);
|
|
1958
|
+
if (suffix) out += " " + suffix;
|
|
1959
|
+
return out;
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// src/modules/assets/hive-engine/utils/hive-engine-token.ts
|
|
1963
|
+
var HiveEngineToken = class {
|
|
1964
|
+
constructor(props) {
|
|
1965
|
+
__publicField(this, "symbol");
|
|
1966
|
+
__publicField(this, "name");
|
|
1967
|
+
__publicField(this, "icon");
|
|
1968
|
+
__publicField(this, "precision");
|
|
1969
|
+
__publicField(this, "stakingEnabled");
|
|
1970
|
+
__publicField(this, "delegationEnabled");
|
|
1971
|
+
__publicField(this, "balance");
|
|
1972
|
+
__publicField(this, "stake");
|
|
1973
|
+
__publicField(this, "stakedBalance");
|
|
1974
|
+
__publicField(this, "delegationsIn");
|
|
1975
|
+
__publicField(this, "delegationsOut");
|
|
1976
|
+
__publicField(this, "usdValue");
|
|
1977
|
+
__publicField(this, "hasDelegations", () => {
|
|
1978
|
+
if (!this.delegationEnabled) {
|
|
1979
|
+
return false;
|
|
1980
|
+
}
|
|
1981
|
+
return this.delegationsIn > 0 && this.delegationsOut > 0;
|
|
1982
|
+
});
|
|
1983
|
+
__publicField(this, "delegations", () => {
|
|
1984
|
+
if (!this.hasDelegations()) {
|
|
1985
|
+
return "";
|
|
1986
|
+
}
|
|
1987
|
+
return `(${formattedNumber(this.stake, {
|
|
1988
|
+
fractionDigits: this.precision
|
|
1989
|
+
})} + ${formattedNumber(this.delegationsIn, {
|
|
1990
|
+
fractionDigits: this.precision
|
|
1991
|
+
})} - ${formattedNumber(this.delegationsOut, {
|
|
1992
|
+
fractionDigits: this.precision
|
|
1993
|
+
})})`;
|
|
1994
|
+
});
|
|
1995
|
+
__publicField(this, "staked", () => {
|
|
1996
|
+
if (!this.stakingEnabled) {
|
|
1997
|
+
return "-";
|
|
1998
|
+
}
|
|
1999
|
+
if (this.stakedBalance < 1e-4) {
|
|
2000
|
+
return this.stakedBalance.toString();
|
|
2001
|
+
}
|
|
2002
|
+
return formattedNumber(this.stakedBalance, {
|
|
2003
|
+
fractionDigits: this.precision
|
|
2004
|
+
});
|
|
2005
|
+
});
|
|
2006
|
+
__publicField(this, "balanced", () => {
|
|
2007
|
+
if (this.balance < 1e-4) {
|
|
2008
|
+
return this.balance.toString();
|
|
2009
|
+
}
|
|
2010
|
+
return formattedNumber(this.balance, { fractionDigits: this.precision });
|
|
2011
|
+
});
|
|
2012
|
+
this.symbol = props.symbol;
|
|
2013
|
+
this.name = props.name || "";
|
|
2014
|
+
this.icon = props.icon || "";
|
|
2015
|
+
this.precision = props.precision || 0;
|
|
2016
|
+
this.stakingEnabled = props.stakingEnabled || false;
|
|
2017
|
+
this.delegationEnabled = props.delegationEnabled || false;
|
|
2018
|
+
this.balance = parseFloat(props.balance) || 0;
|
|
2019
|
+
this.stake = parseFloat(props.stake) || 0;
|
|
2020
|
+
this.delegationsIn = parseFloat(props.delegationsIn) || 0;
|
|
2021
|
+
this.delegationsOut = parseFloat(props.delegationsOut) || 0;
|
|
2022
|
+
this.stakedBalance = this.stake + this.delegationsIn - this.delegationsOut;
|
|
2023
|
+
this.usdValue = props.usdValue;
|
|
2024
|
+
}
|
|
2025
|
+
};
|
|
2026
|
+
|
|
2027
|
+
// src/modules/assets/hive-engine/queries/get-hive-engine-balances-with-usd-query-options.ts
|
|
2028
|
+
function getHiveEngineBalancesWithUsdQueryOptions(account, dynamicProps, allTokens) {
|
|
2029
|
+
return queryOptions({
|
|
2030
|
+
queryKey: [
|
|
2031
|
+
"assets",
|
|
2032
|
+
"hive-engine",
|
|
2033
|
+
"balances-with-usd",
|
|
2034
|
+
account,
|
|
2035
|
+
dynamicProps,
|
|
2036
|
+
allTokens
|
|
2037
|
+
],
|
|
2038
|
+
queryFn: async () => {
|
|
2039
|
+
if (!account) {
|
|
2040
|
+
throw new Error("[HiveEngine] No account in a balances query");
|
|
2041
|
+
}
|
|
2042
|
+
const balancesResponse = await fetch(
|
|
2043
|
+
`${CONFIG.privateApiHost}/private-api/engine-api`,
|
|
2044
|
+
{
|
|
2045
|
+
method: "POST",
|
|
2046
|
+
body: JSON.stringify({
|
|
2047
|
+
jsonrpc: "2.0",
|
|
2048
|
+
method: "find",
|
|
2049
|
+
params: {
|
|
2050
|
+
contract: "tokens",
|
|
2051
|
+
table: "balances",
|
|
2052
|
+
query: {
|
|
2053
|
+
account
|
|
2054
|
+
}
|
|
2055
|
+
},
|
|
2056
|
+
id: 1
|
|
2057
|
+
}),
|
|
2058
|
+
headers: { "Content-type": "application/json" }
|
|
2059
|
+
}
|
|
2060
|
+
);
|
|
2061
|
+
const balancesData = await balancesResponse.json();
|
|
2062
|
+
const balances = balancesData.result || [];
|
|
2063
|
+
const tokensResponse = await fetch(
|
|
2064
|
+
`${CONFIG.privateApiHost}/private-api/engine-api`,
|
|
2065
|
+
{
|
|
2066
|
+
method: "POST",
|
|
2067
|
+
body: JSON.stringify({
|
|
2068
|
+
jsonrpc: "2.0",
|
|
2069
|
+
method: "find",
|
|
2070
|
+
params: {
|
|
2071
|
+
contract: "tokens",
|
|
2072
|
+
table: "tokens",
|
|
2073
|
+
query: {
|
|
2074
|
+
symbol: { $in: balances.map((t) => t.symbol) }
|
|
2075
|
+
}
|
|
2076
|
+
},
|
|
2077
|
+
id: 2
|
|
2078
|
+
}),
|
|
2079
|
+
headers: { "Content-type": "application/json" }
|
|
2080
|
+
}
|
|
2081
|
+
);
|
|
2082
|
+
const tokensData = await tokensResponse.json();
|
|
2083
|
+
const tokens = tokensData.result || [];
|
|
2084
|
+
const pricePerHive = dynamicProps ? dynamicProps.base / dynamicProps.quote : 0;
|
|
2085
|
+
const metrics = Array.isArray(
|
|
2086
|
+
allTokens
|
|
2087
|
+
) ? allTokens : [];
|
|
2088
|
+
return balances.map((balance) => {
|
|
2089
|
+
const token = tokens.find((t) => t.symbol === balance.symbol);
|
|
2090
|
+
let tokenMetadata;
|
|
2091
|
+
if (token?.metadata) {
|
|
2092
|
+
try {
|
|
2093
|
+
tokenMetadata = JSON.parse(token.metadata);
|
|
2094
|
+
} catch {
|
|
2095
|
+
tokenMetadata = void 0;
|
|
2096
|
+
}
|
|
2097
|
+
}
|
|
2098
|
+
const metric = metrics.find((m) => m.symbol === balance.symbol);
|
|
2099
|
+
const lastPrice = Number(metric?.lastPrice ?? "0");
|
|
2100
|
+
const balanceAmount = Number(balance.balance);
|
|
2101
|
+
const usdValue = balance.symbol === "SWAP.HIVE" ? pricePerHive * balanceAmount : lastPrice === 0 ? 0 : Number(
|
|
2102
|
+
(lastPrice * pricePerHive * balanceAmount).toFixed(10)
|
|
2103
|
+
);
|
|
2104
|
+
return new HiveEngineToken({
|
|
2105
|
+
symbol: balance.symbol,
|
|
2106
|
+
name: token?.name ?? balance.symbol,
|
|
2107
|
+
icon: tokenMetadata?.icon ?? "",
|
|
2108
|
+
precision: token?.precision ?? 0,
|
|
2109
|
+
stakingEnabled: token?.stakingEnabled ?? false,
|
|
2110
|
+
delegationEnabled: token?.delegationEnabled ?? false,
|
|
2111
|
+
balance: balance.balance,
|
|
2112
|
+
stake: balance.stake,
|
|
2113
|
+
delegationsIn: balance.delegationsIn,
|
|
2114
|
+
delegationsOut: balance.delegationsOut,
|
|
2115
|
+
usdValue
|
|
2116
|
+
});
|
|
2117
|
+
});
|
|
2118
|
+
},
|
|
2119
|
+
enabled: !!account
|
|
2120
|
+
});
|
|
2121
|
+
}
|
|
1904
2122
|
function getHiveEngineTokensMetadataQueryOptions(tokens) {
|
|
1905
2123
|
return queryOptions({
|
|
1906
2124
|
queryKey: ["assets", "hive-engine", "metadata-list", tokens],
|
|
@@ -2088,6 +2306,30 @@ function getHiveEngineTokensMetricsQueryOptions(symbol, interval = "daily") {
|
|
|
2088
2306
|
}
|
|
2089
2307
|
});
|
|
2090
2308
|
}
|
|
2309
|
+
function getHiveEngineUnclaimedRewardsQueryOptions(username) {
|
|
2310
|
+
return queryOptions({
|
|
2311
|
+
queryKey: ["assets", "hive-engine", "unclaimed", username],
|
|
2312
|
+
staleTime: 6e4,
|
|
2313
|
+
refetchInterval: 9e4,
|
|
2314
|
+
enabled: !!username,
|
|
2315
|
+
queryFn: async () => {
|
|
2316
|
+
try {
|
|
2317
|
+
const response = await fetch(
|
|
2318
|
+
CONFIG.privateApiHost + `/private-api/engine-reward-api/${username}?hive=1`
|
|
2319
|
+
);
|
|
2320
|
+
if (!response.ok) {
|
|
2321
|
+
return [];
|
|
2322
|
+
}
|
|
2323
|
+
const data = await response.json();
|
|
2324
|
+
return Object.values(data).filter(
|
|
2325
|
+
({ pending_token }) => pending_token > 0
|
|
2326
|
+
);
|
|
2327
|
+
} catch (e) {
|
|
2328
|
+
return [];
|
|
2329
|
+
}
|
|
2330
|
+
}
|
|
2331
|
+
});
|
|
2332
|
+
}
|
|
2091
2333
|
async function delegateEngineToken(payload) {
|
|
2092
2334
|
const parsedAsset = parseAsset(payload.amount);
|
|
2093
2335
|
const quantity = parsedAsset.amount.toString();
|
|
@@ -3541,13 +3783,13 @@ function getTronAssetGeneralInfoQueryOptions(username) {
|
|
|
3541
3783
|
// src/modules/wallets/queries/get-account-wallet-asset-info-query-options.ts
|
|
3542
3784
|
function getAccountWalletAssetInfoQueryOptions(username, asset, options2 = { refetch: false }) {
|
|
3543
3785
|
const queryClient = getQueryClient();
|
|
3544
|
-
const fetchQuery = async (
|
|
3786
|
+
const fetchQuery = async (queryOptions43) => {
|
|
3545
3787
|
if (options2.refetch) {
|
|
3546
|
-
await queryClient.fetchQuery(
|
|
3788
|
+
await queryClient.fetchQuery(queryOptions43);
|
|
3547
3789
|
} else {
|
|
3548
|
-
await queryClient.prefetchQuery(
|
|
3790
|
+
await queryClient.prefetchQuery(queryOptions43);
|
|
3549
3791
|
}
|
|
3550
|
-
return queryClient.getQueryData(
|
|
3792
|
+
return queryClient.getQueryData(queryOptions43.queryKey);
|
|
3551
3793
|
};
|
|
3552
3794
|
const portfolioQuery = getVisionPortfolioQueryOptions(username);
|
|
3553
3795
|
const getPortfolioAssetInfo = async () => {
|
|
@@ -4084,6 +4326,6 @@ function useWalletOperation(username, asset, operation) {
|
|
|
4084
4326
|
// src/index.ts
|
|
4085
4327
|
rememberScryptBsvVersion();
|
|
4086
4328
|
|
|
4087
|
-
export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, NaiMap, PointTransactionType, Symbol2 as Symbol, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, resolveHiveOperationFilters, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
|
4329
|
+
export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, HIVE_ACCOUNT_OPERATION_GROUPS, HIVE_OPERATION_LIST, HIVE_OPERATION_NAME_BY_ID, HIVE_OPERATION_ORDERS, HiveEngineToken, NaiMap, PointTransactionType, Symbol2 as Symbol, broadcastWithWalletHiveAuth, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, claimInterestHive, decryptMemoWithAccounts, decryptMemoWithKeys, delay, delegateEngineToken, delegateHive, deriveHiveKey, deriveHiveKeys, deriveHiveMasterPasswordKey, deriveHiveMasterPasswordKeys, detectHiveKeyDerivation, encryptMemoWithAccounts, encryptMemoWithKeys, formattedNumber, getAccountWalletAssetInfoQueryOptions, getAccountWalletListQueryOptions, getAllHiveEngineTokensQueryOptions, getAllTokensListQueryOptions, getBoundFetch, getHbdAssetGeneralInfoQueryOptions, getHbdAssetTransactionsQueryOptions, getHiveAssetGeneralInfoQueryOptions, getHiveAssetMetricQueryOptions, getHiveAssetTransactionsQueryOptions, getHiveAssetWithdrawalRoutesQueryOptions, getHiveEngineBalancesWithUsdQueryOptions, getHiveEngineTokenGeneralInfoQueryOptions, getHiveEngineTokenTransactionsQueryOptions, getHiveEngineTokensBalancesQueryOptions, getHiveEngineTokensMarketQueryOptions, getHiveEngineTokensMetadataQueryOptions, getHiveEngineTokensMetricsQueryOptions, getHiveEngineUnclaimedRewardsQueryOptions, getHivePowerAssetGeneralInfoQueryOptions, getHivePowerAssetTransactionsQueryOptions, getHivePowerDelegatesInfiniteQueryOptions, getHivePowerDelegatingsQueryOptions, getLarynxAssetGeneralInfoQueryOptions, getLarynxPowerAssetGeneralInfoQueryOptions, getPointsAssetGeneralInfoQueryOptions, getPointsAssetTransactionsQueryOptions, getPointsQueryOptions, getSpkAssetGeneralInfoQueryOptions, getSpkMarketsQueryOptions, getSpkWalletQueryOptions, getTokenOperationsQueryOptions, getTokenPriceQueryOptions, getVisionPortfolioQueryOptions, getWallet, hasWalletHiveAuthBroadcast, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, registerWalletHiveAuthBroadcast, resolveHiveOperationFilters, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferFromSavingsHive, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
|
4088
4330
|
//# sourceMappingURL=index.js.map
|
|
4089
4331
|
//# sourceMappingURL=index.js.map
|