@shapeshiftoss/swapper 3.0.7 → 4.0.0
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/dist/api.d.ts +9 -9
- package/dist/swappers/test/TestSwapper.d.ts +3 -3
- package/dist/swappers/thorchain/ThorchainSwapper.d.ts +3 -3
- package/dist/swappers/zrx/ZrxSwapper.d.ts +3 -3
- package/dist/swappers/zrx/ZrxSwapper.js +0 -1
- package/dist/swappers/zrx/utils/test-data/assets.js +0 -6
- package/dist/swappers/zrx/utils/test-data/setupZrxDeps.d.ts +1 -1
- package/dist/swappers/zrx/utils/test-data/setupZrxDeps.js +1 -1
- package/package.json +7 -7
package/dist/api.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { HDWallet } from '@shapeshiftoss/hdwallet-core';
|
|
3
3
|
import { ApprovalNeededOutput, Asset, BuildQuoteTxInput, chainAdapters, ChainTypes, ExecQuoteInput, ExecQuoteOutput, GetQuoteInput, MinMaxOutput, Quote, SwapperType } from '@shapeshiftoss/types';
|
|
4
4
|
export declare type SupportedAssetInput = {
|
|
5
|
-
assetIds:
|
|
5
|
+
assetIds: AssetId[];
|
|
6
6
|
};
|
|
7
7
|
export declare type ByPairInput = {
|
|
8
|
-
sellAssetId:
|
|
9
|
-
buyAssetId:
|
|
8
|
+
sellAssetId: AssetId;
|
|
9
|
+
buyAssetId: AssetId;
|
|
10
10
|
};
|
|
11
11
|
export declare type BuyAssetBySellIdInput = {
|
|
12
|
-
sellAssetId:
|
|
13
|
-
assetIds:
|
|
12
|
+
sellAssetId: AssetId;
|
|
13
|
+
assetIds: AssetId[];
|
|
14
14
|
};
|
|
15
15
|
export declare type SupportedSellAssetsInput = {
|
|
16
|
-
assetIds:
|
|
16
|
+
assetIds: AssetId[];
|
|
17
17
|
};
|
|
18
18
|
export declare type CommonTradeInput = {
|
|
19
19
|
sellAsset: Asset;
|
|
@@ -120,10 +120,10 @@ export interface Swapper {
|
|
|
120
120
|
/**
|
|
121
121
|
* Get supported buyAssetId's by sellAssetId
|
|
122
122
|
*/
|
|
123
|
-
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput):
|
|
123
|
+
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput): AssetId[];
|
|
124
124
|
/**
|
|
125
125
|
* Get supported sell assetIds
|
|
126
126
|
*/
|
|
127
|
-
filterAssetIdsBySellable(assetIds:
|
|
127
|
+
filterAssetIdsBySellable(assetIds: AssetId[]): AssetId[];
|
|
128
128
|
}
|
|
129
129
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ApprovalNeededOutput, Asset, ChainTypes, ExecQuoteOutput, GetQuoteInput, MinMaxOutput, Quote, SwapperType } from '@shapeshiftoss/types';
|
|
3
3
|
import { BuyAssetBySellIdInput, Swapper, Trade, TradeQuote } from '../../api';
|
|
4
4
|
/**
|
|
@@ -16,8 +16,8 @@ export declare class TestSwapper implements Swapper {
|
|
|
16
16
|
executeQuote(): Promise<ExecQuoteOutput>;
|
|
17
17
|
approvalNeeded(): Promise<ApprovalNeededOutput>;
|
|
18
18
|
approveInfinite(): Promise<string>;
|
|
19
|
-
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput):
|
|
20
|
-
filterAssetIdsBySellable():
|
|
19
|
+
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput): AssetId[];
|
|
20
|
+
filterAssetIdsBySellable(): AssetId[];
|
|
21
21
|
buildTrade(): Promise<Trade<ChainTypes>>;
|
|
22
22
|
getTradeQuote(): Promise<TradeQuote<ChainTypes>>;
|
|
23
23
|
executeTrade(): Promise<ExecQuoteOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ApprovalNeededOutput, Asset, ChainTypes, ExecQuoteOutput, GetQuoteInput, MinMaxOutput, Quote, SwapperType } from '@shapeshiftoss/types';
|
|
3
3
|
import { Swapper, Trade, TradeQuote } from '../../api';
|
|
4
4
|
export declare class ThorchainSwapper implements Swapper {
|
|
@@ -10,8 +10,8 @@ export declare class ThorchainSwapper implements Swapper {
|
|
|
10
10
|
executeQuote(): Promise<ExecQuoteOutput>;
|
|
11
11
|
approvalNeeded(): Promise<ApprovalNeededOutput>;
|
|
12
12
|
approveInfinite(): Promise<string>;
|
|
13
|
-
filterBuyAssetsBySellAssetId():
|
|
14
|
-
filterAssetIdsBySellable():
|
|
13
|
+
filterBuyAssetsBySellAssetId(): AssetId[];
|
|
14
|
+
filterAssetIdsBySellable(): AssetId[];
|
|
15
15
|
buildTrade(): Promise<Trade<ChainTypes>>;
|
|
16
16
|
getTradeQuote(): Promise<TradeQuote<ChainTypes>>;
|
|
17
17
|
executeTrade(): Promise<ExecQuoteOutput>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { ChainAdapterManager } from '@shapeshiftoss/chain-adapters';
|
|
3
3
|
import { ApprovalNeededOutput, Asset, BuildQuoteTxInput, ChainTypes, ExecQuoteInput, ExecQuoteOutput, GetQuoteInput, MinMaxOutput, Quote, SwapperType } from '@shapeshiftoss/types';
|
|
4
4
|
import Web3 from 'web3';
|
|
@@ -25,6 +25,6 @@ export declare class ZrxSwapper implements Swapper {
|
|
|
25
25
|
executeTrade(args: ExecuteTradeInput<ChainTypes>): Promise<ExecQuoteOutput>;
|
|
26
26
|
approvalNeeded(args: ApprovalNeededInput<ChainTypes>): Promise<ApprovalNeededOutput>;
|
|
27
27
|
approveInfinite(args: ApproveInfiniteInput<ChainTypes>): Promise<string>;
|
|
28
|
-
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput):
|
|
29
|
-
filterAssetIdsBySellable(assetIds:
|
|
28
|
+
filterBuyAssetsBySellAssetId(args: BuyAssetBySellIdInput): AssetId[];
|
|
29
|
+
filterAssetIdsBySellable(assetIds: AssetId[]): AssetId[];
|
|
30
30
|
}
|
|
@@ -58,7 +58,6 @@ class ZrxSwapper {
|
|
|
58
58
|
}
|
|
59
59
|
filterBuyAssetsBySellAssetId(args) {
|
|
60
60
|
const { assetIds, sellAssetId } = args;
|
|
61
|
-
// TODO: pending changes to caip lib, we may want to import caip2 value instead.
|
|
62
61
|
return assetIds.filter((id) => id.startsWith('eip155:1') && sellAssetId.startsWith('eip155:1'));
|
|
63
62
|
}
|
|
64
63
|
filterAssetIdsBySellable(assetIds) {
|
|
@@ -6,8 +6,6 @@ const types_1 = require("@shapeshiftoss/types");
|
|
|
6
6
|
exports.BTC = {
|
|
7
7
|
assetId: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
|
8
8
|
chainId: 'bip122:000000000019d6689c085ae165831e93',
|
|
9
|
-
caip19: 'bip122:000000000019d6689c085ae165831e93/slip44:0',
|
|
10
|
-
caip2: 'bip122:000000000019d6689c085ae165831e93',
|
|
11
9
|
name: 'bitcoin',
|
|
12
10
|
chain: types_1.ChainTypes.Bitcoin,
|
|
13
11
|
dataSource: types_1.AssetDataSource.CoinGecko,
|
|
@@ -28,8 +26,6 @@ exports.BTC = {
|
|
|
28
26
|
exports.WETH = {
|
|
29
27
|
assetId: 'eip155:1/erc20:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
30
28
|
chainId: 'eip155:1',
|
|
31
|
-
caip19: 'eip155:1/erc20:0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
|
|
32
|
-
caip2: 'eip155:1',
|
|
33
29
|
name: 'WETH',
|
|
34
30
|
chain: types_1.ChainTypes.Ethereum,
|
|
35
31
|
dataSource: types_1.AssetDataSource.CoinGecko,
|
|
@@ -51,8 +47,6 @@ exports.WETH = {
|
|
|
51
47
|
exports.FOX = {
|
|
52
48
|
assetId: 'eip155:1/erc20:0xc770eefad204b5180df6a14ee197d99d808ee52d',
|
|
53
49
|
chainId: 'eip155:1',
|
|
54
|
-
caip19: 'eip155:1/erc20:0xc770eefad204b5180df6a14ee197d99d808ee52d',
|
|
55
|
-
caip2: 'eip155:1',
|
|
56
50
|
name: 'FOX',
|
|
57
51
|
chain: types_1.ChainTypes.Ethereum,
|
|
58
52
|
dataSource: types_1.AssetDataSource.CoinGecko,
|
|
@@ -16,7 +16,7 @@ exports.chainAdapterMockFuncs = {
|
|
|
16
16
|
getInfo: jest.fn(() => Promise.resolve({ data: { network: 'mainnet' } })),
|
|
17
17
|
getAddress: jest.fn(() => Promise.resolve('address')),
|
|
18
18
|
getAccount: jest.fn(() => Promise.resolve({
|
|
19
|
-
chainSpecific: { tokens: [{
|
|
19
|
+
chainSpecific: { tokens: [{ assetId: 'eip155:1/erc20:contractAddress', balance: '1000000' }] }
|
|
20
20
|
})),
|
|
21
21
|
getFeeData: jest.fn(() => Promise.resolve({
|
|
22
22
|
[types_1.chainAdapters.FeeDataKey.Average]: { txFee: '10000' }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/swapper",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "TODO: description",
|
|
5
5
|
"repository": "https://github.com/shapeshift/lib",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@shapeshiftoss/asset-service": "^2.0.0",
|
|
34
|
-
"@shapeshiftoss/caip": "^
|
|
35
|
-
"@shapeshiftoss/chain-adapters": "^
|
|
34
|
+
"@shapeshiftoss/caip": "^3.0.0",
|
|
35
|
+
"@shapeshiftoss/chain-adapters": "^3.0.0",
|
|
36
36
|
"@shapeshiftoss/hdwallet-core": "1.20.0",
|
|
37
|
-
"@shapeshiftoss/types": "
|
|
37
|
+
"@shapeshiftoss/types": "^4.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@shapeshiftoss/asset-service": "^2.0.0",
|
|
41
|
-
"@shapeshiftoss/caip": "^
|
|
42
|
-
"@shapeshiftoss/chain-adapters": "^
|
|
41
|
+
"@shapeshiftoss/caip": "^3.0.0",
|
|
42
|
+
"@shapeshiftoss/chain-adapters": "^3.0.0",
|
|
43
43
|
"@shapeshiftoss/hdwallet-core": "^1.20.0",
|
|
44
|
-
"@shapeshiftoss/types": "
|
|
44
|
+
"@shapeshiftoss/types": "^4.0.0",
|
|
45
45
|
"@types/readline-sync": "^1.4.4",
|
|
46
46
|
"readline-sync": "^1.4.10",
|
|
47
47
|
"web3-utils": "^1.5.2"
|