@debridge-finance/solana-utils 6.2.4 → 6.2.5

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.
@@ -10861,20 +10861,6 @@ const MetadataPointerLayout = struct$1([
10861
10861
  publicKey$5('metadataAddress'),
10862
10862
  ]);
10863
10863
  MetadataPointerLayout.span;
10864
- function getMetadataPointerState(mint) {
10865
- const extensionData = getExtensionData(ExtensionType.MetadataPointer, mint.tlvData);
10866
- if (extensionData !== null) {
10867
- const { authority, metadataAddress } = MetadataPointerLayout.decode(extensionData);
10868
- // Explicitly set None/Zero keys to null
10869
- return {
10870
- authority: authority.equals(PublicKey.default) ? null : authority,
10871
- metadataAddress: metadataAddress.equals(PublicKey.default) ? null : metadataAddress,
10872
- };
10873
- }
10874
- else {
10875
- return null;
10876
- }
10877
- }
10878
10864
 
10879
10865
  /** Buffer layout for de/serializing a mint */
10880
10866
  const MintCloseAuthorityLayout = struct$1([publicKey$5('closeAuthority')]);
@@ -11169,17 +11155,6 @@ function getExtensionData(extension, tlvData) {
11169
11155
  }
11170
11156
  return null;
11171
11157
  }
11172
- function getExtensionTypes(tlvData) {
11173
- const extensionTypes = [];
11174
- let extensionTypeIndex = 0;
11175
- while (extensionTypeIndex < tlvData.length) {
11176
- const entryType = tlvData.readUInt16LE(extensionTypeIndex);
11177
- extensionTypes.push(entryType);
11178
- const entryLength = tlvData.readUInt16LE(extensionTypeIndex + TYPE_SIZE);
11179
- extensionTypeIndex += addTypeAndLengthToLen(entryLength);
11180
- }
11181
- return extensionTypes;
11182
- }
11183
11158
 
11184
11159
  /** Buffer layout for de/serializing a mint */
11185
11160
  const MintLayout = struct$1([
@@ -13219,15 +13194,13 @@ function getTokenInfo(connection_1, tokenAddress_1) {
13219
13194
  }
13220
13195
  // fetcher encapsulates the actual work and is stored in cache when useCache is true
13221
13196
  const fetcher = (() => __awaiter(this, void 0, void 0, function* () {
13222
- var _a;
13223
13197
  const [pda] = getTokenMetadataAddress(tokenAddress, TOKEN_METADATA_PROGRAM_ID);
13224
13198
  const [tokenAccount, pdaAccount] = yield connection.getMultipleAccountsInfo([tokenAddress, pda]);
13225
13199
  if (!tokenAccount || (tokenAccount === null || tokenAccount === void 0 ? void 0 : tokenAccount.lamports) === 0) {
13226
13200
  return null;
13227
13201
  }
13228
13202
  const mint2022 = unpackMint(tokenAddress, tokenAccount, tokenAccount.owner);
13229
- const extTypes = getExtensionTypes((_a = mint2022.tlvData) !== null && _a !== void 0 ? _a : buffer.Buffer.alloc(0));
13230
- const tokenMetaBuf = extTypes.includes(ExtensionType.TokenMetadata)
13203
+ const tokenMetaBuf = mint2022.tlvData.length
13231
13204
  ? getExtensionData(ExtensionType.TokenMetadata, mint2022.tlvData)
13232
13205
  : null;
13233
13206
  if (tokenMetaBuf) {
@@ -13241,24 +13214,6 @@ function getTokenInfo(connection_1, tokenAddress_1) {
13241
13214
  tokenProgram: tokenAccount.owner,
13242
13215
  };
13243
13216
  }
13244
- if (extTypes.includes(ExtensionType.MetadataPointer)) {
13245
- const mpState = getMetadataPointerState(mint2022);
13246
- if ((mpState === null || mpState === void 0 ? void 0 : mpState.metadataAddress) &&
13247
- mpState.metadataAddress.equals(tokenAddress)) {
13248
- const inlineMetaBuf = getExtensionData(ExtensionType.TokenMetadata, mint2022.tlvData);
13249
- if (inlineMetaBuf) {
13250
- const meta = unpack(inlineMetaBuf);
13251
- return {
13252
- address: tokenAddress,
13253
- decimals: mint2022.decimals,
13254
- name: meta.name,
13255
- symbol: meta.symbol,
13256
- json: meta.uri,
13257
- tokenProgram: tokenAccount.owner,
13258
- };
13259
- }
13260
- }
13261
- }
13262
13217
  // parse token account
13263
13218
  // mint_authority - coption(pubkey) = 36
13264
13219
  // supply - u64 = 8