diff --git a/.github/workflows/release-packages.yml b/.github/workflows/release-packages.yml index 35752dea4..1d1b7b064 100644 --- a/.github/workflows/release-packages.yml +++ b/.github/workflows/release-packages.yml @@ -29,15 +29,17 @@ jobs: yarn config unset npmAuthToken - name: Build packages - run: yarn g:build + # run: yarn g:build + run: | + yarn sdk @helix-bridge/universal-router-sdk build - name: Publish to GitHub Packages run: | - npm publish -w @helix-bridge/sdk-core - npm publish -w @helix-bridge/v2-sdk - npm publish -w @helix-bridge/v3-sdk - npm publish -w @helix-bridge/router-sdk - npm publish -w @helix-bridge/uniswapx-sdk npm publish -w @helix-bridge/universal-router-sdk + # npm publish -w @helix-bridge/uniswapx-sdk + # npm publish -w @helix-bridge/router-sdk + # npm publish -w @helix-bridge/v2-sdk + # npm publish -w @helix-bridge/v3-sdk + # npm publish -w @helix-bridge/sdk-core env: NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/sdks/router-sdk/package.json b/sdks/router-sdk/package.json index 8994918e0..89e489550 100644 --- a/sdks/router-sdk/package.json +++ b/sdks/router-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/router-sdk", - "version": "1.0.4", + "version": "1.0.5", "description": "An sdk for routing swaps using Uniswap v2 and Uniswap v3.", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ @@ -22,9 +22,9 @@ }, "dependencies": { "@ethersproject/abi": "^5.5.0", - "@helix-bridge/sdk-core": "1.0.1", - "@helix-bridge/v2-sdk": "1.0.2", - "@helix-bridge/v3-sdk": "1.0.2", + "@helix-bridge/sdk-core": "1.0.5", + "@helix-bridge/v2-sdk": "1.0.5", + "@helix-bridge/v3-sdk": "1.0.5", "@uniswap/swap-router-contracts": "^1.3.0" }, "devDependencies": { diff --git a/sdks/sdk-core/package.json b/sdks/sdk-core/package.json index 4e6f2ec10..3ef7b60a6 100644 --- a/sdks/sdk-core/package.json +++ b/sdks/sdk-core/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/sdk-core", - "version": "1.0.4", + "version": "1.0.5", "description": "⚒️ An SDK for building applications on top of Uniswap V3", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ diff --git a/sdks/sdk-core/src/addresses.ts b/sdks/sdk-core/src/addresses.ts index ae4d48b53..5fbda702a 100644 --- a/sdks/sdk-core/src/addresses.ts +++ b/sdks/sdk-core/src/addresses.ts @@ -243,6 +243,13 @@ const BITLAYER_TESTNET_ADDRESSES: ChainAddresses = { nonfungiblePositionManagerAddress: '0x6b5622503fe2ca3cd371f7dfe5393df04b63ce22', } +const BITLAYER_ADDRESSES: ChainAddresses = { + v3CoreFactoryAddress: '0x9bc1C7567DDBcaF2212185b6665D755d842d01E4', + multicallAddress: '0x876a4f6ecf13eeb101f9e75fcef58f19ff383eeb', + quoterAddress: '0x61B6B8c7C00aA7F060a2BEDeE6b11927CC9c3eF1', + nonfungiblePositionManagerAddress: '0xFBAD806Bdf9cEC2943be281FB355Da05068DE925', +} + export const CHAIN_TO_ADDRESSES_MAP: Record = { [ChainId.MAINNET]: MAINNET_ADDRESSES, [ChainId.OPTIMISM]: OPTIMISM_ADDRESSES, @@ -266,6 +273,7 @@ export const CHAIN_TO_ADDRESSES_MAP: Record // [ChainId.ROOTSTOCK]: ROOTSTOCK_ADDRESSES, [ChainId.BLAST]: BLAST_ADDRESSES, [ChainId.BITLAYER_TESTNET]: BITLAYER_TESTNET_ADDRESSES, + [ChainId.BITLAYER]: BITLAYER_ADDRESSES, } /* V3 Contract Addresses */ diff --git a/sdks/sdk-core/src/chains.ts b/sdks/sdk-core/src/chains.ts index 29cc097d1..7dbc6126f 100644 --- a/sdks/sdk-core/src/chains.ts +++ b/sdks/sdk-core/src/chains.ts @@ -23,6 +23,7 @@ export enum ChainId { // ROOTSTOCK = 30, BLAST = 81457, BITLAYER_TESTNET = 200810, + BITLAYER = 200901, } export const SUPPORTED_CHAINS = [ @@ -48,6 +49,7 @@ export const SUPPORTED_CHAINS = [ // ChainId.ROOTSTOCK, ChainId.BLAST, ChainId.BITLAYER_TESTNET, + ChainId.BITLAYER, ] as const export type SupportedChainsType = (typeof SUPPORTED_CHAINS)[number] @@ -62,3 +64,8 @@ export enum NativeCurrencyName { AVAX = 'AVAX', // ROOTSTOCK = 'RBTC', } + +export const CHAINS_SUPPORTED_BY_HELIXSWAP = [ + ChainId.BITLAYER_TESTNET, + ChainId.BITLAYER, +] diff --git a/sdks/sdk-core/src/entities/ether.ts b/sdks/sdk-core/src/entities/ether.ts index 59fca1477..66c1c5b8e 100644 --- a/sdks/sdk-core/src/entities/ether.ts +++ b/sdks/sdk-core/src/entities/ether.ts @@ -4,12 +4,22 @@ import { NativeCurrency } from './nativeCurrency' import { Token } from './token' import { WETH9 } from './weth9' +function getSymbolAndName(chainId: number) { + switch (chainId) { + case 200810: + case 200901: + return ['BTC', 'BTC'] + default: + return ['ETH', 'Ether'] + } +} + /** * Ether is the main usage of a 'native' currency, i.e. for Ethereum mainnet and all testnets */ export class Ether extends NativeCurrency { protected constructor(chainId: number) { - super(chainId, 18, 'ETH', 'Ether') + super(chainId, 18, getSymbolAndName(chainId)[0], getSymbolAndName(chainId)[1]) } public get wrapped(): Token { diff --git a/sdks/sdk-core/src/entities/weth9.ts b/sdks/sdk-core/src/entities/weth9.ts index 468f7134c..fe8a395d0 100644 --- a/sdks/sdk-core/src/entities/weth9.ts +++ b/sdks/sdk-core/src/entities/weth9.ts @@ -24,5 +24,8 @@ export const WETH9: { [chainId: number]: Token } = { 137: new Token(137, '0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270', 18, 'WMATIC', 'Wrapped MATIC'), 43114: new Token(43114, '0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7', 18, 'WAVAX', 'Wrapped AVAX'), + // Bitlayer Testnet 200810: new Token(200810, '0x5F8D4232367759bCe5d9488D3ade77FCFF6B9b6B', 18, 'WBTC', 'Wrapped BTC'), + // Bitlayer + 200901: new Token(200901, '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', 18, 'WBTC', 'Wrapped BTC'), } diff --git a/sdks/uniswapx-sdk/package.json b/sdks/uniswapx-sdk/package.json index f69c50233..07450fefe 100644 --- a/sdks/uniswapx-sdk/package.json +++ b/sdks/uniswapx-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/uniswapx-sdk", - "version": "1.0.4", + "version": "1.0.5", "author": "Uniswap", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ @@ -31,7 +31,7 @@ "dependencies": { "@ethersproject/bytes": "^5.7.0", "@ethersproject/providers": "^5.7.0", - "@helix-bridge/sdk-core": "1.0.1", + "@helix-bridge/sdk-core": "1.0.5", "@uniswap/permit2-sdk": "^1.2.1", "ethers": "^5.7.0" }, diff --git a/sdks/universal-router-sdk/package.json b/sdks/universal-router-sdk/package.json index d3a717f46..a6815adc4 100644 --- a/sdks/universal-router-sdk/package.json +++ b/sdks/universal-router-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/universal-router-sdk", - "version": "1.0.4", + "version": "1.0.5", "description": "sdk for integrating with the Universal Router contracts", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ @@ -31,10 +31,10 @@ "test:hardhat": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' hardhat test" }, "dependencies": { - "@helix-bridge/router-sdk": "1.0.3", - "@helix-bridge/sdk-core": "1.0.1", - "@helix-bridge/v2-sdk": "1.0.2", - "@helix-bridge/v3-sdk": "1.0.2", + "@helix-bridge/router-sdk": "1.0.5", + "@helix-bridge/sdk-core": "1.0.5", + "@helix-bridge/v2-sdk": "1.0.5", + "@helix-bridge/v3-sdk": "1.0.5", "@uniswap/permit2-sdk": "^1.2.1", "@uniswap/universal-router": "1.6.0", "bignumber.js": "^9.0.2", diff --git a/sdks/universal-router-sdk/src/utils/constants.ts b/sdks/universal-router-sdk/src/utils/constants.ts index 719c9d651..c6766c9df 100644 --- a/sdks/universal-router-sdk/src/utils/constants.ts +++ b/sdks/universal-router-sdk/src/utils/constants.ts @@ -115,6 +115,12 @@ const CHAIN_CONFIGS: { [key: number]: ChainConfig } = { weth: '0x5F8D4232367759bCe5d9488D3ade77FCFF6B9b6B', creationBlock: 3937748, }, + // bitlayer mainnet + [200901]: { + router: '0x0ac58df0cc3542bec4cda71b16d06c3ccc39f405', + weth: '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', + creationBlock: 2753030, + } } export const UNIVERSAL_ROUTER_ADDRESS = (chainId: number): string => { diff --git a/sdks/v2-sdk/package.json b/sdks/v2-sdk/package.json index c5c60c1d2..833e93f48 100644 --- a/sdks/v2-sdk/package.json +++ b/sdks/v2-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/v2-sdk", - "version": "1.0.4", + "version": "1.0.5", "description": "🛠 An SDK for building applications on top of Uniswap V2", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ @@ -27,7 +27,7 @@ "dependencies": { "@ethersproject/address": "^5.0.2", "@ethersproject/solidity": "^5.0.9", - "@helix-bridge/sdk-core": "1.0.1", + "@helix-bridge/sdk-core": "1.0.5", "tiny-invariant": "^1.1.0", "tiny-warning": "^1.0.3" }, diff --git a/sdks/v3-sdk/package.json b/sdks/v3-sdk/package.json index 80dc2ebba..22664411e 100644 --- a/sdks/v3-sdk/package.json +++ b/sdks/v3-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@helix-bridge/v3-sdk", - "version": "1.0.4", + "version": "1.0.5", "description": "⚒️ An SDK for building applications on top of Uniswap V3", "repository": "https://github.com/Uniswap/sdks.git", "keywords": [ @@ -27,7 +27,7 @@ "dependencies": { "@ethersproject/abi": "^5.5.0", "@ethersproject/solidity": "^5.0.9", - "@helix-bridge/sdk-core": "1.0.1", + "@helix-bridge/sdk-core": "1.0.5", "@uniswap/swap-router-contracts": "^1.3.0", "@uniswap/v3-periphery": "^1.1.1", "@uniswap/v3-staker": "1.0.0", diff --git a/sdks/v3-sdk/src/utils/computePoolAddress.ts b/sdks/v3-sdk/src/utils/computePoolAddress.ts index b88f080fa..ad7d9a2c1 100644 --- a/sdks/v3-sdk/src/utils/computePoolAddress.ts +++ b/sdks/v3-sdk/src/utils/computePoolAddress.ts @@ -1,11 +1,11 @@ import { defaultAbiCoder } from '@ethersproject/abi' import { getCreate2Address } from '@ethersproject/address' import { keccak256 } from '@ethersproject/solidity' -import { ChainId, Token } from '@helix-bridge/sdk-core' +import { ChainId, CHAINS_SUPPORTED_BY_HELIXSWAP, Token } from '@helix-bridge/sdk-core' import { FeeAmount, POOL_INIT_CODE_HASH } from '../constants' -function getInitCodeOfSpecialChain(chainId: ChainId) { - if (chainId === ChainId.BITLAYER_TESTNET) { +function getInitCodeHash(chainId: ChainId) { + if (CHAINS_SUPPORTED_BY_HELIXSWAP.includes(chainId)) { return '0x9b06af945a15e497de0a98c56727a90114ae2d082285037c0045493ce98241aa' } return POOL_INIT_CODE_HASH @@ -40,6 +40,6 @@ export function computePoolAddress({ ['bytes'], [defaultAbiCoder.encode(['address', 'address', 'uint24'], [token0.address, token1.address, fee])] ), - initCodeHashManualOverride ?? getInitCodeOfSpecialChain(token0.chainId) + initCodeHashManualOverride ?? getInitCodeHash(token0.chainId) ) } diff --git a/yarn.lock b/yarn.lock index 972665eea..797032168 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2216,16 +2216,16 @@ __metadata: languageName: node linkType: hard -"@helix-bridge/router-sdk@npm:1.0.3": - version: 1.0.3 - resolution: "@helix-bridge/router-sdk@npm:1.0.3::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Frouter-sdk%2F1.0.3%2F6108f0a62da2a2329d10890ede5d9c1fb73ab026" +"@helix-bridge/router-sdk@npm:1.0.5": + version: 1.0.5 + resolution: "@helix-bridge/router-sdk@npm:1.0.5::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Frouter-sdk%2F1.0.5%2F61669a7a2b82ba3ee71314b979ad7c8ff0e1cf4f" dependencies: "@ethersproject/abi": ^5.5.0 - "@helix-bridge/sdk-core": 1.0.1 - "@helix-bridge/v2-sdk": 1.0.2 - "@helix-bridge/v3-sdk": 1.0.2 + "@helix-bridge/sdk-core": 1.0.5 + "@helix-bridge/v2-sdk": 1.0.5 + "@helix-bridge/v3-sdk": 1.0.5 "@uniswap/swap-router-contracts": ^1.3.0 - checksum: 22ceedaf9704546e46cf38e63b1436e4a0864706eba5f261802b3af3f548baa79f50c354d19991bfc113e7149488ed78ea7cf61c6deec5344b1f5729a0974d22 + checksum: 0ada524ee42f6ebd8e5963b4addfb6320a1b4b8cbe32e7f887e89ff0a5c4f8cc6a6dbbe7d23c273c0b4055018a5d1f2cd5e3611bf2baf13653c8234587b091b9 languageName: node linkType: hard @@ -2234,9 +2234,9 @@ __metadata: resolution: "@helix-bridge/router-sdk@workspace:sdks/router-sdk" dependencies: "@ethersproject/abi": ^5.5.0 - "@helix-bridge/sdk-core": 1.0.1 - "@helix-bridge/v2-sdk": 1.0.2 - "@helix-bridge/v3-sdk": 1.0.2 + "@helix-bridge/sdk-core": 1.0.5 + "@helix-bridge/v2-sdk": 1.0.5 + "@helix-bridge/v3-sdk": 1.0.5 "@types/jest": ^24.0.25 "@uniswap/swap-router-contracts": ^1.3.0 prettier: ^2.4.1 @@ -2258,6 +2258,20 @@ __metadata: languageName: node linkType: hard +"@helix-bridge/sdk-core@npm:1.0.5": + version: 1.0.5 + resolution: "@helix-bridge/sdk-core@npm:1.0.5::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Fsdk-core%2F1.0.5%2F9ce81e268c84d0c8dd7126bf198d7b93da9c41eb" + dependencies: + "@ethersproject/address": ^5.0.2 + big.js: ^5.2.2 + decimal.js-light: ^2.5.0 + jsbi: ^3.1.4 + tiny-invariant: ^1.1.0 + toformat: ^2.0.0 + checksum: e63e456044542c0e8c5ea6b44dcd377c44c3be984c63625d9ef67dbf69bdd1c08691dda61d75b5ff0d3022120613c40afb02ba7dc11c97933139855fc34e84c7 + languageName: node + linkType: hard + "@helix-bridge/sdk-core@workspace:sdks/sdk-core": version: 0.0.0-use.local resolution: "@helix-bridge/sdk-core@workspace:sdks/sdk-core" @@ -2280,7 +2294,7 @@ __metadata: dependencies: "@ethersproject/bytes": ^5.7.0 "@ethersproject/providers": ^5.7.0 - "@helix-bridge/sdk-core": 1.0.1 + "@helix-bridge/sdk-core": 1.0.5 "@typechain/ethers-v5": ^10.1.0 "@types/jest": ^24.0.25 "@types/node": ^18.7.16 @@ -2309,10 +2323,10 @@ __metadata: version: 0.0.0-use.local resolution: "@helix-bridge/universal-router-sdk@workspace:sdks/universal-router-sdk" dependencies: - "@helix-bridge/router-sdk": 1.0.3 - "@helix-bridge/sdk-core": 1.0.1 - "@helix-bridge/v2-sdk": 1.0.2 - "@helix-bridge/v3-sdk": 1.0.2 + "@helix-bridge/router-sdk": 1.0.5 + "@helix-bridge/sdk-core": 1.0.5 + "@helix-bridge/v2-sdk": 1.0.5 + "@helix-bridge/v3-sdk": 1.0.5 "@types/chai": ^4.3.3 "@types/mocha": ^9.1.1 "@types/node": ^18.7.16 @@ -2334,16 +2348,16 @@ __metadata: languageName: unknown linkType: soft -"@helix-bridge/v2-sdk@npm:1.0.2": - version: 1.0.2 - resolution: "@helix-bridge/v2-sdk@npm:1.0.2::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Fv2-sdk%2F1.0.2%2F94ae6c6a3c6060b69c5a21a427b683f0b84f8f23" +"@helix-bridge/v2-sdk@npm:1.0.5": + version: 1.0.5 + resolution: "@helix-bridge/v2-sdk@npm:1.0.5::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Fv2-sdk%2F1.0.5%2Fc346994af25ca6540c435b7bfa46eb999fdcdaae" dependencies: "@ethersproject/address": ^5.0.2 "@ethersproject/solidity": ^5.0.9 - "@helix-bridge/sdk-core": 1.0.1 + "@helix-bridge/sdk-core": 1.0.5 tiny-invariant: ^1.1.0 tiny-warning: ^1.0.3 - checksum: 2260124a4aad0f102d59af5ee80ccedc327a1c9f37d74ef6a021ed6c11f9d9965eb2a2602d46b93dad81a567d7064fd21c0549f9ba40a86d06ac25ff6c8b33fc + checksum: ada184f380c97e5a7282854682cdba49244fb6ba99734a165d8992293faad35e50a18c1887117fe6abc9d37a9b73f135d91e80a6b992ff50a7a47e81f8657813 languageName: node linkType: hard @@ -2353,7 +2367,7 @@ __metadata: dependencies: "@ethersproject/address": ^5.0.2 "@ethersproject/solidity": ^5.0.9 - "@helix-bridge/sdk-core": 1.0.1 + "@helix-bridge/sdk-core": 1.0.5 "@types/big.js": ^4.0.5 "@types/jest": ^24.0.25 "@uniswap/v2-core": ^1.0.1 @@ -2364,19 +2378,19 @@ __metadata: languageName: unknown linkType: soft -"@helix-bridge/v3-sdk@npm:1.0.2": - version: 1.0.2 - resolution: "@helix-bridge/v3-sdk@npm:1.0.2::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Fv3-sdk%2F1.0.2%2F3d798efe8945d324b732b53a78201b87f2bbb28d" +"@helix-bridge/v3-sdk@npm:1.0.5": + version: 1.0.5 + resolution: "@helix-bridge/v3-sdk@npm:1.0.5::__archiveUrl=https%3A%2F%2Fnpm.pkg.github.com%2Fdownload%2F%40helix-bridge%2Fv3-sdk%2F1.0.5%2F9c1d40d7e3ff8a7e00e68084e6cc78375193e360" dependencies: "@ethersproject/abi": ^5.5.0 "@ethersproject/solidity": ^5.0.9 - "@helix-bridge/sdk-core": 1.0.1 + "@helix-bridge/sdk-core": 1.0.5 "@uniswap/swap-router-contracts": ^1.3.0 "@uniswap/v3-periphery": ^1.1.1 "@uniswap/v3-staker": 1.0.0 tiny-invariant: ^1.1.0 tiny-warning: ^1.0.3 - checksum: c42ffa8dc7da913218c2185bc3b546fae0f99badcbbc432c1c540443acfb5390194360a64b3a5b6e69b1a8a8d58483f539d4aa362d7674e5ee7a2910195be787 + checksum: 0b11c3ffd741a4bd45edfd09950f1b2e8b0b629c3b7a31f8553e0b1f238e37765287bd488917d77bdc1302bd79b1eb097576b7486fe19ea8bdba6510314d10f0 languageName: node linkType: hard @@ -2386,7 +2400,7 @@ __metadata: dependencies: "@ethersproject/abi": ^5.5.0 "@ethersproject/solidity": ^5.0.9 - "@helix-bridge/sdk-core": 1.0.1 + "@helix-bridge/sdk-core": 1.0.5 "@types/jest": ^24.0.25 "@uniswap/swap-router-contracts": ^1.3.0 "@uniswap/v3-core": 1.0.0