Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions web/packages/api/src/assets_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ export type TransferLocation = {
ethChain?: EthereumChain
}

export type AggregatedAsset = {
tokenErcMetadata: ERC20Metadata
ahAssetMetadata: Asset
sourceAssetMetadata: Asset
amount: bigint
}
Comment on lines +114 to +119
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we don't want to change the SDK interface too often, can we add a field to distinguish if an asset is an ERC-20 or PNA, so we don't have to change the interface later? Or does this type already support this?

We don't have to add PNA support right now, but the interface should be defined with PNA in mind so we don't need to make unnecessary changes later.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An Asset with a non-nil location field is treated as PNA; otherwise, it’s ENA.
It’s a bit implicit, though — we might consider adding an explicit flag to make this clearer.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a flag would be cool yeah! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


export type ConcreteAsset = {
id: Asset
amount: bigint
}

export type ConcreteToken = {
address: string
amount: bigint
}

export const ETHER_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000"

export async function buildRegistry(options: RegistryOptions): Promise<AssetRegistry> {
Expand Down
3 changes: 3 additions & 0 deletions web/packages/api/src/parachains/assethub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export class AssetHubParachain extends ParachainBase {
minimumBalance: BigInt(assetInfo?.minBalance),
isSufficient: Boolean(assetInfo?.isSufficient),
assetId: String(assetId),
isPNA: true,
}
} else if (
locationOnAH?.parents == DOT_LOCATION.parents &&
Expand All @@ -135,6 +136,7 @@ export class AssetHubParachain extends ParachainBase {
foreignId: foreignId,
minimumBalance: BigInt(existentialDeposit as any),
isSufficient: true,
isPNA: true,
}
} else {
let assetType = this.provider.registry.createType(
Expand Down Expand Up @@ -181,6 +183,7 @@ export class AssetHubParachain extends ParachainBase {
foreignId: foreignId,
minimumBalance: BigInt(assetInfo?.minBalance),
isSufficient: Boolean(assetInfo?.isSufficient),
isPNA: true,
}
}
}
Expand Down
1 change: 1 addition & 0 deletions web/packages/api/src/parachains/frequency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class FrequencyParachain extends ParachainBase {
location: HERE_LOCATION,
locationOnAH: FREQUENCY_TOKEN_LOCATION_ON_WESTEND_AH,
locationOnEthereum: FREQUENCY_WESTEND_TOKEN_LOCATION_ON_ETHEREUM,
isPNA: true,
}
} else {
throw Error(
Expand Down
1 change: 1 addition & 0 deletions web/packages/api/src/parachains/penpal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export class PenpalParachain extends ParachainBase {
minimumBalance: BigInt(assetInfo?.minBalance),
isSufficient: Boolean(assetInfo?.isSufficient),
assetId: String(assetId),
isPNA: true,
}
}
}
Expand Down
Loading