Skip to content

Commit

Permalink
Snowbridge/API version 0.1.6 (#1211)
Browse files Browse the repository at this point in the history
* improve start up performance

* history to ethereum working

* fmt

* toPolkadot tracking working

* fmt

* run all

* remove cache

* final fixes

* added max consumers check

* more fixes

* remove logging

* check max consumers

* update version

* remove apis not compatible with next

* decode transaction detail

* fmt

* tracking id

* added when field

* fix beneficiary address

* source addresses

* one fetch at a time

* add asset type

* fmt
  • Loading branch information
alistair-singh authored May 29, 2024
1 parent af0acb1 commit 20c271c
Show file tree
Hide file tree
Showing 12 changed files with 1,512 additions and 49 deletions.
2 changes: 1 addition & 1 deletion web/packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@snowbridge/api",
"version": "0.1.5",
"version": "0.1.6",
"description": "Snowbridge API client",
"license": "Apache-2.0",
"repository": {
Expand Down
11 changes: 10 additions & 1 deletion web/packages/api/src/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,16 @@ export const assetErc20Balance = async (
}
}

export const assetErc20Metadata = async (context: Context, tokenAddress: string) => {
export type ERC20Metadata = {
name: string
symbol: string
decimals: bigint
}

export const assetErc20Metadata = async (
context: Context,
tokenAddress: string
): Promise<ERC20Metadata> => {
const tokenMetadata = IERC20Metadata__factory.connect(tokenAddress, context.ethereum.api)
const [name, symbol, decimals] = await Promise.all([
tokenMetadata.name(),
Expand Down
21 changes: 21 additions & 0 deletions web/packages/api/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export type Config = {
SECONDARY_GOVERNANCE_CHANNEL_ID: string
RELAYERS: Relayer[]
PARACHAINS: string[]
SUBSCAN_API?: {
RELAY_CHAIN_URL: string
ASSET_HUB_URL: string
BRIDGE_HUB_URL: string
}
}

export type SourceType = "substrate" | "ethereum"
Expand All @@ -21,6 +26,7 @@ export type ParachainInfo = {
destinationFeeDOT: bigint
has20ByteAccounts: boolean
decimals: number
maxConsumers: number
ss58Format?: number
}
export type TransferLocation = {
Expand Down Expand Up @@ -61,6 +67,7 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
destinationFeeDOT: 0n,
has20ByteAccounts: false,
decimals: 12,
maxConsumers: 16,
},
erc20tokensReceivable: {
WETH: "0x87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d",
Expand All @@ -76,6 +83,7 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
destinationFeeDOT: 4_000_000_000n,
has20ByteAccounts: false,
decimals: 12,
maxConsumers: 16,
},
erc20tokensReceivable: {
WETH: "0x87d1f7fdfEe7f651FaBc8bFCB6E086C278b77A7d",
Expand Down Expand Up @@ -165,6 +173,7 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
destinationFeeDOT: 0n,
has20ByteAccounts: false,
decimals: 12,
maxConsumers: 16,
},
erc20tokensReceivable: {
WETH: "0xfff9976782d46cc05630d1f6ebab18b2324d6b14",
Expand All @@ -182,6 +191,7 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
destinationFeeDOT: 200_000_000_000n,
has20ByteAccounts: true,
decimals: 12,
maxConsumers: 16,
},
erc20tokensReceivable: {
MUSE: "0xb34a6924a02100ba6ef12af1c798285e8f7a16ee",
Expand Down Expand Up @@ -235,6 +245,11 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
type: "ethereum",
},
],
SUBSCAN_API: {
RELAY_CHAIN_URL: "https://rococo.api.subscan.io",
ASSET_HUB_URL: "https://assethub-rococo.api.subscan.io",
BRIDGE_HUB_URL: "https://bridgehub-rococo.api.subscan.io",
},
},
},
polkadot_mainnet: {
Expand All @@ -259,6 +274,7 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
destinationFeeDOT: 0n,
has20ByteAccounts: false,
decimals: 10,
maxConsumers: 64,
},
erc20tokensReceivable: {
WETH: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
Expand Down Expand Up @@ -312,6 +328,11 @@ export const SNOWBRIDGE_ENV: { [id: string]: SnowbridgeEnvironment } = {
type: "ethereum",
},
],
SUBSCAN_API: {
RELAY_CHAIN_URL: "https://polkadot.api.subscan.io",
ASSET_HUB_URL: "https://assethub-polkadot.api.subscan.io",
BRIDGE_HUB_URL: "https://bridgehub-polkadot.api.subscan.io",
},
},
},
}
Loading

0 comments on commit 20c271c

Please sign in to comment.