@exodus/solana-api 2.0.0 → 2.0.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/package.json +3 -3
- package/src/index.js +15 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Exodus internal Solana asset API wrapper",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@exodus/asset-json-rpc": "^1.0.0",
|
|
17
|
-
"@exodus/solana-lib": "^1.3.
|
|
17
|
+
"@exodus/solana-lib": "^1.3.7",
|
|
18
18
|
"lodash": "^4.17.11",
|
|
19
19
|
"url-join": "4.0.0",
|
|
20
20
|
"wretch": "^1.5.2"
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"node-fetch": "~1.6.3"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "342e5908cd9a4b4806acbb2b7286549e2ed3d80b"
|
|
26
26
|
}
|
package/src/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
TOKEN_PROGRAM_ID,
|
|
11
11
|
SOL_DECIMAL,
|
|
12
12
|
computeBalance,
|
|
13
|
+
SolanaWeb3Message,
|
|
13
14
|
buildRawTransaction,
|
|
14
15
|
} from '@exodus/solana-lib'
|
|
15
16
|
import assets from '@exodus/assets'
|
|
@@ -458,7 +459,9 @@ class Api {
|
|
|
458
459
|
}
|
|
459
460
|
|
|
460
461
|
async getSupply(mintAddress: string): string {
|
|
461
|
-
const {
|
|
462
|
+
const {
|
|
463
|
+
value: { amount },
|
|
464
|
+
} = await this.api.post({
|
|
462
465
|
method: 'getTokenSupply',
|
|
463
466
|
params: [mintAddress],
|
|
464
467
|
})
|
|
@@ -599,8 +602,8 @@ class Api {
|
|
|
599
602
|
return account.owner === SYSTEM_PROGRAM_ID.toBase58()
|
|
600
603
|
? 'solana'
|
|
601
604
|
: account.owner === TOKEN_PROGRAM_ID.toBase58()
|
|
602
|
-
|
|
603
|
-
|
|
605
|
+
? 'token'
|
|
606
|
+
: null
|
|
604
607
|
}
|
|
605
608
|
|
|
606
609
|
async getTokenAddressOwner(address: string) {
|
|
@@ -788,11 +791,16 @@ class Api {
|
|
|
788
791
|
/**
|
|
789
792
|
* Simulate transaction and return side effects
|
|
790
793
|
*/
|
|
791
|
-
simulateAndRetrieveSideEffects = async (
|
|
794
|
+
simulateAndRetrieveSideEffects = async (
|
|
795
|
+
transactionMessage: SolanaWeb3Message,
|
|
796
|
+
publicKey: string
|
|
797
|
+
) => {
|
|
792
798
|
const { config, accountAddresses } = getTransactionSimulationParams(transactionMessage)
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
|
|
799
|
+
const signatures = new Array(transactionMessage.header.numRequiredSignatures || 1).fill(null)
|
|
800
|
+
const encodedTransaction = buildRawTransaction(
|
|
801
|
+
transactionMessage.serialize(),
|
|
802
|
+
signatures
|
|
803
|
+
).toString('base64')
|
|
796
804
|
const futureAccountsState = await this.simulateTransaction(encodedTransaction, config)
|
|
797
805
|
const { solAccounts, tokenAccounts } = filterAccountsByOwner(
|
|
798
806
|
futureAccountsState,
|