-
Notifications
You must be signed in to change notification settings - Fork 0
/
assetlist.ts
178 lines (166 loc) · 4.89 KB
/
assetlist.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
// https://github.com/cosmos/chain-registry/blob/master/assetlist.schema.json
// https://transform.tools/json-schema-to-typescript
import type { ImageType } from "./shared";
/**
* Asset lists are a similar mechanism to allow frontends and other UIs to fetch metadata associated with Cosmos SDK denoms, especially for assets sent over IBC.
*/
export interface AssetList {
$schema?: string;
chain_name: string;
assets: Asset[];
}
export type AssetType = "sdk.coin" | "cw20" | "erc20" | "ics20" | "snip20" | "snip25";
export interface Asset {
/**
* [OPTIONAL] A short description of the asset
*/
description?: string;
denom_units: DenomUnit[];
/**
* [OPTIONAL] The potential options for type of asset. By default, assumes sdk.coin
*/
type_asset?: AssetType;
/**
* [OPTIONAL] The address of the asset. Only required for type_asset : cw20, snip20
*/
address?: string;
/**
* The base unit of the asset. Must be in denom_units.
*/
base: string;
/**
* The project name of the asset. For example Bitcoin.
*/
name: string;
/**
* The human friendly unit of the asset. Must be in denom_units.
*/
display: string;
/**
* The symbol of an asset. For example BTC.
*/
symbol: string;
/**
* The origin of the asset, starting with the index, and capturing all transitions in form and location.
*/
traces?: (IbcTransition | IbcCw20Transition | NonIbcTransition)[];
/**
* [OPTIONAL] IBC Channel between src and dst between chain
*/
ibc?: {
source_channel: string;
dst_channel: string;
source_denom: string;
};
logo_URIs?: {
png?: string;
svg?: string;
};
images?: ImageType[];
/**
* [OPTIONAL] The coingecko id to fetch asset data from coingecko v3 api. See https://api.coingecko.com/api/v3/coins/list
*/
coingecko_id?: string;
keywords?: string[];
}
export interface DenomUnit {
denom: string;
exponent: number;
aliases?: string[];
}
export type TransitionType = IbcTransitionType | IbcCw20TransitionType | NonIbcTransitionType;
export type IbcTransitionType = "ibc";
export interface IbcTransition {
type: IbcTransitionType;
counterparty: {
/**
* The name of the counterparty chain. (must match exactly the chain name used in the Chain Registry)
*/
chain_name: string;
/**
* The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom: string;
/**
* The counterparty IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
};
chain: {
/**
* The chain's IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
/**
* The port/channel/denom input string that generates the 'ibc/...' denom.
*/
path: string;
};
}
export type IbcCw20TransitionType = "ibc-cw20";
export interface IbcCw20Transition {
type: IbcCw20TransitionType;
counterparty: {
/**
* The name of the counterparty chain. (must match exactly the chain name used in the Chain Registry)
*/
chain_name: string;
/**
* The base unit of the asset on its source platform. E.g., when describing ATOM from Cosmos Hub, specify 'uatom', NOT 'atom' nor 'ATOM'; base units are unique per platform.
*/
base_denom: string;
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port: string;
/**
* The counterparty IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
};
chain: {
/**
* The port used to transfer IBC assets; often 'transfer', but sometimes varies, e.g., for outgoing cw20 transfers.
*/
port: string;
/**
* The chain's IBC transfer channel(, e.g., 'channel-1').
*/
channel_id: string;
/**
* The port/channel/denom input string that generates the 'ibc/...' denom.
*/
path: string;
};
}
export type NonIbcTransitionType =
| "bridge"
| "liquid-stake"
| "synthetic"
| "wrapped"
| "additional-mintage"
| "test-mintage";
export interface NonIbcTransition {
type: NonIbcTransitionType;
counterparty: {
/**
* The chain or platform from which the asset originates. E.g., 'cosmoshub', 'ethereum', 'forex', or 'nasdaq'
*/
chain_name: string;
base_denom: string;
/**
* The contract address where the transition takes place, where applicable. E.g., The Ethereum contract that locks up the asset while it's minted on another chain.
*/
contract?: string;
};
chain?: {
/**
* The contract address where the transition takes place, where applicable. E.g., The Ethereum contract that locks up the asset while it's minted on another chain.
*/
contract: string;
};
/**
* The entity offering the service. E.g., 'Gravity Bridge' [Network] or 'Tether' [Company].
*/
provider: string;
}