Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/other token details #10

Merged
merged 24 commits into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
2f771f2
feat: adding token manager type and address
canhtrinh Jan 31, 2024
520b0d2
feat: add other details to interchain token schema
canhtrinh Jan 31, 2024
e4d964f
chore: update existing data to follow schema
canhtrinh Jan 31, 2024
4d466bb
Update cli/schemas/interchain-tokenlist.ts
canhtrinh Feb 2, 2024
b200732
Update cli/wizard/commands/list-squid-token/index.ts
canhtrinh Feb 2, 2024
dfd27a6
Update registry/mainnet/interchain/squid.tokenlist.json
canhtrinh Feb 2, 2024
9a243fc
Update registry/mainnet/interchain/squid.tokenlist.json
canhtrinh Feb 2, 2024
9dee800
chore: update schemas for tokenManager, minter, and salt
canhtrinh Feb 2, 2024
67d8c0a
chore: update schema of squid list
canhtrinh Feb 2, 2024
db1a885
feat: add TDBG19 token
canhtrinh Feb 2, 2024
cc2558c
chore: adding tokenType and srcTxHash to cli
canhtrinh Feb 2, 2024
d607238
chore: add srcTxHash to schema
canhtrinh Feb 2, 2024
bf48b8b
chore: clean up stagenet file
canhtrinh Feb 2, 2024
2f87f1a
chore: code cleanup
canhtrinh Feb 2, 2024
2c51a15
chore: updating lint job for cli,registry,scripts
canhtrinh Feb 2, 2024
80d2f8d
chore: set latest bun
alanrsoares Feb 3, 2024
6d2a2cc
chore: rebuild lockfile
alanrsoares Feb 3, 2024
eca0ecd
chore: rename property srcTxHash -> deploymentTxHash
alanrsoares Feb 3, 2024
88cfcff
chore: rename property tokenManagerAddress -> tokenManager
alanrsoares Feb 3, 2024
0cb0266
fix: type mapping on script
alanrsoares Feb 3, 2024
ab42ea3
chore: fix tokenList
alanrsoares Feb 3, 2024
383635c
chore: schema cleanup
canhtrinh Feb 4, 2024
e51dce9
chore: change interface name for InterchainTokenInfoBaseAPIResponse
canhtrinh Feb 4, 2024
80da059
chore: replace deploymentMessageId with deploymentTxHash
canhtrinh Feb 4, 2024
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
18 changes: 11 additions & 7 deletions cli/schemas/interchain-tokenlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,31 @@ export const IconUrlsSchema = z.object({
svg: z.string().url(),
});

export const remoteToken = z.object({
export const chains = z.object({
axelarChainId: z.string(),
tokenAddress: address,
tokenManager: address,
tokenManagerType: z.string(),
});

export const interchainToken = z.object({
tokenId: hash,
tokenAddress: address,
tokenManagerAddress: address,
deployerAddress: address,
originalMinterAddress: address,
tokenManager: address,
deployer: address,
originalMinter: address,
tokenManagerType: z.string(),
symbol: z.string(),
prettySymbol: z.string(),
decimals: z.number().int(),
name: z.string(),
originAxelarChainId: z.string(),
transferType: z.string(),
tokenType: z.string(),
iconUrls: IconUrlsSchema,
remoteTokens: z.array(remoteToken),
salt: z.string(),
alanrsoares marked this conversation as resolved.
Show resolved Hide resolved
chains: z.array(chains),
coinGeckoId: z.string().optional(),
srcTxHash: hash,
alanrsoares marked this conversation as resolved.
Show resolved Hide resolved
});

export const version = z.object({
Expand All @@ -40,7 +44,7 @@ const interchainTokenList = z.object({
.regex(/^(?:\.\.\/)+schemas\/interchain-tokenlist\.schema\.json$/),
name: z.string(),
version,
tokens: z.array(interchainToken),
tokens: z.record(z.string(), interchainToken),
});

export default interchainTokenList;
Expand Down
59 changes: 40 additions & 19 deletions cli/wizard/commands/list-squid-token/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { input, confirm } from "@inquirer/prompts";
import chalk from "chalk";
import { $, fs, path, spinner } from "zx";
import { convertCase } from "@axelarjs/utils";

import {
InterchainTokenConfig,
Expand Down Expand Up @@ -75,15 +76,14 @@ export async function listSquidToken() {
await patchConfig<InterchainTokenListConfig, InterchainTokenListConfig>(
relativePath,
{
tokens: (tokens) => [...(tokens ?? []), newTokenConfig],
tokens: (tokens) => ({
...tokens,
[newTokenConfig.tokenId]: newTokenConfig,
}),
},
{
isDuplicate: (config) =>
config.tokens.some(
(token) =>
token.tokenAddress === newTokenConfig.tokenAddress ||
token.tokenId === newTokenConfig.tokenId
),
config.tokens[newTokenConfig.tokenId] !== undefined,
}
);

Expand Down Expand Up @@ -161,8 +161,8 @@ export type InterchainTokenDetails = {
originalMinterAddress: string;
canhtrinh marked this conversation as resolved.
Show resolved Hide resolved
axelarChainId: string;
tokenId: string;
deploymentTxHash: string;
deployerAddress: string;
deploymentMessageId: string;
deployer: string;
remoteTokens: RemoteInterchainToken[];
canhtrinh marked this conversation as resolved.
Show resolved Hide resolved
};

Expand All @@ -172,25 +172,46 @@ function parseAsInterchainTokenConfig(
return {
tokenId: hash.parse(data.tokenId),
tokenAddress: address.parse(data.tokenAddress),
tokenManagerAddress: address.parse(data.tokenManagerAddress),
tokenManagerType: data.tokenManagerType,
deployerAddress: data.deployerAddress,
originalMinterAddress: data.originalMinterAddress,
tokenManager: address.parse(data.tokenManagerAddress),
tokenManagerType: convertCase(
"CONSTANT_CASE",
"camelCase"
)(data.tokenManagerType),
deployer: data.deployer,
originalMinter: data.originalMinterAddress,
symbol: data.tokenSymbol,
prettySymbol: data.tokenSymbol,
decimals: data.tokenDecimals,
name: data.tokenName,
originAxelarChainId: data.axelarChainId,
transferType: data.kind,
tokenType: data.kind,
salt: data.salt,
iconUrls: {
svg: `${BASE_REPO_URL}/images/tokens/${data.tokenSymbol.toLowerCase()}.svg`,
},
remoteTokens: data.remoteTokens.map((token) => ({
axelarChainId: token.axelarChainId,
tokenAddress: address.parse(token.tokenAddress),
tokenManagerAddress: address.parse(token.tokenManagerAddress),
tokenManagerType: token.tokenManagerType,
})),
srcTxHash: data.deploymentMessageId?.split("-")[0] ?? "",
chains: [
...[
{
axelarChainId: data.axelarChainId,
tokenAddress: address.parse(data.tokenAddress),
tokenManager: address.parse(data.tokenManagerAddress),
tokenManagerType: convertCase(
"CONSTANT_CASE",
"camelCase"
)(data.tokenManagerType),
},
],
...data.remoteTokens.map((token) => ({
axelarChainId: token.axelarChainId,
tokenAddress: address.parse(token.tokenAddress),
tokenManager: address.parse(token.tokenManagerAddress),
tokenManagerType: convertCase(
"CONSTANT_CASE",
"camelCase"
)(token.tokenManagerType),
})),
],
};
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"@inquirer/prompts": "^3.2.0"
},
"devDependencies": {
"@axelarjs/utils": "^0.1.12",
"@types/prettier": "^2.7.3",
"bun-types": "^0.8.1",
"chalk": "^5.3.0",
Expand Down
45 changes: 45 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 19 additions & 11 deletions registry/mainnet/interchain/squid.tokenlist.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,55 @@
"minor": 1,
"patch": 0
},
"tokens": [
{
"tokens": {
"0xb689de707e78469c6a115fdcfd9a0c2db9f8e7ce5ade7b29526d63f4e01d77fb": {
"tokenId": "0xb689de707e78469c6a115fdcfd9a0c2db9f8e7ce5ade7b29526d63f4e01d77fb",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mint_burn",
"tokenManager": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mintBurn",
canhtrinh marked this conversation as resolved.
Show resolved Hide resolved
"symbol": "RMRK",
canhtrinh marked this conversation as resolved.
Show resolved Hide resolved
"prettySymbol": "RMRK",
"decimals": 18,
"name": "RMRK",
"originAxelarChainId": "moonbeam",
"transferType": "interchain",
"tokenType": "interchain",
canhtrinh marked this conversation as resolved.
Show resolved Hide resolved
"iconUrls": {
"svg": "/images/tokens/rmrk.svg"
},
"remoteTokens": [
"salt": "0x",
alanrsoares marked this conversation as resolved.
Show resolved Hide resolved
"srcTxHash": "",
alanrsoares marked this conversation as resolved.
Show resolved Hide resolved
"chains": [
{
"axelarChainId": "moonbeam",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mintBurn"
},
{
"axelarChainId": "polygon",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mint_burn"
"tokenManagerType": "mintBurn"
},
{
"axelarChainId": "ethereum",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mint_burn"
"tokenManagerType": "mintBurn"
},
{
"axelarChainId": "base",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mint_burn"
"tokenManagerType": "mintBurn"
},
{
"axelarChainId": "binance",
"tokenAddress": "0x524d524B4c9366be706D3A90dcf70076ca037aE3",
"tokenManagerAddress": "0x5F53895484af488e27fd33CE70a3dbD745aeAA52",
"tokenManagerType": "mint_burn"
"tokenManagerType": "mintBurn"
}
]
}
]
}
}
36 changes: 23 additions & 13 deletions registry/schemas/interchain-tokenlist.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@
"name": { "type": "string" },
"version": { "$ref": "#/definitions/version" },
"tokens": {
"type": "array",
"items": { "$ref": "#/definitions/interchainToken" }
"type": "object",
"properties": {
"$id": {
"type": "string"
},
"$schema": {
"type": "object",
"$ref": "#/definitions/interchainToken"
}
}
}
},
"required": ["$schema", "name", "version", "tokens"],
Expand All @@ -33,13 +41,14 @@
"decimals": { "type": "integer" },
"name": { "type": "string" },
"originAxelarChainId": { "type": "string" },
"transferType": { "type": "string" },
"tokenType": { "type": "string" },
"srcTxHash": { "type": "string" },
"iconUrls": { "$ref": "#/definitions/IconUrlsSchema" },
"remoteTokens": {
"chains": {
"type": "array",
"items": { "$ref": "#/definitions/remoteToken" }
"items": { "$ref": "#/definitions/chains" }
},
"tokenManagerAddress": {
"tokenManager": {
"type": "string",
"pattern": "^0x[a-fA-F0-9]{40}$"
},
Expand All @@ -54,23 +63,24 @@
"decimals",
"name",
"originAxelarChainId",
"transferType",
"tokenType",
"iconUrls",
"remoteTokens",
"tokenManagerAddress",
"chains",
"srcTxHash",
"tokenManager",
"tokenManagerType"
],
"additionalProperties": false
},
"remoteToken": {
"chains": {
"type": "object",
"properties": {
"axelarChainId": { "type": "string" },
"tokenAddress": {
"$ref": "#/definitions/interchainToken/properties/tokenAddress"
},
"tokenManagerAddress": {
"$ref": "#/definitions/interchainToken/properties/tokenManagerAddress"
"tokenManager": {
"$ref": "#/definitions/interchainToken/properties/tokenManager"
},
"tokenManagerType": {
"$ref": "#/definitions/interchainToken/properties/tokenManagerType"
Expand All @@ -79,7 +89,7 @@
"required": [
"axelarChainId",
"tokenAddress",
"tokenManagerAddress",
"tokenManager",
"tokenManagerType"
],
"additionalProperties": false
Expand Down
Loading
Loading