@portal-hq/utils 0.2.10 → 0.2.12
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/lib/commonjs/currency/countries/country-codes.js +250 -0
- package/lib/commonjs/currency/countries/currency-codes.js +247 -0
- package/lib/commonjs/currency/countries/index.js +10 -0
- package/lib/commonjs/currency/index.js +29 -0
- package/lib/commonjs/definitions/index.js +33 -0
- package/lib/commonjs/errors/http-error.js +10 -0
- package/lib/commonjs/errors/index.js +23 -0
- package/lib/commonjs/errors/invalid-api-key-error.js +10 -0
- package/lib/commonjs/errors/invalid-chain-id-error.js +10 -0
- package/lib/commonjs/errors/invalid-gateway-config-error.js +10 -0
- package/lib/commonjs/errors/missing-option-error.js +10 -0
- package/lib/commonjs/errors/mpc-signing-error.js +10 -0
- package/lib/commonjs/errors/no-address-error.js +10 -0
- package/lib/commonjs/errors/provider-rpc-error.js +52 -0
- package/lib/commonjs/eth-requests/index.js +93 -0
- package/lib/commonjs/http-request/index.js +72 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/requesters/http.js +52 -0
- package/lib/commonjs/requesters/index.js +8 -0
- package/lib/esm/currency/countries/country-codes.js +248 -0
- package/lib/esm/currency/countries/currency-codes.js +245 -0
- package/lib/esm/currency/countries/index.js +2 -0
- package/lib/esm/currency/index.js +25 -0
- package/lib/esm/definitions/index.js +28 -0
- package/lib/esm/errors/http-error.js +8 -0
- package/lib/esm/errors/index.js +8 -0
- package/lib/esm/errors/invalid-api-key-error.js +8 -0
- package/lib/esm/errors/invalid-chain-id-error.js +8 -0
- package/lib/esm/errors/invalid-gateway-config-error.js +8 -0
- package/lib/esm/errors/missing-option-error.js +8 -0
- package/lib/esm/errors/mpc-signing-error.js +8 -0
- package/lib/esm/errors/no-address-error.js +8 -0
- package/lib/esm/errors/provider-rpc-error.js +49 -0
- package/lib/esm/eth-requests/index.js +89 -0
- package/lib/esm/http-request/index.js +70 -0
- package/lib/esm/index.js +6 -0
- package/lib/esm/requesters/http.js +50 -0
- package/lib/esm/requesters/index.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const countryCodes = {
|
|
4
|
+
AD: 'Andorra',
|
|
5
|
+
AE: 'United Arab Emirates',
|
|
6
|
+
AF: 'Afghanistan',
|
|
7
|
+
AG: 'Antigua and Barbuda',
|
|
8
|
+
AI: 'Anguilla',
|
|
9
|
+
AL: 'Albania',
|
|
10
|
+
AM: 'Armenia',
|
|
11
|
+
AN: 'Netherlands Antilles',
|
|
12
|
+
AO: 'Angola',
|
|
13
|
+
AQ: 'Antarctica',
|
|
14
|
+
AR: 'Argentina',
|
|
15
|
+
AS: 'American Samoa',
|
|
16
|
+
AT: 'Austria',
|
|
17
|
+
AU: 'Australia',
|
|
18
|
+
AW: 'Aruba',
|
|
19
|
+
AZ: 'Azerbaijan',
|
|
20
|
+
BA: 'Bosnia and Herzegovina',
|
|
21
|
+
BB: 'Barbados',
|
|
22
|
+
BD: 'Bangladesh',
|
|
23
|
+
BE: 'Belgium',
|
|
24
|
+
BF: 'Burkina Faso',
|
|
25
|
+
BG: 'Bulgaria',
|
|
26
|
+
BH: 'Bahrain',
|
|
27
|
+
BI: 'Burundi',
|
|
28
|
+
BJ: 'Benin',
|
|
29
|
+
BM: 'Bermuda',
|
|
30
|
+
BN: 'Brunei',
|
|
31
|
+
BO: 'Bolivia',
|
|
32
|
+
BR: 'Brazil',
|
|
33
|
+
BS: 'Bahamas',
|
|
34
|
+
BT: 'Bhutan',
|
|
35
|
+
BV: 'Bouvet Island',
|
|
36
|
+
BW: 'Botswana',
|
|
37
|
+
BY: 'Belarus',
|
|
38
|
+
BZ: 'Belize',
|
|
39
|
+
CA: 'Canada',
|
|
40
|
+
CC: 'Cocos (Keeling) Islands',
|
|
41
|
+
CD: 'The Democratic Republic of Congo',
|
|
42
|
+
CF: 'Central African Republic',
|
|
43
|
+
CG: 'Congo',
|
|
44
|
+
CH: 'Switzerland',
|
|
45
|
+
CI: 'Ivory Coast',
|
|
46
|
+
CK: 'Cook Islands',
|
|
47
|
+
CL: 'Chile',
|
|
48
|
+
CM: 'Cameroon',
|
|
49
|
+
CN: 'China',
|
|
50
|
+
CO: 'Colombia',
|
|
51
|
+
CR: 'Costa Rica',
|
|
52
|
+
CU: 'Cuba',
|
|
53
|
+
CV: 'Cape Verde',
|
|
54
|
+
CX: 'Christmas Island',
|
|
55
|
+
CY: 'Cyprus',
|
|
56
|
+
CZ: 'Czech Republic',
|
|
57
|
+
DE: 'Germany',
|
|
58
|
+
DJ: 'Djibouti',
|
|
59
|
+
DK: 'Denmark',
|
|
60
|
+
DM: 'Dominica',
|
|
61
|
+
DO: 'Dominican Republic',
|
|
62
|
+
DZ: 'Algeria',
|
|
63
|
+
EC: 'Ecuador',
|
|
64
|
+
EE: 'Estonia',
|
|
65
|
+
EG: 'Egypt',
|
|
66
|
+
EH: 'Western Sahara',
|
|
67
|
+
ER: 'Eritrea',
|
|
68
|
+
ES: 'Spain',
|
|
69
|
+
ET: 'Ethiopia',
|
|
70
|
+
FI: 'Finland',
|
|
71
|
+
FJ: 'Fiji Islands',
|
|
72
|
+
FK: 'Falkland Islands',
|
|
73
|
+
FM: 'Micronesia, Federated States of',
|
|
74
|
+
FO: 'Faroe Islands',
|
|
75
|
+
FR: 'France',
|
|
76
|
+
GA: 'Gabon',
|
|
77
|
+
GB: 'Northern Ireland',
|
|
78
|
+
GD: 'Grenada',
|
|
79
|
+
GE: 'Georgia',
|
|
80
|
+
GF: 'French Guiana',
|
|
81
|
+
GG: 'Guernsey',
|
|
82
|
+
GH: 'Ghana',
|
|
83
|
+
GI: 'Gibraltar',
|
|
84
|
+
GL: 'Greenland',
|
|
85
|
+
GM: 'Gambia',
|
|
86
|
+
GN: 'Guinea',
|
|
87
|
+
GP: 'Guadeloupe',
|
|
88
|
+
GQ: 'Equatorial Guinea',
|
|
89
|
+
GR: 'Greece',
|
|
90
|
+
GS: 'South Georgia and the South Sandwich Islands',
|
|
91
|
+
GT: 'Guatemala',
|
|
92
|
+
GU: 'Guam',
|
|
93
|
+
GW: 'Guinea-Bissau',
|
|
94
|
+
GY: 'Guyana',
|
|
95
|
+
HK: 'Hong Kong',
|
|
96
|
+
HM: 'Heard Island and McDonald Islands',
|
|
97
|
+
HN: 'Honduras',
|
|
98
|
+
HR: 'Croatia',
|
|
99
|
+
HT: 'Haiti',
|
|
100
|
+
HU: 'Hungary',
|
|
101
|
+
ID: 'Indonesia',
|
|
102
|
+
IE: 'Ireland',
|
|
103
|
+
IL: 'Israel',
|
|
104
|
+
IM: 'Isle of Man',
|
|
105
|
+
IN: 'India',
|
|
106
|
+
IO: 'British Indian Ocean Territory',
|
|
107
|
+
IQ: 'Iraq',
|
|
108
|
+
IR: 'Iran',
|
|
109
|
+
IS: 'Iceland',
|
|
110
|
+
IT: 'Italy',
|
|
111
|
+
JE: 'Jersey',
|
|
112
|
+
JM: 'Jamaica',
|
|
113
|
+
JO: 'Jordan',
|
|
114
|
+
JP: 'Japan',
|
|
115
|
+
KE: 'Kenya',
|
|
116
|
+
KG: 'Kyrgyzstan',
|
|
117
|
+
KH: 'Cambodia',
|
|
118
|
+
KI: 'Kiribati',
|
|
119
|
+
KM: 'Comoros',
|
|
120
|
+
KN: 'Saint Kitts and Nevis',
|
|
121
|
+
KP: 'North Korea',
|
|
122
|
+
KR: 'South Korea',
|
|
123
|
+
KW: 'Kuwait',
|
|
124
|
+
KY: 'Cayman Islands',
|
|
125
|
+
KZ: 'Kazakhstan',
|
|
126
|
+
LA: 'Laos',
|
|
127
|
+
LB: 'Lebanon',
|
|
128
|
+
LC: 'Saint Lucia',
|
|
129
|
+
LI: 'Liechtenstein',
|
|
130
|
+
LK: 'Sri Lanka',
|
|
131
|
+
LR: 'Liberia',
|
|
132
|
+
LS: 'Lesotho',
|
|
133
|
+
LT: 'Lithuania',
|
|
134
|
+
LU: 'Luxembourg',
|
|
135
|
+
LV: 'Latvia',
|
|
136
|
+
LY: 'Libyan Arab Jamahiriya',
|
|
137
|
+
MA: 'Morocco',
|
|
138
|
+
MC: 'Monaco',
|
|
139
|
+
MD: 'Moldova',
|
|
140
|
+
ME: 'Montenegro',
|
|
141
|
+
MG: 'Madagascar',
|
|
142
|
+
MH: 'Marshall Islands',
|
|
143
|
+
MK: 'North Macedonia',
|
|
144
|
+
ML: 'Mali',
|
|
145
|
+
MM: 'Myanmar',
|
|
146
|
+
MN: 'Mongolia',
|
|
147
|
+
MO: 'Macao',
|
|
148
|
+
MP: 'Northern Mariana Islands',
|
|
149
|
+
MQ: 'Martinique',
|
|
150
|
+
MR: 'Mauritania',
|
|
151
|
+
MS: 'Montserrat',
|
|
152
|
+
MT: 'Malta',
|
|
153
|
+
MU: 'Mauritius',
|
|
154
|
+
MV: 'Maldives',
|
|
155
|
+
MW: 'Malawi',
|
|
156
|
+
MX: 'Mexico',
|
|
157
|
+
MY: 'Malaysia',
|
|
158
|
+
MZ: 'Mozambique',
|
|
159
|
+
NA: 'Namibia',
|
|
160
|
+
NC: 'New Caledonia',
|
|
161
|
+
NE: 'Niger',
|
|
162
|
+
NF: 'Norfolk Island',
|
|
163
|
+
NG: 'Nigeria',
|
|
164
|
+
NI: 'Nicaragua',
|
|
165
|
+
NL: 'Netherlands',
|
|
166
|
+
NO: 'Norway',
|
|
167
|
+
NP: 'Nepal',
|
|
168
|
+
NR: 'Nauru',
|
|
169
|
+
NU: 'Niue',
|
|
170
|
+
NZ: 'New Zealand',
|
|
171
|
+
OM: 'Oman',
|
|
172
|
+
PA: 'Panama',
|
|
173
|
+
PE: 'Peru',
|
|
174
|
+
PF: 'French Polynesia',
|
|
175
|
+
PG: 'Papua New Guinea',
|
|
176
|
+
PH: 'Philippines',
|
|
177
|
+
PK: 'Pakistan',
|
|
178
|
+
PL: 'Poland',
|
|
179
|
+
PM: 'Saint Pierre and Miquelon',
|
|
180
|
+
PN: 'Pitcairn',
|
|
181
|
+
PR: 'Puerto Rico',
|
|
182
|
+
PS: 'Palestine',
|
|
183
|
+
PT: 'Portugal',
|
|
184
|
+
PW: 'Palau',
|
|
185
|
+
PY: 'Paraguay',
|
|
186
|
+
QA: 'Qatar',
|
|
187
|
+
RE: 'Reunion',
|
|
188
|
+
RO: 'Romania',
|
|
189
|
+
RS: 'Serbia',
|
|
190
|
+
RU: 'Russian Federation',
|
|
191
|
+
RW: 'Rwanda',
|
|
192
|
+
SA: 'Saudi Arabia',
|
|
193
|
+
SB: 'Solomon Islands',
|
|
194
|
+
SC: 'Seychelles',
|
|
195
|
+
SD: 'Sudan',
|
|
196
|
+
SE: 'Sweden',
|
|
197
|
+
SG: 'Singapore',
|
|
198
|
+
SH: 'Saint Helena',
|
|
199
|
+
SI: 'Slovenia',
|
|
200
|
+
SJ: 'Svalbard and Jan Mayen',
|
|
201
|
+
SK: 'Slovakia',
|
|
202
|
+
SL: 'Sierra Leone',
|
|
203
|
+
SM: 'San Marino',
|
|
204
|
+
SN: 'Senegal',
|
|
205
|
+
SO: 'Somalia',
|
|
206
|
+
SR: 'Suriname',
|
|
207
|
+
SS: 'South Sudan',
|
|
208
|
+
ST: 'Sao Tome and Principe',
|
|
209
|
+
SV: 'El Salvador',
|
|
210
|
+
SY: 'Syria',
|
|
211
|
+
SZ: 'Swaziland',
|
|
212
|
+
TC: 'Turks and Caicos Islands',
|
|
213
|
+
TD: 'Chad',
|
|
214
|
+
TF: 'French Southern territories',
|
|
215
|
+
TG: 'Togo',
|
|
216
|
+
TH: 'Thailand',
|
|
217
|
+
TJ: 'Tajikistan',
|
|
218
|
+
TK: 'Tokelau',
|
|
219
|
+
TL: 'Timor-Leste',
|
|
220
|
+
TM: 'Turkmenistan',
|
|
221
|
+
TN: 'Tunisia',
|
|
222
|
+
TO: 'Tonga',
|
|
223
|
+
TP: 'East Timor',
|
|
224
|
+
TR: 'Turkey',
|
|
225
|
+
TT: 'Trinidad and Tobago',
|
|
226
|
+
TV: 'Tuvalu',
|
|
227
|
+
TZ: 'Tanzania',
|
|
228
|
+
UA: 'Ukraine',
|
|
229
|
+
UG: 'Uganda',
|
|
230
|
+
UK: 'United Kingdom',
|
|
231
|
+
UM: 'United States Minor Outlying Islands',
|
|
232
|
+
US: 'United States',
|
|
233
|
+
UY: 'Uruguay',
|
|
234
|
+
UZ: 'Uzbekistan',
|
|
235
|
+
VA: 'Holy See (Vatican City State)',
|
|
236
|
+
VC: 'Saint Vincent and the Grenadines',
|
|
237
|
+
VE: 'Venezuela',
|
|
238
|
+
VG: 'Virgin Islands, British',
|
|
239
|
+
VI: 'Virgin Islands, U.S.',
|
|
240
|
+
VN: 'Vietnam',
|
|
241
|
+
VU: 'Vanuatu',
|
|
242
|
+
WF: 'Wallis and Futuna',
|
|
243
|
+
WS: 'Samoa',
|
|
244
|
+
YE: 'Yemen',
|
|
245
|
+
YT: 'Mayotte',
|
|
246
|
+
ZA: 'South Africa',
|
|
247
|
+
ZM: 'Zambia',
|
|
248
|
+
ZW: 'Zimbabwe',
|
|
249
|
+
};
|
|
250
|
+
exports.default = countryCodes;
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const currencyCodes = {
|
|
4
|
+
Afghanistan: 'AFN',
|
|
5
|
+
Albania: 'ALL',
|
|
6
|
+
Algeria: 'DZD',
|
|
7
|
+
'American Samoa': 'USD',
|
|
8
|
+
Andorra: 'EUR',
|
|
9
|
+
Angola: 'AOA',
|
|
10
|
+
Anguilla: 'XCD',
|
|
11
|
+
Antarctica: 'XCD',
|
|
12
|
+
'Antigua and Barbuda': 'XCD',
|
|
13
|
+
Argentina: 'ARS',
|
|
14
|
+
Armenia: 'AMD',
|
|
15
|
+
Aruba: 'AWG',
|
|
16
|
+
Australia: 'AUD',
|
|
17
|
+
Austria: 'EUR',
|
|
18
|
+
Azerbaijan: 'AZN',
|
|
19
|
+
Bahamas: 'BSD',
|
|
20
|
+
Bahrain: 'BHD',
|
|
21
|
+
Bangladesh: 'BDT',
|
|
22
|
+
Barbados: 'BBD',
|
|
23
|
+
Belarus: 'BYR',
|
|
24
|
+
Belgium: 'EUR',
|
|
25
|
+
Belize: 'BZD',
|
|
26
|
+
Benin: 'XOF',
|
|
27
|
+
Bermuda: 'BMD',
|
|
28
|
+
Bhutan: 'BTN',
|
|
29
|
+
Bolivia: 'BOB',
|
|
30
|
+
'Bosnia and Herzegovina': 'BAM',
|
|
31
|
+
Botswana: 'BWP',
|
|
32
|
+
'Bouvet Island': 'NOK',
|
|
33
|
+
Brazil: 'BRL',
|
|
34
|
+
'British Indian Ocean Territory': 'USD',
|
|
35
|
+
Brunei: 'BND',
|
|
36
|
+
Bulgaria: 'BGN',
|
|
37
|
+
'Burkina Faso': 'XOF',
|
|
38
|
+
Burundi: 'BIF',
|
|
39
|
+
Cambodia: 'KHR',
|
|
40
|
+
Cameroon: 'XAF',
|
|
41
|
+
Canada: 'CAD',
|
|
42
|
+
'Cape Verde': 'CVE',
|
|
43
|
+
'Cayman Islands': 'KYD',
|
|
44
|
+
'Central African Republic': 'XAF',
|
|
45
|
+
Chad: 'XAF',
|
|
46
|
+
Chile: 'CLP',
|
|
47
|
+
China: 'CNY',
|
|
48
|
+
'Christmas Island': 'AUD',
|
|
49
|
+
'Cocos (Keeling) Islands': 'AUD',
|
|
50
|
+
Colombia: 'COP',
|
|
51
|
+
Comoros: 'KMF',
|
|
52
|
+
Congo: 'XAF',
|
|
53
|
+
'Cook Islands': 'NZD',
|
|
54
|
+
'Costa Rica': 'CRC',
|
|
55
|
+
Croatia: 'HRK',
|
|
56
|
+
Cuba: 'CUP',
|
|
57
|
+
Cyprus: 'EUR',
|
|
58
|
+
'Czech Republic': 'CZK',
|
|
59
|
+
Denmark: 'DKK',
|
|
60
|
+
Djibouti: 'DJF',
|
|
61
|
+
Dominica: 'XCD',
|
|
62
|
+
'Dominican Republic': 'DOP',
|
|
63
|
+
'East Timor': 'USD',
|
|
64
|
+
Ecuador: 'ECS',
|
|
65
|
+
Egypt: 'EGP',
|
|
66
|
+
'El Salvador': 'SVC',
|
|
67
|
+
England: 'GBP',
|
|
68
|
+
'Equatorial Guinea': 'XAF',
|
|
69
|
+
Eritrea: 'ERN',
|
|
70
|
+
Estonia: 'EUR',
|
|
71
|
+
Ethiopia: 'ETB',
|
|
72
|
+
'Falkland Islands': 'FKP',
|
|
73
|
+
'Faroe Islands': 'DKK',
|
|
74
|
+
'Fiji Islands': 'FJD',
|
|
75
|
+
Finland: 'EUR',
|
|
76
|
+
France: 'EUR',
|
|
77
|
+
'French Guiana': 'EUR',
|
|
78
|
+
'French Polynesia': 'XPF',
|
|
79
|
+
'French Southern territories': 'EUR',
|
|
80
|
+
Gabon: 'XAF',
|
|
81
|
+
Gambia: 'GMD',
|
|
82
|
+
Georgia: 'GEL',
|
|
83
|
+
Germany: 'EUR',
|
|
84
|
+
Ghana: 'GHS',
|
|
85
|
+
Gibraltar: 'GIP',
|
|
86
|
+
Greece: 'EUR',
|
|
87
|
+
Greenland: 'DKK',
|
|
88
|
+
Grenada: 'XCD',
|
|
89
|
+
Guadeloupe: 'EUR',
|
|
90
|
+
Guam: 'USD',
|
|
91
|
+
Guatemala: 'QTQ',
|
|
92
|
+
Guinea: 'GNF',
|
|
93
|
+
'Guinea-Bissau': 'CFA',
|
|
94
|
+
Guyana: 'GYD',
|
|
95
|
+
Haiti: 'HTG',
|
|
96
|
+
'Heard Island and McDonald Islands': 'AUD',
|
|
97
|
+
'Holy See (Vatican City State)': 'EUR',
|
|
98
|
+
Honduras: 'HNL',
|
|
99
|
+
'Hong Kong': 'HKD',
|
|
100
|
+
Hungary: 'HUF',
|
|
101
|
+
Iceland: 'ISK',
|
|
102
|
+
India: 'INR',
|
|
103
|
+
Indonesia: 'IDR',
|
|
104
|
+
Iran: 'IRR',
|
|
105
|
+
Iraq: 'IQD',
|
|
106
|
+
Ireland: 'EUR',
|
|
107
|
+
Israel: 'ILS',
|
|
108
|
+
Italy: 'EUR',
|
|
109
|
+
'Ivory Coast': 'XOF',
|
|
110
|
+
Jamaica: 'JMD',
|
|
111
|
+
Japan: 'JPY',
|
|
112
|
+
Jordan: 'JOD',
|
|
113
|
+
Kazakhstan: 'KZT',
|
|
114
|
+
Kenya: 'KES',
|
|
115
|
+
Kiribati: 'AUD',
|
|
116
|
+
Kuwait: 'KWD',
|
|
117
|
+
Kyrgyzstan: 'KGS',
|
|
118
|
+
Laos: 'LAK',
|
|
119
|
+
Latvia: 'LVL',
|
|
120
|
+
Lebanon: 'LBP',
|
|
121
|
+
Lesotho: 'LSL',
|
|
122
|
+
Liberia: 'LRD',
|
|
123
|
+
'Libyan Arab Jamahiriya': 'LYD',
|
|
124
|
+
Liechtenstein: 'CHF',
|
|
125
|
+
Lithuania: 'LTL',
|
|
126
|
+
Luxembourg: 'EUR',
|
|
127
|
+
Macao: 'MOP',
|
|
128
|
+
'North Macedonia': 'MKD',
|
|
129
|
+
Madagascar: 'MGF',
|
|
130
|
+
Malawi: 'MWK',
|
|
131
|
+
Malaysia: 'MYR',
|
|
132
|
+
Maldives: 'MVR',
|
|
133
|
+
Mali: 'XOF',
|
|
134
|
+
Malta: 'EUR',
|
|
135
|
+
'Marshall Islands': 'USD',
|
|
136
|
+
Martinique: 'EUR',
|
|
137
|
+
Mauritania: 'MRO',
|
|
138
|
+
Mauritius: 'MUR',
|
|
139
|
+
Mayotte: 'EUR',
|
|
140
|
+
Mexico: 'MXN',
|
|
141
|
+
'Micronesia, Federated States of': 'USD',
|
|
142
|
+
Moldova: 'MDL',
|
|
143
|
+
Monaco: 'EUR',
|
|
144
|
+
Mongolia: 'MNT',
|
|
145
|
+
Montserrat: 'XCD',
|
|
146
|
+
Morocco: 'MAD',
|
|
147
|
+
Mozambique: 'MZN',
|
|
148
|
+
Myanmar: 'MMR',
|
|
149
|
+
Namibia: 'NAD',
|
|
150
|
+
Nauru: 'AUD',
|
|
151
|
+
Nepal: 'NPR',
|
|
152
|
+
Netherlands: 'EUR',
|
|
153
|
+
'Netherlands Antilles': 'ANG',
|
|
154
|
+
'New Caledonia': 'XPF',
|
|
155
|
+
'New Zealand': 'NZD',
|
|
156
|
+
Nicaragua: 'NIO',
|
|
157
|
+
Niger: 'XOF',
|
|
158
|
+
Nigeria: 'NGN',
|
|
159
|
+
Niue: 'NZD',
|
|
160
|
+
'Norfolk Island': 'AUD',
|
|
161
|
+
'North Korea': 'KPW',
|
|
162
|
+
'Northern Ireland': 'GBP',
|
|
163
|
+
'Northern Mariana Islands': 'USD',
|
|
164
|
+
Norway: 'NOK',
|
|
165
|
+
Oman: 'OMR',
|
|
166
|
+
Pakistan: 'PKR',
|
|
167
|
+
Palau: 'USD',
|
|
168
|
+
Panama: 'PAB',
|
|
169
|
+
'Papua New Guinea': 'PGK',
|
|
170
|
+
Paraguay: 'PYG',
|
|
171
|
+
Peru: 'PEN',
|
|
172
|
+
Philippines: 'PHP',
|
|
173
|
+
Pitcairn: 'NZD',
|
|
174
|
+
Poland: 'PLN',
|
|
175
|
+
Portugal: 'EUR',
|
|
176
|
+
'Puerto Rico': 'USD',
|
|
177
|
+
Qatar: 'QAR',
|
|
178
|
+
Reunion: 'EUR',
|
|
179
|
+
Romania: 'RON',
|
|
180
|
+
'Russian Federation': 'RUB',
|
|
181
|
+
Rwanda: 'RWF',
|
|
182
|
+
'Saint Helena': 'SHP',
|
|
183
|
+
'Saint Kitts and Nevis': 'XCD',
|
|
184
|
+
'Saint Lucia': 'XCD',
|
|
185
|
+
'Saint Pierre and Miquelon': 'EUR',
|
|
186
|
+
'Saint Vincent and the Grenadines': 'XCD',
|
|
187
|
+
Samoa: 'WST',
|
|
188
|
+
'San Marino': 'EUR',
|
|
189
|
+
'Sao Tome and Principe': 'STD',
|
|
190
|
+
'Saudi Arabia': 'SAR',
|
|
191
|
+
Scotland: 'GBP',
|
|
192
|
+
Senegal: 'XOF',
|
|
193
|
+
Serbia: 'RSD',
|
|
194
|
+
Seychelles: 'SCR',
|
|
195
|
+
'Sierra Leone': 'SLL',
|
|
196
|
+
Singapore: 'SGD',
|
|
197
|
+
Slovakia: 'EUR',
|
|
198
|
+
Slovenia: 'EUR',
|
|
199
|
+
'Solomon Islands': 'SBD',
|
|
200
|
+
Somalia: 'SOS',
|
|
201
|
+
'South Africa': 'ZAR',
|
|
202
|
+
'South Georgia and the South Sandwich Islands': 'GBP',
|
|
203
|
+
'South Korea': 'KRW',
|
|
204
|
+
'South Sudan': 'SSP',
|
|
205
|
+
Spain: 'EUR',
|
|
206
|
+
'Sri Lanka': 'LKR',
|
|
207
|
+
Sudan: 'SDG',
|
|
208
|
+
Suriname: 'SRD',
|
|
209
|
+
'Svalbard and Jan Mayen': 'NOK',
|
|
210
|
+
Swaziland: 'SZL',
|
|
211
|
+
Sweden: 'SEK',
|
|
212
|
+
Switzerland: 'CHF',
|
|
213
|
+
Syria: 'SYP',
|
|
214
|
+
Tajikistan: 'TJS',
|
|
215
|
+
Tanzania: 'TZS',
|
|
216
|
+
Thailand: 'THB',
|
|
217
|
+
'The Democratic Republic of Congo': 'CDF',
|
|
218
|
+
Togo: 'XOF',
|
|
219
|
+
Tokelau: 'NZD',
|
|
220
|
+
Tonga: 'TOP',
|
|
221
|
+
'Trinidad and Tobago': 'TTD',
|
|
222
|
+
Tunisia: 'TND',
|
|
223
|
+
Turkey: 'TRY',
|
|
224
|
+
Turkmenistan: 'TMT',
|
|
225
|
+
'Turks and Caicos Islands': 'USD',
|
|
226
|
+
Tuvalu: 'AUD',
|
|
227
|
+
Uganda: 'UGX',
|
|
228
|
+
Ukraine: 'UAH',
|
|
229
|
+
'United Arab Emirates': 'AED',
|
|
230
|
+
'United Kingdom': 'GBP',
|
|
231
|
+
'United States': 'USD',
|
|
232
|
+
'United States Minor Outlying Islands': 'USD',
|
|
233
|
+
Uruguay: 'UYU',
|
|
234
|
+
Uzbekistan: 'UZS',
|
|
235
|
+
Vanuatu: 'VUV',
|
|
236
|
+
Venezuela: 'VEF',
|
|
237
|
+
Vietnam: 'VND',
|
|
238
|
+
'Virgin Islands, British': 'USD',
|
|
239
|
+
'Virgin Islands, U.S.': 'USD',
|
|
240
|
+
Wales: 'GBP',
|
|
241
|
+
'Wallis and Futuna': 'XPF',
|
|
242
|
+
'Western Sahara': 'MAD',
|
|
243
|
+
Yemen: 'YER',
|
|
244
|
+
Zambia: 'ZMW',
|
|
245
|
+
Zimbabwe: 'ZWD',
|
|
246
|
+
};
|
|
247
|
+
exports.default = currencyCodes;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.currencyCodes = exports.countryCodes = void 0;
|
|
7
|
+
var country_codes_1 = require("./country-codes");
|
|
8
|
+
Object.defineProperty(exports, "countryCodes", { enumerable: true, get: function () { return __importDefault(country_codes_1).default; } });
|
|
9
|
+
var currency_codes_1 = require("./currency-codes");
|
|
10
|
+
Object.defineProperty(exports, "currencyCodes", { enumerable: true, get: function () { return __importDefault(currency_codes_1).default; } });
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.convert = void 0;
|
|
13
|
+
const countries_1 = require("./countries");
|
|
14
|
+
const convert = (value, from = 'ETH', countryCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const country = countries_1.countryCodes[countryCode || 'US'];
|
|
16
|
+
if (!country) {
|
|
17
|
+
throw new Error(`Unable to find country name for country code: ${countryCode}.`);
|
|
18
|
+
}
|
|
19
|
+
const to = countries_1.currencyCodes[country];
|
|
20
|
+
if (!to) {
|
|
21
|
+
throw new Error(`Unable to find currency code for country: ${country}.`);
|
|
22
|
+
}
|
|
23
|
+
const url = `https://min-api.cryptocompare.com/data/price?fsym=${from}&tsyms=${from},${to}`;
|
|
24
|
+
const response = yield fetch(url);
|
|
25
|
+
const data = yield response.json();
|
|
26
|
+
const convertedValue = Math.round((value / (1 / data[to]) + Number.EPSILON) * 100) / 100;
|
|
27
|
+
return convertedValue;
|
|
28
|
+
});
|
|
29
|
+
exports.convert = convert;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Storage = exports.KeychainAdapter = void 0;
|
|
4
|
+
class KeychainAdapter {
|
|
5
|
+
deleteAddress() {
|
|
6
|
+
throw new Error('[Portal] KeychainAdapter method deleteAddress cannot be called directly. Please extend KeychainAdapter.');
|
|
7
|
+
}
|
|
8
|
+
deleteDkgResult() {
|
|
9
|
+
throw new Error('[Portal] KeychainAdapter method deleteDkgResult cannot be called directly. Please extend KeychainAdapter.');
|
|
10
|
+
}
|
|
11
|
+
getAddress(isSim) {
|
|
12
|
+
throw new Error(`[Portal] KeychainAdapter method getAddress(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
13
|
+
}
|
|
14
|
+
getDkgResult(isSim) {
|
|
15
|
+
throw new Error(`[Portal] KeychainAdapter method getDkgResult(${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
16
|
+
}
|
|
17
|
+
storeAddress(address, isSim) {
|
|
18
|
+
throw new Error(`[Portal] KeychainAdapter method storeAddress(${address}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
19
|
+
}
|
|
20
|
+
storeDkgResult(result, isSim) {
|
|
21
|
+
throw new Error(`[Portal] KeychainAdapter method storeDkgResult(${result}, ${isSim}) cannot be called directly. Please extend KeychainAdapter.`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.KeychainAdapter = KeychainAdapter;
|
|
25
|
+
class Storage {
|
|
26
|
+
read() {
|
|
27
|
+
throw new Error('[Portal] Storage method read cannot be called directly. Please extend Storage.');
|
|
28
|
+
}
|
|
29
|
+
write(privateKey) {
|
|
30
|
+
throw new Error(`[Portal] Storage method write(${privateKey}) cannot be called directly. Please extend Storage.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.Storage = Storage;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class HttpError extends Error {
|
|
4
|
+
constructor({ message, status, statusText }) {
|
|
5
|
+
super(`${status} - ${statusText}: ${message}`);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, HttpError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = HttpError;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.RpcErrorCodes = exports.ProviderRpcError = exports.NoAddressError = exports.MpcSigningError = exports.MissingOptionError = exports.InvalidGatewayConfigError = exports.InvalidChainIdError = exports.InvalidApiKeyError = exports.HttpError = void 0;
|
|
7
|
+
var http_error_1 = require("./http-error");
|
|
8
|
+
Object.defineProperty(exports, "HttpError", { enumerable: true, get: function () { return __importDefault(http_error_1).default; } });
|
|
9
|
+
var invalid_api_key_error_1 = require("./invalid-api-key-error");
|
|
10
|
+
Object.defineProperty(exports, "InvalidApiKeyError", { enumerable: true, get: function () { return __importDefault(invalid_api_key_error_1).default; } });
|
|
11
|
+
var invalid_chain_id_error_1 = require("./invalid-chain-id-error");
|
|
12
|
+
Object.defineProperty(exports, "InvalidChainIdError", { enumerable: true, get: function () { return __importDefault(invalid_chain_id_error_1).default; } });
|
|
13
|
+
var invalid_gateway_config_error_1 = require("./invalid-gateway-config-error");
|
|
14
|
+
Object.defineProperty(exports, "InvalidGatewayConfigError", { enumerable: true, get: function () { return __importDefault(invalid_gateway_config_error_1).default; } });
|
|
15
|
+
var missing_option_error_1 = require("./missing-option-error");
|
|
16
|
+
Object.defineProperty(exports, "MissingOptionError", { enumerable: true, get: function () { return __importDefault(missing_option_error_1).default; } });
|
|
17
|
+
var mpc_signing_error_1 = require("./mpc-signing-error");
|
|
18
|
+
Object.defineProperty(exports, "MpcSigningError", { enumerable: true, get: function () { return __importDefault(mpc_signing_error_1).default; } });
|
|
19
|
+
var no_address_error_1 = require("./no-address-error");
|
|
20
|
+
Object.defineProperty(exports, "NoAddressError", { enumerable: true, get: function () { return __importDefault(no_address_error_1).default; } });
|
|
21
|
+
var provider_rpc_error_1 = require("./provider-rpc-error");
|
|
22
|
+
Object.defineProperty(exports, "ProviderRpcError", { enumerable: true, get: function () { return __importDefault(provider_rpc_error_1).default; } });
|
|
23
|
+
Object.defineProperty(exports, "RpcErrorCodes", { enumerable: true, get: function () { return provider_rpc_error_1.RpcErrorCodes; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class InvalidApiKeyError extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super('[Portal] A valid Portal Client API Key was not provided.');
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, InvalidApiKeyError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = InvalidApiKeyError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class InvalidChainIdError extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super('[Portal] A valid Ethereum Chain ID was not provided.');
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, InvalidChainIdError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = InvalidChainIdError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class InvalidGatewayConfigError extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super('[Portal] A valid Gateway configuration was not provided.');
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, InvalidGatewayConfigError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = InvalidGatewayConfigError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class MissingOptionError extends Error {
|
|
4
|
+
constructor({ className, option }) {
|
|
5
|
+
super(`[Portal] Instance option '${option}' is required when instantiating ${className}.`);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, MissingOptionError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = MissingOptionError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class MpcSigningError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(`[Portal] An error occurred in the MPC signing process: ${message}`);
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, MpcSigningError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = MpcSigningError;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class NoAddressError extends Error {
|
|
4
|
+
constructor() {
|
|
5
|
+
super('[Portal] A valid wallet address was not provided.');
|
|
6
|
+
// Set the prototype explicitly.
|
|
7
|
+
Object.setPrototypeOf(this, NoAddressError.prototype);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = NoAddressError;
|