@joai/warps-adapter-solana 1.1.0 → 1.2.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/dist/index.mjs CHANGED
@@ -424,6 +424,38 @@ var WarpSolanaDataLoader = class {
424
424
  return null;
425
425
  }
426
426
  }
427
+ async getAccountNfts(address, options) {
428
+ try {
429
+ const publicKey = new PublicKey2(address);
430
+ const tokenAccounts = await this.connection.getParsedTokenAccountsByOwner(publicKey, {
431
+ programId: new PublicKey2(WarpSolanaConstants.Programs.TokenProgram)
432
+ });
433
+ const size = options?.size || 25;
434
+ const page = options?.page || 0;
435
+ const from = page * size;
436
+ const nftAccounts = tokenAccounts.value.filter((tokenAccount) => {
437
+ const decimals = tokenAccount.account.data.parsed.info.tokenAmount.decimals;
438
+ const amount = tokenAccount.account.data.parsed.info.tokenAmount.amount;
439
+ return decimals === 0 && amount === "1";
440
+ });
441
+ const paged = nftAccounts.slice(from, from + size);
442
+ return paged.map((tokenAccount) => {
443
+ const mintAddress = tokenAccount.account.data.parsed.info.mint;
444
+ return {
445
+ chain: this.chain.name,
446
+ identifier: mintAddress,
447
+ name: mintAddress.slice(0, 8) + "...",
448
+ symbol: "",
449
+ amount: 1n,
450
+ decimals: 0,
451
+ type: "nft",
452
+ nft: {}
453
+ };
454
+ });
455
+ } catch {
456
+ return [];
457
+ }
458
+ }
427
459
  async getAccountActions(address, options) {
428
460
  return [];
429
461
  }
@@ -640,9 +672,7 @@ import {
640
672
  getProviderConfig as getProviderConfig2,
641
673
  getWarpWalletAddressFromConfig,
642
674
  parseOutputOutIndex,
643
- WarpConstants as WarpConstants2,
644
- WarpCache as WarpCache2,
645
- WarpCacheKey as WarpCacheKey2
675
+ WarpConstants as WarpConstants2
646
676
  } from "@joai/warps";
647
677
  import { Connection as Connection3 } from "@solana/web3.js";
648
678
 
@@ -842,10 +872,9 @@ var WarpSolanaOutput = class {
842
872
  this.serializer = new WarpSolanaSerializer();
843
873
  const providerConfig = getProviderConfig2(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
844
874
  this.connection = new Connection3(providerConfig.url, "confirmed");
845
- this.cache = new WarpCache2(config.env, config.cache);
846
875
  }
847
- async getActionExecution(warp, actionIndex, tx) {
848
- const inputs = await this.cache.get(WarpCacheKey2.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
876
+ async getActionExecution(warp, actionIndex, tx, injectedInputs) {
877
+ const inputs = injectedInputs ?? [];
849
878
  const resolvedInputs = extractResolvedInputValues(inputs);
850
879
  if (!tx) {
851
880
  return this.createFailedExecution(warp, actionIndex, resolvedInputs);
@@ -2264,7 +2293,7 @@ var NativeTokenSol = {
2264
2293
  var SolanaAdapter = createSolanaAdapter(WarpChainName5.Solana, {
2265
2294
  mainnet: {
2266
2295
  name: WarpChainName5.Solana,
2267
- displayName: "Solana Mainnet",
2296
+ displayName: "Solana",
2268
2297
  chainId: "101",
2269
2298
  blockTime: 400,
2270
2299
  addressHrp: "",