@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.d.cts CHANGED
@@ -83,6 +83,7 @@ declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
83
83
  getAccountAssets(address: string): Promise<WarpChainAsset[]>;
84
84
  getAsset(identifier: string): Promise<WarpChainAsset | null>;
85
85
  getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
86
+ getAccountNfts(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAsset[]>;
86
87
  getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
87
88
  private getTokenBalances;
88
89
  private getTokenMetadata;
@@ -154,9 +155,8 @@ declare class WarpSolanaOutput implements AdapterWarpOutput {
154
155
  private readonly chain;
155
156
  private readonly serializer;
156
157
  private readonly connection;
157
- private readonly cache;
158
158
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
159
- getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
159
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction, injectedInputs?: ResolvedInput[]): Promise<WarpActionExecutionResult>;
160
160
  private createFailedExecution;
161
161
  private handleWarpChainAction;
162
162
  private handleTransactionSignature;
package/dist/index.d.ts CHANGED
@@ -83,6 +83,7 @@ declare class WarpSolanaDataLoader implements AdapterWarpDataLoader {
83
83
  getAccountAssets(address: string): Promise<WarpChainAsset[]>;
84
84
  getAsset(identifier: string): Promise<WarpChainAsset | null>;
85
85
  getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
86
+ getAccountNfts(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAsset[]>;
86
87
  getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
87
88
  private getTokenBalances;
88
89
  private getTokenMetadata;
@@ -154,9 +155,8 @@ declare class WarpSolanaOutput implements AdapterWarpOutput {
154
155
  private readonly chain;
155
156
  private readonly serializer;
156
157
  private readonly connection;
157
- private readonly cache;
158
158
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
159
- getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction): Promise<WarpActionExecutionResult>;
159
+ getActionExecution(warp: Warp, actionIndex: WarpActionIndex, tx: WarpAdapterGenericRemoteTransaction, injectedInputs?: ResolvedInput[]): Promise<WarpActionExecutionResult>;
160
160
  private createFailedExecution;
161
161
  private handleWarpChainAction;
162
162
  private handleTransactionSignature;
package/dist/index.js CHANGED
@@ -472,6 +472,38 @@ var WarpSolanaDataLoader = class {
472
472
  return null;
473
473
  }
474
474
  }
475
+ async getAccountNfts(address, options) {
476
+ try {
477
+ const publicKey = new import_web32.PublicKey(address);
478
+ const tokenAccounts = await this.connection.getParsedTokenAccountsByOwner(publicKey, {
479
+ programId: new import_web32.PublicKey(WarpSolanaConstants.Programs.TokenProgram)
480
+ });
481
+ const size = options?.size || 25;
482
+ const page = options?.page || 0;
483
+ const from = page * size;
484
+ const nftAccounts = tokenAccounts.value.filter((tokenAccount) => {
485
+ const decimals = tokenAccount.account.data.parsed.info.tokenAmount.decimals;
486
+ const amount = tokenAccount.account.data.parsed.info.tokenAmount.amount;
487
+ return decimals === 0 && amount === "1";
488
+ });
489
+ const paged = nftAccounts.slice(from, from + size);
490
+ return paged.map((tokenAccount) => {
491
+ const mintAddress = tokenAccount.account.data.parsed.info.mint;
492
+ return {
493
+ chain: this.chain.name,
494
+ identifier: mintAddress,
495
+ name: mintAddress.slice(0, 8) + "...",
496
+ symbol: "",
497
+ amount: 1n,
498
+ decimals: 0,
499
+ type: "nft",
500
+ nft: {}
501
+ };
502
+ });
503
+ } catch {
504
+ return [];
505
+ }
506
+ }
475
507
  async getAccountActions(address, options) {
476
508
  return [];
477
509
  }
@@ -871,10 +903,9 @@ var WarpSolanaOutput = class {
871
903
  this.serializer = new WarpSolanaSerializer();
872
904
  const providerConfig = (0, import_warps7.getProviderConfig)(this.config, this.chain.name, this.config.env, this.chain.defaultApiUrl);
873
905
  this.connection = new import_web34.Connection(providerConfig.url, "confirmed");
874
- this.cache = new import_warps7.WarpCache(config.env, config.cache);
875
906
  }
876
- async getActionExecution(warp, actionIndex, tx) {
877
- const inputs = await this.cache.get(import_warps7.WarpCacheKey.WarpExecutable(this.config.env, warp.meta?.hash || "", actionIndex)) ?? [];
907
+ async getActionExecution(warp, actionIndex, tx, injectedInputs) {
908
+ const inputs = injectedInputs ?? [];
878
909
  const resolvedInputs = (0, import_warps7.extractResolvedInputValues)(inputs);
879
910
  if (!tx) {
880
911
  return this.createFailedExecution(warp, actionIndex, resolvedInputs);
@@ -2275,7 +2306,7 @@ var NativeTokenSol = {
2275
2306
  var SolanaAdapter = createSolanaAdapter(import_warps13.WarpChainName.Solana, {
2276
2307
  mainnet: {
2277
2308
  name: import_warps13.WarpChainName.Solana,
2278
- displayName: "Solana Mainnet",
2309
+ displayName: "Solana",
2279
2310
  chainId: "101",
2280
2311
  blockTime: 400,
2281
2312
  addressHrp: "",