@exodus/solana-api 3.22.0 → 3.23.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/CHANGELOG.md +20 -0
- package/package.json +3 -3
- package/src/api.js +5 -0
- package/src/index.js +1 -0
- package/src/init-agent-wallet.js +72 -0
- package/src/rpc-api.js +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,26 @@
|
|
|
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.23.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.22.1...@exodus/solana-api@3.23.0) (2025-10-27)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
* feat: SOL agent accounts (#6757)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
## [3.22.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.22.0...@exodus/solana-api@3.22.1) (2025-10-24)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
### Bug Fixes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
* fix: address has history method (#6764)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
6
26
|
## [3.22.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.21.0...@exodus/solana-api@3.22.0) (2025-10-15)
|
|
7
27
|
|
|
8
28
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/solana-api",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.23.0",
|
|
4
4
|
"description": "Transaction monitors, fee monitors, RPC with the blockchain node, and other networking code for Solana",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"@exodus/fetch": "^1.7.3",
|
|
34
34
|
"@exodus/models": "^12.0.1",
|
|
35
35
|
"@exodus/simple-retry": "^0.0.6",
|
|
36
|
-
"@exodus/solana-lib": "^3.
|
|
36
|
+
"@exodus/solana-lib": "^3.14.0",
|
|
37
37
|
"@exodus/solana-meta": "^2.0.2",
|
|
38
38
|
"@exodus/timer": "^1.1.1",
|
|
39
39
|
"debug": "^4.1.1",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@exodus/assets-testing": "^1.0.0",
|
|
50
50
|
"@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "a5882a43d39ef9455f25523d20ed3060b40eb1a8",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
|
|
55
55
|
},
|
package/src/api.js
CHANGED
|
@@ -1038,6 +1038,11 @@ export class Api {
|
|
|
1038
1038
|
return value
|
|
1039
1039
|
}
|
|
1040
1040
|
|
|
1041
|
+
async addressHasHistory(address) {
|
|
1042
|
+
const value = await this.getAccountInfo(address)
|
|
1043
|
+
return !!value?.data
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1041
1046
|
async isSpl(address) {
|
|
1042
1047
|
const { owner } = await this.getAccountInfo(address)
|
|
1043
1048
|
return [TOKEN_PROGRAM_ID.toBase58(), TOKEN_2022_PROGRAM_ID.toBase58()].includes(owner)
|
package/src/index.js
CHANGED
|
@@ -20,6 +20,7 @@ export { getFeeAsyncFactory } from './get-fees.js'
|
|
|
20
20
|
export { stakingProviderClientFactory } from './staking-provider-client.js'
|
|
21
21
|
export { createTxFactory } from './create-unsigned-tx-for-send.js'
|
|
22
22
|
export { feePayerClientFactory } from './fee-payer.js'
|
|
23
|
+
export { createInitAgentWalletFactory } from './init-agent-wallet.js'
|
|
23
24
|
|
|
24
25
|
// These are not the same asset objects as the wallet creates, so they should never be returned to the wallet.
|
|
25
26
|
// Initially this may be violated by the Solana code until the first monitor tick updates assets with setTokens()
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createAgentTokenInitTx } from '@exodus/solana-lib'
|
|
2
|
+
|
|
3
|
+
const USDC_MINT_ADDRESS = 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'
|
|
4
|
+
|
|
5
|
+
export const createInitAgentWalletFactory = ({ api, assetClientInterface, sendTx }) => {
|
|
6
|
+
return async ({ walletAccount, agentWalletAccount, delegateAccount, asset }) => {
|
|
7
|
+
const supportedPurposes = await assetClientInterface.getSupportedPurposes({
|
|
8
|
+
assetName: asset.name,
|
|
9
|
+
walletAccount: agentWalletAccount,
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
const purpose = supportedPurposes[0]
|
|
13
|
+
|
|
14
|
+
const agentAddress = await assetClientInterface.getAddress({
|
|
15
|
+
assetName: asset.name,
|
|
16
|
+
walletAccount: agentWalletAccount,
|
|
17
|
+
purpose,
|
|
18
|
+
chainIndex: 0,
|
|
19
|
+
addressIndex: 0,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const defaultAddress = await assetClientInterface.getAddress({
|
|
23
|
+
assetName: asset.name,
|
|
24
|
+
walletAccount,
|
|
25
|
+
purpose,
|
|
26
|
+
chainIndex: 0,
|
|
27
|
+
addressIndex: 0,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const recentBlockhash = await api.getRecentBlockHash()
|
|
31
|
+
|
|
32
|
+
const transaction = createAgentTokenInitTx({
|
|
33
|
+
agentWalletAddress: agentAddress.address,
|
|
34
|
+
feePayerWalletAddress: defaultAddress.address,
|
|
35
|
+
tokenMintAddress: USDC_MINT_ADDRESS,
|
|
36
|
+
recentBlockhash,
|
|
37
|
+
delegateAccount,
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const unsignedTx = {
|
|
41
|
+
txData: {
|
|
42
|
+
transaction,
|
|
43
|
+
},
|
|
44
|
+
txMeta: {
|
|
45
|
+
walletAccount: agentWalletAccount,
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const partiallySignedTx = await assetClientInterface.signTransaction({
|
|
50
|
+
assetName: asset.name,
|
|
51
|
+
unsignedTx,
|
|
52
|
+
walletAccount: agentWalletAccount,
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const transactionBuffer = Buffer.from(partiallySignedTx.rawTx, 'base64')
|
|
56
|
+
|
|
57
|
+
const unsignedTxForFeePayer = {
|
|
58
|
+
txData: {
|
|
59
|
+
transactionBuffer,
|
|
60
|
+
},
|
|
61
|
+
txMeta: {
|
|
62
|
+
walletAccount,
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return sendTx({
|
|
67
|
+
asset,
|
|
68
|
+
walletAccount,
|
|
69
|
+
unsignedTx: unsignedTxForFeePayer,
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
}
|
package/src/rpc-api.js
CHANGED
|
@@ -196,6 +196,11 @@ export class RpcApi {
|
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
async addressHasHistory(address) {
|
|
200
|
+
const value = await this.getAccountInfo(address)
|
|
201
|
+
return !!value?.data
|
|
202
|
+
}
|
|
203
|
+
|
|
199
204
|
async getTokenFeeBasisPoints(address) {
|
|
200
205
|
// only for token-2022
|
|
201
206
|
const value = await this.getAccountInfo(address)
|