@exodus/solana-api 3.12.0 → 3.12.1

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 CHANGED
@@ -3,6 +3,16 @@
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.12.1](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.12.0...@exodus/solana-api@3.12.1) (2025-01-02)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+
12
+ * fix: solana nft send (#4768)
13
+
14
+
15
+
6
16
  ## [3.12.0](https://github.com/ExodusMovement/assets/compare/@exodus/solana-api@3.11.9...@exodus/solana-api@3.12.0) (2025-01-02)
7
17
 
8
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/solana-api",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
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",
@@ -30,7 +30,7 @@
30
30
  "@exodus/fetch": "^1.2.0",
31
31
  "@exodus/models": "^12.0.1",
32
32
  "@exodus/simple-retry": "^0.0.6",
33
- "@exodus/solana-lib": "^3.9.3",
33
+ "@exodus/solana-lib": "^3.9.4",
34
34
  "@exodus/solana-meta": "^2.0.2",
35
35
  "@exodus/timer": "^1.1.1",
36
36
  "bn.js": "^4.11.0",
@@ -47,7 +47,7 @@
47
47
  "@exodus/assets-testing": "^1.0.0",
48
48
  "@exodus/solana-web3.js": "^1.63.1-exodus.9-rc3"
49
49
  },
50
- "gitHead": "70de901b0d9b85f1045949400105203c700fc223",
50
+ "gitHead": "8a6a0d1a70d14e86a9cf4d47b8884939f10be724",
51
51
  "bugs": {
52
52
  "url": "https://github.com/ExodusMovement/assets/issues?q=is%3Aissue+is%3Aopen+label%3Asolana-api"
53
53
  },
package/src/tx-send.js CHANGED
@@ -8,19 +8,17 @@ import {
8
8
  import assert from 'minimalistic-assert'
9
9
 
10
10
  export const createAndBroadcastTXFactory =
11
- (api) =>
12
- async ({ asset, walletAccount, address, amount, options = {} }, { assetClientInterface }) => {
11
+ ({ api, assetClientInterface }) =>
12
+ async ({ asset, walletAccount, address, amount, options = {} }) => {
13
13
  const assetName = asset.name
14
14
  assert(assetClientInterface, `assetClientInterface must be supplied in sendTx for ${assetName}`)
15
15
 
16
16
  const {
17
17
  feeAmount,
18
- method,
19
18
  stakeAddresses,
20
19
  seed,
21
20
  pool,
22
- customMintAddress,
23
- tokenStandard,
21
+ nft,
24
22
  // <MagicEden>
25
23
  initializerAddress,
26
24
  initializerDepositTokenAddress,
@@ -38,12 +36,22 @@ export const createAndBroadcastTXFactory =
38
36
  reference,
39
37
  memo,
40
38
  } = options
39
+
40
+ let { method, customMintAddress, tokenStandard } = options
41
+
41
42
  const { baseAsset } = asset
42
43
  const from = await assetClientInterface.getReceiveAddress({
43
44
  assetName: baseAsset.name,
44
45
  walletAccount,
45
46
  })
46
47
 
48
+ if (nft) {
49
+ customMintAddress = nft.mintAddress
50
+ tokenStandard = nft.tokenStandard
51
+ method = tokenStandard === 4 ? 'metaplexTransfer' : undefined
52
+ amount = asset.currency.baseUnit(1)
53
+ }
54
+
47
55
  const isToken = asset.assetType === api.tokenAssetType
48
56
 
49
57
  // Check if receiver has address active when sending tokens.
@@ -72,15 +80,13 @@ export const createAndBroadcastTXFactory =
72
80
  let tokenParams = Object.create(null)
73
81
  if (isToken || customMintAddress) {
74
82
  const tokenMintAddress = customMintAddress || asset.mintAddress
75
- const tokenProgram =
83
+ const tokenProgramPublicKey =
76
84
  (await api.getAddressType(tokenMintAddress)) === 'token-2022'
77
85
  ? TOKEN_2022_PROGRAM_ID
78
86
  : TOKEN_PROGRAM_ID
79
- const tokenAddress = findAssociatedTokenAddress(
80
- address,
81
- tokenMintAddress,
82
- tokenProgram.toBase58()
83
- )
87
+
88
+ const tokenProgram = tokenProgramPublicKey.toBase58()
89
+ const tokenAddress = findAssociatedTokenAddress(address, tokenMintAddress, tokenProgram)
84
90
  const [destinationAddressType, isAssociatedTokenAccountActive, fromTokenAccountAddresses] =
85
91
  await Promise.all([
86
92
  api.getAddressType(address),