@hardkas/kaspa-rpc 0.5.4-alpha → 0.6.0-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.
- package/dist/index.js +9 -5
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -759,11 +759,11 @@ var JsonWrpcKaspaClient = class {
|
|
|
759
759
|
this.timeoutMs = options.timeoutMs ?? 1e4;
|
|
760
760
|
}
|
|
761
761
|
async getInfo() {
|
|
762
|
-
const response = await this.safeRequest(["
|
|
762
|
+
const response = await this.safeRequest(["getInfo", "getInfoRequest", "GetInfo", "get_info"]);
|
|
763
763
|
const info = mapKaspaNodeInfo(response);
|
|
764
764
|
if (info.virtualDaaScore === void 0) {
|
|
765
765
|
try {
|
|
766
|
-
const dagResponse = await this.safeRequest(["
|
|
766
|
+
const dagResponse = await this.safeRequest(["getBlockDagInfo", "getBlockDagInfoRequest", "GetBlockDagInfo", "get_block_dag_info"]);
|
|
767
767
|
const dagData = dagResponse?.params || dagResponse;
|
|
768
768
|
if (dagData?.virtualDaaScore !== void 0) {
|
|
769
769
|
info.virtualDaaScore = BigInt(dagData.virtualDaaScore);
|
|
@@ -793,21 +793,21 @@ var JsonWrpcKaspaClient = class {
|
|
|
793
793
|
}
|
|
794
794
|
async getBalanceByAddress(address) {
|
|
795
795
|
const response = await this.safeRequest(
|
|
796
|
-
["
|
|
796
|
+
["getBalancesByAddresses", "getBalancesByAddressesRequest", "getBalanceByAddressRequest", "GetBalancesByAddresses", "get_balances_by_addresses", "GetBalanceByAddress", "getBalanceByAddress", "get_balance_by_address"],
|
|
797
797
|
{ addresses: [address], address }
|
|
798
798
|
);
|
|
799
799
|
return mapKaspaAddressBalance(response, address);
|
|
800
800
|
}
|
|
801
801
|
async getUtxosByAddress(address) {
|
|
802
802
|
const response = await this.safeRequest(
|
|
803
|
-
["
|
|
803
|
+
["getUtxosByAddresses", "getUtxosByAddressesRequest", "getUtxosByAddressRequest", "GetUtxosByAddresses", "get_utxos_by_addresses", "GetUtxosByAddress", "getUtxosByAddress", "get_utxos_by_address"],
|
|
804
804
|
{ addresses: [address], address }
|
|
805
805
|
);
|
|
806
806
|
return mapKaspaRpcUtxos(response, address);
|
|
807
807
|
}
|
|
808
808
|
async submitTransaction(rawTransaction) {
|
|
809
809
|
const response = await this.safeRequest(
|
|
810
|
-
["
|
|
810
|
+
["submitTransaction", "submitTransactionRequest", "SubmitTransaction", "submit_transaction"],
|
|
811
811
|
{ transaction: rawTransaction, transactionHex: rawTransaction, rawTransaction }
|
|
812
812
|
);
|
|
813
813
|
return mapKaspaSubmitTransactionResult(response);
|
|
@@ -901,18 +901,22 @@ var JsonWrpcKaspaClient = class {
|
|
|
901
901
|
const ws = await this.connect();
|
|
902
902
|
const id = this.requestId++;
|
|
903
903
|
const payload = JSON.stringify({
|
|
904
|
+
jsonrpc: "2.0",
|
|
904
905
|
id,
|
|
905
906
|
method,
|
|
906
907
|
params
|
|
907
908
|
});
|
|
909
|
+
console.log(`[wRPC Debug] Sending payload: ${payload}`);
|
|
908
910
|
return new Promise((resolve, reject) => {
|
|
909
911
|
const timeout = setTimeout(() => {
|
|
910
912
|
cleanup();
|
|
913
|
+
console.log(`[wRPC Debug] Timeout for method: ${method}`);
|
|
911
914
|
reject(new Error(`RPC request timed out after ${this.timeoutMs}ms`));
|
|
912
915
|
}, this.timeoutMs);
|
|
913
916
|
const onMessage = (data) => {
|
|
914
917
|
try {
|
|
915
918
|
const raw = data.toString();
|
|
919
|
+
console.log(`[wRPC Debug] Received for ${method}: ${raw}`);
|
|
916
920
|
const response = JSON.parse(raw);
|
|
917
921
|
if (String(response.id) === String(id)) {
|
|
918
922
|
cleanup();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hardkas/kaspa-rpc",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ws": "^8.18.0",
|
|
12
|
-
"@hardkas/core": "0.
|
|
13
|
-
"@hardkas/tx-builder": "0.
|
|
12
|
+
"@hardkas/core": "0.6.0-alpha",
|
|
13
|
+
"@hardkas/tx-builder": "0.6.0-alpha"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@types/ws": "^8.5.13",
|