@exodus/solana-api 3.9.1 → 3.9.2
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/CHANGELOG.md +9 -0
- package/package.json +2 -2
- package/src/api.js +7 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.9.2](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.9.1...@exodus/solana-api@3.9.2) (2024-07-18)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* match correct solana dex swap amount ([#2878](https://github.com/ExodusMovement/assets/issues/2878)) ([24d8d13](https://github.com/ExodusMovement/assets/commit/24d8d138a99d80d36088b89ff1f5d8a04308a2ec))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [3.9.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.9.0...@exodus/solana-api@3.9.1) (2024-07-15)
|
|
7
16
|
|
|
8
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "Exodus internal Solana asset API wrapper",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@exodus/assets-testing": "^1.0.0",
|
|
48
48
|
"@solana/web3.js": "^1.91.8"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "8224119778ed76066cb18a454118a95f306f2717",
|
|
51
51
|
"bugs": {
|
|
52
52
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
53
53
|
},
|
package/src/api.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BN from 'bn.js'
|
|
2
1
|
import createApi from '@exodus/asset-json-rpc'
|
|
2
|
+
import { magicEden } from '@exodus/nfts-core'
|
|
3
3
|
import { retry } from '@exodus/simple-retry'
|
|
4
4
|
import {
|
|
5
5
|
buildRawTransaction,
|
|
@@ -15,10 +15,11 @@ import {
|
|
|
15
15
|
TOKEN_PROGRAM_ID,
|
|
16
16
|
} from '@exodus/solana-lib'
|
|
17
17
|
import assert from 'assert'
|
|
18
|
+
import BN from 'bn.js'
|
|
18
19
|
import lodash from 'lodash'
|
|
19
20
|
import urljoin from 'url-join'
|
|
20
21
|
import wretch from 'wretch'
|
|
21
|
-
|
|
22
|
+
|
|
22
23
|
import { Connection } from './connection'
|
|
23
24
|
|
|
24
25
|
// Doc: https://docs.solana.com/apps/jsonrpc-api
|
|
@@ -26,7 +27,6 @@ import { Connection } from './connection'
|
|
|
26
27
|
const RPC_URL = 'https://solana.a.exodus.io' // https://vip-api.mainnet-beta.solana.com/, https://api.mainnet-beta.solana.com
|
|
27
28
|
const WS_ENDPOINT = 'wss://solana.a.exodus.io/ws' // not standard across all node providers (we're compatible only with Quicknode)
|
|
28
29
|
const FORCE_HTTP = true // use https over ws
|
|
29
|
-
const WRAPPED_SOLANA_TOKEN_MINT_ADDRESS = `So11111111111111111111111111111111111111112`
|
|
30
30
|
|
|
31
31
|
// Tokens + SOL api support
|
|
32
32
|
export class Api {
|
|
@@ -379,24 +379,19 @@ export class Api {
|
|
|
379
379
|
|
|
380
380
|
const source = lodash.get(ix, 'parsed.info.source')
|
|
381
381
|
const destination = lodash.get(ix, 'parsed.info.destination')
|
|
382
|
-
const mint = lodash.get(ix, 'parsed.info.mint')
|
|
383
382
|
const amount = Number(
|
|
384
383
|
lodash.get(ix, 'parsed.info.amount', 0) ||
|
|
385
384
|
lodash.get(ix, 'parsed.info.tokenAmount.amount', 0)
|
|
386
385
|
)
|
|
387
386
|
const txId = txDetails.transaction.signatures[0]
|
|
388
|
-
if (
|
|
389
|
-
|
|
390
|
-
[source, destination].includes(accountToRedeemToOwner) &&
|
|
391
|
-
mint === WRAPPED_SOLANA_TOKEN_MINT_ADDRESS
|
|
392
|
-
) {
|
|
393
|
-
const ownerOrAccount = (account) =>
|
|
387
|
+
if (accountToRedeemToOwner && destination === accountToRedeemToOwner) {
|
|
388
|
+
const getOwnerOrAccount = (account) =>
|
|
394
389
|
account && account === accountToRedeemToOwner ? ownerAddress : account
|
|
395
390
|
|
|
396
391
|
solanaTransferTx = {
|
|
397
392
|
id: txId,
|
|
398
|
-
from:
|
|
399
|
-
to:
|
|
393
|
+
from: getOwnerOrAccount(source),
|
|
394
|
+
to: getOwnerOrAccount(destination),
|
|
400
395
|
amount,
|
|
401
396
|
fee,
|
|
402
397
|
}
|