@riocrypto/common 1.0.2479 → 1.0.2482
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/build/classes/CryptoAsset.d.ts +3 -3
- package/build/classes/CryptoAsset.js +22 -1
- package/build/helpers/format-transaction-hash.js +3 -3
- package/build/helpers/get-address-for-testing.js +6 -0
- package/build/helpers/validate-address.js +5 -2
- package/build/types/base-market.d.ts +5 -0
- package/build/types/base-market.js +9 -0
- package/build/types/crypto.d.ts +4 -0
- package/build/types/crypto.js +4 -0
- package/build/types/order.d.ts +7 -0
- package/build/types/quote.d.ts +7 -0
- package/package.json +1 -1
|
@@ -4,8 +4,8 @@ export declare class CryptoAsset extends Asset {
|
|
|
4
4
|
rawSymbol: Crypto;
|
|
5
5
|
constructor(rawSymbol: Crypto);
|
|
6
6
|
getImageUri(): string;
|
|
7
|
-
getName(): Crypto.XLM | "Bitcoin" | "Ethereum" | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "Tron" | "Solana" | "Polygon";
|
|
8
|
-
getSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "BTC" | "ETH";
|
|
9
|
-
getGasSymbol(): Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | "BTC" | "ETH" | "MATIC" | "TRX" | "SOL" | "XLM";
|
|
7
|
+
getName(): Crypto.XLM | "Bitcoin" | "Ethereum" | "Ethereum (Base)" | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "EURC (Ethereum)" | "EURC (Solana)" | "EURC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "Tron" | "Solana" | "Polygon";
|
|
8
|
+
getSymbol(): Crypto.EURCEthereum | Crypto.EURCSolana | Crypto.EURCBase | Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | "USDC (Ethereum)" | "USDC (Polygon)" | "USDC (Bridged to Polygon)" | "USDC (Solana)" | "USDC (Stellar)" | "USDC (Base)" | "USDT (Polygon)" | "USDT (Ethereum)" | "USDT (Tron)" | "BTC" | "ETH" | "ETH (Base)";
|
|
9
|
+
getGasSymbol(): Crypto.EURCEthereum | Crypto.EURCSolana | Crypto.EURCBase | Crypto.SOL | Crypto.TRON | Crypto.POL | Crypto.XLM | "BTC" | "ETH" | "BASECHAIN_ETH" | "MATIC" | "TRX" | "SOL" | "XLM";
|
|
10
10
|
getDescription(): string;
|
|
11
11
|
}
|
|
@@ -53,6 +53,9 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
53
53
|
else if (this.rawSymbol === crypto_1.Crypto.ETH) {
|
|
54
54
|
return "Ethereum";
|
|
55
55
|
}
|
|
56
|
+
else if (this.rawSymbol === crypto_1.Crypto.ETHBase) {
|
|
57
|
+
return "Ethereum (Base)";
|
|
58
|
+
}
|
|
56
59
|
else if (this.rawSymbol === crypto_1.Crypto.USDC) {
|
|
57
60
|
return "USDC (Ethereum)";
|
|
58
61
|
}
|
|
@@ -71,6 +74,15 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
71
74
|
else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
|
|
72
75
|
return "USDC (Base)";
|
|
73
76
|
}
|
|
77
|
+
else if (this.rawSymbol === crypto_1.Crypto.EURCEthereum) {
|
|
78
|
+
return "EURC (Ethereum)";
|
|
79
|
+
}
|
|
80
|
+
else if (this.rawSymbol === crypto_1.Crypto.EURCSolana) {
|
|
81
|
+
return "EURC (Solana)";
|
|
82
|
+
}
|
|
83
|
+
else if (this.rawSymbol === crypto_1.Crypto.EURCBase) {
|
|
84
|
+
return "EURC (Base)";
|
|
85
|
+
}
|
|
74
86
|
else if (this.rawSymbol === crypto_1.Crypto.USDTPolygon) {
|
|
75
87
|
return "USDT (Polygon)";
|
|
76
88
|
}
|
|
@@ -100,6 +112,9 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
100
112
|
else if (this.rawSymbol === crypto_1.Crypto.ETH) {
|
|
101
113
|
return "ETH";
|
|
102
114
|
}
|
|
115
|
+
else if (this.rawSymbol === crypto_1.Crypto.ETHBase) {
|
|
116
|
+
return "ETH (Base)";
|
|
117
|
+
}
|
|
103
118
|
else if (this.rawSymbol === crypto_1.Crypto.USDC) {
|
|
104
119
|
return "USDC (Ethereum)";
|
|
105
120
|
}
|
|
@@ -138,6 +153,9 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
138
153
|
else if (this.rawSymbol === crypto_1.Crypto.ETH) {
|
|
139
154
|
return "ETH";
|
|
140
155
|
}
|
|
156
|
+
else if (this.rawSymbol === crypto_1.Crypto.ETHBase) {
|
|
157
|
+
return "BASECHAIN_ETH";
|
|
158
|
+
}
|
|
141
159
|
else if (this.rawSymbol === crypto_1.Crypto.USDCPolygon) {
|
|
142
160
|
return "MATIC";
|
|
143
161
|
}
|
|
@@ -154,7 +172,7 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
154
172
|
return "XLM";
|
|
155
173
|
}
|
|
156
174
|
else if (this.rawSymbol === crypto_1.Crypto.USDCBase) {
|
|
157
|
-
return "
|
|
175
|
+
return "BASECHAIN_ETH";
|
|
158
176
|
}
|
|
159
177
|
else if (this.rawSymbol === crypto_1.Crypto.USDC) {
|
|
160
178
|
return "ETH";
|
|
@@ -175,6 +193,9 @@ class CryptoAsset extends Asset_1.Asset {
|
|
|
175
193
|
}
|
|
176
194
|
else if (this.rawSymbol === crypto_1.Crypto.ETH) {
|
|
177
195
|
return "Ethereum is a decentralized, open-source blockchain with smart contract functionality.";
|
|
196
|
+
}
|
|
197
|
+
else if (this.rawSymbol === crypto_1.Crypto.ETHBase) {
|
|
198
|
+
return "Ethereum (Base) is a decentralized, open-source blockchain with smart contract functionality.";
|
|
178
199
|
// } else if (this.symbol === Crypto.XLM) {
|
|
179
200
|
// return "Stellar is an open source, decentralized protocol for digital currency to fiat money low-cost transfers which allows cross-border transactions between any pair of currencies.";
|
|
180
201
|
// } else if (this.symbol === Crypto.sUSDC) {
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.formatTransactionHash = void 0;
|
|
4
4
|
const crypto_1 = require("../types/crypto");
|
|
5
5
|
const formatTransactionHash = (hash, crypto) => {
|
|
6
|
-
if ([crypto_1.Crypto.USDC, crypto_1.Crypto.USDTEthereum].includes(crypto)) {
|
|
6
|
+
if ([crypto_1.Crypto.USDC, crypto_1.Crypto.USDTEthereum, crypto_1.Crypto.EURCEthereum].includes(crypto)) {
|
|
7
7
|
return `https://etherscan.io/tx/${hash}`;
|
|
8
8
|
}
|
|
9
9
|
else if ([crypto_1.Crypto.USDCPolygon, crypto_1.Crypto.USDTPolygon].includes(crypto)) {
|
|
10
10
|
return `https://polygonscan.com/tx/${hash}`;
|
|
11
11
|
}
|
|
12
|
-
else if ([crypto_1.Crypto.USDCSolana].includes(crypto)) {
|
|
12
|
+
else if ([crypto_1.Crypto.USDCSolana, crypto_1.Crypto.EURCSolana].includes(crypto)) {
|
|
13
13
|
return `https://explorer.solana.com/tx/${hash}`;
|
|
14
14
|
}
|
|
15
15
|
else if ([crypto_1.Crypto.USDTTron].includes(crypto)) {
|
|
@@ -18,7 +18,7 @@ const formatTransactionHash = (hash, crypto) => {
|
|
|
18
18
|
else if ([crypto_1.Crypto.USDCStellar].includes(crypto)) {
|
|
19
19
|
return `https://stellar.expert/explorer/public/tx/${hash}`;
|
|
20
20
|
}
|
|
21
|
-
else if ([crypto_1.Crypto.USDCBase].includes(crypto)) {
|
|
21
|
+
else if ([crypto_1.Crypto.USDCBase, crypto_1.Crypto.EURCBase].includes(crypto)) {
|
|
22
22
|
return `https://basescan.org/tx/${hash}`;
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
@@ -8,6 +8,8 @@ const getAddressForTesting = (crypto) => {
|
|
|
8
8
|
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
9
9
|
case crypto_1.Crypto.USDCPolygon:
|
|
10
10
|
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
11
|
+
case crypto_1.Crypto.EURCEthereum:
|
|
12
|
+
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
11
13
|
case crypto_1.Crypto.USDTEthereum:
|
|
12
14
|
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
13
15
|
case crypto_1.Crypto.USDTPolygon:
|
|
@@ -16,6 +18,8 @@ const getAddressForTesting = (crypto) => {
|
|
|
16
18
|
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
17
19
|
case crypto_1.Crypto.USDCSolana:
|
|
18
20
|
return { address: "5BZDQjWad45rT1vYT5KdJHgSU4rWXL1Y5nDoTwSrT8Pr" };
|
|
21
|
+
case crypto_1.Crypto.EURCSolana:
|
|
22
|
+
return { address: "5BZDQjWad45rT1vYT5KdJHgSU4rWXL1Y5nDoTwSrT8Pr" };
|
|
19
23
|
case crypto_1.Crypto.USDTTron:
|
|
20
24
|
return { address: "TS9kzAVq4PR7xNoQDJXSP6Kgi8GFbwUbzg" };
|
|
21
25
|
case crypto_1.Crypto.USDCStellar:
|
|
@@ -25,6 +29,8 @@ const getAddressForTesting = (crypto) => {
|
|
|
25
29
|
};
|
|
26
30
|
case crypto_1.Crypto.USDCBase:
|
|
27
31
|
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
32
|
+
case crypto_1.Crypto.EURCBase:
|
|
33
|
+
return { address: "0xAf56edF88c429F1D6858f9E47731FF53F6d34D0C" };
|
|
28
34
|
default:
|
|
29
35
|
throw new Error(`Unsupported crypto: ${crypto}`);
|
|
30
36
|
}
|
|
@@ -10,17 +10,20 @@ const isValidCryptoAddress = (address, crypto) => {
|
|
|
10
10
|
switch (crypto) {
|
|
11
11
|
case crypto_1.Crypto.BTC:
|
|
12
12
|
return bitcoinPattern.test(address);
|
|
13
|
-
case crypto_1.Crypto.SOL:
|
|
13
|
+
case crypto_1.Crypto.SOL || crypto_1.Crypto.USDCSolana || crypto_1.Crypto.EURCSolana:
|
|
14
14
|
return solanaPattern.test(address);
|
|
15
15
|
case crypto_1.Crypto.USDCStellar:
|
|
16
16
|
return stellarPattern.test(address);
|
|
17
17
|
case crypto_1.Crypto.ETH ||
|
|
18
|
+
crypto_1.Crypto.ETHBase ||
|
|
18
19
|
crypto_1.Crypto.USDC ||
|
|
19
20
|
crypto_1.Crypto.USDCPolygon ||
|
|
20
21
|
crypto_1.Crypto.USDCBase ||
|
|
22
|
+
crypto_1.Crypto.EURCBase ||
|
|
21
23
|
crypto_1.Crypto.USDTTron ||
|
|
22
24
|
crypto_1.Crypto.USDTPolygon ||
|
|
23
|
-
crypto_1.Crypto.USDTEthereum
|
|
25
|
+
crypto_1.Crypto.USDTEthereum ||
|
|
26
|
+
crypto_1.Crypto.EURCEthereum:
|
|
24
27
|
return ethereumPattern.test(address);
|
|
25
28
|
default:
|
|
26
29
|
return false;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseMarket = void 0;
|
|
4
|
+
var BaseMarket;
|
|
5
|
+
(function (BaseMarket) {
|
|
6
|
+
BaseMarket["USDC_MXN"] = "USDC_MXN";
|
|
7
|
+
BaseMarket["USDC_PEN"] = "USDC_PEN";
|
|
8
|
+
BaseMarket["EURC_USDC"] = "EURC_USDC";
|
|
9
|
+
})(BaseMarket = exports.BaseMarket || (exports.BaseMarket = {}));
|
package/build/types/crypto.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
export declare enum Crypto {
|
|
2
2
|
BTC = "BTC",
|
|
3
3
|
ETH = "ETH",
|
|
4
|
+
ETHBase = "BASECHAIN_ETH",
|
|
4
5
|
USDC = "USDC",
|
|
5
6
|
USDCPolygonBridged = "USDC_POLYGON",
|
|
6
7
|
USDCPolygon = "USDC_POLYGON_NXTB",
|
|
7
8
|
USDCSolana = "SOL_USDC_PTHX",
|
|
8
9
|
USDCStellar = "XLM_USDC_5F3T",
|
|
9
10
|
USDCBase = "USDC_BASECHAIN_ETH_5I5C",
|
|
11
|
+
EURCEthereum = "EUROC_ETH_F5NG",
|
|
12
|
+
EURCSolana = "EURC_SOL",
|
|
13
|
+
EURCBase = "EURC_B609K9QB_Y213",
|
|
10
14
|
USDTPolygon = "USDT_POLYGON",
|
|
11
15
|
USDTEthereum = "USDT_ERC20",
|
|
12
16
|
USDTTron = "TRX_USDT_S2UZ",
|
package/build/types/crypto.js
CHANGED
|
@@ -5,12 +5,16 @@ var Crypto;
|
|
|
5
5
|
(function (Crypto) {
|
|
6
6
|
Crypto["BTC"] = "BTC";
|
|
7
7
|
Crypto["ETH"] = "ETH";
|
|
8
|
+
Crypto["ETHBase"] = "BASECHAIN_ETH";
|
|
8
9
|
Crypto["USDC"] = "USDC";
|
|
9
10
|
Crypto["USDCPolygonBridged"] = "USDC_POLYGON";
|
|
10
11
|
Crypto["USDCPolygon"] = "USDC_POLYGON_NXTB";
|
|
11
12
|
Crypto["USDCSolana"] = "SOL_USDC_PTHX";
|
|
12
13
|
Crypto["USDCStellar"] = "XLM_USDC_5F3T";
|
|
13
14
|
Crypto["USDCBase"] = "USDC_BASECHAIN_ETH_5I5C";
|
|
15
|
+
Crypto["EURCEthereum"] = "EUROC_ETH_F5NG";
|
|
16
|
+
Crypto["EURCSolana"] = "EURC_SOL";
|
|
17
|
+
Crypto["EURCBase"] = "EURC_B609K9QB_Y213";
|
|
14
18
|
Crypto["USDTPolygon"] = "USDT_POLYGON";
|
|
15
19
|
Crypto["USDTEthereum"] = "USDT_ERC20";
|
|
16
20
|
Crypto["USDTTron"] = "TRX_USDT_S2UZ";
|
package/build/types/order.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ import { OrderAttribute } from "./order-attribute";
|
|
|
12
12
|
import { DeferredPaymentType } from "./deferred-payment-type";
|
|
13
13
|
import { TwoWaySettlementType } from "./two-way-settlement-type";
|
|
14
14
|
import { OrderType } from "./order-type";
|
|
15
|
+
import { BaseMarket } from "./base-market";
|
|
15
16
|
export interface Order {
|
|
16
17
|
id: string;
|
|
17
18
|
clientReferenceId?: string;
|
|
@@ -147,5 +148,11 @@ export interface Order {
|
|
|
147
148
|
sessionId: string;
|
|
148
149
|
settlementId: string;
|
|
149
150
|
};
|
|
151
|
+
marketPriceByBaseMarket?: {
|
|
152
|
+
[marketKey in BaseMarket]: number;
|
|
153
|
+
};
|
|
154
|
+
netPriceByBaseMarket?: {
|
|
155
|
+
[marketKey in BaseMarket]: number;
|
|
156
|
+
};
|
|
150
157
|
version: number;
|
|
151
158
|
}
|
package/build/types/quote.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { Processor } from "./processor";
|
|
|
10
10
|
import { Side } from "./side";
|
|
11
11
|
import { TwoWaySettlementType } from "./two-way-settlement-type";
|
|
12
12
|
import { OrderType } from "./order-type";
|
|
13
|
+
import { BaseMarket } from "./base-market";
|
|
13
14
|
export interface Quote {
|
|
14
15
|
id?: string;
|
|
15
16
|
userId: string;
|
|
@@ -55,4 +56,10 @@ export interface Quote {
|
|
|
55
56
|
twoWaySettlementType: TwoWaySettlementType;
|
|
56
57
|
twoWaySettlementDateOffset?: number;
|
|
57
58
|
effectiveTwoWaySettlementDateOffset?: number;
|
|
59
|
+
marketPriceByBaseMarket?: {
|
|
60
|
+
[marketKey in BaseMarket]: number;
|
|
61
|
+
};
|
|
62
|
+
netPriceByBaseMarket?: {
|
|
63
|
+
[marketKey in BaseMarket]: number;
|
|
64
|
+
};
|
|
58
65
|
}
|