crosslightning-solana
Advanced tools
Comparing version 5.5.0-beta1 to 5.5.0-beta10
@@ -261,2 +261,3 @@ "use strict"; | ||
}); | ||
this.blockFeeCache = obj; | ||
} | ||
@@ -263,0 +264,0 @@ return this.blockFeeCache.feeRate; |
@@ -102,3 +102,3 @@ "use strict"; | ||
throw err; | ||
this.logger.debug("txConfirmFromWebsocket(): transaction rejected from WS, running ultimate check, signature: " + signature); | ||
this.logger.debug("txConfirmFromWebsocket(): transaction rejected from WS, running ultimate check, expiry blockheight: " + solanaTx.tx.lastValidBlockHeight + " signature: " + signature + " error: " + err); | ||
const status = yield (0, Utils_1.tryWithRetries)(() => this.getTxIdStatus(signature, finality)); | ||
@@ -168,3 +168,3 @@ this.logger.info("txConfirmFromWebsocket(): transaction status: " + status + " signature: " + signature); | ||
this.logger.debug("prepareTransactions(): fetched latest block data for transactions," + | ||
" blockhash: " + latestBlockData.blockhash); | ||
" blockhash: " + latestBlockData.blockhash + " expiry blockheight: " + latestBlockData.lastValidBlockHeight); | ||
} | ||
@@ -227,3 +227,7 @@ tx.tx.recentBlockhash = latestBlockData.blockhash; | ||
const signedTxs = yield this.provider.wallet.signAllTransactions(txs.map(e => e.tx)); | ||
signedTxs.forEach((tx, index) => txs[index].tx = tx); | ||
signedTxs.forEach((tx, index) => { | ||
const solTx = txs[index]; | ||
tx.lastValidBlockHeight = solTx.tx.lastValidBlockHeight; | ||
solTx.tx = tx; | ||
}); | ||
const options = { | ||
@@ -230,0 +234,0 @@ skipPreflight: true |
@@ -7,3 +7,3 @@ import { AnchorProvider } from "@coral-xyz/anchor"; | ||
import { SolanaProgramBase } from "../program/SolanaProgramBase"; | ||
import BN from "bn.js"; | ||
import * as BN from "bn.js"; | ||
import { SolanaAction } from "../base/SolanaAction"; | ||
@@ -10,0 +10,0 @@ export declare class SolanaBtcRelay<B extends BtcBlock> extends SolanaProgramBase<any> implements BtcRelay<SolanaBtcStoredHeader, { |
@@ -20,5 +20,5 @@ "use strict"; | ||
const SolanaProgramBase_1 = require("../program/SolanaProgramBase"); | ||
const bn_js_1 = require("bn.js"); | ||
const BN = require("bn.js"); | ||
const SolanaAction_1 = require("../base/SolanaAction"); | ||
const BASE_FEE_SOL_PER_BLOCKHEADER = new bn_js_1.default(5000); | ||
const BASE_FEE_SOL_PER_BLOCKHEADER = new BN(5000); | ||
const MAX_CLOSE_IX_PER_TX = 10; | ||
@@ -87,3 +87,3 @@ function serializeBlockHeader(e) { | ||
this.BtcRelayHeader = this.pda("header", (hash) => [hash]); | ||
this.BtcRelayFork = this.pda("fork", (forkId, pubkey) => [new bn_js_1.default(forkId).toBuffer("le", 8), pubkey.toBuffer()]); | ||
this.BtcRelayFork = this.pda("fork", (forkId, pubkey) => [new BN(forkId).toBuffer("le", 8), pubkey.toBuffer()]); | ||
this.maxHeadersPerTx = 5; | ||
@@ -339,3 +339,3 @@ this.maxForkHeadersPerTx = 4; | ||
return this._saveHeaders(forkHeaders, storedHeader, tipWork, forkId, feeRate, (blockHeaders) => this.program.methods | ||
.submitForkHeaders(blockHeaders, storedHeader, new bn_js_1.default(forkId), false) | ||
.submitForkHeaders(blockHeaders, storedHeader, new BN(forkId), false) | ||
.accounts({ | ||
@@ -384,3 +384,3 @@ signer: this.provider.publicKey, | ||
tx.add(yield this.program.methods | ||
.closeForkAccount(new bn_js_1.default(i)) | ||
.closeForkAccount(new BN(i)) | ||
.accounts({ | ||
@@ -419,4 +419,4 @@ signer: this.provider.publicKey, | ||
if (blockheightDelta <= 0) | ||
return new bn_js_1.default(0); | ||
const synchronizationFee = new bn_js_1.default(blockheightDelta).mul(yield this.getFeePerBlock(feeRate)); | ||
return new BN(0); | ||
const synchronizationFee = new BN(blockheightDelta).mul(yield this.getFeePerBlock(feeRate)); | ||
this.logger.debug("estimateSynchronizeFee(): required blockheight: " + requiredBlockheight + | ||
@@ -423,0 +423,0 @@ " blockheight delta: " + blockheightDelta + " fee: " + synchronizationFee.toString(10)); |
@@ -89,3 +89,3 @@ "use strict"; | ||
return null; | ||
const initIx = eventObject.instructions.find(ix => ix.name === "offererInitializePayIn" || ix.name === "offererInitialize"); | ||
const initIx = eventObject.instructions.find(ix => ix != null && (ix.name === "offererInitializePayIn" || ix.name === "offererInitialize")); | ||
if (initIx == null) | ||
@@ -92,0 +92,0 @@ return null; |
@@ -178,3 +178,3 @@ "use strict"; | ||
if (shouldInitAta) { | ||
const initAction = this.root.Tokens.InitAta(swapData.offerer, swapData.token, swapData.offererAta); | ||
const initAction = this.root.Tokens.InitAta(swapData.claimer, swapData.token, swapData.claimerAta); | ||
if (initAction == null) | ||
@@ -222,3 +222,3 @@ throw new crosslightning_base_1.SwapDataVerificationError("Invalid claimer token account address"); | ||
if (shouldInitAta) { | ||
const initAction = this.root.Tokens.InitAta(swapData.offerer, swapData.token, swapData.offererAta); | ||
const initAction = this.root.Tokens.InitAta(swapData.claimer, swapData.token, swapData.claimerAta); | ||
if (initAction == null) | ||
@@ -225,0 +225,0 @@ throw new crosslightning_base_1.SwapDataVerificationError("Invalid claimer token account address"); |
{ | ||
"name": "crosslightning-solana", | ||
"version": "5.5.0-beta1", | ||
"version": "5.5.0-beta10", | ||
"description": "Solana specific base implementation", | ||
@@ -26,6 +26,6 @@ "main": "./dist/index.js", | ||
"@coral-xyz/anchor": "0.29.0", | ||
"@solana/spl-token": "0.4.8", | ||
"@solana/spl-token": "0.3.9", | ||
"@solana/web3.js": "1.95.2", | ||
"bn.js": "5.2.1", | ||
"crosslightning-base": "^6.0.3", | ||
"crosslightning-base": "6.0.3", | ||
"tweetnacl": "1.0.3" | ||
@@ -32,0 +32,0 @@ }, |
@@ -304,2 +304,3 @@ import * as BN from "bn.js"; | ||
}); | ||
this.blockFeeCache = obj; | ||
} | ||
@@ -306,0 +307,0 @@ |
@@ -112,3 +112,3 @@ import { | ||
if(abortSignal!=null && abortSignal.aborted) throw err; | ||
this.logger.debug("txConfirmFromWebsocket(): transaction rejected from WS, running ultimate check, signature: "+signature); | ||
this.logger.debug("txConfirmFromWebsocket(): transaction rejected from WS, running ultimate check, expiry blockheight: "+solanaTx.tx.lastValidBlockHeight+" signature: "+signature+" error: "+err); | ||
const status = await tryWithRetries( | ||
@@ -179,3 +179,3 @@ () => this.getTxIdStatus(signature, finality) | ||
this.logger.debug("prepareTransactions(): fetched latest block data for transactions," + | ||
" blockhash: "+latestBlockData.blockhash); | ||
" blockhash: "+latestBlockData.blockhash+" expiry blockheight: "+latestBlockData.lastValidBlockHeight); | ||
} | ||
@@ -233,3 +233,7 @@ tx.tx.recentBlockhash = latestBlockData.blockhash; | ||
const signedTxs = await this.provider.wallet.signAllTransactions(txs.map(e => e.tx)); | ||
signedTxs.forEach((tx, index) => txs[index].tx = tx); | ||
signedTxs.forEach((tx, index) => { | ||
const solTx = txs[index]; | ||
tx.lastValidBlockHeight = solTx.tx.lastValidBlockHeight; | ||
solTx.tx = tx | ||
}); | ||
@@ -236,0 +240,0 @@ const options = { |
@@ -15,3 +15,3 @@ import {AnchorProvider} from "@coral-xyz/anchor"; | ||
import {SolanaProgramBase} from "../program/SolanaProgramBase"; | ||
import BN from "bn.js"; | ||
import * as BN from "bn.js"; | ||
import {SolanaAction} from "../base/SolanaAction"; | ||
@@ -18,0 +18,0 @@ |
@@ -121,3 +121,3 @@ import {ChainEvents, ClaimEvent, EventListener, InitializeEvent, RefundEvent, SwapEvent} from "crosslightning-base"; | ||
const initIx = eventObject.instructions.find( | ||
ix => ix.name === "offererInitializePayIn" || ix.name === "offererInitialize" | ||
ix => ix!=null && (ix.name === "offererInitializePayIn" || ix.name === "offererInitialize") | ||
) as InitInstruction; | ||
@@ -124,0 +124,0 @@ if(initIx == null) return null; |
@@ -248,3 +248,3 @@ import {SolanaSwapModule} from "../SolanaSwapModule"; | ||
if(shouldInitAta) { | ||
const initAction = this.root.Tokens.InitAta(swapData.offerer, swapData.token, swapData.offererAta); | ||
const initAction = this.root.Tokens.InitAta(swapData.claimer, swapData.token, swapData.claimerAta); | ||
if(initAction==null) throw new SwapDataVerificationError("Invalid claimer token account address"); | ||
@@ -305,3 +305,3 @@ action.add(initAction); | ||
if(shouldInitAta) { | ||
const initAction = this.root.Tokens.InitAta(swapData.offerer, swapData.token, swapData.offererAta); | ||
const initAction = this.root.Tokens.InitAta(swapData.claimer, swapData.token, swapData.claimerAta); | ||
if(initAction==null) throw new SwapDataVerificationError("Invalid claimer token account address"); | ||
@@ -308,0 +308,0 @@ await initAction.addToTxs(txs, feeRate); |
844496
21249
+ Added@solana/spl-token@0.3.9(transitive)
- Removed@solana/codecs@2.0.0-preview.4(transitive)
- Removed@solana/codecs-core@2.0.0-preview.4(transitive)
- Removed@solana/codecs-data-structures@2.0.0-preview.4(transitive)
- Removed@solana/codecs-numbers@2.0.0-preview.4(transitive)
- Removed@solana/codecs-strings@2.0.0-preview.4(transitive)
- Removed@solana/errors@2.0.0-preview.4(transitive)
- Removed@solana/options@2.0.0-preview.4(transitive)
- Removed@solana/spl-token@0.4.8(transitive)
- Removed@solana/spl-token-group@0.0.5(transitive)
- Removed@solana/spl-token-metadata@0.1.6(transitive)
- Removed@solana/spl-type-length-value@0.1.0(transitive)
- Removed@solana/web3.js@1.98.0(transitive)
- Removedchalk@5.4.1(transitive)
- Removedcommander@12.1.0(transitive)
- Removedfastestsmallesttextencoderdecoder@1.0.22(transitive)
- Removedtypescript@5.7.3(transitive)
Updated@solana/spl-token@0.3.9
Updatedcrosslightning-base@6.0.3