-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fetch chaindata from Talisman chaindata * fix linter errors * add graphql * Native asset transfers * native transfer * token pallet transfers * orml * remove * fix linter errors * remove accidentally added code * fix ci * format * cleanup & small fixes * edge case minor problem fix * error handling --------- Co-authored-by: cute0laf <oliverlim818@gmail.com>
- Loading branch information
Showing
23 changed files
with
458 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { gql, request } from 'graphql-request'; | ||
|
||
const graphqlUrl = 'https://squid.subsquid.io/chaindata/v/v4/graphql'; | ||
|
||
/// NOTE: this file is copied from the talisman chaindata. | ||
|
||
const chainsQuery = gql` | ||
query chains { | ||
chains(orderBy: sortIndex_ASC) { | ||
id | ||
name | ||
paraId | ||
relay { | ||
id | ||
} | ||
rpcs { | ||
url | ||
} | ||
} | ||
} | ||
`; | ||
|
||
const tokensQuery = gql` | ||
query tokens { | ||
tokens(orderBy: id_ASC) { | ||
data | ||
} | ||
} | ||
`; | ||
|
||
export const getChains = async (): Promise<Array<any>> => { | ||
const result: any = await request(graphqlUrl, chainsQuery); | ||
return result.chains; | ||
}; | ||
|
||
export const getTokens = async (): Promise<Array<any>> => { | ||
const result: any = await request(graphqlUrl, tokensQuery); | ||
return result.tokens; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import axios from 'axios'; | ||
|
||
const ss58registry = async (chainName: string): Promise<number | null> => { | ||
const ss58Registry = (await axios.get('https://raw.githubusercontent.com/paritytech/ss58-registry/main/ss58-registry.json')).data.registry; | ||
|
||
const result: any = ss58Registry.find((chain: any) => chain.network === chainName); | ||
|
||
if (!result) { | ||
return null | ||
} | ||
|
||
return result.prefix; | ||
} | ||
|
||
export default ss58registry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.