@wireio/stake 2.1.0 → 2.1.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/lib/stake.browser.js +7 -38
- package/lib/stake.browser.js.map +1 -1
- package/lib/stake.d.ts +6 -5
- package/lib/stake.js +7 -38
- package/lib/stake.js.map +1 -1
- package/lib/stake.m.js +7 -38
- package/lib/stake.m.js.map +1 -1
- package/package.json +1 -1
- package/src/networks/solana/solana.ts +20 -71
package/lib/stake.d.ts
CHANGED
|
@@ -15889,12 +15889,13 @@ declare class SolanaStakingClient implements IStakingClient {
|
|
|
15889
15889
|
private static readonly FEE_CACHE_TTL_MS;
|
|
15890
15890
|
private getSingleTxFeeLamports;
|
|
15891
15891
|
/**
|
|
15892
|
-
* Send a signed transaction over HTTP RPC
|
|
15893
|
-
* Throws if the transaction fails.
|
|
15892
|
+
* Send a signed transaction over HTTP RPC.
|
|
15894
15893
|
*
|
|
15895
|
-
* -
|
|
15896
|
-
* -
|
|
15897
|
-
*
|
|
15894
|
+
* - Returns immediately on successful sendRawTransaction.
|
|
15895
|
+
* - If sendRawTransaction throws a SendTransactionError with
|
|
15896
|
+
* "already been processed", we treat it as success and
|
|
15897
|
+
* just return a derived signature.
|
|
15898
|
+
* - No confirmTransaction / polling / blockheight handling.
|
|
15898
15899
|
*/
|
|
15899
15900
|
private sendAndConfirmHttp;
|
|
15900
15901
|
/**
|
package/lib/stake.js
CHANGED
|
@@ -16579,59 +16579,28 @@ const _SolanaStakingClient = class _SolanaStakingClient {
|
|
|
16579
16579
|
var _a, _b, _c;
|
|
16580
16580
|
this.ensureUser();
|
|
16581
16581
|
const rawTx = signed.serialize();
|
|
16582
|
-
let signature;
|
|
16583
16582
|
try {
|
|
16584
|
-
signature = yield this.connection.sendRawTransaction(rawTx, {
|
|
16583
|
+
const signature = yield this.connection.sendRawTransaction(rawTx, {
|
|
16585
16584
|
skipPreflight: false,
|
|
16586
16585
|
preflightCommitment: commitment,
|
|
16587
16586
|
maxRetries: 3
|
|
16588
16587
|
});
|
|
16588
|
+
return signature;
|
|
16589
16589
|
} catch (e) {
|
|
16590
16590
|
const msg = (_a = e == null ? void 0 : e.message) != null ? _a : "";
|
|
16591
16591
|
const isSendTxError = e instanceof web3_js.SendTransactionError || (e == null ? void 0 : e.name) === "SendTransactionError";
|
|
16592
16592
|
if (isSendTxError && msg.includes("already been processed")) {
|
|
16593
16593
|
console.warn(
|
|
16594
|
-
'sendRawTransaction
|
|
16594
|
+
'sendRawTransaction reports "already been processed"; treating as success without further confirmation.'
|
|
16595
16595
|
);
|
|
16596
16596
|
const legacy = signed;
|
|
16597
16597
|
const first = (_c = (_b = legacy.signatures) == null ? void 0 : _b[0]) == null ? void 0 : _c.signature;
|
|
16598
|
-
if (
|
|
16599
|
-
|
|
16598
|
+
if (first) {
|
|
16599
|
+
return bs58.encode(first);
|
|
16600
16600
|
}
|
|
16601
|
-
|
|
16602
|
-
} else {
|
|
16603
|
-
throw e;
|
|
16601
|
+
return "already-processed";
|
|
16604
16602
|
}
|
|
16605
|
-
|
|
16606
|
-
const start = Date.now();
|
|
16607
|
-
const timeoutMs = 3e4;
|
|
16608
|
-
const pollIntervalMs = 500;
|
|
16609
|
-
while (true) {
|
|
16610
|
-
const { value } = yield this.connection.getSignatureStatuses(
|
|
16611
|
-
[signature],
|
|
16612
|
-
{ searchTransactionHistory: true }
|
|
16613
|
-
);
|
|
16614
|
-
const status = value[0];
|
|
16615
|
-
if (status) {
|
|
16616
|
-
if (status.err) {
|
|
16617
|
-
throw new Error(
|
|
16618
|
-
`Transaction failed: ${JSON.stringify(status.err)}`
|
|
16619
|
-
);
|
|
16620
|
-
}
|
|
16621
|
-
const confirmations = status.confirmations;
|
|
16622
|
-
const confirmationStatus = status.confirmationStatus;
|
|
16623
|
-
const satisfied = confirmationStatus === "confirmed" || confirmationStatus === "finalized" || confirmations === null ||
|
|
16624
|
-
(confirmations != null ? confirmations : 0) > 0;
|
|
16625
|
-
if (satisfied) {
|
|
16626
|
-
return signature;
|
|
16627
|
-
}
|
|
16628
|
-
}
|
|
16629
|
-
if (Date.now() - start > timeoutMs) {
|
|
16630
|
-
throw new Error(
|
|
16631
|
-
`Transaction confirmation timed out for ${signature}`
|
|
16632
|
-
);
|
|
16633
|
-
}
|
|
16634
|
-
yield new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
16603
|
+
throw e;
|
|
16635
16604
|
}
|
|
16636
16605
|
});
|
|
16637
16606
|
}
|