Skip to content

Commit

Permalink
feat!: move to a new @Lifi scope (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
chybisov authored Jul 12, 2022
1 parent 865bc14 commit b58c5a1
Show file tree
Hide file tree
Showing 31 changed files with 132 additions and 174 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -38,7 +38,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup .npmrc file to publish to GitHub Packages
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
registry-url: 'https://npm.pkg.github.com'
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand All @@ -26,11 +26,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 14
registry-url: 'https://registry.npmjs.org'
- name: Install modules
run: yarn install
Expand All @@ -41,9 +41,9 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Setup .npmrc file to publish to GitHub Packages
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '14.x'
node-version: 14
registry-url: 'https://npm.pkg.github.com'
scope: '@lifinance'
- run: npm run addscope
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# Li.Finance - SDK
# LI.FI - SDK

LiFi Any-to-Any Cross-Chain-Swap SDK
Please checkout the [SDK docs](https://docs.li.finance/official-documentation/sdk-docs/quick-start) and our [API reference](https://apidocs.li.finance/reference/how-to-transfer-tokens) for further information.
LI.FI Any-to-Any Cross-Chain-Swap SDK
Please checkout the [SDK docs](https://docs.li.fi/official-documentation/sdk-docs/quick-start) and our [API reference](https://apidocs.li.fi) for further information.

## Installation

```bash
yarn add @lifinance/sdk
yarn add @lifi/sdk
```

or

```bash
npm install --save @lifinance/sdk
npm install --save @lifi/sdk
```

## Summary

This package allows accessing to LiFi API which finds the best cross-chain routes on different bridges. The routes can
then be executed via the SDK. Learn more about LiFi on (https://li.finance).
This package allows accessing to LI.FI API which finds the best cross-chain routes on different bridges. The routes can
then be executed via the SDK. Learn more about LI.FI on (https://li.fi).

Check out the [Changelog](./CHANGELOG.md) to see what changed in the last releases.

Expand Down
26 changes: 13 additions & 13 deletions e2e/allowance.e2e.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { constants, providers, Signer, Wallet } from 'ethers'
import {
approveToken,
bulkGetTokenApproval,
getTokenApproval,
revokeTokenApproval,
} from '../src/allowance'
import { constants, providers, Signer, Wallet } from 'ethers'
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifinance/types'
import BigNumber from 'bignumber.js'
import { sleep } from '../src/utils/utils'
import { getApproved, setApproval } from '../src/allowance/utils'
import { sleep } from '../src/utils/utils'

const USDC_ON_DAI = findDefaultToken(CoinKey.USDC, ChainId.DAI)
const USDT_ON_DAI = findDefaultToken(CoinKey.USDT, ChainId.DAI)
Expand Down Expand Up @@ -71,8 +71,8 @@ describe('allowance e2e tests', () => {
token: USDC_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
amount,
infiniteApproval: false
})
infiniteApproval: false,
})

await checkSetApproval(USDC_ON_DAI.address, amount)
})
Expand All @@ -87,8 +87,8 @@ describe('allowance e2e tests', () => {
token: USDC_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
amount,
infiniteApproval: true
})
infiniteApproval: true,
})

await checkSetApproval(
USDC_ON_DAI.address,
Expand All @@ -108,8 +108,8 @@ describe('allowance e2e tests', () => {
token: USDC_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
amount,
infiniteApproval: false
})
infiniteApproval: false,
})

await sleep(2000)

Expand All @@ -120,7 +120,7 @@ describe('allowance e2e tests', () => {
await revokeTokenApproval({
signer,
token: USDC_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
})

await sleep(2000)
Expand All @@ -140,7 +140,7 @@ describe('allowance e2e tests', () => {
token: USDC_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
amount,
infiniteApproval: false
infiniteApproval: false,
})

await sleep(2000)
Expand Down Expand Up @@ -173,7 +173,7 @@ describe('allowance e2e tests', () => {
token: USDT_ON_DAI,
approvalAddress: SUSHISWAP_APPROVAL_ADDRESS_ON_DAI,
amount,
infiniteApproval: false
infiniteApproval: false,
})

await sleep(2000)
Expand Down
8 changes: 4 additions & 4 deletions npm.README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
### Installation

```bash
yarn add @lifinance/sdk
yarn add @lifi/sdk
```

or

```bash
npm install --save @lifinance/sdk
npm install --save @lifi/sdk
```

### Summary

This package allows accessing to LiFi API which finds the best cross-chain routes on different bridges. The routes can
then be executed via the SDK. Learn more about LiFi on (https://li.finance).
This package allows accessing to LI.FI API which finds the best cross-chain routes on different bridges. The routes can
then be executed via the SDK. Learn more about LI.FI on (https://li.fi).
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lifinance/sdk",
"name": "@lifi/sdk",
"version": "1.0.0",
"description": "LiFi Any-to-Any Cross-Chain-Swap SDK",
"description": "LI.FI Any-to-Any Cross-Chain-Swap SDK",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
Expand All @@ -13,7 +13,7 @@
"test:unit": "yarn test .unit.spec.ts",
"test:cov": "jest --coverage --no-cache --runInBand --forceExit",
"test:e2e": "jest -c jest.e2e.config.js",
"addscope": "node tools/packagejson name @lifinance/sdk",
"addscope": "node tools/packagejson name @lifi/sdk",
"pre-commit": "lint-staged",
"pre-push": "yarn types:check && yarn build && yarn test:unit",
"lint": "eslint --ext .tsx --ext .ts ./src",
Expand Down Expand Up @@ -52,7 +52,7 @@
"dependencies": {
"@ethersproject/abi": "^5.6.4",
"@ethersproject/contracts": "^5.6.2",
"@lifinance/types": "^0.14.16",
"@lifi/types": "^1.0.0",
"axios": "^0.27.2",
"bignumber.js": "^9.0.1",
"eth-rpc-errors": "^4.0.3",
Expand All @@ -66,8 +66,8 @@
"@types/hdkey": "^2.0.0",
"@types/jest": "^28.1.4",
"@types/websocket": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"@typescript-eslint/eslint-plugin": "^5.30.6",
"@typescript-eslint/parser": "^5.30.6",
"eslint": "^8.19.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.2.1",
Expand Down
2 changes: 1 addition & 1 deletion src/Lifi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
TokensResponse,
ToolsRequest,
ToolsResponse,
} from '@lifinance/types'
} from '@lifi/types'
import { Signer } from 'ethers'
import {
approveToken,
Expand Down
2 changes: 1 addition & 1 deletion src/Lifi.unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifinance/types'
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifi/types'
import balances from './balances'
import Lifi from './Lifi'

Expand Down
2 changes: 1 addition & 1 deletion src/allowance/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Token } from '@lifinance/types'
import { Token } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { constants, Signer } from 'ethers'
import { isSameToken } from '../helpers'
Expand Down
2 changes: 1 addition & 1 deletion src/allowance/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, Token } from '@lifinance/types'
import { ChainId, Token } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { Contract, ContractTransaction, Signer } from 'ethers'
import ChainsService from '../services/ChainsService'
Expand Down
2 changes: 1 addition & 1 deletion src/balances/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Token, TokenAmount } from '@lifinance/types'
import { Token, TokenAmount } from '@lifi/types'
import utils from './utils'

const getTokenBalance = async (
Expand Down
2 changes: 1 addition & 1 deletion src/balances/index.unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifinance/types'
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifi/types'
import balances from '.'
import utils from './utils'

Expand Down
2 changes: 1 addition & 1 deletion src/balances/utils.int.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifinance/types'
import { ChainId, CoinKey, findDefaultToken, Token } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { retryTimes } from '../../jest.int.config'
import { setupTestEnvironment } from '../../test/setup'
Expand Down
2 changes: 1 addition & 1 deletion src/balances/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fragment, JsonFragment } from '@ethersproject/abi'
import { FallbackProvider } from '@ethersproject/providers'
import { ChainId, Token, TokenAmount } from '@lifinance/types'
import { ChainId, Token, TokenAmount } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { ethers } from 'ethers'
import { getMulticallAddress, getRpcProvider } from '../connectors'
Expand Down
2 changes: 1 addition & 1 deletion src/execution/bridges/bridge.execute.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionResponse } from '@ethersproject/abstract-provider'
import { Execution, StatusResponse } from '@lifinance/types'
import { Execution, StatusResponse } from '@lifi/types'
import { constants } from 'ethers'
import ApiService from '../../services/ApiService'
import ChainsService from '../../services/ChainsService'
Expand Down
2 changes: 1 addition & 1 deletion src/execution/exchanges/swap.execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
TransactionReceipt,
TransactionResponse,
} from '@ethersproject/providers'
import { Execution, StatusResponse } from '@lifinance/types'
import { Execution, StatusResponse } from '@lifi/types'
import { constants } from 'ethers'
import ApiService from '../../services/ApiService'
import ChainsService from '../../services/ChainsService'
Expand Down
2 changes: 1 addition & 1 deletion src/execution/switchChain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Step } from '@lifinance/types'
import { Step } from '@lifi/types'
import { Signer } from 'ethers'
import { SwitchChainHook } from '../types'
import { LifiErrorCode, ProviderError } from '../utils/errors'
Expand Down
2 changes: 1 addition & 1 deletion src/execution/switchChain.unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Step } from '@lifinance/types'
import { Step } from '@lifi/types'
import { Signer } from 'ethers'
import { buildStepObject } from '../../test/fixtures'
import { InternalExecutionSettings } from '../types'
Expand Down
2 changes: 1 addition & 1 deletion src/execution/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StatusResponse,
Step,
Substatus,
} from '@lifinance/types'
} from '@lifi/types'
import { StatusManager } from '..'
import ApiService from '../services/ApiService'
import { ServerError } from '../utils/errors'
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ExternalProvider } from '@ethersproject/providers'
import { Token } from '@lifinance/types'
import { Token } from '@lifi/types'

declare const ethereum: ExternalProvider

Expand Down
2 changes: 1 addition & 1 deletion src/services/ApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
RequestOptions,
TokensRequest,
TokensResponse,
} from '@lifinance/types'
} from '@lifi/types'
import axios from 'axios'
import { isRoutesRequest, isStep } from '../typeguards'
import {
Expand Down
2 changes: 1 addition & 1 deletion src/services/ApiService.unit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
Step,
StepTool,
StepType,
} from '@lifinance/types'
} from '@lifi/types'
import axios from 'axios'
import { ServerError, ValidationError } from '../utils/errors'
import ApiService from './ApiService'
Expand Down
2 changes: 1 addition & 1 deletion src/services/ChainsService.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Chain, ChainId } from '@lifinance/types'
import { Chain, ChainId } from '@lifi/types'
import { ValidationError } from '../utils/errors'
import ApiService from './ApiService'

Expand Down
2 changes: 1 addition & 1 deletion src/types/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from '@lifinance/types'
export * from '@lifi/types'
export { ErrorCode, LifiError } from '../utils/errors'
export * from './ERC20'
export * from './internal.types'
2 changes: 1 addition & 1 deletion src/types/internal.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
Step,
SwapStep,
Token,
} from '@lifinance/types'
} from '@lifi/types'
import BigNumber from 'bignumber.js'
import { Signer } from 'ethers'
import { ChainId } from '.'
Expand Down
6 changes: 3 additions & 3 deletions src/utils/parseError.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getChainById, Process, Step } from '@lifinance/types'
import { getChainById, Process, Step } from '@lifi/types'
import {
errorCodes as MetaMaskErrorCodes,
getMessageFromCode,
Expand Down Expand Up @@ -84,12 +84,12 @@ export const getTransactionFailedMessage = (
step: Step,
txLink?: string
): string => {
const baseString = `It appears that your transaction may not have been successful.
const baseString = `It appears that your transaction may not have been successful.
However, to confirm this, please check your ${
getChainById(step.action.toChainId).name
} wallet for ${step.action.toToken.symbol}.`
return txLink
? `${baseString}
? `${baseString}
You can also check the&nbsp;<a href="${txLink}" target="_blank" rel="nofollow noreferrer">block explorer</a> for more information.`
: baseString
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionReceipt } from '@ethersproject/providers'
import { Token } from '@lifinance/types'
import { Token } from '@lifi/types'
import BigNumber from 'bignumber.js'
import { constants, Signer } from 'ethers'

Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.unit.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChainId, CoinKey, findDefaultToken } from '@lifinance/types'
import { ChainId, CoinKey, findDefaultToken } from '@lifi/types'
import BigNumber from 'bignumber.js'

import { formatTokenAmountOnly, repeatUntilDone } from './utils'
Expand Down
Loading

0 comments on commit b58c5a1

Please sign in to comment.