@tomo-inc/chains-service 0.0.20 → 0.0.22

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/index.cjs CHANGED
@@ -4623,7 +4623,7 @@ var DogecoinService = class _DogecoinService extends BaseService {
4623
4623
  if (!spendableUtxos || spendableUtxos?.length === 0) {
4624
4624
  txData.spendableUtxos = await getSpendableUtxos(txData.from);
4625
4625
  }
4626
- const { psbtBase64, usingUtxos } = await createPsbt(txData);
4626
+ const { psbtBase64 } = await createPsbt(txData);
4627
4627
  const signedPsbt = await this.accountInfo.signTransaction(JSON.stringify({ psbtBase64 }));
4628
4628
  const signedTx = DogecoinUtils.extractPsbtTransaction(signedPsbt, 1e5);
4629
4629
  if (signedTx === "") {
@@ -4631,7 +4631,6 @@ var DogecoinService = class _DogecoinService extends BaseService {
4631
4631
  }
4632
4632
  try {
4633
4633
  const { txid } = await sendDogeTx(signedTx);
4634
- addUsedUtxos(usingUtxos);
4635
4634
  return { txId: txid };
4636
4635
  } catch (err) {
4637
4636
  throw new Error("Error: send transaction err." + JSON.stringify(err));
@@ -5461,14 +5460,14 @@ var TomoWallet = class _TomoWallet extends BaseService {
5461
5460
  };
5462
5461
 
5463
5462
  // src/index.ts
5464
- var ChainTypeServices = {
5463
+ var ChainServiceMap = {
5465
5464
  [walletUtils.ChainTypeEnum.EVM]: EvmService,
5466
5465
  [walletUtils.ChainTypeEnum.SOLANA]: SolanaService,
5467
5466
  [walletUtils.ChainTypeEnum.DOGECOIN]: DogecoinService
5468
5467
  };
5469
5468
 
5470
5469
  exports.AccountType = AccountType;
5471
- exports.ChainTypeServices = ChainTypeServices;
5470
+ exports.ChainServiceMap = ChainServiceMap;
5472
5471
  exports.DogecoinAPI = rpc_exports;
5473
5472
  exports.DogecoinAddress = DogecoinAddress;
5474
5473
  exports.DogecoinService = DogecoinService;
package/dist/index.d.cts CHANGED
@@ -782,10 +782,15 @@ declare class DogecoinUtils {
782
782
  static rawTxToPsbtBase64(rawTx: string): Promise<string>;
783
783
  }
784
784
 
785
- declare const ChainTypeServices: {
785
+ type ChainServiceTypes = {
786
+ [ChainTypeEnum.EVM]: EvmService;
787
+ [ChainTypeEnum.SOLANA]: SolanaService;
788
+ [ChainTypeEnum.DOGECOIN]: DogecoinService;
789
+ };
790
+ declare const ChainServiceMap: {
786
791
  evm: typeof EvmService;
787
792
  solana: typeof SolanaService;
788
793
  dogecoin: typeof DogecoinService;
789
794
  };
790
795
 
791
- export { AccountType, type ChainAddress, ChainTypeServices, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
796
+ export { AccountType, type ChainAddress, ChainServiceMap, type ChainServiceTypes, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
package/dist/index.d.ts CHANGED
@@ -782,10 +782,15 @@ declare class DogecoinUtils {
782
782
  static rawTxToPsbtBase64(rawTx: string): Promise<string>;
783
783
  }
784
784
 
785
- declare const ChainTypeServices: {
785
+ type ChainServiceTypes = {
786
+ [ChainTypeEnum.EVM]: EvmService;
787
+ [ChainTypeEnum.SOLANA]: SolanaService;
788
+ [ChainTypeEnum.DOGECOIN]: DogecoinService;
789
+ };
790
+ declare const ChainServiceMap: {
786
791
  evm: typeof EvmService;
787
792
  solana: typeof SolanaService;
788
793
  dogecoin: typeof DogecoinService;
789
794
  };
790
795
 
791
- export { AccountType, type ChainAddress, ChainTypeServices, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
796
+ export { AccountType, type ChainAddress, ChainServiceMap, type ChainServiceTypes, API as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, type IAccount, type IAccountInfo, SolanaService, type TomoAppInfo, TomoWallet, type TransactionItem, TransactionParser, type TransactionsParams, type TransactionsResponse, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi, type utxoTx };
package/dist/index.js CHANGED
@@ -4615,7 +4615,7 @@ var DogecoinService = class _DogecoinService extends BaseService {
4615
4615
  if (!spendableUtxos || spendableUtxos?.length === 0) {
4616
4616
  txData.spendableUtxos = await getSpendableUtxos(txData.from);
4617
4617
  }
4618
- const { psbtBase64, usingUtxos } = await createPsbt(txData);
4618
+ const { psbtBase64 } = await createPsbt(txData);
4619
4619
  const signedPsbt = await this.accountInfo.signTransaction(JSON.stringify({ psbtBase64 }));
4620
4620
  const signedTx = DogecoinUtils.extractPsbtTransaction(signedPsbt, 1e5);
4621
4621
  if (signedTx === "") {
@@ -4623,7 +4623,6 @@ var DogecoinService = class _DogecoinService extends BaseService {
4623
4623
  }
4624
4624
  try {
4625
4625
  const { txid } = await sendDogeTx(signedTx);
4626
- addUsedUtxos(usingUtxos);
4627
4626
  return { txId: txid };
4628
4627
  } catch (err) {
4629
4628
  throw new Error("Error: send transaction err." + JSON.stringify(err));
@@ -5453,10 +5452,10 @@ var TomoWallet = class _TomoWallet extends BaseService {
5453
5452
  };
5454
5453
 
5455
5454
  // src/index.ts
5456
- var ChainTypeServices = {
5455
+ var ChainServiceMap = {
5457
5456
  [ChainTypeEnum.EVM]: EvmService,
5458
5457
  [ChainTypeEnum.SOLANA]: SolanaService,
5459
5458
  [ChainTypeEnum.DOGECOIN]: DogecoinService
5460
5459
  };
5461
5460
 
5462
- export { AccountType, ChainTypeServices, rpc_exports as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, SolanaService, TomoWallet, TransactionParser, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi };
5461
+ export { AccountType, ChainServiceMap, rpc_exports as DogecoinAPI, DogecoinAddress, DogecoinService, DogecoinUtils, EvmService, SolanaService, TomoWallet, TransactionParser, TxTypes, addUsedUtxos, createPsbt, decodePsbt, getUsedUtxos, toBitcoin, toSatoshi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tomo-inc/chains-service",
3
- "version": "0.0.20",
3
+ "version": "0.0.22",
4
4
  "author": "tomo.inc",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -15,7 +15,7 @@ import { DogeTxData } from "./type";
15
15
  import * as utils from "./utils";
16
16
 
17
17
  import { BaseConfig } from "./config";
18
- import { addUsedUtxos, createPsbt, toBitcoin } from "./utils";
18
+ import { createPsbt, toBitcoin } from "./utils";
19
19
 
20
20
  export class DogecoinService extends BaseService {
21
21
  private static instance: DogecoinService;
@@ -204,8 +204,9 @@ export class DogecoinService extends BaseService {
204
204
  if (!spendableUtxos || spendableUtxos?.length === 0) {
205
205
  txData.spendableUtxos = await API.getSpendableUtxos(txData.from);
206
206
  }
207
+ // const { psbtBase64, usingUtxos } = await createPsbt(txData as any);
208
+ const { psbtBase64 } = await createPsbt(txData as any);
207
209
 
208
- const { psbtBase64, usingUtxos } = await createPsbt(txData as any);
209
210
  const signedPsbt = await this.accountInfo.signTransaction(JSON.stringify({ psbtBase64 }));
210
211
  const signedTx = DogecoinUtils.extractPsbtTransaction(signedPsbt, 100000);
211
212
 
@@ -214,7 +215,7 @@ export class DogecoinService extends BaseService {
214
215
  }
215
216
  try {
216
217
  const { txid } = await API.sendDogeTx(signedTx);
217
- addUsedUtxos(usingUtxos);
218
+ // addUsedUtxos(usingUtxos);
218
219
  return { txId: txid };
219
220
  } catch (err) {
220
221
  throw new Error("Error: send transaction err." + JSON.stringify(err));
package/src/index.ts CHANGED
@@ -3,16 +3,21 @@ import { DogecoinService } from "./dogecoin/service";
3
3
  import { EvmService } from "./evm/service";
4
4
  import { SolanaService } from "./solana/service";
5
5
 
6
+ export { TomoWallet } from "./wallet";
6
7
  export { DogecoinService, EvmService, SolanaService };
7
8
 
8
- export const ChainTypeServices = {
9
+ export type ChainServiceTypes = {
10
+ [ChainTypeEnum.EVM]: EvmService;
11
+ [ChainTypeEnum.SOLANA]: SolanaService;
12
+ [ChainTypeEnum.DOGECOIN]: DogecoinService;
13
+ };
14
+
15
+ export const ChainServiceMap = {
9
16
  [ChainTypeEnum.EVM]: EvmService,
10
17
  [ChainTypeEnum.SOLANA]: SolanaService,
11
18
  [ChainTypeEnum.DOGECOIN]: DogecoinService,
12
19
  };
13
20
 
14
- export { TomoWallet } from "./wallet";
15
-
16
21
  // export * from "./types";
17
22
  // export type * from "./types";
18
23
 
@@ -23,7 +28,7 @@ export type {
23
28
  TomoAppInfo,
24
29
  TransactionItem,
25
30
  TransactionsParams,
26
- TransactionsResponse,
31
+ TransactionsResponse
27
32
  } from "./types";
28
33
 
29
34
  export { AccountType, TxTypes } from "./types";
@@ -31,3 +36,4 @@ export { AccountType, TxTypes } from "./types";
31
36
  export * as DogecoinAPI from "./dogecoin/rpc";
32
37
  export * from "./dogecoin/utils";
33
38
  export * from "./dogecoin/utils-doge";
39
+