@exodus/solana-plugin 1.4.1 → 1.6.0
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/create-asset.js +13 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Exodus internal Solana asset plugin",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@exodus/assets": "^9.0.1",
|
|
23
23
|
"@exodus/bip44-constants": "^195.0.0",
|
|
24
24
|
"@exodus/solana-api": "^3.0.0",
|
|
25
|
-
"@exodus/solana-lib": "^2.
|
|
25
|
+
"@exodus/solana-lib": "^2.2.0",
|
|
26
26
|
"@exodus/solana-meta": "^1.0.7",
|
|
27
27
|
"minimalistic-assert": "^1.0.1",
|
|
28
28
|
"ms": "^2.1.3"
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@exodus/assets-testing": "^1.0.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "85fd61e1f2f77aff4c32b5684eb5f4845f06794a"
|
|
34
34
|
}
|
package/src/create-asset.js
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
isValidAddress,
|
|
8
8
|
parseUnsignedTx,
|
|
9
9
|
signUnsignedTx,
|
|
10
|
+
signUnsignedTxWithSigner,
|
|
10
11
|
signHardware,
|
|
11
12
|
createFeeData,
|
|
12
13
|
} from '@exodus/solana-lib'
|
|
@@ -26,7 +27,7 @@ const DEFAULT_LOW_BALANCE = 0.01
|
|
|
26
27
|
const DEFAULT_MIN_STAKING_AMOUNT = 0.01
|
|
27
28
|
|
|
28
29
|
export const createSolanaAssetFactory =
|
|
29
|
-
({ assetList, serverApi }) =>
|
|
30
|
+
({ assetList, serverApi, isTestnet = false }) =>
|
|
30
31
|
({
|
|
31
32
|
assetClientInterface,
|
|
32
33
|
config: {
|
|
@@ -39,6 +40,7 @@ export const createSolanaAssetFactory =
|
|
|
39
40
|
ticksBetweenHistoryFetches,
|
|
40
41
|
ticksBetweenStakeFetches,
|
|
41
42
|
txsLimit,
|
|
43
|
+
signWithSigner = true,
|
|
42
44
|
} = {},
|
|
43
45
|
overrideCallback = ({ asset }) => asset,
|
|
44
46
|
} = {}) => {
|
|
@@ -105,6 +107,8 @@ export const createSolanaAssetFactory =
|
|
|
105
107
|
feesApi: true,
|
|
106
108
|
nfts: true,
|
|
107
109
|
staking: {},
|
|
110
|
+
isTestnet,
|
|
111
|
+
signWithSigner,
|
|
108
112
|
}
|
|
109
113
|
|
|
110
114
|
const assetStakingApi = {
|
|
@@ -113,6 +117,8 @@ export const createSolanaAssetFactory =
|
|
|
113
117
|
|
|
114
118
|
const SolanaAccountState = createAccountState({ assetList })
|
|
115
119
|
|
|
120
|
+
const defaultAddressPath = 'm/0/0'
|
|
121
|
+
|
|
116
122
|
const api = {
|
|
117
123
|
getActivityTxs,
|
|
118
124
|
addressHasHistory: (...args) => serverApi.getAccountInfo(...args).then((acc) => !!acc),
|
|
@@ -131,9 +137,10 @@ export const createSolanaAssetFactory =
|
|
|
131
137
|
}),
|
|
132
138
|
createToken: (tokenDef) =>
|
|
133
139
|
tokenDef.isBuiltIn ? createToken(tokenDef) : createCustomToken(tokenDef),
|
|
134
|
-
defaultAddressPath
|
|
140
|
+
defaultAddressPath,
|
|
135
141
|
features,
|
|
136
142
|
getBalances,
|
|
143
|
+
getDefaultAddressPath: () => defaultAddressPath,
|
|
137
144
|
getFee: ({ feeData }) => feeData.fee,
|
|
138
145
|
getFeeAsync: async ({ feeData }) => feeData.fee,
|
|
139
146
|
getFeeData: () => feeData,
|
|
@@ -148,7 +155,10 @@ export const createSolanaAssetFactory =
|
|
|
148
155
|
parseUnsignedTx: (unsignedTx) => parseUnsignedTx({ asset: base, unsignedTx }),
|
|
149
156
|
parseTx: ({ unsignedTx }) => parseUnsignedTx({ asset: base, unsignedTx }),
|
|
150
157
|
sendTx,
|
|
151
|
-
signTx: ({ unsignedTx, privateKey }) =>
|
|
158
|
+
signTx: ({ unsignedTx, privateKey, signer }) =>
|
|
159
|
+
signer
|
|
160
|
+
? signUnsignedTxWithSigner(unsignedTx, signer)
|
|
161
|
+
: signUnsignedTx(unsignedTx, privateKey),
|
|
152
162
|
signUnsignedTx,
|
|
153
163
|
signHardware,
|
|
154
164
|
staking: assetStakingApi,
|