@exodus/solana-api 1.2.19 → 1.2.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.
- package/package.json +3 -3
- package/src/index.js +15 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.21",
|
|
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.2.
|
|
17
|
+
"@exodus/solana-lib": "^1.2.21",
|
|
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": "dac1d4d133b92c18334de5a37332cfad769e1459"
|
|
26
26
|
}
|
package/src/index.js
CHANGED
|
@@ -316,6 +316,7 @@ class Api {
|
|
|
316
316
|
tokenName: token.tokenName,
|
|
317
317
|
ticker: token.ticker,
|
|
318
318
|
balance,
|
|
319
|
+
mintAddress: mint,
|
|
319
320
|
})
|
|
320
321
|
}
|
|
321
322
|
// eventually filter by token
|
|
@@ -352,19 +353,23 @@ class Api {
|
|
|
352
353
|
}
|
|
353
354
|
}
|
|
354
355
|
|
|
355
|
-
async
|
|
356
|
-
// solana, token or null (unknown), meaning address has never been initialized
|
|
356
|
+
async getAccountInfo(address: string) {
|
|
357
357
|
const { value } = await this.api.post({
|
|
358
358
|
method: 'getAccountInfo',
|
|
359
|
-
params: [address, { encoding: '
|
|
359
|
+
params: [address, { encoding: 'jsonParsed', commitment: 'single' }],
|
|
360
360
|
})
|
|
361
|
+
return value
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
async getAddressType(address: string) {
|
|
365
|
+
// solana, token or null (unknown), meaning address has never been initialized
|
|
366
|
+
const value = await this.getAccountInfo(address)
|
|
361
367
|
if (value === null) return null
|
|
362
368
|
|
|
363
369
|
const account = {
|
|
364
370
|
executable: value.executable,
|
|
365
371
|
owner: value.owner,
|
|
366
372
|
lamports: value.lamports,
|
|
367
|
-
data: value.data,
|
|
368
373
|
}
|
|
369
374
|
|
|
370
375
|
return account.owner === SYSTEM_PROGRAM_ID.toBase58()
|
|
@@ -374,6 +379,12 @@ class Api {
|
|
|
374
379
|
: null
|
|
375
380
|
}
|
|
376
381
|
|
|
382
|
+
async getAddressMint(address) {
|
|
383
|
+
const value = await this.getAccountInfo(address)
|
|
384
|
+
const mintAddress = lodash.get(value, 'data.parsed.info.mint', null) // token mint
|
|
385
|
+
return mintAddress
|
|
386
|
+
}
|
|
387
|
+
|
|
377
388
|
async isTokenAddress(address: string) {
|
|
378
389
|
const type = await this.getAddressType(address)
|
|
379
390
|
return type === 'token'
|