Skip to content

Commit

Permalink
Aug 5, 2024, 5:34 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 5, 2024
1 parent b442527 commit 9380be4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/balance-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export abstract class BalanceAdapter {
// get asset registry object by chain and id
let assetRegistryObject = getAssetRegistryObject(paraId, tokenId, relay)
tokenConfig = createBasicTokenFromAsset(assetRegistryObject)
throw new TokenNotFound(token, this.chain);

// Will throw AssetObjectNotFound error if not found
}


Expand Down
4 changes: 3 additions & 1 deletion src/custom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url';
import { ChainId } from './configs';
import { kusamaChains } from './configs/chains/kusama-chains';
import { polkadotChains } from './configs/chains/polkadot-chains';
import { AssetObjectNotFound } from './errors';
const __dirname = path.dirname(fileURLToPath(import.meta.url));

export function getAdapter(relay: Relay, paraId: number){
Expand Down Expand Up @@ -170,7 +171,8 @@ export function getAssetRegistryObject(paraId: number, localId: string, relay: R
return assetRegistryObject.tokenData.chain == paraId && JSON.stringify(assetRegistryObject.tokenData.localId).replace(/\\|"/g, "") == localId
})
if(asset == undefined){
throw new Error(`Balance Adapter: Asset not found in registry: chainId: ${paraId}, localId: ${localId} | localId stringify: ${JSON.stringify(localId)}`)
// throw new Error(`Balance Adapter: Asset not found in registry: chainId: ${paraId}, localId: ${localId} | localId stringify: ${JSON.stringify(localId)}`)
throw new AssetObjectNotFound(localId, paraId)
}
return asset
}
Expand Down
3 changes: 2 additions & 1 deletion src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export class AssetObjectNotFound extends Error{
constructor(tokenId: string, paraId: number){
super();

this.message = `TokenNotFound and can't find asset in asset registry. | token id: ${tokenId} | para id: ${paraId}`
let idStringified = `${JSON.stringify(tokenId)}`
this.message = `BalanceAdapter: TokenNotFound and can't find asset in asset registry. | token id: ${tokenId} | para id: ${paraId} | stringified: ${idStringified} `
this.name = 'AssetObjectNotFound'
}
}
Expand Down

0 comments on commit 9380be4

Please sign in to comment.