@shapeshiftoss/swapper 20.5.0 → 20.6.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/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/swappers/KyberSwapper/utils/constants.d.ts +1 -0
- package/dist/cjs/swappers/KyberSwapper/utils/constants.js +1 -0
- package/dist/cjs/swappers/RelaySwapper/constant.js +1 -0
- package/dist/cjs/swappers/RelaySwapper/utils/relayTokenToAssetId.js +5 -0
- package/dist/cjs/swappers/ThorchainSwapper/generated/generatedThorLongtailTokens.json +1 -0
- package/dist/cjs/swappers/ZrxSwapper/types.d.ts +1 -1
- package/dist/cjs/swappers/ZrxSwapper/types.js +1 -0
- package/dist/cjs/swappers/ZrxSwapper/utils/constants.js +1 -0
- package/dist/cjs/swappers/ZrxSwapper/utils/helpers.d.ts +1 -1
- package/dist/cjs/swappers/ZrxSwapper/utils/helpers.js +5 -0
- package/dist/cjs/utils/helpers.js +1 -0
- package/dist/cjs/utils/helpers.test.js +1 -0
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/swappers/KyberSwapper/utils/constants.d.ts +1 -0
- package/dist/esm/swappers/KyberSwapper/utils/constants.js +1 -0
- package/dist/esm/swappers/RelaySwapper/constant.js +2 -1
- package/dist/esm/swappers/RelaySwapper/utils/relayTokenToAssetId.js +5 -0
- package/dist/esm/swappers/ThorchainSwapper/generated/generatedThorLongtailTokens.json +1 -0
- package/dist/esm/swappers/ZrxSwapper/types.d.ts +1 -1
- package/dist/esm/swappers/ZrxSwapper/types.js +1 -0
- package/dist/esm/swappers/ZrxSwapper/utils/constants.js +1 -0
- package/dist/esm/swappers/ZrxSwapper/utils/helpers.d.ts +1 -1
- package/dist/esm/swappers/ZrxSwapper/utils/helpers.js +5 -0
- package/dist/esm/utils/helpers.js +2 -1
- package/dist/esm/utils/helpers.test.js +1 -0
- package/package.json +7 -7
|
@@ -15,6 +15,7 @@ export declare const KYBER_CHAINS: {
|
|
|
15
15
|
readonly "eip155:999": "hyperevm";
|
|
16
16
|
readonly "eip155:4326": "megaeth";
|
|
17
17
|
readonly "eip155:9745": "plasma";
|
|
18
|
+
readonly "eip155:99901": "elysium";
|
|
18
19
|
};
|
|
19
20
|
export type KyberSupportedChainId = keyof typeof KYBER_CHAINS;
|
|
20
21
|
export declare const KYBER_ROUTER_ADDRESS: Address;
|
|
@@ -15,6 +15,7 @@ export const KYBER_CHAINS = {
|
|
|
15
15
|
[KnownChainIds.HyperEvmMainnet]: 'hyperevm',
|
|
16
16
|
[KnownChainIds.MegaEthMainnet]: 'megaeth',
|
|
17
17
|
[KnownChainIds.PlasmaMainnet]: 'plasma',
|
|
18
|
+
[KnownChainIds.ElysiumMainnet]: 'elysium',
|
|
18
19
|
};
|
|
19
20
|
// MetaAggregationRouterV2, same address on every chain: https://docs.kyberswap.com/developer-guide/aggregator-api/contracts
|
|
20
21
|
export const KYBER_ROUTER_ADDRESS = '0x6131B5fae19EA4f9D964eAc0408E4408b66337b5';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { abstractChainId, arbitrumChainId, avalancheChainId, baseChainId, berachainChainId, blastChainId, bobChainId, bscChainId, btcChainId, celoChainId, cronosChainId, ethChainId, etherealChainId, flowEvmChainId, gnosisChainId, hemiChainId, hyperEvmChainId, inkChainId, katanaChainId, lineaChainId, mantleChainId, megaethChainId, modeChainId, monadChainId, optimismChainId, plasmaChainId, plumeChainId, polygonChainId, robinhoodChainId, scrollChainId, seiChainId, solanaChainId, soneiumChainId, sonicChainId, storyChainId, tronChainId, unichainChainId, worldChainChainId, zkSyncEraChainId, } from '@shapeshiftoss/caip';
|
|
1
|
+
import { abstractChainId, arbitrumChainId, avalancheChainId, baseChainId, berachainChainId, blastChainId, bobChainId, bscChainId, btcChainId, celoChainId, cronosChainId, elysiumChainId, ethChainId, etherealChainId, flowEvmChainId, gnosisChainId, hemiChainId, hyperEvmChainId, inkChainId, katanaChainId, lineaChainId, mantleChainId, megaethChainId, modeChainId, monadChainId, optimismChainId, plasmaChainId, plumeChainId, polygonChainId, robinhoodChainId, scrollChainId, seiChainId, solanaChainId, soneiumChainId, sonicChainId, storyChainId, tronChainId, unichainChainId, worldChainChainId, zkSyncEraChainId, } from '@shapeshiftoss/caip';
|
|
2
2
|
import invert from 'lodash/invert';
|
|
3
3
|
import { zeroAddress } from 'viem';
|
|
4
4
|
import { abstract, arbitrum, avalanche, base, berachain, blast, bob, bsc, celo, cronos, flowMainnet, gnosis, hemi, hyperEvm, ink, katana, linea, mainnet as ethereum, mantle, megaeth, mode, monad, optimism, plasma, plumeMainnet, polygon, robinhood, scroll, sei, soneium, sonic, story, tron, unichain, worldchain, zksync, } from 'viem/chains';
|
|
@@ -45,6 +45,7 @@ export const chainIdToRelayChainId = {
|
|
|
45
45
|
[seiChainId]: sei.id,
|
|
46
46
|
[abstractChainId]: abstract.id,
|
|
47
47
|
[robinhoodChainId]: robinhood.id,
|
|
48
|
+
[elysiumChainId]: 99901,
|
|
48
49
|
};
|
|
49
50
|
export var RelayStatusMessage;
|
|
50
51
|
(function (RelayStatusMessage) {
|
|
@@ -234,6 +234,11 @@ export const relayTokenToAssetId = (relayToken) => {
|
|
|
234
234
|
assetReference: ASSET_REFERENCE.Robinhood,
|
|
235
235
|
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
236
236
|
};
|
|
237
|
+
case CHAIN_REFERENCE.ElysiumMainnet:
|
|
238
|
+
return {
|
|
239
|
+
assetReference: ASSET_REFERENCE.Elysium,
|
|
240
|
+
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
241
|
+
};
|
|
237
242
|
default:
|
|
238
243
|
throw Error(`chainId '${relayToken.chainId}' not supported`);
|
|
239
244
|
}
|
|
@@ -1018,6 +1018,7 @@
|
|
|
1018
1018
|
"eip155:1/erc20:0xcbb8f1bda10b9696c57e13bc128fe674769dcec0",
|
|
1019
1019
|
"eip155:1/erc20:0x72dfb2e44f59c5ad2bafe84314e5b99a7cd5075e",
|
|
1020
1020
|
"eip155:1/erc20:0xce682c89c63d2850cb2ca898e44d6c7c30d897a6",
|
|
1021
|
+
"eip155:1/erc20:0x68749665ff8d2d112fa859aa293f07a622782f38",
|
|
1021
1022
|
"eip155:43114/erc20:0xc891eb4cbdeff6e073e859e987815ed1505c2acd",
|
|
1022
1023
|
"eip155:43114/erc20:0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64",
|
|
1023
1024
|
"eip155:43114/erc20:0x47c3118ad183712acd42648e9e522e13690f29a0",
|
|
@@ -4,7 +4,7 @@ import type { Address } from 'viem';
|
|
|
4
4
|
import type { GetEvmTradeQuoteInput, GetEvmTradeRateInput } from '../../types.js';
|
|
5
5
|
export type ZrxTradeQuoteInput = GetEvmTradeQuoteInput;
|
|
6
6
|
export type ZrxTradeRateInput = GetEvmTradeRateInput;
|
|
7
|
-
export declare const zrxSupportedChainIds: readonly [KnownChainIds.EthereumMainnet, KnownChainIds.AvalancheMainnet, KnownChainIds.OptimismMainnet, KnownChainIds.BnbSmartChainMainnet, KnownChainIds.PolygonMainnet, KnownChainIds.ArbitrumMainnet, KnownChainIds.BaseMainnet, KnownChainIds.RobinhoodMainnet];
|
|
7
|
+
export declare const zrxSupportedChainIds: readonly [KnownChainIds.EthereumMainnet, KnownChainIds.AvalancheMainnet, KnownChainIds.OptimismMainnet, KnownChainIds.BnbSmartChainMainnet, KnownChainIds.PolygonMainnet, KnownChainIds.ArbitrumMainnet, KnownChainIds.BaseMainnet, KnownChainIds.RobinhoodMainnet, KnownChainIds.ElysiumMainnet];
|
|
8
8
|
export type ZrxSupportedChainId = (typeof zrxSupportedChainIds)[number];
|
|
9
9
|
type ZrxFee = {
|
|
10
10
|
amount: string;
|
|
@@ -19,6 +19,7 @@ export const ZRX_SUPPORTED_CHAINIDS = Object.freeze([
|
|
|
19
19
|
KnownChainIds.ArbitrumMainnet,
|
|
20
20
|
KnownChainIds.BaseMainnet,
|
|
21
21
|
KnownChainIds.RobinhoodMainnet,
|
|
22
|
+
KnownChainIds.ElysiumMainnet,
|
|
22
23
|
]);
|
|
23
24
|
// https://0x.org/docs/developer-resources/faqs-and-troubleshooting
|
|
24
25
|
export const ZRX_NATIVE_ASSET_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
|
@@ -6,7 +6,7 @@ import type { SwapErrorRight } from '../../../types.js';
|
|
|
6
6
|
import type { ZrxFees, ZrxPriceResponse } from '../types.js';
|
|
7
7
|
export declare const assetIdToZrxToken: (assetId: AssetId) => string;
|
|
8
8
|
export declare const zrxTokenToAssetId: (token: string, chainId: ChainId) => AssetId;
|
|
9
|
-
export declare const isSupportedChainId: (chainId: ChainId) => chainId is KnownChainIds.EthereumMainnet | KnownChainIds.AvalancheMainnet | KnownChainIds.OptimismMainnet | KnownChainIds.BnbSmartChainMainnet | KnownChainIds.PolygonMainnet | KnownChainIds.ArbitrumMainnet | KnownChainIds.BaseMainnet | KnownChainIds.RobinhoodMainnet;
|
|
9
|
+
export declare const isSupportedChainId: (chainId: ChainId) => chainId is KnownChainIds.EthereumMainnet | KnownChainIds.AvalancheMainnet | KnownChainIds.OptimismMainnet | KnownChainIds.BnbSmartChainMainnet | KnownChainIds.PolygonMainnet | KnownChainIds.ArbitrumMainnet | KnownChainIds.BaseMainnet | KnownChainIds.RobinhoodMainnet | KnownChainIds.ElysiumMainnet;
|
|
10
10
|
export declare const isWrappedNativeSell: (route: ZrxPriceResponse['route']) => boolean;
|
|
11
11
|
export declare const assertValidTrade: ({ buyAsset, sellAsset, }: {
|
|
12
12
|
buyAsset: Asset;
|
|
@@ -61,6 +61,11 @@ export const zrxTokenToAssetId = (token, chainId) => {
|
|
|
61
61
|
assetReference: ASSET_REFERENCE.Robinhood,
|
|
62
62
|
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
63
63
|
};
|
|
64
|
+
case KnownChainIds.ElysiumMainnet:
|
|
65
|
+
return {
|
|
66
|
+
assetReference: ASSET_REFERENCE.Elysium,
|
|
67
|
+
assetNamespace: ASSET_NAMESPACE.slip44,
|
|
68
|
+
};
|
|
64
69
|
default:
|
|
65
70
|
throw Error(`chainId '${chainId}' not supported`);
|
|
66
71
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CHAIN_NAMESPACE, fromAssetId } from '@shapeshiftoss/caip';
|
|
2
2
|
import { KnownChainIds } from '@shapeshiftoss/types';
|
|
3
|
-
import { chainIdToFeeAssetId, DAO_TREASURY_ARBITRUM, DAO_TREASURY_AVALANCHE, DAO_TREASURY_BASE, DAO_TREASURY_BITCOIN, DAO_TREASURY_BOB, DAO_TREASURY_BSC, DAO_TREASURY_ETHEREUM_MAINNET, DAO_TREASURY_GNOSIS, DAO_TREASURY_HYPEREVM, DAO_TREASURY_MEGAETH, DAO_TREASURY_MONAD, DAO_TREASURY_OPTIMISM, DAO_TREASURY_PLASMA, DAO_TREASURY_POLYGON, DAO_TREASURY_ROBINHOOD, DAO_TREASURY_SOLANA, DAO_TREASURY_STARKNET, DAO_TREASURY_TON, DAO_TREASURY_UNICHAIN, isTreasuryChainId, } from '@shapeshiftoss/utils';
|
|
3
|
+
import { chainIdToFeeAssetId, DAO_TREASURY_ARBITRUM, DAO_TREASURY_AVALANCHE, DAO_TREASURY_BASE, DAO_TREASURY_BITCOIN, DAO_TREASURY_BOB, DAO_TREASURY_BSC, DAO_TREASURY_ELYSIUM, DAO_TREASURY_ETHEREUM_MAINNET, DAO_TREASURY_GNOSIS, DAO_TREASURY_HYPEREVM, DAO_TREASURY_MEGAETH, DAO_TREASURY_MONAD, DAO_TREASURY_OPTIMISM, DAO_TREASURY_PLASMA, DAO_TREASURY_POLYGON, DAO_TREASURY_ROBINHOOD, DAO_TREASURY_SOLANA, DAO_TREASURY_STARKNET, DAO_TREASURY_TON, DAO_TREASURY_UNICHAIN, isTreasuryChainId, } from '@shapeshiftoss/utils';
|
|
4
4
|
import { SwapperName } from '../types.js';
|
|
5
5
|
export const getTradeAmount = (input) => 'buyAmountCryptoBaseUnit' in input
|
|
6
6
|
? { direction: 'exactOut', cryptoBaseUnit: input.buyAmountCryptoBaseUnit }
|
|
@@ -39,6 +39,7 @@ const DAO_TREASURY_BY_CHAIN_ID = {
|
|
|
39
39
|
[KnownChainIds.PlasmaMainnet]: DAO_TREASURY_PLASMA,
|
|
40
40
|
[KnownChainIds.MegaEthMainnet]: DAO_TREASURY_MEGAETH,
|
|
41
41
|
[KnownChainIds.UnichainMainnet]: DAO_TREASURY_UNICHAIN,
|
|
42
|
+
[KnownChainIds.ElysiumMainnet]: DAO_TREASURY_ELYSIUM,
|
|
42
43
|
};
|
|
43
44
|
export const getTreasuryAddressFromChainId = (chainId) => {
|
|
44
45
|
const maybeTreasuryChainId = isTreasuryChainId(chainId) ? chainId : undefined;
|
|
@@ -24,6 +24,7 @@ describe('getTreasuryAddressFromChainId', () => {
|
|
|
24
24
|
[KnownChainIds.PlasmaMainnet]: '0xF5AA59151bE6515C4Ca68A0282CF68B3eA4846fC',
|
|
25
25
|
[KnownChainIds.MegaEthMainnet]: '0xF5AA59151bE6515C4Ca68A0282CF68B3eA4846fC',
|
|
26
26
|
[KnownChainIds.UnichainMainnet]: '0xF5AA59151bE6515C4Ca68A0282CF68B3eA4846fC',
|
|
27
|
+
[KnownChainIds.ElysiumMainnet]: '0xF5AA59151bE6515C4Ca68A0282CF68B3eA4846fC',
|
|
27
28
|
[KnownChainIds.BitcoinMainnet]: 'bc1q9xrjfet2a05r3jvsxx66rru7pysevk5dvqasdw9eeea3rfqlk33qr4hghh',
|
|
28
29
|
[KnownChainIds.SolanaMainnet]: 'FxXyPB5RH4uHLPPJR5H89zGwZp19juBetmRwrxfsLj2j',
|
|
29
30
|
[KnownChainIds.StarknetMainnet]: '0x07ac2252f2da7cbf085e7a5ddc1318243aa818607cdd430dd2e17dd5d487606a',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shapeshiftoss/swapper",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.6.0",
|
|
4
4
|
"repository": "https://github.com/shapeshift/web",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@defuse-protocol/one-click-sdk-typescript": "^0.1.1-0.2",
|
|
30
30
|
"@gobob/bob-sdk": "6.0.1",
|
|
31
31
|
"@mysten/sui": "2.31.2",
|
|
32
|
-
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.
|
|
32
|
+
"@shapeshiftoss/bitcoinjs-lib": "7.0.0-shapeshift.3",
|
|
33
33
|
"@sniptt/monads": "^0.5.10",
|
|
34
34
|
"@solana/web3.js": "1.98.0",
|
|
35
35
|
"@ston-fi/omniston-sdk": "^0.7.8",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"retry-axios": "^2.6.0",
|
|
50
50
|
"uuid": "^9.0.0",
|
|
51
51
|
"viem": "2.55.11",
|
|
52
|
-
"@shapeshiftoss/
|
|
52
|
+
"@shapeshiftoss/caip": "^8.19.0",
|
|
53
53
|
"@shapeshiftoss/hdwallet-core": "^1.62.41",
|
|
54
|
-
"@shapeshiftoss/
|
|
55
|
-
"@shapeshiftoss/
|
|
56
|
-
"@shapeshiftoss/types": "^9.2.0",
|
|
54
|
+
"@shapeshiftoss/chain-adapters": "^11.9.0",
|
|
55
|
+
"@shapeshiftoss/types": "^9.3.0",
|
|
57
56
|
"@shapeshiftoss/unchained-client": "^10.17.0",
|
|
58
|
-
"@shapeshiftoss/
|
|
57
|
+
"@shapeshiftoss/utils": "^2.1.0",
|
|
58
|
+
"@shapeshiftoss/contracts": "^2.1.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/lodash": "^4.14.178",
|