@ecency/wallets 1.4.14 → 1.4.16

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.
@@ -26,8 +26,7 @@ declare enum EcencyWalletBasicTokens {
26
26
  Points = "POINTS",
27
27
  HivePower = "HP",
28
28
  Hive = "HIVE",
29
- HiveDollar = "HBD",
30
- Spk = "SPK"
29
+ HiveDollar = "HBD"
31
30
  }
32
31
 
33
32
  interface EcencyTokenMetadata {
@@ -818,7 +817,6 @@ declare function vestsToHp(vests: number, hivePerMVests: number): number;
818
817
  declare function rewardSpk(data: SpkApiWallet, sstats: any): number;
819
818
 
820
819
  interface SpkTransferPayload<T extends HiveBasedAssetSignType> {
821
- id: string;
822
820
  from: string;
823
821
  to: string;
824
822
  amount: string;
@@ -849,6 +847,17 @@ declare function powerUpLarynx<T extends HiveBasedAssetSignType>(payload: T exte
849
847
  key: PrivateKey;
850
848
  } : SpkPowerPayload<T>): Promise<unknown>;
851
849
 
850
+ interface LarynxTransferPayload<T extends HiveBasedAssetSignType> {
851
+ from: string;
852
+ to: string;
853
+ amount: string;
854
+ memo?: string;
855
+ type: T;
856
+ }
857
+ declare function transferLarynx<T extends HiveBasedAssetSignType>(payload: T extends "key" ? LarynxTransferPayload<T> & {
858
+ key: PrivateKey;
859
+ } : LarynxTransferPayload<T>): Promise<unknown>;
860
+
852
861
  declare function getLarynxAssetGeneralInfoQueryOptions(username: string): _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<{
853
862
  name: string;
854
863
  title: string;
@@ -1660,4 +1669,4 @@ declare function buildExternalTx(currency: EcencyWalletCurrency, tx: ExternalTxP
1660
1669
 
1661
1670
  declare function getBoundFetch(): typeof fetch;
1662
1671
 
1663
- 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, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
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 };
@@ -58,7 +58,6 @@ var EcencyWalletBasicTokens = /* @__PURE__ */ ((EcencyWalletBasicTokens2) => {
58
58
  EcencyWalletBasicTokens2["HivePower"] = "HP";
59
59
  EcencyWalletBasicTokens2["Hive"] = "HIVE";
60
60
  EcencyWalletBasicTokens2["HiveDollar"] = "HBD";
61
- EcencyWalletBasicTokens2["Spk"] = "SPK";
62
61
  return EcencyWalletBasicTokens2;
63
62
  })(EcencyWalletBasicTokens || {});
64
63
  var currencyChainMap = {
@@ -1322,11 +1321,11 @@ var AssetOperation = /* @__PURE__ */ ((AssetOperation2) => {
1322
1321
  async function transferSpk(payload) {
1323
1322
  const json = JSON.stringify({
1324
1323
  to: payload.to,
1325
- amount: +payload.amount * 1e3,
1324
+ amount: parseAsset(payload.amount).amount * 1e3,
1326
1325
  ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1327
1326
  });
1328
1327
  const op = {
1329
- id: payload.id,
1328
+ id: "spkcc_spk_send",
1330
1329
  json,
1331
1330
  required_auths: [payload.from],
1332
1331
  required_posting_auths: []
@@ -1337,7 +1336,7 @@ async function transferSpk(payload) {
1337
1336
  } else if (payload.type === "keychain") {
1338
1337
  return Keychain.customJson(
1339
1338
  payload.from,
1340
- payload.id,
1339
+ "spkcc_spk_send",
1341
1340
  "Active",
1342
1341
  json,
1343
1342
  payload.to
@@ -1350,7 +1349,7 @@ async function transferSpk(payload) {
1350
1349
  authority: "active",
1351
1350
  required_auths: `["${payload.from}"]`,
1352
1351
  required_posting_auths: "[]",
1353
- id: payload.id,
1352
+ id: "spkcc_spk_send",
1354
1353
  json: JSON.stringify({
1355
1354
  to: payload.to,
1356
1355
  amount: +amount * 1e3,
@@ -1429,6 +1428,48 @@ async function powerUpLarynx(payload) {
1429
1428
  );
1430
1429
  }
1431
1430
  }
1431
+ async function transferLarynx(payload) {
1432
+ const json = JSON.stringify({
1433
+ to: payload.to,
1434
+ amount: parseAsset(payload.amount).amount * 1e3,
1435
+ ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1436
+ });
1437
+ const op = {
1438
+ id: "spkcc_send",
1439
+ json,
1440
+ required_auths: [payload.from],
1441
+ required_posting_auths: []
1442
+ };
1443
+ if (payload.type === "key" && "key" in payload) {
1444
+ const { key } = payload;
1445
+ return CONFIG.hiveClient.broadcast.json(op, key);
1446
+ } else if (payload.type === "keychain") {
1447
+ return Keychain.customJson(
1448
+ payload.from,
1449
+ "spkcc_send",
1450
+ "Active",
1451
+ json,
1452
+ payload.to
1453
+ );
1454
+ } else {
1455
+ const { amount } = parseAsset(payload.amount);
1456
+ return hs.sign(
1457
+ "custom_json",
1458
+ {
1459
+ authority: "active",
1460
+ required_auths: `["${payload.from}"]`,
1461
+ required_posting_auths: "[]",
1462
+ id: "spkcc_send",
1463
+ json: JSON.stringify({
1464
+ to: payload.to,
1465
+ amount: +amount * 1e3,
1466
+ ...typeof payload.memo === "string" ? { memo: payload.memo } : {}
1467
+ })
1468
+ },
1469
+ `https://ecency.com/@${payload.from}/wallet`
1470
+ );
1471
+ }
1472
+ }
1432
1473
  function getSpkMarketsQueryOptions() {
1433
1474
  return queryOptions({
1434
1475
  queryKey: ["assets", "spk", "markets"],
@@ -2398,7 +2439,7 @@ function getAllTokensListQueryOptions(username) {
2398
2439
  "HBD" /* HiveDollar */
2399
2440
  ],
2400
2441
  external: Object.values(EcencyWalletCurrency),
2401
- spk: ["SPK" /* Spk */, "LARYNX", "LP"],
2442
+ spk: ["SPK", "LARYNX", "LP"],
2402
2443
  layer2: await getLayer2TokensMetadata(username)
2403
2444
  };
2404
2445
  }
@@ -2430,8 +2471,7 @@ function getAccountWalletListQueryOptions(username) {
2430
2471
  "POINTS" /* Points */,
2431
2472
  "HIVE" /* Hive */,
2432
2473
  "HP" /* HivePower */,
2433
- "HBD" /* HiveDollar */,
2434
- "SPK" /* Spk */
2474
+ "HBD" /* HiveDollar */
2435
2475
  ];
2436
2476
  }
2437
2477
  });
@@ -2948,7 +2988,7 @@ function getTokenOperationsQueryOptions(token, username, isForOwner = false) {
2948
2988
  "buy" /* Buy */
2949
2989
  ] : []
2950
2990
  ];
2951
- case "SPK" /* Spk */:
2991
+ case "SPK":
2952
2992
  return ["transfer" /* Transfer */];
2953
2993
  case "LARYNX":
2954
2994
  return [
@@ -3357,6 +3397,7 @@ var operationToFunctionMap = {
3357
3397
  ["transfer" /* Transfer */]: transferSpk
3358
3398
  },
3359
3399
  LARYNX: {
3400
+ ["transfer" /* Transfer */]: transferLarynx,
3360
3401
  ["lock" /* LockLiquidity */]: lockLarynx,
3361
3402
  ["power-up" /* PowerUp */]: powerUpLarynx
3362
3403
  }
@@ -3411,6 +3452,6 @@ function useWalletOperation(username, asset, operation) {
3411
3452
  // src/index.ts
3412
3453
  rememberScryptBsvVersion();
3413
3454
 
3414
- 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, transferPoint, transferSpk, transferToSavingsHive, undelegateEngineToken, unstakeEngineToken, useClaimPoints, useClaimRewards, useGetExternalWalletBalanceQuery, useHiveKeysQuery, useImportWallet, useSaveWalletInformationToMetadata, useSeedPhrase, useWalletCreate, useWalletOperation, useWalletsCacheQuery, vestsToHp, withdrawVestingRouteHive };
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 };
3415
3456
  //# sourceMappingURL=index.js.map
3416
3457
  //# sourceMappingURL=index.js.map