@cryptorubic/web3 1.8.1-alpha.solana.2 → 1.8.1-alpha.solana.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptorubic/web3",
3
- "version": "1.8.1-alpha.solana.2",
3
+ "version": "1.8.1-alpha.solana.4",
4
4
  "dependencies": {
5
5
  "@ethersproject/bignumber": "^5.8.0",
6
6
  "@mysten/sui": "^1.24.0",
@@ -33,11 +33,12 @@ class SolanaAdapterSigner extends abstract_adapter_signer_1.AbstractAdapterSigne
33
33
  try {
34
34
  const decodedData = js_base64_1.Base64.toUint8Array(params.txOptions.data);
35
35
  const tx = web3_js_1.VersionedTransaction.deserialize(decodedData);
36
- const signedTx = await this.wallet.signTransaction(tx);
37
- signedTx.message.recentBlockhash = (await this.publicClient.getLatestBlockhash('confirmed')).blockhash;
38
- const txBase64 = js_base64_1.Base64.fromUint8Array(signedTx.serialize());
36
+ const { blockhash } = await this.publicClient.getLatestBlockhash('confirmed');
37
+ tx.message.recentBlockhash = blockhash;
39
38
  let signature;
40
39
  if (params.txOptions?.sponsorParams) {
40
+ const signedTx = await this.wallet.signTransaction(tx);
41
+ const txBase64 = js_base64_1.Base64.fromUint8Array(signedTx.serialize());
41
42
  const response = await this.httpClient.post(`${this.apiUrl}/api/utility/solana/relay`, {
42
43
  data: txBase64,
43
44
  id: params.txOptions.sponsorParams.tradeId
@@ -46,8 +47,8 @@ class SolanaAdapterSigner extends abstract_adapter_signer_1.AbstractAdapterSigne
46
47
  }
47
48
  else {
48
49
  try {
49
- const simulation = await this.publicClient.simulateTransaction(signedTx, {
50
- sigVerify: false,
50
+ const simulation = await this.publicClient.simulateTransaction(tx, {
51
+ sigVerify: true,
51
52
  replaceRecentBlockhash: false
52
53
  });
53
54
  console.log(simulation);
@@ -55,10 +56,14 @@ class SolanaAdapterSigner extends abstract_adapter_signer_1.AbstractAdapterSigne
55
56
  catch (err) {
56
57
  console.log(err);
57
58
  }
58
- signature = await this.publicClient.sendRawTransaction(signedTx.serialize(), {
59
+ signature = await this.publicClient.sendTransaction(tx, {
59
60
  maxRetries: 3,
60
61
  skipPreflight: false
61
62
  });
63
+ // signature = await this.publicClient.sendRawTransaction(signedTx.serialize(), {
64
+ // maxRetries: 3,
65
+ // skipPreflight: false
66
+ // });
62
67
  }
63
68
  params.txOptions.onTransactionHash?.(signature);
64
69
  await this.waitForTxConfirmation(signature);