@hardkas/kaspa-rpc 0.9.0-alpha → 0.9.1-alpha

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.
Files changed (2) hide show
  1. package/dist/index.js +40 -11
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -345,8 +345,10 @@ var KaspaJsonRpcClient = class {
345
345
  }
346
346
  if (txAny.inputs && Array.isArray(txAny.inputs)) {
347
347
  txAny.inputs.forEach((input) => {
348
- if (typeof input.sequence === "string") input.sequence = Number(input.sequence);
349
- if (typeof input.sigOpCount === "string") input.sigOpCount = Number(input.sigOpCount);
348
+ if (typeof input.sequence === "string")
349
+ input.sequence = Number(input.sequence);
350
+ if (typeof input.sigOpCount === "string")
351
+ input.sigOpCount = Number(input.sigOpCount);
350
352
  });
351
353
  }
352
354
  }
@@ -851,7 +853,10 @@ var JsonWrpcKaspaClient = class {
851
853
  const info = mapKaspaNodeInfo(response);
852
854
  if (info.virtualDaaScore === void 0) {
853
855
  try {
854
- const dagResponse = await this.callMethod("getBlockDagInfo", "getBlockDagInfoRequest");
856
+ const dagResponse = await this.callMethod(
857
+ "getBlockDagInfo",
858
+ "getBlockDagInfoRequest"
859
+ );
855
860
  const dagData = dagResponse?.params || dagResponse;
856
861
  if (dagData && typeof dagData === "object" && "virtualDaaScore" in dagData) {
857
862
  info.virtualDaaScore = BigInt(dagData.virtualDaaScore);
@@ -883,14 +888,26 @@ var JsonWrpcKaspaClient = class {
883
888
  await this.detectFlavor();
884
889
  let response;
885
890
  if (this.rpcFlavor === "legacy") {
886
- response = await this.callMethod("getBalanceByAddress", "getBalanceByAddressRequest", { address });
891
+ response = await this.callMethod(
892
+ "getBalanceByAddress",
893
+ "getBalanceByAddressRequest",
894
+ { address }
895
+ );
887
896
  } else {
888
- response = await this.callMethod("getBalancesByAddresses", "getBalancesByAddressesRequest", { addresses: [address] });
897
+ response = await this.callMethod(
898
+ "getBalancesByAddresses",
899
+ "getBalancesByAddressesRequest",
900
+ { addresses: [address] }
901
+ );
889
902
  }
890
903
  return mapKaspaAddressBalance(response, address);
891
904
  }
892
905
  async getUtxosByAddress(address) {
893
- const response = await this.callMethod("getUtxosByAddresses", "getUtxosByAddressesRequest", { addresses: [address] });
906
+ const response = await this.callMethod(
907
+ "getUtxosByAddresses",
908
+ "getUtxosByAddressesRequest",
909
+ { addresses: [address] }
910
+ );
894
911
  return mapKaspaRpcUtxos(response, address);
895
912
  }
896
913
  async submitTransaction(rawTransaction) {
@@ -931,19 +948,29 @@ var JsonWrpcKaspaClient = class {
931
948
  }
932
949
  if (txAny.inputs && Array.isArray(txAny.inputs)) {
933
950
  txAny.inputs.forEach((input) => {
934
- if (typeof input.sequence === "string") input.sequence = Number(input.sequence);
935
- if (typeof input.sigOpCount === "string") input.sigOpCount = Number(input.sigOpCount);
951
+ if (typeof input.sequence === "string")
952
+ input.sequence = Number(input.sequence);
953
+ if (typeof input.sigOpCount === "string")
954
+ input.sigOpCount = Number(input.sigOpCount);
936
955
  });
937
956
  }
938
957
  }
939
958
  } catch (e) {
940
959
  }
941
- const response = await this.callMethod("submitTransaction", "submitTransactionRequest", { transaction: txObj, allowOrphan: false });
960
+ const response = await this.callMethod(
961
+ "submitTransaction",
962
+ "submitTransactionRequest",
963
+ { transaction: txObj, allowOrphan: false }
964
+ );
942
965
  return mapKaspaSubmitTransactionResult(response);
943
966
  }
944
967
  async getMempoolEntry(txId) {
945
968
  try {
946
- const response = await this.callMethod("getMempoolEntry", "getMempoolEntryRequest", { transactionId: txId, includeOrphanPool: true, filterTransactionPool: false });
969
+ const response = await this.callMethod(
970
+ "getMempoolEntry",
971
+ "getMempoolEntryRequest",
972
+ { transactionId: txId, includeOrphanPool: true, filterTransactionPool: false }
973
+ );
947
974
  if (!response) return null;
948
975
  const resObj = response;
949
976
  return {
@@ -956,7 +983,9 @@ var JsonWrpcKaspaClient = class {
956
983
  }
957
984
  async getTransaction(txId) {
958
985
  try {
959
- return await this.callMethod("getTransaction", "getTransactionRequest", { transactionId: txId });
986
+ return await this.callMethod("getTransaction", "getTransactionRequest", {
987
+ transactionId: txId
988
+ });
960
989
  } catch (e) {
961
990
  return null;
962
991
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hardkas/kaspa-rpc",
3
- "version": "0.9.0-alpha",
3
+ "version": "0.9.1-alpha",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  },
14
14
  "dependencies": {
15
15
  "ws": "^8.18.0",
16
- "@hardkas/core": "0.9.0-alpha",
17
- "@hardkas/tx-builder": "0.9.0-alpha"
16
+ "@hardkas/core": "0.9.1-alpha",
17
+ "@hardkas/tx-builder": "0.9.1-alpha"
18
18
  },
19
19
  "devDependencies": {
20
20
  "@types/ws": "^8.5.13",