-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from Cryptorubic/develop
Develop
- Loading branch information
Showing
87 changed files
with
1,430 additions
and
746 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Documentation generation | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
lint: | ||
name: Generate docs and push to github pages | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Read .nvmrc | ||
run: echo ::set-output name=NVMRC::$(cat .nvmrc) | ||
id: nvm | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '${{ steps.nvm.outputs.NVMRC }}' | ||
|
||
- name: Set up yarn | ||
run: npm install --global yarn | ||
|
||
- name: Set up dependencies | ||
run: yarn | ||
|
||
- name: Generate docs | ||
run: yarn docs | ||
|
||
- name: Deploy Github Page | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ | |
/dist/ | ||
/cache/ | ||
/scripts/node.log | ||
/docker-compose.yml | ||
|
||
/docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
version: "3.7" | ||
|
||
services: | ||
eth-node: | ||
image: ottebrut/rubic-sdk-tools:eth-node-1.2 | ||
container_name: eth-node | ||
ports: | ||
- 8545:8545 | ||
- 1545:1545 | ||
polygon-node: | ||
image: ottebrut/rubic-sdk-tools:polygon-node-1.2 | ||
container_name: polygon-node | ||
ports: | ||
- 8547:8545 | ||
- 1547:1545 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
/** | ||
* Configuration, used for cache decorator. | ||
*/ | ||
export interface CacheConfig { | ||
/** | ||
* Amount of time, during which cached result is relevant. | ||
*/ | ||
maxAge?: number; | ||
|
||
/** | ||
* If true, then results must be of type {@link ConditionalResult}, | ||
* defining whether to cache calculated result. | ||
*/ | ||
conditionalCache?: boolean; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* @internal | ||
* Thrown, if rpc provider has not passed healthcheck. | ||
*/ | ||
export class HealthcheckError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when gas price is too low. | ||
*/ | ||
export class LowGasError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, if transaction was reverted without specified error. | ||
*/ | ||
export class TransactionRevertedError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when user cancels transaction. | ||
*/ | ||
export class UserRejectError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/** | ||
* Type of errors, thrown by web3 methods. | ||
*/ | ||
export interface Web3Error extends Error { | ||
code: number; | ||
} |
3 changes: 3 additions & 0 deletions
3
src/common/errors/cross-chain/cross-chain-is-unavailable.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when cross chain contracts are on pause or there is not enough crypto balance. | ||
*/ | ||
export class CrossChainIsUnavailableError extends RubicSdkError {} |
9 changes: 0 additions & 9 deletions
9
src/common/errors/cross-chain/cross-chain-max-amount-error.ts
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/common/errors/cross-chain/cross-chain-min-amount-error.ts
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
src/common/errors/cross-chain/insufficient-funds-gas-price-value.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when user doesn't have enough native token balance for gas fee plus `value`. | ||
*/ | ||
export class InsufficientFundsGasPriceValueError extends RubicSdkError {} |
4 changes: 4 additions & 0 deletions
4
src/common/errors/cross-chain/max-gas-price-overflow.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when current gas price is higher, than max gas price on cross chain contract | ||
* in target network. | ||
*/ | ||
export class MaxGasPriceOverflowError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when provided chain id does not match real one, set in wallet. | ||
*/ | ||
export class WrongChainIdError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
/** | ||
* Base class for all errors that can be thrown in sdk. | ||
*/ | ||
export class RubicSdkError extends Error {} |
4 changes: 4 additions & 0 deletions
4
src/common/errors/swap/failed-to-check-for-transaction-receipt.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* @internal | ||
* Thrown, when transaction is passed, but web3 cannot retrieve transaction receipt. | ||
*/ | ||
export class FailedToCheckForTransactionReceiptError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown by 1inch, if user doesn't have enough balance. | ||
*/ | ||
export class InsufficientFundsOneinchError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when user doesn't have enough balance. | ||
*/ | ||
export class InsufficientFundsError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when tokens' pair doesn't have enough liquidity. | ||
*/ | ||
export class InsufficientLiquidityError extends RubicSdkError {} |
3 changes: 3 additions & 0 deletions
3
src/common/errors/swap/low-slippage-deflationary-token.error.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when user is selling deflationary token with too low slippage. | ||
*/ | ||
export class LowSlippageDeflationaryTokenError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when token cannot be swapped with provided options. | ||
*/ | ||
export class LowSlippageError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* @internal | ||
* Thrown, when provider does not support provided blockchain. | ||
*/ | ||
export class NotSupportedBlockchain extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when approve method is called, but there is enough allowance. | ||
*/ | ||
export class UnnecessaryApproveError extends RubicSdkError {} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown, when method, which requires connected wallet, is called without | ||
* wallet being connected. | ||
*/ | ||
export class WalletNotConnectedError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { RubicSdkError } from '@common/errors/rubic-sdk.error'; | ||
|
||
/** | ||
* Thrown during swap, if user's selected network does not match source blockchain | ||
* in swap parameters. | ||
*/ | ||
export class WrongNetworkError extends RubicSdkError {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/** | ||
* Compares provided addresses case insensitive. | ||
*/ | ||
export function compareAddresses(address0: string, address1: string): boolean { | ||
return address0.toLowerCase() === address1.toLowerCase(); | ||
} |
Oops, something went wrong.