@vleap/warps-adapter-fastset 0.1.0-alpha.15 → 0.1.0-alpha.17

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
@@ -1,4 +1,4 @@
1
- import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpDataLoaderOptions, WarpChainAction, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
2
2
  import * as _mysten_bcs from '@mysten/bcs';
3
3
 
4
4
  declare const WarpFastsetConstants: {};
@@ -182,6 +182,16 @@ interface FastsetJsonRpcResponse<T = unknown> {
182
182
  data?: unknown;
183
183
  };
184
184
  }
185
+ interface FastsetAssetBalance {
186
+ asset_id: string;
187
+ balance: string;
188
+ name?: string;
189
+ decimals?: number;
190
+ logo_url?: string;
191
+ }
192
+ interface FastsetAssetBalances {
193
+ [assetId: string]: FastsetAssetBalance;
194
+ }
185
195
 
186
196
  interface ClaimData {
187
197
  [key: string]: unknown;
@@ -213,9 +223,11 @@ interface FastsetClientConfig {
213
223
  }
214
224
  declare class FastsetClient {
215
225
  private config;
216
- constructor(config: FastsetClientConfig);
226
+ constructor(config?: FastsetClientConfig);
217
227
  getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
218
228
  getNextNonce(senderAddress: string): Promise<number>;
229
+ getAssetBalance(accountId: string, assetId: string): Promise<FastsetAssetBalance | null>;
230
+ getAssetBalances(accountId: string): Promise<FastsetAssetBalances | null>;
219
231
  fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
220
232
  submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
221
233
  submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
@@ -292,6 +304,8 @@ declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
292
304
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
293
305
  getAccount(address: string): Promise<WarpChainAccount>;
294
306
  getAccountAssets(address: string): Promise<WarpChainAsset[]>;
307
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
308
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
295
309
  getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
296
310
  getAccountInfo(address: string): Promise<FastsetAccountData | null>;
297
311
  getTransactionInfo(txHash: string): Promise<FastsetTransactionData | null>;
@@ -300,6 +314,7 @@ declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
300
314
  balance: string;
301
315
  balanceDecimal: number;
302
316
  } | null>;
317
+ getAssetBalance(address: string, assetId: string): Promise<WarpChainAsset | null>;
303
318
  }
304
319
 
305
320
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
@@ -360,4 +375,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
360
375
  stringToTyped(value: string): any;
361
376
  }
362
377
 
363
- export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
378
+ export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, type FastsetAssetBalance, type FastsetAssetBalances, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpDataLoaderOptions, WarpChainAction, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
1
+ import { WarpChainAsset, AdapterFactory, AdapterWarpDataLoader, WarpClientConfig, WarpChainInfo, WarpChainAccount, WarpChainAction, WarpDataLoaderOptions, AdapterWarpExecutor, WarpExecutable, WarpActionInputType, AdapterWarpExplorer, AdapterWarpResults, Warp, WarpExecution, ResolvedInput, WarpExecutionResults, AdapterWarpSerializer, WarpSerializer, WarpNativeValue, BaseWarpActionInputType, WarpAdapterGenericType } from '@vleap/warps';
2
2
  import * as _mysten_bcs from '@mysten/bcs';
3
3
 
4
4
  declare const WarpFastsetConstants: {};
@@ -182,6 +182,16 @@ interface FastsetJsonRpcResponse<T = unknown> {
182
182
  data?: unknown;
183
183
  };
184
184
  }
185
+ interface FastsetAssetBalance {
186
+ asset_id: string;
187
+ balance: string;
188
+ name?: string;
189
+ decimals?: number;
190
+ logo_url?: string;
191
+ }
192
+ interface FastsetAssetBalances {
193
+ [assetId: string]: FastsetAssetBalance;
194
+ }
185
195
 
186
196
  interface ClaimData {
187
197
  [key: string]: unknown;
@@ -213,9 +223,11 @@ interface FastsetClientConfig {
213
223
  }
214
224
  declare class FastsetClient {
215
225
  private config;
216
- constructor(config: FastsetClientConfig);
226
+ constructor(config?: FastsetClientConfig);
217
227
  getAccountInfo(address: string): Promise<FastsetAccountInfo | null>;
218
228
  getNextNonce(senderAddress: string): Promise<number>;
229
+ getAssetBalance(accountId: string, assetId: string): Promise<FastsetAssetBalance | null>;
230
+ getAssetBalances(accountId: string): Promise<FastsetAssetBalances | null>;
219
231
  fundFromFaucet(recipientAddress: string, amount: string): Promise<FastsetFaucetResponse>;
220
232
  submitTransaction(request: FastsetSubmitTransactionRequest): Promise<FastsetSubmitTransactionResponse>;
221
233
  submitCertificate(request: FastsetSubmitCertificateRequest): Promise<void>;
@@ -292,6 +304,8 @@ declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
292
304
  constructor(config: WarpClientConfig, chain: WarpChainInfo);
293
305
  getAccount(address: string): Promise<WarpChainAccount>;
294
306
  getAccountAssets(address: string): Promise<WarpChainAsset[]>;
307
+ getAsset(identifier: string): Promise<WarpChainAsset | null>;
308
+ getAction(identifier: string, awaitCompleted?: boolean): Promise<WarpChainAction | null>;
295
309
  getAccountActions(address: string, options?: WarpDataLoaderOptions): Promise<WarpChainAction[]>;
296
310
  getAccountInfo(address: string): Promise<FastsetAccountData | null>;
297
311
  getTransactionInfo(txHash: string): Promise<FastsetTransactionData | null>;
@@ -300,6 +314,7 @@ declare class WarpFastsetDataLoader implements AdapterWarpDataLoader {
300
314
  balance: string;
301
315
  balanceDecimal: number;
302
316
  } | null>;
317
+ getAssetBalance(address: string, assetId: string): Promise<WarpChainAsset | null>;
303
318
  }
304
319
 
305
320
  declare class WarpFastsetExecutor implements AdapterWarpExecutor {
@@ -360,4 +375,4 @@ declare class WarpFastsetSerializer implements AdapterWarpSerializer {
360
375
  stringToTyped(value: string): any;
361
376
  }
362
377
 
363
- export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
378
+ export { Address, Amount, BcsTransaction, Bytes32, Claim, type ClaimData, ClaimType, type FastsetAccountData, type FastsetAccountInfo, type FastsetAssetBalance, type FastsetAssetBalances, FastsetClient, type FastsetClientConfig, type FastsetFaucetRequest, type FastsetFaucetResponse, type FastsetJsonRpcRequest, type FastsetJsonRpcResponse, type FastsetSubmitCertificateRequest, type FastsetSubmitTransactionRequest, type FastsetSubmitTransactionResponse, type FastsetTransaction, type FastsetTransactionData, type FastsetTransferRequest, NativeTokenSet, Nonce, PublicKey, Transaction, type TransactionOptions, Transfer, TransferClaim, UserData, Wallet, type WalletConfig, type WalletInfo, WarpFastsetConstants, WarpFastsetDataLoader, WarpFastsetExecutor, WarpFastsetExplorer, WarpFastsetResults, WarpFastsetSerializer, getFastsetAdapter };
package/dist/index.js CHANGED
@@ -268,9 +268,14 @@ var Wallet = class _Wallet {
268
268
  BigInt.prototype.toJSON = function() {
269
269
  return Number(this);
270
270
  };
271
+ var FASTSET_VALIDATOR_URL = "http://157.90.201.117:8765";
272
+ var FASTSET_PROXY_URL = "http://136.243.61.168:44444";
271
273
  var FastsetClient = class {
272
274
  constructor(config) {
273
- this.config = config;
275
+ this.config = config || {
276
+ validatorUrl: FASTSET_VALIDATOR_URL,
277
+ proxyUrl: FASTSET_PROXY_URL
278
+ };
274
279
  }
275
280
  async getAccountInfo(address) {
276
281
  try {
@@ -278,9 +283,6 @@ var FastsetClient = class {
278
283
  const response = await this.requestValidator("set_getAccountInfo", {
279
284
  address: Array.from(addressBytes)
280
285
  });
281
- if (response.error) {
282
- return null;
283
- }
284
286
  return response.result;
285
287
  } catch (error) {
286
288
  return null;
@@ -290,15 +292,33 @@ var FastsetClient = class {
290
292
  const accountInfo = await this.getAccountInfo(senderAddress);
291
293
  return accountInfo?.next_nonce ?? 0;
292
294
  }
295
+ async getAssetBalance(accountId, assetId) {
296
+ try {
297
+ const response = await this.requestValidator("vsl_getAssetBalance", {
298
+ account_id: accountId,
299
+ assert_id: assetId
300
+ });
301
+ return response.result;
302
+ } catch (error) {
303
+ return null;
304
+ }
305
+ }
306
+ async getAssetBalances(accountId) {
307
+ try {
308
+ const response = await this.requestValidator("vsl_getAssetBalances", {
309
+ account_id: accountId
310
+ });
311
+ return response.result;
312
+ } catch (error) {
313
+ return null;
314
+ }
315
+ }
293
316
  async fundFromFaucet(recipientAddress, amount) {
294
317
  const recipientBytes = Wallet.decodeBech32Address(recipientAddress);
295
318
  const response = await this.requestProxy("faucetDrip", {
296
319
  recipient: Array.from(recipientBytes),
297
320
  amount
298
321
  });
299
- if (response.error) {
300
- throw new Error(`Faucet request failed: ${response.error.message}`);
301
- }
302
322
  return response.result;
303
323
  }
304
324
  async submitTransaction(request) {
@@ -306,9 +326,6 @@ var FastsetClient = class {
306
326
  transaction: request.transaction,
307
327
  signature: Array.from(request.signature)
308
328
  });
309
- if (response.error) {
310
- throw new Error(`Transaction submission failed: ${response.error.message}`);
311
- }
312
329
  const result = response.result;
313
330
  return {
314
331
  transaction_hash: new Uint8Array(result.transaction_hash),
@@ -317,14 +334,11 @@ var FastsetClient = class {
317
334
  };
318
335
  }
319
336
  async submitCertificate(request) {
320
- const response = await this.requestValidator("set_submitTransactionCertificate", {
337
+ await this.requestValidator("set_submitTransactionCertificate", {
321
338
  transaction: request.transaction,
322
339
  signature: Array.from(request.signature),
323
340
  validator_signatures: request.validator_signatures.map(([validator, signature]) => [Array.from(validator), Array.from(signature)])
324
341
  });
325
- if (response.error) {
326
- throw new Error(`Certificate submission failed: ${response.error.message}`);
327
- }
328
342
  }
329
343
  async executeTransfer(senderPrivateKey, recipient, amount, userData) {
330
344
  const senderPublicKey = await (0, import_ed255192.getPublicKey)(senderPrivateKey);
@@ -385,9 +399,6 @@ var FastsetClient = class {
385
399
  const response = await this.requestValidator("set_getTransactionStatus", {
386
400
  hash: txHash
387
401
  });
388
- if (response.error) {
389
- return null;
390
- }
391
402
  return response.result;
392
403
  } catch (error) {
393
404
  return null;
@@ -398,9 +409,6 @@ var FastsetClient = class {
398
409
  const response = await this.requestValidator("set_getTransactionInfo", {
399
410
  hash: txHash
400
411
  });
401
- if (response.error) {
402
- return null;
403
- }
404
412
  return response.result;
405
413
  } catch (error) {
406
414
  return null;
@@ -409,9 +417,6 @@ var FastsetClient = class {
409
417
  async getNetworkInfo() {
410
418
  try {
411
419
  const response = await this.requestValidator("set_getNetworkInfo", {});
412
- if (response.error) {
413
- return null;
414
- }
415
420
  return response.result;
416
421
  } catch (error) {
417
422
  return null;
@@ -424,21 +429,30 @@ var FastsetClient = class {
424
429
  return this.request(this.config.proxyUrl, method, params);
425
430
  }
426
431
  async request(url, method, params) {
427
- const request = {
428
- jsonrpc: "2.0",
429
- id: 1,
430
- method,
431
- params
432
- };
433
- const response = await fetch(url, {
434
- method: "POST",
435
- headers: { "Content-Type": "application/json" },
436
- body: JSON.stringify(request, this.jsonReplacer)
437
- });
438
- if (!response.ok) {
439
- throw new Error(`HTTP request failed: ${response.statusText}`);
432
+ try {
433
+ const request = {
434
+ jsonrpc: "2.0",
435
+ id: 1,
436
+ method,
437
+ params
438
+ };
439
+ const response = await fetch(url, {
440
+ method: "POST",
441
+ headers: { "Content-Type": "application/json" },
442
+ body: JSON.stringify(request, this.jsonReplacer)
443
+ });
444
+ if (!response.ok) {
445
+ throw new Error(`HTTP request failed: ${response.statusText}`);
446
+ }
447
+ const jsonResponse = await response.json();
448
+ if (jsonResponse.error) {
449
+ throw new Error(`RPC error: ${jsonResponse.error.message}`);
450
+ }
451
+ return jsonResponse;
452
+ } catch (error) {
453
+ console.error(`Fastset RPC request failed: ${error}`);
454
+ throw error;
440
455
  }
441
- return response.json();
442
456
  }
443
457
  jsonReplacer(key, value) {
444
458
  if (value instanceof Uint8Array) {
@@ -453,108 +467,100 @@ var WarpFastsetDataLoader = class {
453
467
  constructor(config, chain) {
454
468
  this.config = config;
455
469
  this.chain = chain;
456
- const validatorUrl = this.chain.defaultApiUrl;
457
- const proxyUrl = this.chain.defaultApiUrl;
458
- this.client = new FastsetClient({
459
- validatorUrl,
460
- proxyUrl
461
- });
470
+ this.client = new FastsetClient();
462
471
  }
463
472
  async getAccount(address) {
464
- try {
465
- const accountInfo = await this.client.getAccountInfo(address);
466
- if (!accountInfo) {
467
- return {
468
- chain: this.chain.name,
469
- address,
470
- balance: BigInt(0)
471
- };
472
- }
473
- return {
474
- chain: this.chain.name,
475
- address,
476
- balance: BigInt(parseInt(accountInfo.balance, 16))
477
- };
478
- } catch (error) {
473
+ const accountInfo = await this.client.getAccountInfo(address);
474
+ if (!accountInfo) {
479
475
  return {
480
476
  chain: this.chain.name,
481
477
  address,
482
478
  balance: BigInt(0)
483
479
  };
484
480
  }
481
+ return {
482
+ chain: this.chain.name,
483
+ address,
484
+ balance: BigInt(parseInt(accountInfo.balance, 16))
485
+ };
485
486
  }
486
487
  async getAccountAssets(address) {
487
- try {
488
- const account = await this.getAccount(address);
489
- if (account.balance > 0) {
490
- return [
491
- {
492
- chain: this.chain.name,
493
- identifier: this.chain.nativeToken?.identifier || "SET",
494
- name: this.chain.nativeToken?.name || "SET",
495
- decimals: this.chain.nativeToken?.decimals || 6,
496
- amount: account.balance,
497
- logoUrl: this.chain.nativeToken?.logoUrl
488
+ const accountReq = this.getAccount(address);
489
+ const assetBalancesReq = this.client.getAssetBalances(address);
490
+ const [account, assetBalances] = await Promise.all([accountReq, assetBalancesReq]);
491
+ const assets = [];
492
+ if (account.balance > 0) {
493
+ assets.push({
494
+ chain: this.chain.name,
495
+ identifier: this.chain.nativeToken?.identifier || "SET",
496
+ name: this.chain.nativeToken?.name || "SET",
497
+ decimals: this.chain.nativeToken?.decimals || 6,
498
+ amount: account.balance,
499
+ logoUrl: this.chain.nativeToken?.logoUrl
500
+ });
501
+ }
502
+ if (assetBalances) {
503
+ for (const [assetId, assetBalance] of Object.entries(assetBalances)) {
504
+ if (assetBalance.balance) {
505
+ const amount = BigInt(assetBalance.balance);
506
+ if (amount > 0) {
507
+ assets.push({
508
+ chain: this.chain.name,
509
+ identifier: assetId,
510
+ name: assetBalance.name || assetId,
511
+ decimals: assetBalance.decimals || 6,
512
+ amount,
513
+ logoUrl: assetBalance.logo_url
514
+ });
498
515
  }
499
- ];
516
+ }
500
517
  }
501
- return [];
502
- } catch (error) {
503
- return [];
504
518
  }
519
+ return assets;
520
+ }
521
+ async getAsset(identifier) {
522
+ return null;
523
+ }
524
+ async getAction(identifier, awaitCompleted = false) {
525
+ return null;
505
526
  }
506
527
  async getAccountActions(address, options) {
507
528
  return [];
508
529
  }
509
530
  async getAccountInfo(address) {
510
- try {
511
- const accountInfo = await this.client.getAccountInfo(address);
512
- if (!accountInfo) {
513
- return null;
514
- }
515
- const balanceDecimal = parseInt(accountInfo.balance, 16);
516
- return {
517
- address,
518
- balance: accountInfo.balance,
519
- balanceDecimal,
520
- nextNonce: accountInfo.next_nonce,
521
- sequenceNumber: accountInfo.sequence_number
522
- };
523
- } catch (error) {
524
- console.error("Error getting account info:", error);
531
+ const accountInfo = await this.client.getAccountInfo(address);
532
+ if (!accountInfo) {
525
533
  return null;
526
534
  }
535
+ const balanceDecimal = parseInt(accountInfo.balance, 16);
536
+ return {
537
+ address,
538
+ balance: accountInfo.balance,
539
+ balanceDecimal,
540
+ nextNonce: accountInfo.next_nonce,
541
+ sequenceNumber: accountInfo.sequence_number
542
+ };
527
543
  }
528
544
  async getTransactionInfo(txHash) {
529
- try {
530
- return {
545
+ return {
546
+ hash: txHash,
547
+ hashHex: txHash.startsWith("0x") ? txHash.slice(2) : txHash,
548
+ status: "submitted",
549
+ details: {
531
550
  hash: txHash,
532
- hashHex: txHash.startsWith("0x") ? txHash.slice(2) : txHash,
533
- status: "submitted",
534
- details: {
535
- hash: txHash,
536
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
537
- }
538
- };
539
- } catch (error) {
540
- console.error("Error getting transaction info:", error);
541
- return null;
542
- }
551
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
552
+ }
553
+ };
543
554
  }
544
555
  async checkTransferStatus(fromAddress, toAddress, amount) {
545
- try {
546
- const fromAccount = await this.getAccountInfo(fromAddress);
547
- const toAccount = await this.getAccountInfo(toAddress);
548
- if (!fromAccount || !toAccount) {
549
- return false;
550
- }
551
- const transferAmount = parseInt(amount);
552
- const fromBalance = fromAccount.balanceDecimal;
553
- return fromBalance < transferAmount;
554
- } catch (error) {
555
- console.error("Error checking transfer status:", error);
556
+ const fromAccount = await this.getAccountInfo(fromAddress);
557
+ const toAccount = await this.getAccountInfo(toAddress);
558
+ if (!fromAccount || !toAccount) {
556
559
  return false;
557
560
  }
561
+ const transferAmount = parseInt(amount);
562
+ const fromBalance = fromAccount.balanceDecimal;
563
+ return fromBalance < transferAmount;
558
564
  }
559
565
  async getAccountBalance(address) {
560
566
  const accountInfo = await this.getAccountInfo(address);
@@ -566,6 +572,24 @@ var WarpFastsetDataLoader = class {
566
572
  balanceDecimal: accountInfo.balanceDecimal
567
573
  };
568
574
  }
575
+ async getAssetBalance(address, assetId) {
576
+ const assetBalance = await this.client.getAssetBalance(address, assetId);
577
+ if (!assetBalance || !assetBalance.balance) {
578
+ return null;
579
+ }
580
+ const amount = BigInt(assetBalance.balance);
581
+ if (amount === 0n) {
582
+ return null;
583
+ }
584
+ return {
585
+ chain: this.chain.name,
586
+ identifier: assetId,
587
+ name: assetBalance.name || assetId,
588
+ decimals: assetBalance.decimals || 6,
589
+ amount,
590
+ logoUrl: assetBalance.logo_url
591
+ };
592
+ }
569
593
  };
570
594
 
571
595
  // src/WarpFastsetExecutor.ts