@orb-labs/orby-core 0.0.5 → 0.0.7
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/CHANGELOG.md +7 -0
- package/dist/actions/account_cluster.d.ts +5 -5
- package/dist/actions/account_cluster.js +147 -330
- package/dist/actions/admin.d.ts +3 -3
- package/dist/actions/admin.js +37 -127
- package/dist/actions/application.d.ts +2 -2
- package/dist/actions/application.js +14 -77
- package/dist/actions/instance.d.ts +3 -3
- package/dist/actions/instance.js +98 -255
- package/dist/actions/operation.d.ts +4 -4
- package/dist/actions/operation.js +92 -263
- package/dist/actions/token.d.ts +3 -3
- package/dist/actions/token.js +34 -119
- package/dist/constants.d.ts +3 -3
- package/dist/constants.js +70 -71
- package/dist/entities/account.d.ts +1 -1
- package/dist/entities/account.js +25 -30
- package/dist/entities/financial/account_balance.d.ts +2 -2
- package/dist/entities/financial/account_balance.js +20 -22
- package/dist/entities/financial/asset.js +13 -15
- package/dist/entities/financial/currency.d.ts +1 -1
- package/dist/entities/financial/currency.js +16 -35
- package/dist/entities/financial/currency_amount.d.ts +1 -1
- package/dist/entities/financial/currency_amount.js +49 -71
- package/dist/entities/financial/fungible_token.d.ts +2 -2
- package/dist/entities/financial/fungible_token.js +31 -52
- package/dist/entities/financial/fungible_token_amount.d.ts +2 -2
- package/dist/entities/financial/fungible_token_amount.js +53 -75
- package/dist/entities/financial/non_fungible_token.d.ts +2 -2
- package/dist/entities/financial/non_fungible_token.js +25 -45
- package/dist/entities/financial/semi_fungible_token.d.ts +2 -2
- package/dist/entities/financial/semi_fungible_token.js +25 -45
- package/dist/entities/library_request.d.ts +1 -1
- package/dist/entities/library_request.js +7 -9
- package/dist/entities/state.d.ts +4 -4
- package/dist/entities/state.js +57 -67
- package/dist/index.d.ts +27 -27
- package/dist/index.js +27 -27
- package/dist/interfaces/account_cluster.d.ts +4 -4
- package/dist/interfaces/admin.d.ts +1 -1
- package/dist/interfaces/instance.d.ts +1 -1
- package/dist/interfaces/operation.d.ts +3 -3
- package/dist/interfaces/orby.d.ts +6 -6
- package/dist/interfaces/token.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +7 -7
- package/dist/utils/action_helpers.d.ts +1 -1
- package/dist/utils/action_helpers.js +42 -58
- package/dist/utils/jsbi.d.ts +2 -0
- package/dist/utils/jsbi.js +2 -0
- package/dist/utils/utils.d.ts +1 -1
- package/dist/utils/utils.js +17 -19
- package/dist/utils/validateAndParseAddress.js +3 -3
- package/package.json +4 -2
package/dist/constants.js
CHANGED
@@ -1,134 +1,133 @@
|
|
1
|
-
var _a, _b, _c;
|
2
1
|
import toFormat from "toformat";
|
3
2
|
import _Big from "big.js";
|
4
|
-
import { Blockchain, BlockchainEnvironment } from "./enums";
|
5
|
-
import { Currency } from "./entities/financial/currency";
|
6
|
-
export
|
7
|
-
export
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
3
|
+
import { Blockchain, BlockchainEnvironment } from "./enums.js";
|
4
|
+
import { Currency } from "./entities/financial/currency.js";
|
5
|
+
export const Big = toFormat(_Big);
|
6
|
+
export const BLOCKCHAIN_ID = {
|
7
|
+
[Blockchain.ETHEREUM]: 1,
|
8
|
+
[Blockchain.POLYGON]: 137,
|
9
|
+
[Blockchain.BINANCE]: 56,
|
10
|
+
[Blockchain.ARBITRUM]: 42161,
|
11
|
+
[Blockchain.ARBITRUM_NOVA]: 42170,
|
12
|
+
[Blockchain.OPTIMISM]: 10,
|
13
|
+
[Blockchain.EVMOS]: 9001,
|
14
|
+
[Blockchain.MOONBEAM]: 1284,
|
15
|
+
[Blockchain.BASE]: 8453,
|
16
|
+
[Blockchain.AVALANCHE]: 43114,
|
18
17
|
// testnets
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
18
|
+
[Blockchain.ETHEREUM_SEPOLIA]: 11155111,
|
19
|
+
[Blockchain.ETHEREUM_HOLESKY]: 17000,
|
20
|
+
[Blockchain.ARBITRUM_SEPOLIA]: 421614,
|
21
|
+
[Blockchain.OPTIMISM_SEPOLIA]: 11155420,
|
22
|
+
[Blockchain.POLYGON_AMOY]: 80002,
|
23
|
+
[Blockchain.BINANCE_TESTNET]: 97,
|
24
|
+
[Blockchain.OPBNB_TESTNET]: 5611,
|
25
|
+
[Blockchain.MOONBEAM_ALPHA]: 1287,
|
26
|
+
[Blockchain.BASE_SEPOLIA]: 84532,
|
28
27
|
// local testing
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
export
|
34
|
-
|
28
|
+
[Blockchain.HARDHAT]: 31337,
|
29
|
+
[Blockchain.LOCAL_CHAIN_0]: 1_000_000_000_001,
|
30
|
+
[Blockchain.LOCAL_CHAIN_1]: 1_000_000_000_002,
|
31
|
+
};
|
32
|
+
export const CHAIN_CONFIGS = {
|
33
|
+
[Blockchain.ETHEREUM]: {
|
35
34
|
environment: BlockchainEnvironment.MAINNET,
|
36
35
|
chainId: BigInt(1),
|
37
36
|
},
|
38
|
-
|
37
|
+
[Blockchain.POLYGON]: {
|
39
38
|
environment: BlockchainEnvironment.MAINNET,
|
40
39
|
chainId: BigInt(137),
|
41
40
|
},
|
42
|
-
|
41
|
+
[Blockchain.BINANCE]: {
|
43
42
|
environment: BlockchainEnvironment.MAINNET,
|
44
43
|
chainId: BigInt(56),
|
45
44
|
},
|
46
|
-
|
45
|
+
[Blockchain.ARBITRUM]: {
|
47
46
|
environment: BlockchainEnvironment.MAINNET,
|
48
47
|
chainId: BigInt(42161),
|
49
48
|
},
|
50
|
-
|
49
|
+
[Blockchain.ARBITRUM_NOVA]: {
|
51
50
|
environment: BlockchainEnvironment.MAINNET,
|
52
51
|
chainId: BigInt(42170),
|
53
52
|
},
|
54
|
-
|
53
|
+
[Blockchain.OPTIMISM]: {
|
55
54
|
environment: BlockchainEnvironment.MAINNET,
|
56
55
|
chainId: BigInt(10),
|
57
56
|
},
|
58
|
-
|
57
|
+
[Blockchain.EVMOS]: {
|
59
58
|
environment: BlockchainEnvironment.MAINNET,
|
60
59
|
chainId: BigInt(9001),
|
61
60
|
},
|
62
|
-
|
61
|
+
[Blockchain.MOONBEAM]: {
|
63
62
|
environment: BlockchainEnvironment.MAINNET,
|
64
63
|
chainId: BigInt(1284),
|
65
64
|
},
|
66
|
-
|
65
|
+
[Blockchain.BASE]: {
|
67
66
|
environment: BlockchainEnvironment.MAINNET,
|
68
67
|
chainId: BigInt(8453),
|
69
68
|
},
|
70
|
-
|
69
|
+
[Blockchain.AVALANCHE]: {
|
71
70
|
environment: BlockchainEnvironment.MAINNET,
|
72
71
|
chainId: BigInt(43114),
|
73
72
|
},
|
74
73
|
// testnets
|
75
|
-
|
74
|
+
[Blockchain.ETHEREUM_SEPOLIA]: {
|
76
75
|
environment: BlockchainEnvironment.TESTNET,
|
77
76
|
chainId: BigInt(11155111),
|
78
77
|
},
|
79
|
-
|
78
|
+
[Blockchain.ETHEREUM_HOLESKY]: {
|
80
79
|
environment: BlockchainEnvironment.TESTNET,
|
81
80
|
chainId: BigInt(17000),
|
82
81
|
},
|
83
|
-
|
82
|
+
[Blockchain.ARBITRUM_SEPOLIA]: {
|
84
83
|
environment: BlockchainEnvironment.TESTNET,
|
85
84
|
chainId: BigInt(421614),
|
86
85
|
},
|
87
|
-
|
86
|
+
[Blockchain.BASE_SEPOLIA]: {
|
88
87
|
environment: BlockchainEnvironment.TESTNET,
|
89
88
|
chainId: BigInt(84532),
|
90
89
|
},
|
91
|
-
|
90
|
+
[Blockchain.OPTIMISM_SEPOLIA]: {
|
92
91
|
environment: BlockchainEnvironment.TESTNET,
|
93
92
|
chainId: BigInt(11155420),
|
94
93
|
},
|
95
|
-
|
94
|
+
[Blockchain.BINANCE_TESTNET]: {
|
96
95
|
environment: BlockchainEnvironment.TESTNET,
|
97
96
|
chainId: BigInt(97),
|
98
97
|
},
|
99
|
-
|
98
|
+
[Blockchain.OPBNB_TESTNET]: {
|
100
99
|
environment: BlockchainEnvironment.TESTNET,
|
101
100
|
chainId: BigInt(5611),
|
102
101
|
},
|
103
|
-
|
102
|
+
[Blockchain.MOONBEAM_ALPHA]: {
|
104
103
|
environment: BlockchainEnvironment.TESTNET,
|
105
104
|
chainId: BigInt(1287),
|
106
105
|
},
|
107
|
-
|
106
|
+
[Blockchain.POLYGON_AMOY]: {
|
108
107
|
environment: BlockchainEnvironment.TESTNET,
|
109
108
|
chainId: BigInt(80002),
|
110
109
|
},
|
111
|
-
|
112
|
-
export
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
110
|
+
};
|
111
|
+
export const BLOCKCHAIN_ID_TO_BLOCKCHAIN = {
|
112
|
+
[1]: Blockchain.ETHEREUM,
|
113
|
+
[137]: Blockchain.POLYGON,
|
114
|
+
[56]: Blockchain.BINANCE,
|
115
|
+
[42161]: Blockchain.ARBITRUM,
|
116
|
+
[42170]: Blockchain.ARBITRUM_NOVA,
|
117
|
+
[10]: Blockchain.OPTIMISM,
|
118
|
+
[9001]: Blockchain.EVMOS,
|
119
|
+
[1284]: Blockchain.MOONBEAM,
|
120
|
+
[8453]: Blockchain.BASE,
|
121
|
+
[43114]: Blockchain.AVALANCHE,
|
123
122
|
// testnets
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
export
|
123
|
+
[11155111]: Blockchain.ETHEREUM_SEPOLIA,
|
124
|
+
[84532]: Blockchain.BASE_SEPOLIA,
|
125
|
+
[17000]: Blockchain.ETHEREUM_HOLESKY,
|
126
|
+
[421614]: Blockchain.ARBITRUM_SEPOLIA,
|
127
|
+
[11155420]: Blockchain.OPTIMISM_SEPOLIA,
|
128
|
+
[80002]: Blockchain.POLYGON_AMOY,
|
129
|
+
[97]: Blockchain.BINANCE_TESTNET,
|
130
|
+
[5611]: Blockchain.OPBNB_TESTNET,
|
131
|
+
[1287]: Blockchain.MOONBEAM_ALPHA,
|
132
|
+
};
|
133
|
+
export const FIAT_CURRENCY = new Currency(6, "USD", "US Dollar", undefined, false, false);
|
package/dist/entities/account.js
CHANGED
@@ -1,10 +1,20 @@
|
|
1
|
-
import { AccountType } from "../enums";
|
2
|
-
import { getChainIdFromOrbyChainId } from "../utils/utils";
|
3
|
-
|
4
|
-
|
1
|
+
import { AccountType } from "../enums.js";
|
2
|
+
import { getChainIdFromOrbyChainId } from "../utils/utils.js";
|
3
|
+
export class Account {
|
4
|
+
static toAccount(account) {
|
5
|
+
const chainId = account?.chainId
|
6
|
+
? getChainIdFromOrbyChainId(account.chainId)
|
7
|
+
: undefined;
|
8
|
+
const formattedAccountType = account?.accountType?.toLowerCase();
|
9
|
+
if (!chainId && formattedAccountType == AccountType.SCA) {
|
10
|
+
return undefined;
|
11
|
+
}
|
12
|
+
return new Account(account.address, formattedAccountType, account.vmType, chainId);
|
13
|
+
}
|
14
|
+
constructor(address, accountType, vmType, chainId) {
|
5
15
|
// TODO(felix): add this back
|
6
16
|
// invariant(!_.isUndefined(getBlockchainFromBlockchainId(chainId)), "CHAIN_ID");
|
7
|
-
this.address = address
|
17
|
+
this.address = address?.toLowerCase(); // validateAndParseAddress(address)?.toLowerCase();
|
8
18
|
this.chainId = chainId ? BigInt(chainId) : undefined;
|
9
19
|
this.accountType = accountType;
|
10
20
|
this.vmType = vmType;
|
@@ -16,35 +26,20 @@ var Account = /** @class */ (function () {
|
|
16
26
|
this.hasSufficientBalanceForGas = false;
|
17
27
|
}
|
18
28
|
}
|
19
|
-
|
20
|
-
var _a;
|
21
|
-
var chainId = (account === null || account === void 0 ? void 0 : account.chainId)
|
22
|
-
? getChainIdFromOrbyChainId(account.chainId)
|
23
|
-
: undefined;
|
24
|
-
var formattedAccountType = (_a = account === null || account === void 0 ? void 0 : account.accountType) === null || _a === void 0 ? void 0 : _a.toLowerCase();
|
25
|
-
if (!chainId && formattedAccountType == AccountType.SCA) {
|
26
|
-
return undefined;
|
27
|
-
}
|
28
|
-
return new Account(account.address, formattedAccountType, account.vmType, chainId);
|
29
|
-
};
|
30
|
-
Account.key = function (address, chainId) {
|
31
|
-
var _a;
|
29
|
+
static key(address, chainId) {
|
32
30
|
return chainId
|
33
|
-
?
|
31
|
+
? `${chainId?.toString()?.toLowerCase()}-${address}`
|
34
32
|
: address;
|
35
|
-
}
|
36
|
-
|
37
|
-
var _a, _b;
|
33
|
+
}
|
34
|
+
toAccountModel() {
|
38
35
|
return {
|
39
36
|
address: this.address,
|
40
|
-
accountType:
|
41
|
-
vmType:
|
37
|
+
accountType: this.accountType?.toUpperCase(),
|
38
|
+
vmType: this.vmType?.toUpperCase(),
|
42
39
|
chainId: this.chainId ? "EIP155-" + this.chainId : undefined,
|
43
40
|
};
|
44
|
-
}
|
45
|
-
|
41
|
+
}
|
42
|
+
equals(other) {
|
46
43
|
return this.key == other.key && this.accountType == other.accountType;
|
47
|
-
}
|
48
|
-
|
49
|
-
}());
|
50
|
-
export { Account };
|
44
|
+
}
|
45
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { Account } from "../account";
|
2
|
-
import { FungibleTokenAmount } from "./fungible_token_amount";
|
1
|
+
import { Account } from "../account.js";
|
2
|
+
import { FungibleTokenAmount } from "./fungible_token_amount.js";
|
3
3
|
export declare class AccountBalance {
|
4
4
|
readonly amount: FungibleTokenAmount;
|
5
5
|
readonly account: Account;
|
@@ -1,33 +1,31 @@
|
|
1
|
-
import { Account } from "../account";
|
2
|
-
import { FungibleTokenAmount } from "./fungible_token_amount";
|
3
|
-
|
4
|
-
|
5
|
-
this.amount = amount;
|
6
|
-
this.account = account;
|
7
|
-
}
|
8
|
-
AccountBalance.toAccountBalance = function (balance) {
|
1
|
+
import { Account } from "../account.js";
|
2
|
+
import { FungibleTokenAmount } from "./fungible_token_amount.js";
|
3
|
+
export class AccountBalance {
|
4
|
+
static toAccountBalance(balance) {
|
9
5
|
if (!balance) {
|
10
6
|
return undefined;
|
11
7
|
}
|
12
|
-
|
13
|
-
|
8
|
+
const amount = FungibleTokenAmount.toFungibleTokenAmount(balance.amount);
|
9
|
+
const account = Account.toAccount(balance.account);
|
14
10
|
return new AccountBalance(amount, account);
|
15
|
-
}
|
16
|
-
|
11
|
+
}
|
12
|
+
constructor(amount, account) {
|
13
|
+
this.amount = amount;
|
14
|
+
this.account = account;
|
15
|
+
}
|
16
|
+
equals(other) {
|
17
17
|
return (this.account.equals(other.account) && this.amount.equals(other.amount));
|
18
|
-
}
|
19
|
-
|
18
|
+
}
|
19
|
+
lessThan(other) {
|
20
20
|
return (this.account.equals(other.account) && this.amount.lessThan(other.amount));
|
21
|
-
}
|
22
|
-
|
21
|
+
}
|
22
|
+
greaterThan(other) {
|
23
23
|
return (this.account.equals(other.account) &&
|
24
24
|
this.amount.greaterThan(other.amount));
|
25
|
-
}
|
26
|
-
|
25
|
+
}
|
26
|
+
greaterThanOrEqual(other) {
|
27
27
|
return (this.account.equals(other.account) &&
|
28
28
|
(this.amount.greaterThan(other.amount) ||
|
29
29
|
this.amount.equals(other.amount)));
|
30
|
-
}
|
31
|
-
|
32
|
-
}());
|
33
|
-
export { AccountBalance };
|
30
|
+
}
|
31
|
+
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
/**
|
2
2
|
* An Asset is any fungible financial instrument, including Ether, all ERC20 tokens, and NFTs
|
3
3
|
*/
|
4
|
-
|
4
|
+
export class Asset {
|
5
5
|
/**
|
6
6
|
* Constructs an instance of the `Asset`.
|
7
7
|
* @param symbol symbol of the asset
|
8
8
|
* @param name of the asset
|
9
9
|
*/
|
10
|
-
|
10
|
+
constructor(symbol, name, coinGeckoId) {
|
11
11
|
this.symbol = symbol;
|
12
12
|
this.name = name;
|
13
13
|
this.coinGeckoId = coinGeckoId;
|
@@ -16,25 +16,23 @@ var Asset = /** @class */ (function () {
|
|
16
16
|
* Returns whether this asset is functionally equivalent to the other asset
|
17
17
|
* @param other the other asset
|
18
18
|
*/
|
19
|
-
|
19
|
+
equals(other) {
|
20
20
|
if (this === other)
|
21
21
|
return true;
|
22
22
|
return this.symbol === other.symbol && this.name === other.name;
|
23
|
-
}
|
23
|
+
}
|
24
24
|
// return Asset in the "@domains/orby/src/api/graphql/generated" but could not set type here because the generated code is not available for other domains
|
25
|
-
|
25
|
+
toAssetModel() {
|
26
26
|
return { symbol: this.symbol, name: this.name };
|
27
|
-
}
|
28
|
-
|
27
|
+
}
|
28
|
+
static toAsset(asset) {
|
29
29
|
if (!asset) {
|
30
30
|
return undefined;
|
31
31
|
}
|
32
|
-
|
32
|
+
const { symbol, name } = asset;
|
33
33
|
return new Asset(symbol, name);
|
34
|
-
}
|
35
|
-
|
36
|
-
return
|
37
|
-
}
|
38
|
-
|
39
|
-
}());
|
40
|
-
export { Asset };
|
34
|
+
}
|
35
|
+
id() {
|
36
|
+
return `${this.name}:${this.symbol}`;
|
37
|
+
}
|
38
|
+
}
|
@@ -1,27 +1,11 @@
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
2
|
-
var extendStatics = function (d, b) {
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
6
|
-
return extendStatics(d, b);
|
7
|
-
};
|
8
|
-
return function (d, b) {
|
9
|
-
if (typeof b !== "function" && b !== null)
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
11
|
-
extendStatics(d, b);
|
12
|
-
function __() { this.constructor = d; }
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
14
|
-
};
|
15
|
-
})();
|
16
1
|
import invariant from "tiny-invariant";
|
17
|
-
import { Asset } from "./asset";
|
2
|
+
import { Asset } from "./asset.js";
|
18
3
|
// This class is inspired by the Uniswap SDK's (@uniswap/sdk-core) CurrencyAmount class. Create this instance here
|
19
4
|
// because we represent currency amounts that are not fungible token amounts.
|
20
5
|
/**
|
21
6
|
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
|
22
7
|
*/
|
23
|
-
|
24
|
-
__extends(Currency, _super);
|
8
|
+
export class Currency extends Asset {
|
25
9
|
/**
|
26
10
|
* Constructs an instance of the base class `Currency`.
|
27
11
|
* @param decimals decimals of the currency
|
@@ -30,39 +14,36 @@ var Currency = /** @class */ (function (_super) {
|
|
30
14
|
* @param isNative whether the currency is native to the chain and must be wrapped (e.g. Ether)
|
31
15
|
* @param isToken whether the currency is a token that is usable in Uniswap without wrapping
|
32
16
|
*/
|
33
|
-
|
34
|
-
|
17
|
+
constructor(decimals, symbol, name, logoUrl, isNative, isToken, coinGeckoId) {
|
18
|
+
super(symbol, name, coinGeckoId);
|
35
19
|
invariant(decimals >= 0 && decimals < 255 && Number.isInteger(decimals), "DECIMALS");
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return _this;
|
20
|
+
this.decimals = decimals;
|
21
|
+
this.isNative = isNative ?? false;
|
22
|
+
this.isToken = isToken ?? true;
|
23
|
+
this.logoUrl = logoUrl;
|
41
24
|
}
|
42
25
|
/**
|
43
26
|
* Returns whether this currency is functionally equivalent to the other currency
|
44
27
|
* @param other the other currency
|
45
28
|
*/
|
46
|
-
|
29
|
+
equals(other) {
|
47
30
|
if (this === other)
|
48
31
|
return true;
|
49
32
|
return (this.symbol === other.symbol &&
|
50
33
|
this.name === other.name &&
|
51
34
|
this.decimals === other.decimals);
|
52
|
-
}
|
35
|
+
}
|
53
36
|
/**
|
54
37
|
* Returns the asset representation of this currency
|
55
38
|
*/
|
56
|
-
|
39
|
+
asset() {
|
57
40
|
return this;
|
58
|
-
}
|
59
|
-
|
41
|
+
}
|
42
|
+
static toCurrency(currency) {
|
60
43
|
if (!currency) {
|
61
44
|
return undefined;
|
62
45
|
}
|
63
|
-
|
46
|
+
const { asset, decimals, logoUrl, isNative } = currency;
|
64
47
|
return new Currency(decimals, asset.symbol, asset.name, logoUrl, isNative);
|
65
|
-
}
|
66
|
-
|
67
|
-
}(Asset));
|
68
|
-
export { Currency };
|
48
|
+
}
|
49
|
+
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import JSBI from "jsbi";
|
2
2
|
import { Fraction, BigintIsh, Rounding } from "@uniswap/sdk-core";
|
3
|
-
import { Currency } from "./currency";
|
3
|
+
import { Currency } from "./currency.js";
|
4
4
|
export declare class CurrencyAmount extends Fraction {
|
5
5
|
readonly currency: Currency;
|
6
6
|
readonly decimalScale: JSBI;
|