@ecency/wallets 1.4.17 → 1.4.19
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 +84 -2
- package/dist/browser/index.js +137 -13
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +138 -12
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +137 -13
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -129,17 +129,47 @@ declare function getHiveAssetGeneralInfoQueryOptions(username: string): _tanstac
|
|
|
129
129
|
title: string;
|
|
130
130
|
price: number;
|
|
131
131
|
accountBalance: number;
|
|
132
|
+
parts?: undefined;
|
|
133
|
+
} | {
|
|
134
|
+
name: string;
|
|
135
|
+
title: string;
|
|
136
|
+
price: number;
|
|
137
|
+
accountBalance: number;
|
|
138
|
+
parts: {
|
|
139
|
+
name: string;
|
|
140
|
+
balance: number;
|
|
141
|
+
}[];
|
|
132
142
|
}, Error, {
|
|
133
143
|
name: string;
|
|
134
144
|
title: string;
|
|
135
145
|
price: number;
|
|
136
146
|
accountBalance: number;
|
|
147
|
+
parts?: undefined;
|
|
148
|
+
} | {
|
|
149
|
+
name: string;
|
|
150
|
+
title: string;
|
|
151
|
+
price: number;
|
|
152
|
+
accountBalance: number;
|
|
153
|
+
parts: {
|
|
154
|
+
name: string;
|
|
155
|
+
balance: number;
|
|
156
|
+
}[];
|
|
137
157
|
}, string[]>, "queryFn"> & {
|
|
138
158
|
queryFn?: _tanstack_react_query.QueryFunction<{
|
|
139
159
|
name: string;
|
|
140
160
|
title: string;
|
|
141
161
|
price: number;
|
|
142
162
|
accountBalance: number;
|
|
163
|
+
parts?: undefined;
|
|
164
|
+
} | {
|
|
165
|
+
name: string;
|
|
166
|
+
title: string;
|
|
167
|
+
price: number;
|
|
168
|
+
accountBalance: number;
|
|
169
|
+
parts: {
|
|
170
|
+
name: string;
|
|
171
|
+
balance: number;
|
|
172
|
+
}[];
|
|
143
173
|
}, string[], never> | undefined;
|
|
144
174
|
} & {
|
|
145
175
|
queryKey: string[] & {
|
|
@@ -148,6 +178,16 @@ declare function getHiveAssetGeneralInfoQueryOptions(username: string): _tanstac
|
|
|
148
178
|
title: string;
|
|
149
179
|
price: number;
|
|
150
180
|
accountBalance: number;
|
|
181
|
+
parts?: undefined;
|
|
182
|
+
} | {
|
|
183
|
+
name: string;
|
|
184
|
+
title: string;
|
|
185
|
+
price: number;
|
|
186
|
+
accountBalance: number;
|
|
187
|
+
parts: {
|
|
188
|
+
name: string;
|
|
189
|
+
balance: number;
|
|
190
|
+
}[];
|
|
151
191
|
};
|
|
152
192
|
[dataTagErrorSymbol]: Error;
|
|
153
193
|
};
|
|
@@ -697,10 +737,12 @@ interface TransformedSpkMarkets {
|
|
|
697
737
|
declare enum AssetOperation {
|
|
698
738
|
Transfer = "transfer",
|
|
699
739
|
TransferToSavings = "transfer-saving",
|
|
740
|
+
WithdrawFromSavings = "withdraw-saving",
|
|
700
741
|
Delegate = "delegate",
|
|
701
742
|
PowerUp = "power-up",
|
|
702
743
|
PowerDown = "power-down",
|
|
703
|
-
WithdrawRoutes = "withdraw-
|
|
744
|
+
WithdrawRoutes = "withdraw-routes",
|
|
745
|
+
ClaimInterest = "claim-interest",
|
|
704
746
|
Swap = "swap",
|
|
705
747
|
Gift = "gift",
|
|
706
748
|
Promote = "promote",
|
|
@@ -749,6 +791,20 @@ declare function transferToSavingsHive<T extends HiveBasedAssetSignType>(payload
|
|
|
749
791
|
key: PrivateKey;
|
|
750
792
|
} : Payload$4<T>): Promise<unknown>;
|
|
751
793
|
|
|
794
|
+
interface PayloadBase$1 {
|
|
795
|
+
from: string;
|
|
796
|
+
to: string;
|
|
797
|
+
amount: string;
|
|
798
|
+
memo: string;
|
|
799
|
+
request_id?: number;
|
|
800
|
+
}
|
|
801
|
+
interface PayloadWithKey$1<T extends HiveBasedAssetSignType> extends PayloadBase$1 {
|
|
802
|
+
type: T;
|
|
803
|
+
}
|
|
804
|
+
declare function transferFromSavingsHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? PayloadWithKey$1<T> & {
|
|
805
|
+
key: PrivateKey;
|
|
806
|
+
} : PayloadWithKey$1<T>): Promise<unknown>;
|
|
807
|
+
|
|
752
808
|
interface Payload$3<T extends HiveBasedAssetSignType> {
|
|
753
809
|
from: string;
|
|
754
810
|
to: string;
|
|
@@ -793,6 +849,20 @@ declare function withdrawVestingRouteHive<T extends HiveBasedAssetSignType>(payl
|
|
|
793
849
|
|
|
794
850
|
declare function useClaimRewards(username: string, onSuccess: () => void): ReturnType<typeof useBroadcastMutation<void>>;
|
|
795
851
|
|
|
852
|
+
interface PayloadBase {
|
|
853
|
+
from: string;
|
|
854
|
+
to: string;
|
|
855
|
+
amount: string;
|
|
856
|
+
memo: string;
|
|
857
|
+
request_id?: number;
|
|
858
|
+
}
|
|
859
|
+
interface PayloadWithKey<T extends HiveBasedAssetSignType> extends PayloadBase {
|
|
860
|
+
type: T;
|
|
861
|
+
}
|
|
862
|
+
declare function claimInterestHive<T extends HiveBasedAssetSignType>(payload: T extends "key" ? PayloadWithKey<T> & {
|
|
863
|
+
key: PrivateKey;
|
|
864
|
+
} : PayloadWithKey<T>): Promise<unknown>;
|
|
865
|
+
|
|
796
866
|
declare enum Symbol {
|
|
797
867
|
HIVE = "HIVE",
|
|
798
868
|
HBD = "HBD",
|
|
@@ -1384,6 +1454,9 @@ declare function getPointsAssetTransactionsQueryOptions(username: string | undef
|
|
|
1384
1454
|
asset: string;
|
|
1385
1455
|
}[];
|
|
1386
1456
|
id: number;
|
|
1457
|
+
from: string | undefined;
|
|
1458
|
+
to: string | undefined;
|
|
1459
|
+
memo: string | undefined;
|
|
1387
1460
|
}[], Error, {
|
|
1388
1461
|
created: Date;
|
|
1389
1462
|
type: PointTransactionType;
|
|
@@ -1392,6 +1465,9 @@ declare function getPointsAssetTransactionsQueryOptions(username: string | undef
|
|
|
1392
1465
|
asset: string;
|
|
1393
1466
|
}[];
|
|
1394
1467
|
id: number;
|
|
1468
|
+
from: string | undefined;
|
|
1469
|
+
to: string | undefined;
|
|
1470
|
+
memo: string | undefined;
|
|
1395
1471
|
}[], (string | PointTransactionType | undefined)[]>, "queryFn"> & {
|
|
1396
1472
|
queryFn?: _tanstack_react_query.QueryFunction<{
|
|
1397
1473
|
created: Date;
|
|
@@ -1401,6 +1477,9 @@ declare function getPointsAssetTransactionsQueryOptions(username: string | undef
|
|
|
1401
1477
|
asset: string;
|
|
1402
1478
|
}[];
|
|
1403
1479
|
id: number;
|
|
1480
|
+
from: string | undefined;
|
|
1481
|
+
to: string | undefined;
|
|
1482
|
+
memo: string | undefined;
|
|
1404
1483
|
}[], (string | PointTransactionType | undefined)[], never> | undefined;
|
|
1405
1484
|
} & {
|
|
1406
1485
|
queryKey: (string | PointTransactionType | undefined)[] & {
|
|
@@ -1412,6 +1491,9 @@ declare function getPointsAssetTransactionsQueryOptions(username: string | undef
|
|
|
1412
1491
|
asset: string;
|
|
1413
1492
|
}[];
|
|
1414
1493
|
id: number;
|
|
1494
|
+
from: string | undefined;
|
|
1495
|
+
to: string | undefined;
|
|
1496
|
+
memo: string | undefined;
|
|
1415
1497
|
}[];
|
|
1416
1498
|
[dataTagErrorSymbol]: Error;
|
|
1417
1499
|
};
|
|
@@ -1669,4 +1751,4 @@ declare function buildExternalTx(currency: EcencyWalletCurrency, tx: ExternalTxP
|
|
|
1669
1751
|
|
|
1670
1752
|
declare function getBoundFetch(): typeof fetch;
|
|
1671
1753
|
|
|
1672
|
-
export { type AccountPointsResponse, type Asset, AssetOperation, type DelegateEnginePayload, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type ExternalTxParams, type ExternalWalletBalance, type GeneralAssetInfo, type GeneralAssetTransaction, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, type HiveEngineTokenBalance, type HiveEngineTokenMetadataResponse, type HiveEngineTransaction, type HiveKeyDerivation, type HiveRole, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type TransferEnginePayload, type TransferPayload, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, 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, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
|
1754
|
+
export { type AccountPointsResponse, type Asset, AssetOperation, type DelegateEnginePayload, type EcencyHiveKeys, type EcencyTokenMetadata, EcencyWalletBasicTokens, EcencyWalletCurrency, index as EcencyWalletsPrivateApi, type ExternalTxParams, type ExternalWalletBalance, type GeneralAssetInfo, type GeneralAssetTransaction, type HiveBasedAssetSignType, type HiveEngineMarketResponse, type HiveEngineMetric, type HiveEngineTokenBalance, type HiveEngineTokenMetadataResponse, type HiveEngineTransaction, type HiveKeyDerivation, type HiveRole, NaiMap, type PointTransaction, PointTransactionType, type Points, type PointsResponse, type SpkApiWallet, type SpkMarkets, type StakeEnginePayload, Symbol, type TransferEnginePayload, type TransferPayload, type TransformedSpkMarkets, type UndelegateEnginePayload, type UnstakeEnginePayload, 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, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, 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
|
@@ -654,11 +654,31 @@ function getHiveAssetGeneralInfoQueryOptions(username) {
|
|
|
654
654
|
);
|
|
655
655
|
const marketTicker = await CONFIG.hiveClient.call("condenser_api", "get_ticker", []).catch(() => void 0);
|
|
656
656
|
const marketPrice = Number.parseFloat(marketTicker?.latest ?? "");
|
|
657
|
+
if (!accountData) {
|
|
658
|
+
return {
|
|
659
|
+
name: "HIVE",
|
|
660
|
+
title: "Hive",
|
|
661
|
+
price: Number.isFinite(marketPrice) ? marketPrice : dynamicProps ? dynamicProps.base / dynamicProps.quote : 0,
|
|
662
|
+
accountBalance: 0
|
|
663
|
+
};
|
|
664
|
+
}
|
|
665
|
+
const liquidBalance = parseAsset(accountData.balance).amount;
|
|
666
|
+
const savingsBalance = parseAsset(accountData.savings_balance).amount;
|
|
657
667
|
return {
|
|
658
668
|
name: "HIVE",
|
|
659
669
|
title: "Hive",
|
|
660
670
|
price: Number.isFinite(marketPrice) ? marketPrice : dynamicProps ? dynamicProps.base / dynamicProps.quote : 0,
|
|
661
|
-
accountBalance:
|
|
671
|
+
accountBalance: liquidBalance + savingsBalance,
|
|
672
|
+
parts: [
|
|
673
|
+
{
|
|
674
|
+
name: "current",
|
|
675
|
+
balance: liquidBalance
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "savings",
|
|
679
|
+
balance: savingsBalance
|
|
680
|
+
}
|
|
681
|
+
]
|
|
662
682
|
};
|
|
663
683
|
}
|
|
664
684
|
});
|
|
@@ -784,7 +804,7 @@ function getHbdAssetGeneralInfoQueryOptions(username) {
|
|
|
784
804
|
apr: ((dynamicProps?.hbdInterestRate ?? 0) / 100).toFixed(3),
|
|
785
805
|
parts: [
|
|
786
806
|
{
|
|
787
|
-
name: "
|
|
807
|
+
name: "current",
|
|
788
808
|
balance: parseAsset(accountData.hbd_balance).amount
|
|
789
809
|
},
|
|
790
810
|
{
|
|
@@ -1160,6 +1180,36 @@ async function transferToSavingsHive(payload) {
|
|
|
1160
1180
|
);
|
|
1161
1181
|
}
|
|
1162
1182
|
}
|
|
1183
|
+
async function transferFromSavingsHive(payload) {
|
|
1184
|
+
const requestId = payload.request_id ?? Date.now() >>> 0;
|
|
1185
|
+
const operationPayload = {
|
|
1186
|
+
from: payload.from,
|
|
1187
|
+
to: payload.to,
|
|
1188
|
+
amount: payload.amount,
|
|
1189
|
+
memo: payload.memo,
|
|
1190
|
+
request_id: requestId
|
|
1191
|
+
};
|
|
1192
|
+
if (payload.type === "key" && "key" in payload) {
|
|
1193
|
+
const { key } = payload;
|
|
1194
|
+
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
1195
|
+
[["transfer_from_savings", operationPayload]],
|
|
1196
|
+
key
|
|
1197
|
+
);
|
|
1198
|
+
}
|
|
1199
|
+
if (payload.type === "keychain") {
|
|
1200
|
+
return Keychain.broadcast(
|
|
1201
|
+
payload.from,
|
|
1202
|
+
[["transfer_from_savings", operationPayload]],
|
|
1203
|
+
"Active"
|
|
1204
|
+
);
|
|
1205
|
+
}
|
|
1206
|
+
return hs.sendOperation(
|
|
1207
|
+
["transfer_from_savings", operationPayload],
|
|
1208
|
+
{ callback: `https://ecency.com/@${payload.from}/wallet` },
|
|
1209
|
+
() => {
|
|
1210
|
+
}
|
|
1211
|
+
);
|
|
1212
|
+
}
|
|
1163
1213
|
async function powerUpHive(payload) {
|
|
1164
1214
|
if (payload.type === "key" && "key" in payload) {
|
|
1165
1215
|
const { key, type, ...params } = payload;
|
|
@@ -1298,15 +1348,60 @@ function useClaimRewards(username, onSuccess) {
|
|
|
1298
1348
|
}
|
|
1299
1349
|
);
|
|
1300
1350
|
}
|
|
1351
|
+
async function claimInterestHive(payload) {
|
|
1352
|
+
const requestId = payload.request_id ?? Date.now() >>> 0;
|
|
1353
|
+
const baseOperation = {
|
|
1354
|
+
from: payload.from,
|
|
1355
|
+
to: payload.to,
|
|
1356
|
+
amount: payload.amount,
|
|
1357
|
+
memo: payload.memo,
|
|
1358
|
+
request_id: requestId
|
|
1359
|
+
};
|
|
1360
|
+
const cancelOperation = {
|
|
1361
|
+
from: payload.from,
|
|
1362
|
+
request_id: requestId
|
|
1363
|
+
};
|
|
1364
|
+
if (payload.type === "key" && "key" in payload) {
|
|
1365
|
+
const { key } = payload;
|
|
1366
|
+
return CONFIG.hiveClient.broadcast.sendOperations(
|
|
1367
|
+
[
|
|
1368
|
+
["transfer_from_savings", baseOperation],
|
|
1369
|
+
["cancel_transfer_from_savings", cancelOperation]
|
|
1370
|
+
],
|
|
1371
|
+
key
|
|
1372
|
+
);
|
|
1373
|
+
}
|
|
1374
|
+
if (payload.type === "keychain") {
|
|
1375
|
+
return Keychain.broadcast(
|
|
1376
|
+
payload.from,
|
|
1377
|
+
[
|
|
1378
|
+
["transfer_from_savings", baseOperation],
|
|
1379
|
+
["cancel_transfer_from_savings", cancelOperation]
|
|
1380
|
+
],
|
|
1381
|
+
"Active"
|
|
1382
|
+
);
|
|
1383
|
+
}
|
|
1384
|
+
return hs.sendOperations(
|
|
1385
|
+
[
|
|
1386
|
+
["transfer_from_savings", baseOperation],
|
|
1387
|
+
["cancel_transfer_from_savings", cancelOperation]
|
|
1388
|
+
],
|
|
1389
|
+
{ callback: `https://ecency.com/@${payload.from}/wallet` },
|
|
1390
|
+
() => {
|
|
1391
|
+
}
|
|
1392
|
+
);
|
|
1393
|
+
}
|
|
1301
1394
|
|
|
1302
1395
|
// src/modules/assets/types/asset-operation.ts
|
|
1303
1396
|
var AssetOperation = /* @__PURE__ */ ((AssetOperation2) => {
|
|
1304
1397
|
AssetOperation2["Transfer"] = "transfer";
|
|
1305
1398
|
AssetOperation2["TransferToSavings"] = "transfer-saving";
|
|
1399
|
+
AssetOperation2["WithdrawFromSavings"] = "withdraw-saving";
|
|
1306
1400
|
AssetOperation2["Delegate"] = "delegate";
|
|
1307
1401
|
AssetOperation2["PowerUp"] = "power-up";
|
|
1308
1402
|
AssetOperation2["PowerDown"] = "power-down";
|
|
1309
|
-
AssetOperation2["WithdrawRoutes"] = "withdraw-
|
|
1403
|
+
AssetOperation2["WithdrawRoutes"] = "withdraw-routes";
|
|
1404
|
+
AssetOperation2["ClaimInterest"] = "claim-interest";
|
|
1310
1405
|
AssetOperation2["Swap"] = "swap";
|
|
1311
1406
|
AssetOperation2["Gift"] = "gift";
|
|
1312
1407
|
AssetOperation2["Promote"] = "promote";
|
|
@@ -2264,7 +2359,7 @@ function getPointsAssetTransactionsQueryOptions(username, type) {
|
|
|
2264
2359
|
}
|
|
2265
2360
|
);
|
|
2266
2361
|
const data = await response.json();
|
|
2267
|
-
return data.map(({ created, type: type2, amount, id }) => ({
|
|
2362
|
+
return data.map(({ created, type: type2, amount, id, sender, receiver, memo }) => ({
|
|
2268
2363
|
created: new Date(created),
|
|
2269
2364
|
type: type2,
|
|
2270
2365
|
results: [
|
|
@@ -2273,7 +2368,10 @@ function getPointsAssetTransactionsQueryOptions(username, type) {
|
|
|
2273
2368
|
asset: "POINTS"
|
|
2274
2369
|
}
|
|
2275
2370
|
],
|
|
2276
|
-
id
|
|
2371
|
+
id,
|
|
2372
|
+
from: sender ?? void 0,
|
|
2373
|
+
to: receiver ?? void 0,
|
|
2374
|
+
memo: memo ?? void 0
|
|
2277
2375
|
}));
|
|
2278
2376
|
}
|
|
2279
2377
|
});
|
|
@@ -2959,26 +3057,50 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
|
2959
3057
|
return queryOptions({
|
|
2960
3058
|
queryKey: ["wallets", "token-operations", token, username, isForOwner],
|
|
2961
3059
|
queryFn: async () => {
|
|
3060
|
+
const queryClient = getQueryClient();
|
|
3061
|
+
const ensureAssetInfo = async () => {
|
|
3062
|
+
if (!isForOwner || !username) {
|
|
3063
|
+
return void 0;
|
|
3064
|
+
}
|
|
3065
|
+
return await queryClient.ensureQueryData(
|
|
3066
|
+
getAccountWalletAssetInfoQueryOptions(username, token)
|
|
3067
|
+
);
|
|
3068
|
+
};
|
|
2962
3069
|
switch (token) {
|
|
2963
|
-
case "HIVE" /* Hive */:
|
|
3070
|
+
case "HIVE" /* Hive */: {
|
|
3071
|
+
const assetInfo = await ensureAssetInfo();
|
|
3072
|
+
const savingsBalance = assetInfo?.parts?.find(
|
|
3073
|
+
(part) => part.name === "savings"
|
|
3074
|
+
)?.balance;
|
|
2964
3075
|
return [
|
|
2965
3076
|
"transfer" /* Transfer */,
|
|
2966
3077
|
...isForOwner ? [
|
|
3078
|
+
...savingsBalance && savingsBalance > 0 ? ["withdraw-saving" /* WithdrawFromSavings */] : [],
|
|
2967
3079
|
"transfer-saving" /* TransferToSavings */,
|
|
2968
3080
|
"power-up" /* PowerUp */,
|
|
2969
3081
|
"swap" /* Swap */
|
|
2970
3082
|
] : []
|
|
2971
3083
|
];
|
|
3084
|
+
}
|
|
2972
3085
|
case "HP" /* HivePower */:
|
|
2973
3086
|
return [
|
|
2974
3087
|
"delegate" /* Delegate */,
|
|
2975
|
-
...isForOwner ? ["power-down" /* PowerDown */, "withdraw-
|
|
3088
|
+
...isForOwner ? ["power-down" /* PowerDown */, "withdraw-routes" /* WithdrawRoutes */] : ["power-up" /* PowerUp */]
|
|
2976
3089
|
];
|
|
2977
|
-
case "HBD" /* HiveDollar */:
|
|
3090
|
+
case "HBD" /* HiveDollar */: {
|
|
3091
|
+
const assetInfo = await ensureAssetInfo();
|
|
3092
|
+
const savingsBalance = assetInfo?.parts?.find(
|
|
3093
|
+
(part) => part.name === "savings"
|
|
3094
|
+
)?.balance;
|
|
2978
3095
|
return [
|
|
2979
3096
|
"transfer" /* Transfer */,
|
|
2980
|
-
...isForOwner ? [
|
|
3097
|
+
...isForOwner ? [
|
|
3098
|
+
...savingsBalance && savingsBalance > 0 ? ["withdraw-saving" /* WithdrawFromSavings */] : [],
|
|
3099
|
+
"transfer-saving" /* TransferToSavings */,
|
|
3100
|
+
"swap" /* Swap */
|
|
3101
|
+
] : []
|
|
2981
3102
|
];
|
|
3103
|
+
}
|
|
2982
3104
|
case "POINTS" /* Points */:
|
|
2983
3105
|
return [
|
|
2984
3106
|
"gift" /* Gift */,
|
|
@@ -3012,7 +3134,6 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
|
|
|
3012
3134
|
if (!username) {
|
|
3013
3135
|
return ["transfer" /* Transfer */];
|
|
3014
3136
|
}
|
|
3015
|
-
const queryClient = getQueryClient();
|
|
3016
3137
|
const balancesListQuery = getHiveEngineTokensBalancesQueryOptions(username);
|
|
3017
3138
|
const balances = await queryClient.ensureQueryData(balancesListQuery);
|
|
3018
3139
|
const tokensQuery = getHiveEngineTokensMetadataQueryOptions(
|
|
@@ -3379,16 +3500,19 @@ var operationToFunctionMap = {
|
|
|
3379
3500
|
HIVE: {
|
|
3380
3501
|
["transfer" /* Transfer */]: transferHive,
|
|
3381
3502
|
["transfer-saving" /* TransferToSavings */]: transferToSavingsHive,
|
|
3503
|
+
["withdraw-saving" /* WithdrawFromSavings */]: transferFromSavingsHive,
|
|
3382
3504
|
["power-up" /* PowerUp */]: powerUpHive
|
|
3383
3505
|
},
|
|
3384
3506
|
HBD: {
|
|
3385
3507
|
["transfer" /* Transfer */]: transferHive,
|
|
3386
|
-
["transfer-saving" /* TransferToSavings */]: transferToSavingsHive
|
|
3508
|
+
["transfer-saving" /* TransferToSavings */]: transferToSavingsHive,
|
|
3509
|
+
["withdraw-saving" /* WithdrawFromSavings */]: transferFromSavingsHive,
|
|
3510
|
+
["claim-interest" /* ClaimInterest */]: claimInterestHive
|
|
3387
3511
|
},
|
|
3388
3512
|
HP: {
|
|
3389
3513
|
["power-down" /* PowerDown */]: powerDownHive,
|
|
3390
3514
|
["delegate" /* Delegate */]: delegateHive,
|
|
3391
|
-
["withdraw-
|
|
3515
|
+
["withdraw-routes" /* WithdrawRoutes */]: withdrawVestingRouteHive
|
|
3392
3516
|
},
|
|
3393
3517
|
POINTS: {
|
|
3394
3518
|
["gift" /* Gift */]: transferPoint
|
|
@@ -3452,6 +3576,6 @@ function useWalletOperation(username, asset, operation) {
|
|
|
3452
3576
|
// src/index.ts
|
|
3453
3577
|
rememberScryptBsvVersion();
|
|
3454
3578
|
|
|
3455
|
-
export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, NaiMap, PointTransactionType, Symbol2 as Symbol, buildAptTx, buildEthTx, buildExternalTx, buildPsbt, buildSolTx, buildTonTx, buildTronTx, 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, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, rewardSpk, signDigest, signExternalTx, signExternalTxAndBroadcast, signTx, signTxAndBroadcast, stakeEngineToken, transferEngineToken, transferHive, transferLarynx, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
|
|
3579
|
+
export { AssetOperation, EcencyWalletBasicTokens, EcencyWalletCurrency, private_api_exports as EcencyWalletsPrivateApi, NaiMap, PointTransactionType, Symbol2 as Symbol, 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, getWallet, isEmptyDate, lockLarynx, mnemonicToSeedBip39, parseAsset, powerDownHive, powerUpHive, powerUpLarynx, 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 };
|
|
3456
3580
|
//# sourceMappingURL=index.js.map
|
|
3457
3581
|
//# sourceMappingURL=index.js.map
|