@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.
@@ -16238,59 +16238,28 @@ const _SolanaStakingClient = class _SolanaStakingClient {
16238
16238
  async sendAndConfirmHttp(signed, _ctx) {
16239
16239
  this.ensureUser();
16240
16240
  const rawTx = signed.serialize();
16241
- let signature;
16242
16241
  try {
16243
- signature = await this.connection.sendRawTransaction(rawTx, {
16242
+ const signature = await this.connection.sendRawTransaction(rawTx, {
16244
16243
  skipPreflight: false,
16245
16244
  preflightCommitment: commitment,
16246
16245
  maxRetries: 3
16247
16246
  });
16247
+ return signature;
16248
16248
  } catch (e) {
16249
16249
  const msg = e?.message ?? "";
16250
16250
  const isSendTxError = e instanceof SendTransactionError || e?.name === "SendTransactionError";
16251
16251
  if (isSendTxError && msg.includes("already been processed")) {
16252
16252
  console.warn(
16253
- 'sendRawTransaction preflight says "already been processed"; treating as success and deriving signature from signed tx.'
16253
+ 'sendRawTransaction reports "already been processed"; treating as success without further confirmation.'
16254
16254
  );
16255
16255
  const legacy = signed;
16256
16256
  const first = legacy.signatures?.[0]?.signature;
16257
- if (!first) {
16258
- throw e;
16257
+ if (first) {
16258
+ return bs58.encode(first);
16259
16259
  }
16260
- signature = bs58.encode(first);
16261
- } else {
16262
- throw e;
16263
- }
16264
- }
16265
- const start = Date.now();
16266
- const timeoutMs = 3e4;
16267
- const pollIntervalMs = 500;
16268
- while (true) {
16269
- const { value } = await this.connection.getSignatureStatuses(
16270
- [signature],
16271
- { searchTransactionHistory: true }
16272
- );
16273
- const status = value[0];
16274
- if (status) {
16275
- if (status.err) {
16276
- throw new Error(
16277
- `Transaction failed: ${JSON.stringify(status.err)}`
16278
- );
16279
- }
16280
- const confirmations = status.confirmations;
16281
- const confirmationStatus = status.confirmationStatus;
16282
- const satisfied = confirmationStatus === "confirmed" || confirmationStatus === "finalized" || confirmations === null ||
16283
- (confirmations ?? 0) > 0;
16284
- if (satisfied) {
16285
- return signature;
16286
- }
16287
- }
16288
- if (Date.now() - start > timeoutMs) {
16289
- throw new Error(
16290
- `Transaction confirmation timed out for ${signature}`
16291
- );
16260
+ return "already-processed";
16292
16261
  }
16293
- await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
16262
+ throw e;
16294
16263
  }
16295
16264
  }
16296
16265
  async signTransaction(tx) {