@requestnetwork/types 0.43.1-next.2033 → 0.43.1-next.2035
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/currency-types.d.ts +132 -0
- package/dist/currency-types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/currency-types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as RequestLogicTypes from './request-logic-types';
|
|
1
2
|
/**
|
|
2
3
|
* List of supported EVM chains
|
|
3
4
|
*/
|
|
@@ -20,4 +21,135 @@ export type ChainName = EvmChainName | BtcChainName | NearChainName | Declarativ
|
|
|
20
21
|
* Virtual machin chains, where payment proxy contracts can be deployed
|
|
21
22
|
*/
|
|
22
23
|
export type VMChainName = EvmChainName | NearChainName;
|
|
24
|
+
/**
|
|
25
|
+
* Common types used in token configuration files
|
|
26
|
+
*/
|
|
27
|
+
type TokenAddress = string;
|
|
28
|
+
type TokenDefinition = {
|
|
29
|
+
name: string;
|
|
30
|
+
symbol: string;
|
|
31
|
+
decimals: number;
|
|
32
|
+
id?: string;
|
|
33
|
+
};
|
|
34
|
+
export type TokenMap = Record<TokenAddress, TokenDefinition>;
|
|
35
|
+
/**
|
|
36
|
+
* Common types used in chain configuration files
|
|
37
|
+
*/
|
|
38
|
+
export type Chain = {
|
|
39
|
+
chainId: number | string;
|
|
40
|
+
testnet?: boolean;
|
|
41
|
+
currencies?: TokenMap;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* A native blockchain token (ETH, MATIC, ETH-rinkeby...)
|
|
45
|
+
*/
|
|
46
|
+
export type NativeCurrency = {
|
|
47
|
+
symbol: string;
|
|
48
|
+
decimals: number;
|
|
49
|
+
network: ChainName;
|
|
50
|
+
};
|
|
51
|
+
type NamedCurrency = {
|
|
52
|
+
name: string;
|
|
53
|
+
};
|
|
54
|
+
export type NamedNativeCurrency = NativeCurrency & NamedCurrency;
|
|
55
|
+
/** Native Currency types */
|
|
56
|
+
export type NativeCurrencyType = RequestLogicTypes.CURRENCY.BTC | RequestLogicTypes.CURRENCY.ETH;
|
|
57
|
+
/**
|
|
58
|
+
* A Fiat currency (EUR, USD...)
|
|
59
|
+
*/
|
|
60
|
+
export type ISO4217Currency = {
|
|
61
|
+
symbol: string;
|
|
62
|
+
decimals: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* An ERC20 token (DAI, USDT...)
|
|
66
|
+
*/
|
|
67
|
+
export type ERC20Currency = {
|
|
68
|
+
symbol: string;
|
|
69
|
+
decimals: number;
|
|
70
|
+
network: EvmChainName | NearChainName | DeclarativeChainName;
|
|
71
|
+
address: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* An ERC777 SuperToken (DAIx, USDCx...)
|
|
75
|
+
*/
|
|
76
|
+
export type ERC777Currency = {
|
|
77
|
+
symbol: string;
|
|
78
|
+
decimals: number;
|
|
79
|
+
network: EvmChainName;
|
|
80
|
+
address: string;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* The minimum properties of a native Currency
|
|
84
|
+
*/
|
|
85
|
+
export type NativeCurrencyInput = {
|
|
86
|
+
type: RequestLogicTypes.CURRENCY.ETH | RequestLogicTypes.CURRENCY.BTC;
|
|
87
|
+
} & NativeCurrency;
|
|
88
|
+
/**
|
|
89
|
+
* The minimum properties of an ISO4217 Currency
|
|
90
|
+
*/
|
|
91
|
+
export type ISO4217CurrencyInput = {
|
|
92
|
+
type: RequestLogicTypes.CURRENCY.ISO4217;
|
|
93
|
+
} & ISO4217Currency;
|
|
94
|
+
/**
|
|
95
|
+
* The minimum properties of an ERC20 Currency
|
|
96
|
+
*/
|
|
97
|
+
export type ERC20CurrencyInput = {
|
|
98
|
+
type: RequestLogicTypes.CURRENCY.ERC20;
|
|
99
|
+
} & ERC20Currency;
|
|
100
|
+
/**
|
|
101
|
+
* The minimum properties of an ERC777 Currency
|
|
102
|
+
*/
|
|
103
|
+
export type ERC777CurrencyInput = {
|
|
104
|
+
type: RequestLogicTypes.CURRENCY.ERC777;
|
|
105
|
+
} & ERC777Currency;
|
|
106
|
+
/**
|
|
107
|
+
* The minimum properties of a Currency
|
|
108
|
+
*/
|
|
109
|
+
export type CurrencyInput = NativeCurrencyInput | ISO4217CurrencyInput | ERC20CurrencyInput | ERC777CurrencyInput;
|
|
110
|
+
/**
|
|
111
|
+
* The description of Currency, its core properties and some computed properties.
|
|
112
|
+
* `meta` enables applications to add any metadata they need to a Currency
|
|
113
|
+
*/
|
|
114
|
+
export type CurrencyDefinition<TMeta = unknown> = CurrencyInput & {
|
|
115
|
+
id: string;
|
|
116
|
+
hash: string;
|
|
117
|
+
meta: TMeta;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Alias for ICurrency for clarity in the context
|
|
121
|
+
*/
|
|
122
|
+
export type StorageCurrency = RequestLogicTypes.ICurrency;
|
|
123
|
+
/**
|
|
124
|
+
* A Currency manager handles a list of currencies and provides utility to retrieve and change format
|
|
125
|
+
*/
|
|
126
|
+
export interface ICurrencyManager<TMeta = unknown> {
|
|
127
|
+
from(symbolOrAddress: string, network?: string): CurrencyDefinition<TMeta> | undefined;
|
|
128
|
+
fromAddress(address: string, network?: string): CurrencyDefinition<TMeta> | undefined;
|
|
129
|
+
fromSymbol(symbol: string, network?: string): CurrencyDefinition<TMeta> | undefined;
|
|
130
|
+
fromHash(hash: string, network?: string): CurrencyDefinition<TMeta> | undefined;
|
|
131
|
+
fromStorageCurrency(currency: StorageCurrency): CurrencyDefinition<TMeta> | undefined;
|
|
132
|
+
getNativeCurrency(type: NativeCurrencyType, network: string): CurrencyDefinition<TMeta> | undefined;
|
|
133
|
+
getConversionPath(from: Pick<CurrencyDefinition, 'hash'>, to: Pick<CurrencyDefinition, 'hash'>, network: string): string[] | null;
|
|
134
|
+
supportsConversion(currency: Pick<CurrencyDefinition, 'hash'>, network: string): boolean;
|
|
135
|
+
validateAddress(address: string, currency: CurrencyInput | StorageCurrency): boolean;
|
|
136
|
+
validateCurrency(currency: StorageCurrency): boolean;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* A mapping from old to new name for a given currency.
|
|
140
|
+
*
|
|
141
|
+
* Format { "chainName": {"TOKEN": ["NEW_TOKEN","NEW_CHAIN"]}}
|
|
142
|
+
*/
|
|
143
|
+
export type LegacyTokenMap = Record<string, Record<string, [string, ChainName]>>;
|
|
144
|
+
/**
|
|
145
|
+
* currencyFrom => currencyTo => cost
|
|
146
|
+
*/
|
|
147
|
+
export type CurrencyPairs = Record<string, Record<string, number>>;
|
|
148
|
+
/**
|
|
149
|
+
* Aggregators maps define pairs of currencies for which an onchain oracle exists, by network.
|
|
150
|
+
*
|
|
151
|
+
* Network => currencyFrom => currencyTo => cost
|
|
152
|
+
*/
|
|
153
|
+
export type AggregatorsMap<T extends ChainName = ChainName> = Partial<Record<T, CurrencyPairs>>;
|
|
154
|
+
export {};
|
|
23
155
|
//# sourceMappingURL=currency-types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-types.d.ts","sourceRoot":"","sources":["../src/currency-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,cAAc,GACd,kBAAkB,GAClB,WAAW,GACX,MAAM,GACN,KAAK,GACL,SAAS,GACT,MAAM,GACN,MAAM,GACN,QAAQ,GACR,MAAM,GACN,QAAQ,GACR,SAAS,GACT,QAAQ,GACR,gBAAgB,GAChB,OAAO,GACP,UAAU,GACV,QAAQ,GACR,UAAU,GACV,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,GACP,WAAW,GACX,MAAM,GACN,kBAAkB,GAClB,WAAW,CAAC;AAEhB;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,CAAC;AAEjD;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD;;;GAGG;A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AAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@requestnetwork/types",
|
|
3
|
-
"version": "0.43.1-next.
|
|
3
|
+
"version": "0.43.1-next.2035+cb6dee00",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"typed-emitter": "2.1.0",
|
|
46
46
|
"typescript": "5.1.3"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "cb6dee00dcae850e9cd5ceb805c868538897315b"
|
|
49
49
|
}
|