@kingdomchain/wallet-client 0.6.0 → 0.6.1
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.d.ts +3 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -700,7 +700,9 @@ declare function fetchFeeGrantGranter(restUrl: string, grantee: string): Promise
|
|
|
700
700
|
|
|
701
701
|
declare class CitizenTxError extends Error {
|
|
702
702
|
readonly code: CitizenTxErrorCode;
|
|
703
|
-
|
|
703
|
+
/** Raw on-chain log from a failed DeliverTx/indexed tx, when available. */
|
|
704
|
+
readonly rawLog?: string;
|
|
705
|
+
constructor(message: string, code: CitizenTxErrorCode, cause?: unknown, rawLog?: string);
|
|
704
706
|
}
|
|
705
707
|
type CitizenTxErrorCode = "INSUFFICIENT_FEE" | "INSUFFICIENT_BALANCE" | "SEQUENCE_MISMATCH" | "TX_FAILED" | "TIMEOUT" | "INVALID_INPUT";
|
|
706
708
|
interface BroadcastConfirmOptions {
|
package/dist/index.js
CHANGED
|
@@ -3273,12 +3273,15 @@ async function fetchFeeGrantGranter(restUrl, grantee) {
|
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
3275
|
var CitizenTxError = class extends Error {
|
|
3276
|
-
constructor(message, code, cause) {
|
|
3276
|
+
constructor(message, code, cause, rawLog) {
|
|
3277
3277
|
super(message, { cause });
|
|
3278
3278
|
this.code = code;
|
|
3279
3279
|
this.name = "CitizenTxError";
|
|
3280
|
+
this.rawLog = rawLog;
|
|
3280
3281
|
}
|
|
3281
3282
|
code;
|
|
3283
|
+
/** Raw on-chain log from a failed DeliverTx/indexed tx, when available. */
|
|
3284
|
+
rawLog;
|
|
3282
3285
|
};
|
|
3283
3286
|
var DEFAULT_GAS = "200000";
|
|
3284
3287
|
var DEFAULT_FEE_UKDR = "5000";
|
|
@@ -3356,6 +3359,7 @@ async function broadcastAndConfirmTx(client, signerAddress, messages, fee, memo
|
|
|
3356
3359
|
try {
|
|
3357
3360
|
deliverTx = await client.signAndBroadcast(signerAddress, messages, fee, memo);
|
|
3358
3361
|
} catch (err) {
|
|
3362
|
+
console.error("[citizenTx] broadcast threw before inclusion:", err);
|
|
3359
3363
|
const message = err instanceof Error ? err.message : String(err);
|
|
3360
3364
|
if (message.toLowerCase().includes("insufficient")) {
|
|
3361
3365
|
throw new CitizenTxError(citizenTxErrorMessage("INSUFFICIENT_FEE"), "INSUFFICIENT_FEE", err);
|
|
@@ -3363,8 +3367,12 @@ async function broadcastAndConfirmTx(client, signerAddress, messages, fee, memo
|
|
|
3363
3367
|
throw new CitizenTxError(citizenTxErrorMessage("TX_FAILED"), "TX_FAILED", err);
|
|
3364
3368
|
}
|
|
3365
3369
|
if (deliverTx.code !== 0) {
|
|
3370
|
+
console.error("[citizenTx] deliverTx failed:", {
|
|
3371
|
+
code: deliverTx.code,
|
|
3372
|
+
rawLog: deliverTx.rawLog
|
|
3373
|
+
});
|
|
3366
3374
|
const code = classifyBroadcastFailure(deliverTx.rawLog ?? "", deliverTx.code);
|
|
3367
|
-
throw new CitizenTxError(citizenTxErrorMessage(code), code);
|
|
3375
|
+
throw new CitizenTxError(citizenTxErrorMessage(code), code, void 0, deliverTx.rawLog ?? "");
|
|
3368
3376
|
}
|
|
3369
3377
|
const hash = deliverTx.transactionHash;
|
|
3370
3378
|
const deadline = Date.now() + timeoutMs;
|
|
@@ -3372,8 +3380,12 @@ async function broadcastAndConfirmTx(client, signerAddress, messages, fee, memo
|
|
|
3372
3380
|
const indexed = await client.getTx(hash);
|
|
3373
3381
|
if (indexed) {
|
|
3374
3382
|
if (indexed.code !== 0) {
|
|
3383
|
+
console.error("[citizenTx] indexed tx failed:", {
|
|
3384
|
+
code: indexed.code,
|
|
3385
|
+
rawLog: indexed.rawLog
|
|
3386
|
+
});
|
|
3375
3387
|
const code = classifyBroadcastFailure(indexed.rawLog ?? "", indexed.code);
|
|
3376
|
-
throw new CitizenTxError(citizenTxErrorMessage(code), code);
|
|
3388
|
+
throw new CitizenTxError(citizenTxErrorMessage(code), code, void 0, indexed.rawLog ?? "");
|
|
3377
3389
|
}
|
|
3378
3390
|
return {
|
|
3379
3391
|
hash,
|