@exodus/solana-api 1.2.27 → 1.3.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 +2 -2
- package/src/index.js +23 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "1.2
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "Exodus internal Solana asset API wrapper",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"node-fetch": "~1.6.3"
|
|
24
24
|
},
|
|
25
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "9ec7084bcdfe14f1c6f11df393351885773046a6"
|
|
26
26
|
}
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
// @flow
|
|
2
2
|
import createApi from '@exodus/asset-json-rpc'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getMetadataAccount,
|
|
5
|
+
deserializeMetaplexMetadata,
|
|
6
|
+
tokens,
|
|
7
|
+
SYSTEM_PROGRAM_ID,
|
|
8
|
+
STAKE_PROGRAM_ID,
|
|
9
|
+
TOKEN_PROGRAM_ID,
|
|
10
|
+
} from '@exodus/solana-lib'
|
|
4
11
|
import assert from 'assert'
|
|
5
12
|
import lodash from 'lodash'
|
|
6
13
|
import urljoin from 'url-join'
|
|
@@ -90,7 +97,7 @@ class Api {
|
|
|
90
97
|
async getConfirmedSignaturesForAddress(address: string, { until, before, limit } = {}): any {
|
|
91
98
|
until = until || undefined
|
|
92
99
|
return this.api.post({
|
|
93
|
-
method: '
|
|
100
|
+
method: 'getSignaturesForAddress',
|
|
94
101
|
params: [address, { until, before, limit }],
|
|
95
102
|
})
|
|
96
103
|
}
|
|
@@ -410,6 +417,20 @@ class Api {
|
|
|
410
417
|
return value
|
|
411
418
|
}
|
|
412
419
|
|
|
420
|
+
async getMetaplexMetadata(tokenMintAddress: string) {
|
|
421
|
+
const metaplexPDA = getMetadataAccount(tokenMintAddress)
|
|
422
|
+
const res = await this.getAccountInfo(metaplexPDA)
|
|
423
|
+
const data = lodash.get(res, 'data[0]')
|
|
424
|
+
if (!data) return null
|
|
425
|
+
|
|
426
|
+
return deserializeMetaplexMetadata(Buffer.from(data, 'base64'))
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
async getDecimals(tokenMintAddress: string) {
|
|
430
|
+
const res = await this.api.post({ method: 'getTokenSupply', params: [tokenMintAddress] })
|
|
431
|
+
return lodash.get(res, 'value.decimals', null)
|
|
432
|
+
}
|
|
433
|
+
|
|
413
434
|
async getAddressType(address: string) {
|
|
414
435
|
// solana, token or null (unknown), meaning address has never been initialized
|
|
415
436
|
const value = await this.getAccountInfo(address)
|