@shogun-sdk/swap 0.0.2-test.2 → 0.0.2-test.21

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.
@@ -8,7 +8,7 @@ var adaptSolanaWallet = (walletAddress, chainId, rpcUrl, signAndSendTransaction)
8
8
  const getChainId = async () => _chainId;
9
9
  const sendTransaction = async (transaction) => {
10
10
  const txHash = await signAndSendTransaction(transaction);
11
- console.log(`\u{1F6F0} Sent transaction: ${txHash}`);
11
+ console.debug(`\u{1F6F0} Sent transaction: ${txHash}`);
12
12
  const maxRetries = 20;
13
13
  const delayMs = 2e3;
14
14
  for (let attempt = 0; attempt < maxRetries; attempt++) {
@@ -102,15 +102,26 @@ var adaptViemWallet = (wallet) => {
102
102
  if (!isEVMTransaction(transaction)) {
103
103
  throw new Error("Expected EVMTransaction but got SolanaTransaction");
104
104
  }
105
- const tx = await wallet.sendTransaction({
106
- from: transaction.from,
107
- to: transaction.to,
108
- data: transaction.data,
109
- value: transaction.value,
110
- account: wallet.account?.address,
111
- chain: wallet.chain
112
- });
113
- return tx;
105
+ if (wallet.transport.type === "http") {
106
+ const request = await wallet.prepareTransactionRequest({
107
+ to: transaction.to,
108
+ data: transaction.data,
109
+ value: transaction.value,
110
+ chain: wallet.chain
111
+ });
112
+ const serializedTransaction = await wallet.signTransaction(request);
113
+ const tx = await wallet.sendRawTransaction({ serializedTransaction });
114
+ return tx;
115
+ } else {
116
+ const hash = await wallet.sendTransaction({
117
+ to: transaction.to,
118
+ data: transaction.data,
119
+ value: transaction.value,
120
+ chain: wallet.chain,
121
+ account: wallet.account
122
+ });
123
+ return hash;
124
+ }
114
125
  };
115
126
  const switchChain = async (chainId) => {
116
127
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shogun-sdk/swap",
3
- "version": "0.0.2-test.2",
3
+ "version": "0.0.2-test.21",
4
4
  "type": "module",
5
5
  "description": "Shogun Network Swap utilities and helpers",
6
6
  "author": "Shogun Network",
@@ -57,7 +57,7 @@
57
57
  "@solana/web3.js": "^1.98.4",
58
58
  "ethers": "^5.6.1",
59
59
  "wagmi": "2.18.0",
60
- "@shogun-sdk/intents-sdk": "1.2.6-test.1"
60
+ "@shogun-sdk/intents-sdk": "1.2.6-test.3"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "viem": "^2.38.1",