From f55a34c62bf1f8aa4ce1a79f2132c739b6ac8f44 Mon Sep 17 00:00:00 2001 From: Nantian Date: Thu, 5 Sep 2024 12:47:54 +1200 Subject: [PATCH 1/4] fix lodash --- packages/sdk-core/src/converter.ts | 2 +- packages/sdk-core/src/fixed-point-number.ts | 2 +- packages/sdk-payment/src/Payment.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/sdk-core/src/converter.ts b/packages/sdk-core/src/converter.ts index 9b0da1b5..51cc6b63 100644 --- a/packages/sdk-core/src/converter.ts +++ b/packages/sdk-core/src/converter.ts @@ -1,5 +1,5 @@ import { AcalaPrimitivesCurrencyCurrencyId, AcalaPrimitivesCurrencyTokenSymbol } from '@polkadot/types/lookup'; -import { isArray } from 'lodash'; +import isArray from 'lodash/isArray.js'; import { ConvertToCurrencyIdFailed, ConvertToCurrencyNameFailed, diff --git a/packages/sdk-core/src/fixed-point-number.ts b/packages/sdk-core/src/fixed-point-number.ts index 7f33ca2b..9998a951 100644 --- a/packages/sdk-core/src/fixed-point-number.ts +++ b/packages/sdk-core/src/fixed-point-number.ts @@ -1,5 +1,5 @@ import { BigNumber } from 'bignumber.js'; -import { isNumber } from 'lodash'; +import isNumber from 'lodash/isNumber.js'; /** * @constant diff --git a/packages/sdk-payment/src/Payment.ts b/packages/sdk-payment/src/Payment.ts index 9e4e80ce..62c79005 100644 --- a/packages/sdk-payment/src/Payment.ts +++ b/packages/sdk-payment/src/Payment.ts @@ -2,7 +2,7 @@ import { Wallet } from '@acala-network/sdk'; import { AggregateDex } from '@acala-network/sdk-swap'; import { PaymentConfig, PaymentMethod, PaymentMethodTypes, Tx } from './types.js'; import { AnyApi, Token } from '@acala-network/sdk-core'; -import { isEmpty } from 'lodash'; +import isEmpty from 'lodash/isEmpty.js'; import { toPromise } from './utils/index.js'; import { Storages, createStorages } from './storage.js'; import { NotReady } from './error.js'; From d338b14fe41f8ed08c75643adc4b4986f95f1f7f Mon Sep 17 00:00:00 2001 From: Nantian Date: Thu, 5 Sep 2024 13:27:17 +1200 Subject: [PATCH 2/4] fix esm --- packages/sdk-loan/src/loan.ts | 2 +- packages/sdk-loan/src/storages.ts | 2 +- packages/sdk-loan/src/types.ts | 2 +- packages/sdk-payment/src/storage.ts | 2 +- packages/sdk-swap/src/dex-providers/acala/index.ts | 4 ++-- packages/sdk/src/wallet/balance-adapter/erc20-adapter.ts | 2 +- packages/sdk/src/wallet/token-provider/acala.ts | 4 ++-- packages/wormhole-portal/src/wormhole-portal.ts | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/sdk-loan/src/loan.ts b/packages/sdk-loan/src/loan.ts index 4b807a43..d24b327d 100644 --- a/packages/sdk-loan/src/loan.ts +++ b/packages/sdk-loan/src/loan.ts @@ -5,7 +5,7 @@ import { GlobalLoan, LoanSDKParams, LoanTypes, UserLoan } from './types.js'; import { map } from 'rxjs/operators'; import { combineLatest, firstValueFrom, Observable } from 'rxjs'; import { memoize } from '@polkadot/util'; -import { PriceProviderType } from '@acala-network/sdk/wallet/price-provider/types.js'; +import { PriceProviderType } from '@acala-network/sdk/wallet/price-provider/types'; import { LoanCalculator } from './loan-calculator.js'; const YEAR_SECONDS = 365 * 24 * 60 * 60; // second of one year diff --git a/packages/sdk-loan/src/storages.ts b/packages/sdk-loan/src/storages.ts index 50bbe795..db21e1be 100644 --- a/packages/sdk-loan/src/storages.ts +++ b/packages/sdk-loan/src/storages.ts @@ -1,4 +1,4 @@ -import { Storage } from '@acala-network/sdk/utils/storage/index.js'; +import { Storage } from '@acala-network/sdk/utils/storage/index'; import { AnyApi, Token } from '@acala-network/sdk-core'; import { AcalaPrimitivesPosition, diff --git a/packages/sdk-loan/src/types.ts b/packages/sdk-loan/src/types.ts index b4bc7d89..595e6a68 100644 --- a/packages/sdk-loan/src/types.ts +++ b/packages/sdk-loan/src/types.ts @@ -1,6 +1,6 @@ import { Wallet } from '@acala-network/sdk'; import { AnyApi, FixedPointNumber, Token } from '@acala-network/sdk-core'; -import { PriceProviderType } from '@acala-network/sdk/wallet/price-provider/types.js'; +import { PriceProviderType } from '@acala-network/sdk/wallet/price-provider/types'; export interface LoanSDKParams { api: AnyApi; diff --git a/packages/sdk-payment/src/storage.ts b/packages/sdk-payment/src/storage.ts index 8c42a31f..8724683b 100644 --- a/packages/sdk-payment/src/storage.ts +++ b/packages/sdk-payment/src/storage.ts @@ -1,5 +1,5 @@ import { AnyApi } from '@acala-network/sdk-core'; -import { Storage } from '@acala-network/sdk/utils/storage/index.js'; +import { Storage } from '@acala-network/sdk/utils/storage/index'; import { AcalaPrimitivesCurrencyCurrencyId } from '@polkadot/types/lookup'; import { Option, Vec, StorageKey } from '@polkadot/types'; diff --git a/packages/sdk-swap/src/dex-providers/acala/index.ts b/packages/sdk-swap/src/dex-providers/acala/index.ts index 27bb1d39..a51b3af7 100644 --- a/packages/sdk-swap/src/dex-providers/acala/index.ts +++ b/packages/sdk-swap/src/dex-providers/acala/index.ts @@ -6,13 +6,13 @@ import { Token, unzipDexShareName } from '@acala-network/sdk-core'; -import { Wallet } from '@acala-network/sdk/wallet/index.js'; +import { Wallet } from '@acala-network/sdk/wallet/index'; import { AcalaPrimitivesTradingPair, ModuleDexTradingPairStatus } from '@polkadot/types/lookup'; import { SubmittableExtrinsic } from '@polkadot/api/types'; import { StorageKey } from '@polkadot/types'; import { combineLatest, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { Storage } from '@acala-network/sdk/utils/storage/index.js'; +import { Storage } from '@acala-network/sdk/utils/storage/index'; import { AmountTooSmall, InsufficientLiquidityError, ParamsNotAcceptableForDexProvider } from '../../errors.js'; import { BaseSwap, diff --git a/packages/sdk/src/wallet/balance-adapter/erc20-adapter.ts b/packages/sdk/src/wallet/balance-adapter/erc20-adapter.ts index ce880804..424ed5ee 100644 --- a/packages/sdk/src/wallet/balance-adapter/erc20-adapter.ts +++ b/packages/sdk/src/wallet/balance-adapter/erc20-adapter.ts @@ -7,7 +7,7 @@ import { from, Observable, Subject } from 'rxjs'; import { filter, finalize, shareReplay } from 'rxjs/operators'; import { BalanceData } from '../types.js'; import { AnyFunction } from '@polkadot/types/types'; -import { NotERC20TokenName } from '@acala-network/sdk-core/errors.js'; +import { NotERC20TokenName } from '@acala-network/sdk-core/errors'; export class ERC20Adapter { private provider: EvmRpcProvider; diff --git a/packages/sdk/src/wallet/token-provider/acala.ts b/packages/sdk/src/wallet/token-provider/acala.ts index ef1eacc2..1a4daf65 100644 --- a/packages/sdk/src/wallet/token-provider/acala.ts +++ b/packages/sdk/src/wallet/token-provider/acala.ts @@ -12,8 +12,8 @@ import { filter, map, shareReplay, take } from 'rxjs/operators'; import { TokenProvider, TokenProviderConfigs } from './type.js'; import { Storage } from '../../utils/storage/index.js'; import { createTokenList } from './create-token-list.js'; -import { ChainType } from '@acala-network/sdk/types.js'; -import { getChainType } from '@acala-network/sdk/utils/get-chain-type.js'; +import { ChainType } from '@acala-network/sdk/types'; +import { getChainType } from '@acala-network/sdk/utils/get-chain-type'; import { TokenRecord } from '../types.js'; import { CurrencyNotFound } from '../errors.js'; diff --git a/packages/wormhole-portal/src/wormhole-portal.ts b/packages/wormhole-portal/src/wormhole-portal.ts index 94c4f703..37d2929c 100644 --- a/packages/wormhole-portal/src/wormhole-portal.ts +++ b/packages/wormhole-portal/src/wormhole-portal.ts @@ -17,7 +17,7 @@ import { import { combineLatest, firstValueFrom, from, Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { BaseSDK } from '@acala-network/sdk/types.js'; +import { BaseSDK } from '@acala-network/sdk/types'; import { SupportChain } from './consts/index.js'; import { ConvertAssetsShouldNotEqual, From f024779fb01a04a97702da5e54896c4f92569312 Mon Sep 17 00:00:00 2001 From: Nantian Date: Thu, 5 Sep 2024 13:48:00 +1200 Subject: [PATCH 3/4] fix exports --- packages/sdk/package.json | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index dc7e666d..541722a2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -32,7 +32,17 @@ "require": "./dist/cjs/*.js", "import": "./dist/esm/*.js", "default": "./dist/esm/*.js" - } + }, + "./utils/storage": { + "require": "./dist/cjs/utils/storage/index.js", + "import": "./dist/esm/utils/storage/index.js", + "default": "./dist/esm/utils/storage/index.js" + }, + "./wallet/wallet": { + "require": "./dist/cjs/wallet/wallet.js", + "import": "./dist/esm/wallet/wallet.js", + "default": "./dist/esm/wallet/wallet.js" + } }, "repository": "https://github.com/AcalaNetwork/acala.js.git", "bugs": { From febc0870f647c5c780048679e4d0f9bc08735e32 Mon Sep 17 00:00:00 2001 From: Nantian Date: Thu, 5 Sep 2024 14:45:52 +1200 Subject: [PATCH 4/4] fix --- packages/sdk/package.json | 16 ++++++++-------- packages/sdk/src/wallet/token-provider/acala.ts | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 541722a2..fbaadb21 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -34,15 +34,15 @@ "default": "./dist/esm/*.js" }, "./utils/storage": { - "require": "./dist/cjs/utils/storage/index.js", - "import": "./dist/esm/utils/storage/index.js", - "default": "./dist/esm/utils/storage/index.js" - }, + "require": "./dist/cjs/utils/storage/index.js", + "import": "./dist/esm/utils/storage/index.js", + "default": "./dist/esm/utils/storage/index.js" + }, "./wallet/wallet": { - "require": "./dist/cjs/wallet/wallet.js", - "import": "./dist/esm/wallet/wallet.js", - "default": "./dist/esm/wallet/wallet.js" - } + "require": "./dist/cjs/wallet/wallet.js", + "import": "./dist/esm/wallet/wallet.js", + "default": "./dist/esm/wallet/wallet.js" + } }, "repository": "https://github.com/AcalaNetwork/acala.js.git", "bugs": { diff --git a/packages/sdk/src/wallet/token-provider/acala.ts b/packages/sdk/src/wallet/token-provider/acala.ts index 1a4daf65..8eab53e5 100644 --- a/packages/sdk/src/wallet/token-provider/acala.ts +++ b/packages/sdk/src/wallet/token-provider/acala.ts @@ -12,8 +12,8 @@ import { filter, map, shareReplay, take } from 'rxjs/operators'; import { TokenProvider, TokenProviderConfigs } from './type.js'; import { Storage } from '../../utils/storage/index.js'; import { createTokenList } from './create-token-list.js'; -import { ChainType } from '@acala-network/sdk/types'; -import { getChainType } from '@acala-network/sdk/utils/get-chain-type'; +import { ChainType } from '../../types.js'; +import { getChainType } from '../../utils/get-chain-type.js'; import { TokenRecord } from '../types.js'; import { CurrencyNotFound } from '../errors.js';