mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-01-12 06:44:18 +08:00
refactor: rebrand to Brotocol [WIP]
This commit is contained in:
@@ -1,14 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
root: true,
|
|
||||||
extends: [
|
|
||||||
"./node_modules/@c4605/toolconfs/eslintrc.base",
|
|
||||||
"./node_modules/@c4605/toolconfs/eslintrc.prettier",
|
|
||||||
"./node_modules/@c4605/toolconfs/eslintrc.ts",
|
|
||||||
],
|
|
||||||
parserOptions: {
|
|
||||||
project: "./tsconfig.json",
|
|
||||||
},
|
|
||||||
rules: {
|
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
@xlink-network:registry=https://npm.pkg.github.com
|
@brotocol-xyz:registry=https://npm.pkg.github.com
|
||||||
//npm.pkg.github.com/:_authToken=${GITHUB_NPM_KEY}
|
//npm.pkg.github.com/:_authToken=${GITHUB_NPM_KEY}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
@xlink-network:registry=https://registry.npmjs.org/
|
@brotocol-xyz:registry=https://registry.npmjs.org/
|
||||||
//registry.npmjs.org/:_authToken=${NPM_KEY}
|
//registry.npmjs.org/:_authToken=${NPM_KEY}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
...require("@c4605/toolconfs/prettierrc"),
|
trailingComma: "all",
|
||||||
|
semi: false,
|
||||||
|
arrowParens: "avoid",
|
||||||
singleQuote: false,
|
singleQuote: false,
|
||||||
}
|
}
|
||||||
|
|||||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -3,6 +3,7 @@
|
|||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"abtc",
|
"abtc",
|
||||||
"Bitlayer",
|
"Bitlayer",
|
||||||
|
"Brotocol",
|
||||||
"Bsquared",
|
"Bsquared",
|
||||||
"BTCB",
|
"BTCB",
|
||||||
"codegen",
|
"codegen",
|
||||||
@@ -15,7 +16,6 @@
|
|||||||
"susdt",
|
"susdt",
|
||||||
"txid",
|
"txid",
|
||||||
"UTXO",
|
"UTXO",
|
||||||
"viem",
|
"viem"
|
||||||
"xlink"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ This document explains the process for adding support for a new EVM token in the
|
|||||||
Adding support for a new EVM token requires modifying the following files:
|
Adding support for a new EVM token requires modifying the following files:
|
||||||
|
|
||||||
1. `src/utils/types/knownIds.ts` - Add the new Token ID
|
1. `src/utils/types/knownIds.ts` - Add the new Token ID
|
||||||
2. `src/evmUtils/xlinkContractHelpers.ts` - Add the token to the contract configuration
|
2. `src/evmUtils/contractHelpers.ts` - Add the token to the contract configuration
|
||||||
3. `src/stacksUtils/stxContractAddresses.ts` - Add contract addresses for the corresponding token on the Stacks chain
|
3. `src/stacksUtils/stxContractAddresses.ts` - Add contract addresses for the corresponding token on the Stacks chain
|
||||||
|
|
||||||
## Important Notice for Developers and AI Assistants
|
## Important Notice for Developers and AI Assistants
|
||||||
@@ -47,9 +47,9 @@ export namespace KnownTokenId {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Update Contract Configuration in xlinkContractHelpers.ts
|
### 2. Update Contract Configuration in contractHelpers.ts
|
||||||
|
|
||||||
In the `src/evmUtils/xlinkContractHelpers.ts` file, you need to update the following sections:
|
In the `src/evmUtils/contractHelpers.ts` file, you need to update the following sections:
|
||||||
|
|
||||||
1. Add a new token key to the `ONCHAIN_CONFIG_KEY` enum:
|
1. Add a new token key to the `ONCHAIN_CONFIG_KEY` enum:
|
||||||
|
|
||||||
@@ -105,12 +105,12 @@ export const stxTokenContractAddresses_legacy: Record<
|
|||||||
[KnownTokenId.Stacks.TOKEN_NAME]: {
|
[KnownTokenId.Stacks.TOKEN_NAME]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
// IMPORTANT: Use the exact addresses provided by the contract deployers
|
// IMPORTANT: Use the exact addresses provided by the contract deployers
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-name", // This contract name must be obtained from the team
|
contractName: "token-name", // This contract name must be obtained from the team
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
// IMPORTANT: Use the exact addresses provided by the contract deployers
|
// IMPORTANT: Use the exact addresses provided by the contract deployers
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "token-name", // This contract name must be obtained from the team
|
contractName: "token-name", // This contract name must be obtained from the team
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -127,7 +127,7 @@ Here's a real example of adding support for the ETH token:
|
|||||||
export const ETH = tokenId("stx-eth") // In Stacks namespace - same name as EVM
|
export const ETH = tokenId("stx-eth") // In Stacks namespace - same name as EVM
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Updating `xlinkContractHelpers.ts`:
|
2. Updating `contractHelpers.ts`:
|
||||||
```typescript
|
```typescript
|
||||||
// Add to enum - this key was provided by the contract deployers
|
// Add to enum - this key was provided by the contract deployers
|
||||||
// Note that this is TOKEN_ETH, not just ETH
|
// Note that this is TOKEN_ETH, not just ETH
|
||||||
@@ -148,11 +148,11 @@ Here's a real example of adding support for the ETH token:
|
|||||||
```typescript
|
```typescript
|
||||||
[KnownTokenId.Stacks.ETH]: {
|
[KnownTokenId.Stacks.ETH]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-eth", // This name was provided by the team
|
contractName: "token-eth", // This name was provided by the team
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "token-eth", // This name was provided by the team
|
contractName: "token-eth", // This name was provided by the team
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
2. Add a `.npmrc` file to the project that needs to install this package (the `GITHUB_NPM_KEY' is an environment variable, which is the personal access token created in the previous step)
|
2. Add a `.npmrc` file to the project that needs to install this package (the `GITHUB_NPM_KEY' is an environment variable, which is the personal access token created in the previous step)
|
||||||
```
|
```
|
||||||
@xlink-network:registry=https://npm.pkg.github.com
|
@brotocol-xyz:registry=https://npm.pkg.github.com
|
||||||
//npm.pkg.github.com/:_authToken=${GITHUB_NPM_KEY}
|
//npm.pkg.github.com/:_authToken=${GITHUB_NPM_KEY}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
74
eslint.config.mjs
Normal file
74
eslint.config.mjs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import prettierPlugin from "eslint-plugin-prettier"
|
||||||
|
import prettierPluginRecommendedConfig from "eslint-plugin-prettier/recommended"
|
||||||
|
import prettierConfig from "eslint-config-prettier"
|
||||||
|
import tseslint from "typescript-eslint"
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
prettierConfig,
|
||||||
|
prettierPluginRecommendedConfig,
|
||||||
|
tseslint.configs.recommended,
|
||||||
|
{
|
||||||
|
plugins: {
|
||||||
|
prettier: prettierPlugin,
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"max-classes-per-file": "off",
|
||||||
|
"no-shadow": "off",
|
||||||
|
"no-extra-semi": "off",
|
||||||
|
curly: ["error", "multi-line"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
files: ["src/**/*.ts", "examples/**/*.ts", "examples/**/*.tsx"],
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: "./tsconfig.json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "off",
|
||||||
|
"@typescript-eslint/no-empty-interface": "off",
|
||||||
|
"@typescript-eslint/no-namespace": "off",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-non-null-assertion": "off",
|
||||||
|
"@typescript-eslint/no-parameter-properties": "off",
|
||||||
|
"@typescript-eslint/no-use-before-define": "off",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "off",
|
||||||
|
"@typescript-eslint/no-extra-semi": "off",
|
||||||
|
"@typescript-eslint/no-redeclare": [
|
||||||
|
"off",
|
||||||
|
{ ignoreDeclarationMerge: true },
|
||||||
|
],
|
||||||
|
|
||||||
|
"@typescript-eslint/no-unused-vars": [
|
||||||
|
"warn",
|
||||||
|
{
|
||||||
|
args: "after-used",
|
||||||
|
caughtErrors: "none",
|
||||||
|
argsIgnorePattern: "^_",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
accessibility: "no-public",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"@typescript-eslint/no-floating-promises": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
ignoreVoid: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"@typescript-eslint/explicit-function-return-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
allowExpressions: true,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "xlink-sdk-cross-chain-swap-example",
|
"name": "bro-sdk-cross-chain-swap-example",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
"@stacks/network": "^7.0.2",
|
"@stacks/network": "^7.0.2",
|
||||||
"@stacks/stacks-blockchain-api-types": "^7.14.1",
|
"@stacks/stacks-blockchain-api-types": "^7.14.1",
|
||||||
"@stacks/transactions": "^7.0.5",
|
"@stacks/transactions": "^7.0.5",
|
||||||
"@xlink-network/xlink-sdk": "file:../..",
|
"@brotocol-xyz/bro-sdk": "file:../..",
|
||||||
"alex-sdk": "^3.2.0",
|
"alex-sdk": "^3.2.0",
|
||||||
"c32check": "^2.0.0",
|
"c32check": "^2.0.0",
|
||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
|
|||||||
56
examples/cross-chain-swap/pnpm-lock.yaml
generated
56
examples/cross-chain-swap/pnpm-lock.yaml
generated
@@ -8,6 +8,9 @@ importers:
|
|||||||
|
|
||||||
.:
|
.:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
'@brotocol-xyz/bro-sdk':
|
||||||
|
specifier: file:../..
|
||||||
|
version: file:../..(@stacks/common@7.0.2)(typescript@5.8.2)
|
||||||
'@stacks/common':
|
'@stacks/common':
|
||||||
specifier: ^7.0.2
|
specifier: ^7.0.2
|
||||||
version: 7.0.2
|
version: 7.0.2
|
||||||
@@ -23,9 +26,6 @@ importers:
|
|||||||
'@stacks/transactions':
|
'@stacks/transactions':
|
||||||
specifier: ^7.0.5
|
specifier: ^7.0.5
|
||||||
version: 7.0.5
|
version: 7.0.5
|
||||||
'@xlink-network/xlink-sdk':
|
|
||||||
specifier: file:../..
|
|
||||||
version: file:../..(@stacks/common@7.0.2)(typescript@5.8.2)
|
|
||||||
alex-sdk:
|
alex-sdk:
|
||||||
specifier: ^3.2.0
|
specifier: ^3.2.0
|
||||||
version: 3.2.0(@stacks/common@7.0.2)(@stacks/network@7.0.2)(@stacks/transactions@7.0.5)
|
version: 3.2.0(@stacks/common@7.0.2)(@stacks/network@7.0.2)(@stacks/transactions@7.0.5)
|
||||||
@@ -165,6 +165,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==}
|
resolution: {integrity: sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==}
|
||||||
engines: {node: '>=6.9.0'}
|
engines: {node: '>=6.9.0'}
|
||||||
|
|
||||||
|
'@brotocol-xyz/bro-sdk@file:../..':
|
||||||
|
resolution: {directory: ../.., type: directory}
|
||||||
|
|
||||||
'@c4/btc-utils@0.3.1':
|
'@c4/btc-utils@0.3.1':
|
||||||
resolution: {integrity: sha512-mhJ43BhjJP7KspiWZVNnvCy3VTmN8EksBiV+d49jVPBDwrj8dBGuhbv3aM+AVnIfq4Z0Ds6k6q2wkl/lKeNcOA==}
|
resolution: {integrity: sha512-mhJ43BhjJP7KspiWZVNnvCy3VTmN8EksBiV+d49jVPBDwrj8dBGuhbv3aM+AVnIfq4Z0Ds6k6q2wkl/lKeNcOA==}
|
||||||
|
|
||||||
@@ -536,9 +539,6 @@ packages:
|
|||||||
peerDependencies:
|
peerDependencies:
|
||||||
vite: ^4.2.0 || ^5.0.0 || ^6.0.0
|
vite: ^4.2.0 || ^5.0.0 || ^6.0.0
|
||||||
|
|
||||||
'@xlink-network/xlink-sdk@file:../..':
|
|
||||||
resolution: {directory: ../.., type: directory}
|
|
||||||
|
|
||||||
abitype@1.0.8:
|
abitype@1.0.8:
|
||||||
resolution: {integrity: sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==}
|
resolution: {integrity: sha512-ZeiI6h3GnW06uYDLx0etQtX/p8E24UaHHBj57RSjK7YBFe7iuVn07EDpOeP451D06sF27VOz9JJPlIKJmXgkEg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -1235,6 +1235,25 @@ snapshots:
|
|||||||
'@babel/helper-string-parser': 7.25.9
|
'@babel/helper-string-parser': 7.25.9
|
||||||
'@babel/helper-validator-identifier': 7.25.9
|
'@babel/helper-validator-identifier': 7.25.9
|
||||||
|
|
||||||
|
'@brotocol-xyz/bro-sdk@file:../..(@stacks/common@7.0.2)(typescript@5.8.2)':
|
||||||
|
dependencies:
|
||||||
|
'@c4/btc-utils': 0.3.1
|
||||||
|
'@scure/btc-signer': 1.7.0
|
||||||
|
'@stacks/network': 7.0.2
|
||||||
|
'@stacks/transactions': 7.0.5
|
||||||
|
big.js: 6.2.2
|
||||||
|
c32check: 2.0.0
|
||||||
|
clarity-codegen: 1.1.3(@stacks/common@7.0.2)(@stacks/transactions@7.0.5)
|
||||||
|
viem: 2.23.11(typescript@5.8.2)
|
||||||
|
transitivePeerDependencies:
|
||||||
|
- '@stacks/common'
|
||||||
|
- bufferutil
|
||||||
|
- debug
|
||||||
|
- encoding
|
||||||
|
- typescript
|
||||||
|
- utf-8-validate
|
||||||
|
- zod
|
||||||
|
|
||||||
'@c4/btc-utils@0.3.1':
|
'@c4/btc-utils@0.3.1':
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@scure/btc-signer': 1.7.0
|
'@scure/btc-signer': 1.7.0
|
||||||
@@ -1516,7 +1535,7 @@ snapshots:
|
|||||||
|
|
||||||
'@types/bn.js@5.1.6':
|
'@types/bn.js@5.1.6':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 18.19.80
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/estree@1.0.6': {}
|
'@types/estree@1.0.6': {}
|
||||||
|
|
||||||
@@ -1533,7 +1552,6 @@ snapshots:
|
|||||||
'@types/node@22.13.10':
|
'@types/node@22.13.10':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 6.20.0
|
undici-types: 6.20.0
|
||||||
optional: true
|
|
||||||
|
|
||||||
'@types/react-dom@19.0.4(@types/react@19.0.10)':
|
'@types/react-dom@19.0.4(@types/react@19.0.10)':
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -1554,25 +1572,6 @@ snapshots:
|
|||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- supports-color
|
- supports-color
|
||||||
|
|
||||||
'@xlink-network/xlink-sdk@file:../..(@stacks/common@7.0.2)(typescript@5.8.2)':
|
|
||||||
dependencies:
|
|
||||||
'@c4/btc-utils': 0.3.1
|
|
||||||
'@scure/btc-signer': 1.7.0
|
|
||||||
'@stacks/network': 7.0.2
|
|
||||||
'@stacks/transactions': 7.0.5
|
|
||||||
big.js: 6.2.2
|
|
||||||
c32check: 2.0.0
|
|
||||||
clarity-codegen: 1.1.3(@stacks/common@7.0.2)(@stacks/transactions@7.0.5)
|
|
||||||
viem: 2.23.11(typescript@5.8.2)
|
|
||||||
transitivePeerDependencies:
|
|
||||||
- '@stacks/common'
|
|
||||||
- bufferutil
|
|
||||||
- debug
|
|
||||||
- encoding
|
|
||||||
- typescript
|
|
||||||
- utf-8-validate
|
|
||||||
- zod
|
|
||||||
|
|
||||||
abitype@1.0.8(typescript@5.8.2):
|
abitype@1.0.8(typescript@5.8.2):
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
typescript: 5.8.2
|
typescript: 5.8.2
|
||||||
@@ -2061,8 +2060,7 @@ snapshots:
|
|||||||
|
|
||||||
undici-types@5.26.5: {}
|
undici-types@5.26.5: {}
|
||||||
|
|
||||||
undici-types@6.20.0:
|
undici-types@6.20.0: {}
|
||||||
optional: true
|
|
||||||
|
|
||||||
unload@2.2.0:
|
unload@2.2.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { XLinkSDK } from "@xlink-network/xlink-sdk"
|
import { XLinkSDK } from "@brotocol-xyz/bro-sdk"
|
||||||
import { AlexSDK } from "alex-sdk"
|
import { AlexSDK } from "alex-sdk"
|
||||||
import { FC } from "react"
|
import { FC } from "react"
|
||||||
import "./App.css"
|
import "./App.css"
|
||||||
@@ -6,7 +6,7 @@ import { SwapRouteSelector } from "./components/SwapRouteSelector"
|
|||||||
import { QueryClient, QueryClientProvider } from "react-query"
|
import { QueryClient, QueryClientProvider } from "react-query"
|
||||||
|
|
||||||
const alex = new AlexSDK()
|
const alex = new AlexSDK()
|
||||||
const xlink = new XLinkSDK()
|
const sdk = new XLinkSDK()
|
||||||
const queryClient = new QueryClient()
|
const queryClient = new QueryClient()
|
||||||
|
|
||||||
const App: FC = () => {
|
const App: FC = () => {
|
||||||
@@ -18,7 +18,7 @@ const App: FC = () => {
|
|||||||
</header>
|
</header>
|
||||||
<main className="app-main">
|
<main className="app-main">
|
||||||
<div className="content-wrapper">
|
<div className="content-wrapper">
|
||||||
<SwapRouteSelector alexSDK={alex} xlinkSDK={xlink} />
|
<SwapRouteSelector alexSDK={alex} sdk={sdk} />
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import {
|
|||||||
SwapRoute_WithExchangeRate,
|
SwapRoute_WithExchangeRate,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
XLinkSDK,
|
XLinkSDK,
|
||||||
} from "@xlink-network/xlink-sdk"
|
} from "@brotocol-xyz/bro-sdk"
|
||||||
import { AlexSDK } from "alex-sdk"
|
import { AlexSDK } from "alex-sdk"
|
||||||
import { FC, Fragment, useState } from "react"
|
import { FC, Fragment, useState } from "react"
|
||||||
import { useQuery } from "react-query"
|
import { useQuery } from "react-query"
|
||||||
@@ -17,8 +17,8 @@ import { getSwapRoutesViaEVMDEX } from "../utils/getSwapRoutesViaEVMDEX"
|
|||||||
|
|
||||||
export const SwapRouteSelector: FC<{
|
export const SwapRouteSelector: FC<{
|
||||||
alexSDK: AlexSDK
|
alexSDK: AlexSDK
|
||||||
xlinkSDK: XLinkSDK
|
sdk: XLinkSDK
|
||||||
}> = ({ alexSDK, xlinkSDK }) => {
|
}> = ({ alexSDK, sdk }) => {
|
||||||
const [swapAmount, setSwapAmount] = useState("")
|
const [swapAmount, setSwapAmount] = useState("")
|
||||||
const [selectedRoute, setSelectedRoute] = useState<null | KnownRoute>(null)
|
const [selectedRoute, setSelectedRoute] = useState<null | KnownRoute>(null)
|
||||||
const [selectedSwapRoute, setSelectedSwapRoute] =
|
const [selectedSwapRoute, setSelectedSwapRoute] =
|
||||||
@@ -29,7 +29,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
|
|
||||||
const availableRoutes = useQuery({
|
const availableRoutes = useQuery({
|
||||||
queryKey: ["availableRoutes"],
|
queryKey: ["availableRoutes"],
|
||||||
queryFn: () => getAvailableRoutes(xlinkSDK),
|
queryFn: () => getAvailableRoutes(sdk),
|
||||||
})
|
})
|
||||||
|
|
||||||
const alexRoutes = useQuery({
|
const alexRoutes = useQuery({
|
||||||
@@ -50,7 +50,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
return getSwapRoutesViaALEX(
|
return getSwapRoutesViaALEX(
|
||||||
{
|
{
|
||||||
alexSDK: alexSDK,
|
alexSDK: alexSDK,
|
||||||
xlinkSDK: xlinkSDK,
|
sdk: sdk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...debouncedRoute,
|
...debouncedRoute,
|
||||||
@@ -78,7 +78,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
|
|
||||||
return getSwapRoutesViaEVMDEX(
|
return getSwapRoutesViaEVMDEX(
|
||||||
{
|
{
|
||||||
xlinkSDK: xlinkSDK,
|
sdk: sdk,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
...debouncedRoute,
|
...debouncedRoute,
|
||||||
@@ -94,7 +94,9 @@ export const SwapRouteSelector: FC<{
|
|||||||
queryKey: [
|
queryKey: [
|
||||||
"bridgeInfo",
|
"bridgeInfo",
|
||||||
JSON.stringify(selectedRoute),
|
JSON.stringify(selectedRoute),
|
||||||
JSON.stringify(selectedSwapRoute),
|
JSON.stringify(selectedSwapRoute, (k, v) =>
|
||||||
|
typeof v === "bigint" ? `${v}` : v,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
queryFn: () => {
|
queryFn: () => {
|
||||||
if (selectedRoute == null) {
|
if (selectedRoute == null) {
|
||||||
@@ -105,7 +107,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (KnownChainId.isBitcoinChain(selectedRoute.fromChain)) {
|
if (KnownChainId.isBitcoinChain(selectedRoute.fromChain)) {
|
||||||
return xlinkSDK.bridgeInfoFromBitcoin({
|
return sdk.bridgeInfoFromBitcoin({
|
||||||
...selectedRoute,
|
...selectedRoute,
|
||||||
swapRoute: selectedSwapRoute,
|
swapRoute: selectedSwapRoute,
|
||||||
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
||||||
@@ -113,7 +115,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (KnownChainId.isBRC20Chain(selectedRoute.fromChain)) {
|
if (KnownChainId.isBRC20Chain(selectedRoute.fromChain)) {
|
||||||
return xlinkSDK.bridgeInfoFromBRC20({
|
return sdk.bridgeInfoFromBRC20({
|
||||||
...selectedRoute,
|
...selectedRoute,
|
||||||
swapRoute: selectedSwapRoute,
|
swapRoute: selectedSwapRoute,
|
||||||
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
||||||
@@ -121,7 +123,7 @@ export const SwapRouteSelector: FC<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (KnownChainId.isRunesChain(selectedRoute.fromChain)) {
|
if (KnownChainId.isRunesChain(selectedRoute.fromChain)) {
|
||||||
return xlinkSDK.bridgeInfoFromRunes({
|
return sdk.bridgeInfoFromRunes({
|
||||||
...selectedRoute,
|
...selectedRoute,
|
||||||
swapRoute: selectedSwapRoute,
|
swapRoute: selectedSwapRoute,
|
||||||
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
amount: toSDKNumberOrUndefined(Number(swapAmount)),
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { KnownChainId } from "../../node_modules/@xlink-network/xlink-sdk/lib/utils/types/knownIds"
|
import { KnownChainId } from "@brotocol-xyz/bro-sdk"
|
||||||
|
|
||||||
export const formatXLinkSDKChainName = (
|
export const formatXLinkSDKChainName = (
|
||||||
chain: KnownChainId.KnownChain,
|
chain: KnownChainId.KnownChain,
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import {
|
|||||||
KnownRoute,
|
KnownRoute,
|
||||||
KnownTokenId,
|
KnownTokenId,
|
||||||
XLinkSDK,
|
XLinkSDK,
|
||||||
} from "@xlink-network/xlink-sdk"
|
} from "@brotocol-xyz/bro-sdk"
|
||||||
|
|
||||||
export const getAvailableRoutes = async (
|
export const getAvailableRoutes = async (
|
||||||
xlinkSDK: XLinkSDK,
|
sdk: XLinkSDK,
|
||||||
): Promise<(KnownRoute & { fromTokenName: string; toTokenName: string })[]> => {
|
): Promise<(KnownRoute & { fromTokenName: string; toTokenName: string })[]> => {
|
||||||
const routes = await _getAvailableRoutes(xlinkSDK)
|
const routes = await _getAvailableRoutes(sdk)
|
||||||
return routes.map(
|
return routes.map(
|
||||||
(route): KnownRoute & { fromTokenName: string; toTokenName: string } =>
|
(route): KnownRoute & { fromTokenName: string; toTokenName: string } =>
|
||||||
({
|
({
|
||||||
@@ -31,14 +31,14 @@ type ChainTokenPair = readonly [
|
|||||||
type AvailableRoute = readonly [from: ChainTokenPair, to: ChainTokenPair]
|
type AvailableRoute = readonly [from: ChainTokenPair, to: ChainTokenPair]
|
||||||
|
|
||||||
const _getAvailableRoutes = async (
|
const _getAvailableRoutes = async (
|
||||||
xlinkSDK: XLinkSDK,
|
sdk: XLinkSDK,
|
||||||
): Promise<AvailableRoute[]> => {
|
): Promise<AvailableRoute[]> => {
|
||||||
const alexBrc20 = await xlinkSDK.brc20TickToBRC20Token(
|
const alexBrc20 = await sdk.brc20TickToBRC20Token(
|
||||||
KnownChainId.BRC20.Mainnet,
|
KnownChainId.BRC20.Mainnet,
|
||||||
"alex$",
|
"alex$",
|
||||||
)
|
)
|
||||||
|
|
||||||
const ausdBrc20 = await xlinkSDK.brc20TickToBRC20Token(
|
const ausdBrc20 = await sdk.brc20TickToBRC20Token(
|
||||||
KnownChainId.BRC20.Mainnet,
|
KnownChainId.BRC20.Mainnet,
|
||||||
"ausd$",
|
"ausd$",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -6,15 +6,15 @@ import {
|
|||||||
SwapRouteViaALEX_WithMinimumAmountsOut,
|
SwapRouteViaALEX_WithMinimumAmountsOut,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
XLinkSDK,
|
XLinkSDK,
|
||||||
} from "@xlink-network/xlink-sdk"
|
} from "@brotocol-xyz/bro-sdk"
|
||||||
import { getALEXSwapParameters } from "@xlink-network/xlink-sdk/swapHelpers"
|
import { getALEXSwapParameters } from "@brotocol-xyz/bro-sdk/swapHelpers"
|
||||||
import { AlexSDK } from "alex-sdk"
|
import { AlexSDK } from "alex-sdk"
|
||||||
import { sortBy, uniqBy } from "lodash-es"
|
import { sortBy, uniqBy } from "lodash-es"
|
||||||
|
|
||||||
export async function getSwapRoutesViaALEX(
|
export async function getSwapRoutesViaALEX(
|
||||||
context: {
|
context: {
|
||||||
alexSDK: AlexSDK
|
alexSDK: AlexSDK
|
||||||
xlinkSDK: XLinkSDK
|
sdk: XLinkSDK
|
||||||
},
|
},
|
||||||
swapRequest: KnownRoute & {
|
swapRequest: KnownRoute & {
|
||||||
amount: SDKNumber
|
amount: SDKNumber
|
||||||
@@ -28,9 +28,9 @@ export async function getSwapRoutesViaALEX(
|
|||||||
SwapRouteViaALEX_WithMinimumAmountsOut)[]
|
SwapRouteViaALEX_WithMinimumAmountsOut)[]
|
||||||
}
|
}
|
||||||
> {
|
> {
|
||||||
const { alexSDK, xlinkSDK } = context
|
const { alexSDK, sdk } = context
|
||||||
|
|
||||||
const swapParameters = await getALEXSwapParameters(xlinkSDK, swapRequest)
|
const swapParameters = await getALEXSwapParameters(sdk, swapRequest)
|
||||||
if (swapParameters == null) {
|
if (swapParameters == null) {
|
||||||
return { type: "failed", reason: "unsupported-route" }
|
return { type: "failed", reason: "unsupported-route" }
|
||||||
}
|
}
|
||||||
@@ -43,11 +43,11 @@ export async function getSwapRoutesViaALEX(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const [fromTokenAddress, toTokenAddress] = await Promise.all([
|
const [fromTokenAddress, toTokenAddress] = await Promise.all([
|
||||||
xlinkSDK.stacksAddressFromStacksToken(
|
sdk.stacksAddressFromStacksToken(
|
||||||
swapParameters.stacksChain,
|
swapParameters.stacksChain,
|
||||||
swapParameters.fromToken,
|
swapParameters.fromToken,
|
||||||
),
|
),
|
||||||
xlinkSDK.stacksAddressFromStacksToken(
|
sdk.stacksAddressFromStacksToken(
|
||||||
swapParameters.stacksChain,
|
swapParameters.stacksChain,
|
||||||
swapParameters.toToken,
|
swapParameters.toToken,
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,16 +5,16 @@ import {
|
|||||||
SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut,
|
SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
XLinkSDK,
|
XLinkSDK,
|
||||||
} from "@xlink-network/xlink-sdk"
|
} from "@brotocol-xyz/bro-sdk"
|
||||||
import {
|
import {
|
||||||
fetchIceScreamSwapPossibleRoutesFactory,
|
fetchKyberSwapPossibleRoutesFactory,
|
||||||
getDexAggregatorRoutes,
|
getDexAggregatorRoutes,
|
||||||
getPossibleEVMDexAggregatorSwapParameters,
|
getPossibleEVMDexAggregatorSwapParameters,
|
||||||
} from "@xlink-network/xlink-sdk/swapHelpers"
|
} from "@brotocol-xyz/bro-sdk/swapHelpers"
|
||||||
|
|
||||||
export async function getSwapRoutesViaEVMDEX(
|
export async function getSwapRoutesViaEVMDEX(
|
||||||
context: {
|
context: {
|
||||||
xlinkSDK: XLinkSDK
|
sdk: XLinkSDK
|
||||||
},
|
},
|
||||||
swapRequest: KnownRoute & {
|
swapRequest: KnownRoute & {
|
||||||
amount: SDKNumber
|
amount: SDKNumber
|
||||||
@@ -28,16 +28,16 @@ export async function getSwapRoutesViaEVMDEX(
|
|||||||
SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut)[]
|
SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut)[]
|
||||||
}
|
}
|
||||||
> {
|
> {
|
||||||
const { xlinkSDK } = context
|
const { sdk } = context
|
||||||
|
|
||||||
const possibleSwapParameters =
|
const possibleSwapParameters =
|
||||||
await getPossibleEVMDexAggregatorSwapParameters(xlinkSDK, swapRequest)
|
await getPossibleEVMDexAggregatorSwapParameters(sdk, swapRequest)
|
||||||
if (possibleSwapParameters.length === 0) {
|
if (possibleSwapParameters.length === 0) {
|
||||||
return { type: "failed", reason: "unsupported-route" }
|
return { type: "failed", reason: "unsupported-route" }
|
||||||
}
|
}
|
||||||
|
|
||||||
const routes = await getDexAggregatorRoutes(xlinkSDK, {
|
const routes = await getDexAggregatorRoutes(sdk, {
|
||||||
routeFetcher: fetchIceScreamSwapPossibleRoutesFactory({}),
|
routeFetcher: fetchKyberSwapPossibleRoutesFactory({}),
|
||||||
routes: possibleSwapParameters.map(p => ({
|
routes: possibleSwapParameters.map(p => ({
|
||||||
evmChain: p.evmChain,
|
evmChain: p.evmChain,
|
||||||
fromToken: p.fromToken,
|
fromToken: p.fromToken,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import react from "@vitejs/plugin-react"
|
|||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [react()],
|
plugins: [react()],
|
||||||
base: "/xlink-sdk-example/cross-chain-swap/",
|
base: "/bro-sdk-example/cross-chain-swap/",
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
"/api/matcha": {
|
"/api/matcha": {
|
||||||
|
|||||||
32
generated/smartContract/contracts_bro.ts
Normal file
32
generated/smartContract/contracts_bro.ts
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
import { defineContract } from "../smartContractHelpers/codegenImport";
|
||||||
|
import { btcPegInEndpointV207 } from "./contract_bro_btc-peg-in-endpoint-v2-07"
|
||||||
|
import { btcPegInEndpointV207Swap } from "./contract_bro_btc-peg-in-endpoint-v2-07-swap"
|
||||||
|
import { btcPegInEndpointV207Agg } from "./contract_bro_btc-peg-in-endpoint-v2-07-agg"
|
||||||
|
import { btcPegInEndpointV205Launchpad } from "./contract_bro_btc-peg-in-endpoint-v2-05-launchpad"
|
||||||
|
import { btcPegOutEndpointV201 } from "./contract_bro_btc-peg-out-endpoint-v2-01"
|
||||||
|
import { crossPegInEndpointV204 } from "./contract_bro_cross-peg-in-endpoint-v2-04"
|
||||||
|
import { crossPegInEndpointV204Swap } from "./contract_bro_cross-peg-in-endpoint-v2-04-swap"
|
||||||
|
import { crossPegOutEndpointV201 } from "./contract_bro_cross-peg-out-endpoint-v2-01"
|
||||||
|
import { crossPegOutEndpointV201Agg } from "./contract_bro_cross-peg-out-endpoint-v2-01-agg"
|
||||||
|
import { metaPegInEndpointV204 } from "./contract_bro_meta-peg-in-endpoint-v2-04"
|
||||||
|
import { metaPegInEndpointV206Swap } from "./contract_bro_meta-peg-in-endpoint-v2-06-swap"
|
||||||
|
import { metaPegInEndpointV206Agg } from "./contract_bro_meta-peg-in-endpoint-v2-06-agg"
|
||||||
|
import { metaPegOutEndpointV204 } from "./contract_bro_meta-peg-out-endpoint-v2-04"
|
||||||
|
|
||||||
|
export const broContracts = defineContract({
|
||||||
|
...btcPegInEndpointV207,
|
||||||
|
...btcPegInEndpointV207Swap,
|
||||||
|
...btcPegInEndpointV207Agg,
|
||||||
|
...btcPegInEndpointV205Launchpad,
|
||||||
|
...btcPegOutEndpointV201,
|
||||||
|
...crossPegInEndpointV204,
|
||||||
|
...crossPegInEndpointV204Swap,
|
||||||
|
...crossPegOutEndpointV201,
|
||||||
|
...crossPegOutEndpointV201Agg,
|
||||||
|
...metaPegInEndpointV204,
|
||||||
|
...metaPegInEndpointV206Swap,
|
||||||
|
...metaPegInEndpointV206Agg,
|
||||||
|
...metaPegOutEndpointV204
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import { defineContract } from "../smartContractHelpers/codegenImport";
|
|
||||||
import { btcPegInEndpointV207 } from "./contract_xlink_btc-peg-in-endpoint-v2-07"
|
|
||||||
import { btcPegInEndpointV207Swap } from "./contract_xlink_btc-peg-in-endpoint-v2-07-swap"
|
|
||||||
import { btcPegInEndpointV207Agg } from "./contract_xlink_btc-peg-in-endpoint-v2-07-agg"
|
|
||||||
import { btcPegInEndpointV205Launchpad } from "./contract_xlink_btc-peg-in-endpoint-v2-05-launchpad"
|
|
||||||
import { btcPegOutEndpointV201 } from "./contract_xlink_btc-peg-out-endpoint-v2-01"
|
|
||||||
import { crossPegInEndpointV204 } from "./contract_xlink_cross-peg-in-endpoint-v2-04"
|
|
||||||
import { crossPegInEndpointV204Swap } from "./contract_xlink_cross-peg-in-endpoint-v2-04-swap"
|
|
||||||
import { crossPegOutEndpointV201 } from "./contract_xlink_cross-peg-out-endpoint-v2-01"
|
|
||||||
import { crossPegOutEndpointV201Agg } from "./contract_xlink_cross-peg-out-endpoint-v2-01-agg"
|
|
||||||
import { metaPegInEndpointV204 } from "./contract_xlink_meta-peg-in-endpoint-v2-04"
|
|
||||||
import { metaPegInEndpointV206Swap } from "./contract_xlink_meta-peg-in-endpoint-v2-06-swap"
|
|
||||||
import { metaPegInEndpointV206Agg } from "./contract_xlink_meta-peg-in-endpoint-v2-06-agg"
|
|
||||||
import { metaPegOutEndpointV204 } from "./contract_xlink_meta-peg-out-endpoint-v2-04"
|
|
||||||
|
|
||||||
export const xlinkContracts = defineContract({
|
|
||||||
...btcPegInEndpointV207,
|
|
||||||
...btcPegInEndpointV207Swap,
|
|
||||||
...btcPegInEndpointV207Agg,
|
|
||||||
...btcPegInEndpointV205Launchpad,
|
|
||||||
...btcPegOutEndpointV201,
|
|
||||||
...crossPegInEndpointV204,
|
|
||||||
...crossPegInEndpointV204Swap,
|
|
||||||
...crossPegOutEndpointV201,
|
|
||||||
...crossPegOutEndpointV201Agg,
|
|
||||||
...metaPegInEndpointV204,
|
|
||||||
...metaPegInEndpointV206Swap,
|
|
||||||
...metaPegInEndpointV206Agg,
|
|
||||||
...metaPegOutEndpointV204
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
26
package.json
26
package.json
@@ -1,17 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@xlink-network/xlink-sdk",
|
"name": "@brotocol-xyz/bro-sdk",
|
||||||
"version": "0.4.3",
|
"version": "0.4.3",
|
||||||
"description": "XLINK js SDK",
|
"description": "Brotocol js SDK",
|
||||||
"packageManager": "pnpm@9.9.0",
|
"packageManager": "pnpm@9.9.0",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"bitcoin",
|
"bitcoin",
|
||||||
"ethereum",
|
"ethereum",
|
||||||
"stacks",
|
"stacks",
|
||||||
"XLINK",
|
"brotocol"
|
||||||
"alexlab"
|
|
||||||
],
|
],
|
||||||
"repository": "github:xlink-network/xlink-sdk",
|
"repository": "github:brotocol-xyz/bro-sdk",
|
||||||
"author": "c4605 <yuntao@alexgo.io>",
|
"author": "c4605",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"files": [
|
"files": [
|
||||||
"lib",
|
"lib",
|
||||||
@@ -57,23 +56,22 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@c4/btc-utils": "^0.3.1",
|
"@c4/btc-utils": "^0.3.1",
|
||||||
"c32check": "^2.0.0",
|
|
||||||
"clarity-codegen": "^1.1.3",
|
|
||||||
"@scure/btc-signer": "^1.2.2",
|
"@scure/btc-signer": "^1.2.2",
|
||||||
"@stacks/network": "^7.0.2",
|
"@stacks/network": "^7.0.2",
|
||||||
"@stacks/transactions": "^7.0.5",
|
"@stacks/transactions": "^7.0.5",
|
||||||
"big.js": "^6.2.2",
|
"big.js": "^6.2.2",
|
||||||
|
"c32check": "^2.0.0",
|
||||||
|
"clarity-codegen": "^1.1.3",
|
||||||
"viem": "^2.23.10"
|
"viem": "^2.23.10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@c4605/toolconfs": "^5.3.0",
|
|
||||||
"@stacks/stacks-blockchain-api-types": "^7.14.1",
|
"@stacks/stacks-blockchain-api-types": "^7.14.1",
|
||||||
"@types/big.js": "^6.2.2",
|
"@types/big.js": "^6.2.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.5.0",
|
"@typescript-eslint/eslint-plugin": "^8.24.0",
|
||||||
"@typescript-eslint/parser": "^7.5.0",
|
"@typescript-eslint/parser": "^8.24.0",
|
||||||
"eslint": "^8.57.0",
|
"eslint": "^9.20.0",
|
||||||
"eslint-config-prettier": "^9.1.0",
|
"eslint-config-prettier": "^10.0.1",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.2.3",
|
||||||
"prettier": "^3.2.5",
|
"prettier": "^3.2.5",
|
||||||
"tsup": "^8.4.0",
|
"tsup": "^8.4.0",
|
||||||
"tsx": "^4.19.3",
|
"tsx": "^4.19.3",
|
||||||
|
|||||||
800
pnpm-lock.yaml
generated
800
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -9,8 +9,8 @@ import {
|
|||||||
import {
|
import {
|
||||||
StacksContractName,
|
StacksContractName,
|
||||||
stxContractAddresses,
|
stxContractAddresses,
|
||||||
xlinkContractsMultisigMainnet,
|
contractsMultisigMainnet,
|
||||||
xlinkContractsMultisigTestnet,
|
contractsMultisigTestnet,
|
||||||
} from "../src/stacksUtils/stxContractAddresses"
|
} from "../src/stacksUtils/stxContractAddresses"
|
||||||
import { KnownChainId } from "../src/utils/types/knownIds"
|
import { KnownChainId } from "../src/utils/types/knownIds"
|
||||||
|
|
||||||
@@ -23,8 +23,8 @@ const envName = process.env.ENV_NAME === "dev" ? "dev" : "prod"
|
|||||||
: KnownChainId.Stacks.Testnet
|
: KnownChainId.Stacks.Testnet
|
||||||
const fallbackDeployerAddress =
|
const fallbackDeployerAddress =
|
||||||
envName === "prod"
|
envName === "prod"
|
||||||
? xlinkContractsMultisigMainnet
|
? contractsMultisigMainnet
|
||||||
: xlinkContractsMultisigTestnet
|
: contractsMultisigTestnet
|
||||||
const fallbackStacksNetwork =
|
const fallbackStacksNetwork =
|
||||||
envName === "prod" ? STACKS_MAINNET : STACKS_TESTNET
|
envName === "prod" ? STACKS_MAINNET : STACKS_TESTNET
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ const envName = process.env.ENV_NAME === "dev" ? "dev" : "prod"
|
|||||||
"meta-peg-out-endpoint-v2-04",
|
"meta-peg-out-endpoint-v2-04",
|
||||||
],
|
],
|
||||||
path.resolve(__dirname, "../generated/smartContract/"),
|
path.resolve(__dirname, "../generated/smartContract/"),
|
||||||
"xlink",
|
"bro",
|
||||||
"../smartContractHelpers/codegenImport",
|
"../smartContractHelpers/codegenImport",
|
||||||
envName === "prod"
|
envName === "prod"
|
||||||
? contractNameOverrides_mainnet
|
? contractNameOverrides_mainnet
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { XLinkSDK } from "../src"
|
import { XLinkSDK } from "../src"
|
||||||
import { getAllAddresses } from "../src/evmUtils/xlinkContractHelpers"
|
import { getAllAddresses } from "../src/evmUtils/contractHelpers"
|
||||||
import { getXLinkSDKContext } from "../src/lowlevelUnstableInfos"
|
import { getXLinkSDKContext } from "../src/lowlevelUnstableInfos"
|
||||||
import { _allKnownEVMChains } from "../src/utils/types/knownIds"
|
import { _allKnownEVMChains } from "../src/utils/types/knownIds"
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
getEVMContractCallInfo,
|
getEVMContractCallInfo,
|
||||||
getEVMToken,
|
getEVMToken,
|
||||||
getEVMTokenContractInfo,
|
getEVMTokenContractInfo,
|
||||||
} from "./evmUtils/xlinkContractHelpers"
|
} from "./evmUtils/contractHelpers"
|
||||||
import { getBRC20SupportedRoutes } from "./metaUtils/apiHelpers/getBRC20SupportedRoutes"
|
import { getBRC20SupportedRoutes } from "./metaUtils/apiHelpers/getBRC20SupportedRoutes"
|
||||||
import { getRunesSupportedRoutes } from "./metaUtils/apiHelpers/getRunesSupportedRoutes"
|
import { getRunesSupportedRoutes } from "./metaUtils/apiHelpers/getRunesSupportedRoutes"
|
||||||
import {
|
import {
|
||||||
@@ -23,7 +23,7 @@ import { isSupportedStacksRoute } from "./stacksUtils/peggingHelpers"
|
|||||||
import {
|
import {
|
||||||
getStacksToken,
|
getStacksToken,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
} from "./stacksUtils/xlinkContractHelpers"
|
} from "./stacksUtils/contractHelpers"
|
||||||
import { TooManyRequestsError } from "./utils/apiHelpers"
|
import { TooManyRequestsError } from "./utils/apiHelpers"
|
||||||
import {
|
import {
|
||||||
DefinedRoute,
|
DefinedRoute,
|
||||||
@@ -41,37 +41,37 @@ import {
|
|||||||
BridgeFromBitcoinInput,
|
BridgeFromBitcoinInput,
|
||||||
BridgeFromBitcoinOutput,
|
BridgeFromBitcoinOutput,
|
||||||
bridgeFromBitcoin,
|
bridgeFromBitcoin,
|
||||||
} from "./xlinkSdkUtils/bridgeFromBitcoin"
|
} from "./sdkUtils/bridgeFromBitcoin"
|
||||||
import {
|
import {
|
||||||
BridgeFromBRC20Input,
|
BridgeFromBRC20Input,
|
||||||
BridgeFromBRC20Output,
|
BridgeFromBRC20Output,
|
||||||
bridgeFromBRC20,
|
bridgeFromBRC20,
|
||||||
} from "./xlinkSdkUtils/bridgeFromBRC20"
|
} from "./sdkUtils/bridgeFromBRC20"
|
||||||
import {
|
import {
|
||||||
BridgeFromEVMInput,
|
BridgeFromEVMInput,
|
||||||
BridgeFromEVMOutput,
|
BridgeFromEVMOutput,
|
||||||
bridgeFromEVM,
|
bridgeFromEVM,
|
||||||
} from "./xlinkSdkUtils/bridgeFromEVM"
|
} from "./sdkUtils/bridgeFromEVM"
|
||||||
import {
|
import {
|
||||||
BridgeFromRunesInput,
|
BridgeFromRunesInput,
|
||||||
BridgeFromRunesOutput,
|
BridgeFromRunesOutput,
|
||||||
bridgeFromRunes,
|
bridgeFromRunes,
|
||||||
} from "./xlinkSdkUtils/bridgeFromRunes"
|
} from "./sdkUtils/bridgeFromRunes"
|
||||||
import {
|
import {
|
||||||
BridgeFromStacksInput,
|
BridgeFromStacksInput,
|
||||||
BridgeFromStacksOutput,
|
BridgeFromStacksOutput,
|
||||||
bridgeFromStacks,
|
bridgeFromStacks,
|
||||||
} from "./xlinkSdkUtils/bridgeFromStacks"
|
} from "./sdkUtils/bridgeFromStacks"
|
||||||
import {
|
import {
|
||||||
BridgeInfoFromBitcoinInput,
|
BridgeInfoFromBitcoinInput,
|
||||||
BridgeInfoFromBitcoinOutput,
|
BridgeInfoFromBitcoinOutput,
|
||||||
bridgeInfoFromBitcoin,
|
bridgeInfoFromBitcoin,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromBitcoin"
|
} from "./sdkUtils/bridgeInfoFromBitcoin"
|
||||||
import {
|
import {
|
||||||
BridgeInfoFromEVMInput,
|
BridgeInfoFromEVMInput,
|
||||||
BridgeInfoFromEVMOutput,
|
BridgeInfoFromEVMOutput,
|
||||||
bridgeInfoFromEVM,
|
bridgeInfoFromEVM,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromEVM"
|
} from "./sdkUtils/bridgeInfoFromEVM"
|
||||||
import {
|
import {
|
||||||
BridgeInfoFromBRC20Input,
|
BridgeInfoFromBRC20Input,
|
||||||
BridgeInfoFromBRC20Output,
|
BridgeInfoFromBRC20Output,
|
||||||
@@ -79,27 +79,27 @@ import {
|
|||||||
BridgeInfoFromRunesOutput,
|
BridgeInfoFromRunesOutput,
|
||||||
bridgeInfoFromBRC20,
|
bridgeInfoFromBRC20,
|
||||||
bridgeInfoFromRunes,
|
bridgeInfoFromRunes,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromMeta"
|
} from "./sdkUtils/bridgeInfoFromMeta"
|
||||||
import {
|
import {
|
||||||
BridgeInfoFromStacksInput,
|
BridgeInfoFromStacksInput,
|
||||||
BridgeInfoFromStacksOutput,
|
BridgeInfoFromStacksOutput,
|
||||||
bridgeInfoFromStacks,
|
bridgeInfoFromStacks,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromStacks"
|
} from "./sdkUtils/bridgeInfoFromStacks"
|
||||||
import {
|
import {
|
||||||
EstimateBridgeTransactionFromBitcoinInput,
|
EstimateBridgeTransactionFromBitcoinInput,
|
||||||
EstimateBridgeTransactionFromBitcoinOutput,
|
EstimateBridgeTransactionFromBitcoinOutput,
|
||||||
estimateBridgeTransactionFromBitcoin,
|
estimateBridgeTransactionFromBitcoin,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromBitcoin"
|
} from "./sdkUtils/estimateBridgeTransactionFromBitcoin"
|
||||||
import {
|
import {
|
||||||
EstimateBridgeTransactionFromBRC20Input,
|
EstimateBridgeTransactionFromBRC20Input,
|
||||||
EstimateBridgeTransactionFromBRC20Output,
|
EstimateBridgeTransactionFromBRC20Output,
|
||||||
estimateBridgeTransactionFromBRC20,
|
estimateBridgeTransactionFromBRC20,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromBRC20"
|
} from "./sdkUtils/estimateBridgeTransactionFromBRC20"
|
||||||
import {
|
import {
|
||||||
EstimateBridgeTransactionFromRunesInput,
|
EstimateBridgeTransactionFromRunesInput,
|
||||||
EstimateBridgeTransactionFromRunesOutput,
|
EstimateBridgeTransactionFromRunesOutput,
|
||||||
estimateBridgeTransactionFromRunes,
|
estimateBridgeTransactionFromRunes,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromRunes"
|
} from "./sdkUtils/estimateBridgeTransactionFromRunes"
|
||||||
import {
|
import {
|
||||||
ClaimTimeLockedAssetsInput,
|
ClaimTimeLockedAssetsInput,
|
||||||
ClaimTimeLockedAssetsOutput,
|
ClaimTimeLockedAssetsOutput,
|
||||||
@@ -107,7 +107,7 @@ import {
|
|||||||
GetTimeLockedAssetsOutput,
|
GetTimeLockedAssetsOutput,
|
||||||
claimTimeLockedAssetsFromEVM,
|
claimTimeLockedAssetsFromEVM,
|
||||||
getTimeLockedAssetsFromEVM,
|
getTimeLockedAssetsFromEVM,
|
||||||
} from "./xlinkSdkUtils/timelockFromEVM"
|
} from "./sdkUtils/timelockFromEVM"
|
||||||
import {
|
import {
|
||||||
ChainId,
|
ChainId,
|
||||||
EVMAddress,
|
EVMAddress,
|
||||||
@@ -116,8 +116,8 @@ import {
|
|||||||
RuneIdCombined,
|
RuneIdCombined,
|
||||||
StacksContractAddress,
|
StacksContractAddress,
|
||||||
evmNativeCurrencyAddress,
|
evmNativeCurrencyAddress,
|
||||||
} from "./xlinkSdkUtils/types"
|
} from "./sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "./xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "./sdkUtils/types.internal"
|
||||||
import { DumpableCache, getCacheInside } from "./utils/DumpableCache"
|
import { DumpableCache, getCacheInside } from "./utils/DumpableCache"
|
||||||
import { isNotNull } from "./utils/typeHelpers"
|
import { isNotNull } from "./utils/typeHelpers"
|
||||||
import { SwapRoute } from "./utils/SwapRouteHelpers"
|
import { SwapRoute } from "./utils/SwapRouteHelpers"
|
||||||
@@ -131,64 +131,64 @@ export {
|
|||||||
BridgeFromBitcoinInput_signPsbtFn,
|
BridgeFromBitcoinInput_signPsbtFn,
|
||||||
BridgeFromBitcoinInput_reselectSpendableUTXOs,
|
BridgeFromBitcoinInput_reselectSpendableUTXOs,
|
||||||
BridgeFromBitcoinOutput,
|
BridgeFromBitcoinOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeFromBitcoin"
|
} from "./sdkUtils/bridgeFromBitcoin"
|
||||||
export {
|
export {
|
||||||
BridgeFromBRC20Input,
|
BridgeFromBRC20Input,
|
||||||
BridgeFromBRC20Input_signPsbtFn,
|
BridgeFromBRC20Input_signPsbtFn,
|
||||||
BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs,
|
BridgeFromBRC20Input_reselectSpendableNetworkFeeUTXOs,
|
||||||
BridgeFromBRC20Output,
|
BridgeFromBRC20Output,
|
||||||
} from "./xlinkSdkUtils/bridgeFromBRC20"
|
} from "./sdkUtils/bridgeFromBRC20"
|
||||||
export {
|
export {
|
||||||
BridgeFromEVMInput,
|
BridgeFromEVMInput,
|
||||||
BridgeFromEVMOutput,
|
BridgeFromEVMOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeFromEVM"
|
} from "./sdkUtils/bridgeFromEVM"
|
||||||
export {
|
export {
|
||||||
BridgeFromRunesInput,
|
BridgeFromRunesInput,
|
||||||
BridgeFromRunesInput_signPsbtFn,
|
BridgeFromRunesInput_signPsbtFn,
|
||||||
BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs,
|
BridgeFromRunesInput_reselectSpendableNetworkFeeUTXOs,
|
||||||
BridgeFromRunesOutput,
|
BridgeFromRunesOutput,
|
||||||
RunesUTXOSpendable,
|
RunesUTXOSpendable,
|
||||||
} from "./xlinkSdkUtils/bridgeFromRunes"
|
} from "./sdkUtils/bridgeFromRunes"
|
||||||
export {
|
export {
|
||||||
BridgeFromStacksInput,
|
BridgeFromStacksInput,
|
||||||
BridgeFromStacksOutput,
|
BridgeFromStacksOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeFromStacks"
|
} from "./sdkUtils/bridgeFromStacks"
|
||||||
export {
|
export {
|
||||||
BridgeInfoFromBitcoinInput,
|
BridgeInfoFromBitcoinInput,
|
||||||
BridgeInfoFromBitcoinOutput,
|
BridgeInfoFromBitcoinOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromBitcoin"
|
} from "./sdkUtils/bridgeInfoFromBitcoin"
|
||||||
export {
|
export {
|
||||||
BridgeInfoFromEVMInput,
|
BridgeInfoFromEVMInput,
|
||||||
BridgeInfoFromEVMOutput,
|
BridgeInfoFromEVMOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromEVM"
|
} from "./sdkUtils/bridgeInfoFromEVM"
|
||||||
export {
|
export {
|
||||||
BridgeInfoFromBRC20Input,
|
BridgeInfoFromBRC20Input,
|
||||||
BridgeInfoFromBRC20Output,
|
BridgeInfoFromBRC20Output,
|
||||||
BridgeInfoFromRunesInput,
|
BridgeInfoFromRunesInput,
|
||||||
BridgeInfoFromRunesOutput,
|
BridgeInfoFromRunesOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromMeta"
|
} from "./sdkUtils/bridgeInfoFromMeta"
|
||||||
export {
|
export {
|
||||||
BridgeInfoFromStacksInput,
|
BridgeInfoFromStacksInput,
|
||||||
BridgeInfoFromStacksOutput,
|
BridgeInfoFromStacksOutput,
|
||||||
} from "./xlinkSdkUtils/bridgeInfoFromStacks"
|
} from "./sdkUtils/bridgeInfoFromStacks"
|
||||||
export {
|
export {
|
||||||
EstimateBridgeTransactionFromBitcoinInput,
|
EstimateBridgeTransactionFromBitcoinInput,
|
||||||
EstimateBridgeTransactionFromBitcoinOutput,
|
EstimateBridgeTransactionFromBitcoinOutput,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromBitcoin"
|
} from "./sdkUtils/estimateBridgeTransactionFromBitcoin"
|
||||||
export {
|
export {
|
||||||
EstimateBridgeTransactionFromBRC20Input,
|
EstimateBridgeTransactionFromBRC20Input,
|
||||||
EstimateBridgeTransactionFromBRC20Output,
|
EstimateBridgeTransactionFromBRC20Output,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromBRC20"
|
} from "./sdkUtils/estimateBridgeTransactionFromBRC20"
|
||||||
export {
|
export {
|
||||||
EstimateBridgeTransactionFromRunesInput,
|
EstimateBridgeTransactionFromRunesInput,
|
||||||
EstimateBridgeTransactionFromRunesOutput,
|
EstimateBridgeTransactionFromRunesOutput,
|
||||||
} from "./xlinkSdkUtils/estimateBridgeTransactionFromRunes"
|
} from "./sdkUtils/estimateBridgeTransactionFromRunes"
|
||||||
export {
|
export {
|
||||||
ClaimTimeLockedAssetsInput,
|
ClaimTimeLockedAssetsInput,
|
||||||
ClaimTimeLockedAssetsOutput,
|
ClaimTimeLockedAssetsOutput,
|
||||||
GetTimeLockedAssetsInput,
|
GetTimeLockedAssetsInput,
|
||||||
GetTimeLockedAssetsOutput,
|
GetTimeLockedAssetsOutput,
|
||||||
} from "./xlinkSdkUtils/timelockFromEVM"
|
} from "./sdkUtils/timelockFromEVM"
|
||||||
export type { DumpableCache } from "./utils/DumpableCache"
|
export type { DumpableCache } from "./utils/DumpableCache"
|
||||||
|
|
||||||
export interface XLinkSDKOptions {
|
export interface XLinkSDKOptions {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { toHex } from "viem"
|
import { toHex } from "viem"
|
||||||
import { requestAPI } from "../../utils/apiHelpers"
|
import { requestAPI } from "../../utils/apiHelpers"
|
||||||
import { KnownChainId } from "../../utils/types/knownIds"
|
import { KnownChainId } from "../../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export async function broadcastRevealableTransaction(
|
export async function broadcastRevealableTransaction(
|
||||||
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
||||||
@@ -14,7 +14,7 @@ export async function broadcastRevealableTransaction(
|
|||||||
orderData: Uint8Array
|
orderData: Uint8Array
|
||||||
orderOutputIndex: number
|
orderOutputIndex: number
|
||||||
orderOutputSatsAmount: bigint
|
orderOutputSatsAmount: bigint
|
||||||
xlinkPegInAddress: {
|
pegInAddress: {
|
||||||
address: string
|
address: string
|
||||||
scriptPubKey: Uint8Array
|
scriptPubKey: Uint8Array
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,8 @@ export async function broadcastRevealableTransaction(
|
|||||||
orderOutputIndex: info.orderOutputIndex,
|
orderOutputIndex: info.orderOutputIndex,
|
||||||
orderOutputSatoshiAmount: info.orderOutputSatsAmount.toString(),
|
orderOutputSatoshiAmount: info.orderOutputSatsAmount.toString(),
|
||||||
xlinkPegInAddress: {
|
xlinkPegInAddress: {
|
||||||
address: info.xlinkPegInAddress.address,
|
address: info.pegInAddress.address,
|
||||||
scriptPubKeyHex: toHex(info.xlinkPegInAddress.scriptPubKey),
|
scriptPubKeyHex: toHex(info.pegInAddress.scriptPubKey),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { BigNumber } from "../../utils/BigNumber"
|
|||||||
import { UnsupportedBridgeRouteError } from "../../utils/errors"
|
import { UnsupportedBridgeRouteError } from "../../utils/errors"
|
||||||
import { decodeHex } from "../../utils/hexHelpers"
|
import { decodeHex } from "../../utils/hexHelpers"
|
||||||
import { KnownChainId, KnownTokenId } from "../../utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
import { getBTCPegInAddress } from "../btcAddresses"
|
import { getBTCPegInAddress } from "../btcAddresses"
|
||||||
import { BITCOIN_OUTPUT_MINIMUM_AMOUNT } from "../constants"
|
import { BITCOIN_OUTPUT_MINIMUM_AMOUNT } from "../constants"
|
||||||
import { calculateFee } from "../prepareTransaction"
|
import { calculateFee } from "../prepareTransaction"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { toHex } from "viem"
|
import { toHex } from "viem"
|
||||||
import { requestAPI } from "../../utils/apiHelpers"
|
import { requestAPI } from "../../utils/apiHelpers"
|
||||||
import { KnownChainId } from "../../utils/types/knownIds"
|
import { KnownChainId } from "../../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export async function createRevealTx(
|
export async function createRevealTx(
|
||||||
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
||||||
@@ -14,7 +14,7 @@ export async function createRevealTx(
|
|||||||
vout: number
|
vout: number
|
||||||
satsAmount: bigint
|
satsAmount: bigint
|
||||||
orderData: Uint8Array
|
orderData: Uint8Array
|
||||||
xlinkPegInAddress: {
|
pegInAddress: {
|
||||||
address: string
|
address: string
|
||||||
scriptPubKey: Uint8Array
|
scriptPubKey: Uint8Array
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,8 @@ export async function createRevealTx(
|
|||||||
satsAmount: info.satsAmount,
|
satsAmount: info.satsAmount,
|
||||||
orderDataHex: toHex(info.orderData),
|
orderDataHex: toHex(info.orderData),
|
||||||
xlinkPegInAddress: {
|
xlinkPegInAddress: {
|
||||||
address: info.xlinkPegInAddress.address,
|
address: info.pegInAddress.address,
|
||||||
scriptPubKeyHex: toHex(info.xlinkPegInAddress.scriptPubKey),
|
scriptPubKeyHex: toHex(info.pegInAddress.scriptPubKey),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
numberFromStacksContractNumber,
|
numberFromStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
IsSupportedFn,
|
IsSupportedFn,
|
||||||
@@ -36,7 +36,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
SDKGlobalContext,
|
SDKGlobalContext,
|
||||||
withGlobalContextCache,
|
withGlobalContextCache,
|
||||||
} from "../xlinkSdkUtils/types.internal"
|
} from "../sdkUtils/types.internal"
|
||||||
import { getBTCPegInAddress } from "./btcAddresses"
|
import { getBTCPegInAddress } from "./btcAddresses"
|
||||||
|
|
||||||
export const getBtc2StacksFeeInfo = async (
|
export const getBtc2StacksFeeInfo = async (
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import {
|
|||||||
RuneIdCombined,
|
RuneIdCombined,
|
||||||
SDKNumber,
|
SDKNumber,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
} from "../xlinkSdkUtils/types"
|
} from "../sdkUtils/types"
|
||||||
import { UTXOSpendable } from "./bitcoinHelpers"
|
import { UTXOSpendable } from "./bitcoinHelpers"
|
||||||
|
|
||||||
export class NotEnoughRunesError extends Error {
|
export class NotEnoughRunesError extends Error {
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { sortBy } from "../utils/arrayHelpers"
|
|||||||
import { MAX_BIGINT, sum } from "../utils/bigintHelpers"
|
import { MAX_BIGINT, sum } from "../utils/bigintHelpers"
|
||||||
import { decodeHex } from "../utils/hexHelpers"
|
import { decodeHex } from "../utils/hexHelpers"
|
||||||
import { isNotNull } from "../utils/typeHelpers"
|
import { isNotNull } from "../utils/typeHelpers"
|
||||||
import { ReselectSpendableUTXOsFn_Public } from "../xlinkSdkUtils/bridgeFromBitcoin"
|
import { ReselectSpendableUTXOsFn_Public } from "../sdkUtils/bridgeFromBitcoin"
|
||||||
import {
|
import {
|
||||||
isSameUTXO,
|
isSameUTXO,
|
||||||
sumUTXO,
|
sumUTXO,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
EVMDexAggregatorSwapParameters,
|
EVMDexAggregatorSwapParameters,
|
||||||
getPossibleEVMDexAggregatorSwapParametersImpl,
|
getPossibleEVMDexAggregatorSwapParametersImpl,
|
||||||
} from "../utils/swapHelpers/evmDexAggregatorSwapParametersHelpers"
|
} from "../utils/swapHelpers/evmDexAggregatorSwapParametersHelpers"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { getBtc2StacksFeeInfo } from "./peggingHelpers"
|
import { getBtc2StacksFeeInfo } from "./peggingHelpers"
|
||||||
|
|
||||||
export async function getALEXSwapParameters_FromBitcoin(
|
export async function getALEXSwapParameters_FromBitcoin(
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { getStacksToken } from "../../stacksUtils/xlinkContractHelpers"
|
import { getStacksToken } from "../../stacksUtils/contractHelpers"
|
||||||
import { requestAPI } from "../../utils/apiHelpers"
|
import { requestAPI } from "../../utils/apiHelpers"
|
||||||
import { BigNumber } from "../../utils/BigNumber"
|
import { BigNumber } from "../../utils/BigNumber"
|
||||||
import { isNotNull } from "../../utils/typeHelpers"
|
import { isNotNull } from "../../utils/typeHelpers"
|
||||||
import { KnownChainId, KnownTokenId } from "../../utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../../utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "../../xlinkSdkUtils/types"
|
import { StacksContractAddress } from "../../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export interface EVMSupportedRoute {
|
export interface EVMSupportedRoute {
|
||||||
evmChain: KnownChainId.EVMChain
|
evmChain: KnownChainId.EVMChain
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ import {
|
|||||||
EVMAddress,
|
EVMAddress,
|
||||||
EVMNativeCurrencyAddress,
|
EVMNativeCurrencyAddress,
|
||||||
evmNativeCurrencyAddress,
|
evmNativeCurrencyAddress,
|
||||||
} from "../xlinkSdkUtils/types"
|
} from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { BridgeConfigAbi } from "./contractAbi/bridgeConfig"
|
import { BridgeConfigAbi } from "./contractAbi/bridgeConfig"
|
||||||
import {
|
import {
|
||||||
EVMEndpointContract,
|
EVMEndpointContract,
|
||||||
@@ -303,11 +303,16 @@ function maybeAddress(value: string | null): Address | undefined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum ONCHAIN_CONFIG_KEY {
|
enum ONCHAIN_CONFIG_KEY {
|
||||||
/**
|
|
||||||
* https://t.me/c/1599543687/57298
|
|
||||||
*/
|
|
||||||
ENDPOINT = "ENDPOINT",
|
ENDPOINT = "ENDPOINT",
|
||||||
|
ENDPOINT_NATIVE = "ENDPOINT_NATIVE",
|
||||||
REGISTRY = "REGISTRY",
|
REGISTRY = "REGISTRY",
|
||||||
|
TIMELOCK = "TIMELOCK",
|
||||||
|
MULTISIG = "MULTISIG",
|
||||||
|
MIGRATE = "MIGRATE",
|
||||||
|
MIGRATE_BOB = "MIGRATE_BOB",
|
||||||
|
MIGRATE_BOB_L2 = "MIGRATE_BOB_L2",
|
||||||
|
MIGRATE_BOB_L2_S = "MIGRATE_BOB_L2_S",
|
||||||
|
|
||||||
TOKEN_ABTC = "TOKEN_ABTC",
|
TOKEN_ABTC = "TOKEN_ABTC",
|
||||||
TOKEN_ALEX = "TOKEN_ALEX",
|
TOKEN_ALEX = "TOKEN_ALEX",
|
||||||
TOKEN_ATALEX = "TOKEN_ATALEX",
|
TOKEN_ATALEX = "TOKEN_ATALEX",
|
||||||
@@ -319,35 +324,12 @@ enum ONCHAIN_CONFIG_KEY {
|
|||||||
TOKEN_SUSDT = "TOKEN_SUSDT",
|
TOKEN_SUSDT = "TOKEN_SUSDT",
|
||||||
TOKEN_DB20 = "TOKEN_DB20",
|
TOKEN_DB20 = "TOKEN_DB20",
|
||||||
TOKEN_DOG = "TOKEN_DOG",
|
TOKEN_DOG = "TOKEN_DOG",
|
||||||
TIMELOCK = "TIMELOCK",
|
|
||||||
MULTISIG = "MULTISIG",
|
|
||||||
MIGRATE = "MIGRATE",
|
|
||||||
MIGRATE_BOB = "MIGRATE_BOB",
|
|
||||||
MIGRATE_BOB_L2 = "MIGRATE_BOB_L2",
|
|
||||||
MIGRATE_BOB_L2_S = "MIGRATE_BOB_L2_S",
|
|
||||||
|
|
||||||
// https://github.com/xlink-network/xlink/blob/9e6e268d820f2f9756ca15a36f8580e4f98c087e/packages/contracts/bridge-solidity/scripts/params.ts
|
|
||||||
ENDPOINT_NATIVE = "ENDPOINT_NATIVE",
|
|
||||||
|
|
||||||
// https://github.com/xlink-network/xlink/pull/299/commits/22b23c9ff3ea65eeb7c632db4255afe803f97fef#diff-8302902f9863ee3c7928a0fa6eb6ca22edd10f5553708459cdd072c1ea3ef696
|
|
||||||
TOKEN_UBTC = "TOKEN_UBTC",
|
TOKEN_UBTC = "TOKEN_UBTC",
|
||||||
TOKEN_WUBTC = "TOKEN_WUBTC",
|
TOKEN_WUBTC = "TOKEN_WUBTC",
|
||||||
|
|
||||||
// https://github.com/xlink-network/xlink/pull/366/files#diff-84d6042780ec5ce60f8e5349d20baf5f577f9d878feb8a703748ad37a91e31fd
|
|
||||||
TOKEN_STX = "TOKEN_STX",
|
TOKEN_STX = "TOKEN_STX",
|
||||||
|
|
||||||
// https://t.me/c/1599543687/69562
|
|
||||||
TOKEN_TRUMP = "TOKEN_TRUMP",
|
TOKEN_TRUMP = "TOKEN_TRUMP",
|
||||||
|
|
||||||
// https://t.me/c/1599543687/73009
|
|
||||||
TOKEN_GHIBLICZ = "TOKEN_GHIBLICZ",
|
TOKEN_GHIBLICZ = "TOKEN_GHIBLICZ",
|
||||||
|
|
||||||
// https://t.me/c/1599543687/73347
|
|
||||||
TOKEN_ETH = "TOKEN_ETH",
|
TOKEN_ETH = "TOKEN_ETH",
|
||||||
|
|
||||||
// https://t.me/c/1599543687/73387
|
|
||||||
TOKEN_SOL = "TOKEN_SOL",
|
TOKEN_SOL = "TOKEN_SOL",
|
||||||
|
|
||||||
// https://t.me/c/1599543687/73476
|
|
||||||
TOKEN_LINK = "TOKEN_LINK",
|
TOKEN_LINK = "TOKEN_LINK",
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
numberFromStacksContractNumber,
|
numberFromStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
getAndCheckTransitStacksTokens,
|
getAndCheckTransitStacksTokens,
|
||||||
@@ -37,11 +37,11 @@ import {
|
|||||||
evmNativeCurrencyAddress,
|
evmNativeCurrencyAddress,
|
||||||
isStacksContractAddressEqual,
|
isStacksContractAddressEqual,
|
||||||
StacksContractAddress,
|
StacksContractAddress,
|
||||||
} from "../xlinkSdkUtils/types"
|
} from "../sdkUtils/types"
|
||||||
import {
|
import {
|
||||||
SDKGlobalContext,
|
SDKGlobalContext,
|
||||||
withGlobalContextCache,
|
withGlobalContextCache,
|
||||||
} from "../xlinkSdkUtils/types.internal"
|
} from "../sdkUtils/types.internal"
|
||||||
import {
|
import {
|
||||||
getEVMSupportedRoutes,
|
getEVMSupportedRoutes,
|
||||||
getEVMSupportedRoutesByChainType,
|
getEVMSupportedRoutesByChainType,
|
||||||
@@ -52,7 +52,7 @@ import {
|
|||||||
getEVMContractCallInfo,
|
getEVMContractCallInfo,
|
||||||
getEVMTokenContractInfo,
|
getEVMTokenContractInfo,
|
||||||
numberFromSolidityContractNumber,
|
numberFromSolidityContractNumber,
|
||||||
} from "./xlinkContractHelpers"
|
} from "./contractHelpers"
|
||||||
|
|
||||||
export const getEvm2StacksFeeInfo = async (
|
export const getEvm2StacksFeeInfo = async (
|
||||||
ctx: SDKGlobalContext,
|
ctx: SDKGlobalContext,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
ALEXSwapParameters,
|
ALEXSwapParameters,
|
||||||
getALEXSwapParametersImpl,
|
getALEXSwapParametersImpl,
|
||||||
} from "../utils/swapHelpers/alexSwapParametersHelpers"
|
} from "../utils/swapHelpers/alexSwapParametersHelpers"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { getEvm2StacksFeeInfo } from "./peggingHelpers"
|
import { getEvm2StacksFeeInfo } from "./peggingHelpers"
|
||||||
|
|
||||||
export async function getALEXSwapParameters_FromEVM(
|
export async function getALEXSwapParameters_FromEVM(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export {
|
|||||||
StacksContractAddress,
|
StacksContractAddress,
|
||||||
PublicEVMContractType as EVMContractType,
|
PublicEVMContractType as EVMContractType,
|
||||||
RuneIdCombined,
|
RuneIdCombined,
|
||||||
} from "./xlinkSdkUtils/types"
|
} from "./sdkUtils/types"
|
||||||
export {
|
export {
|
||||||
SwapRoute,
|
SwapRoute,
|
||||||
SwapRoute_WithMinimumAmountsToReceive_Public as SwapRoute_WithMinimumAmountsOut,
|
SwapRoute_WithMinimumAmountsToReceive_Public as SwapRoute_WithMinimumAmountsOut,
|
||||||
@@ -24,7 +24,7 @@ export {
|
|||||||
SwapRouteViaEVMDexAggregator_WithMinimumAmountsToReceive_Public as SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut,
|
SwapRouteViaEVMDexAggregator_WithMinimumAmountsToReceive_Public as SwapRouteViaEVMDexAggregator_WithMinimumAmountsOut,
|
||||||
SwapRouteViaEVMDexAggregator_WithExchangeRate_Public as SwapRouteViaEVMDexAggregator_WithExchangeRate,
|
SwapRouteViaEVMDexAggregator_WithExchangeRate_Public as SwapRouteViaEVMDexAggregator_WithExchangeRate,
|
||||||
} from "./utils/SwapRouteHelpers"
|
} from "./utils/SwapRouteHelpers"
|
||||||
export { TimeLockedAsset } from "./xlinkSdkUtils/timelockFromEVM"
|
export { TimeLockedAsset } from "./sdkUtils/timelockFromEVM"
|
||||||
export {
|
export {
|
||||||
PublicTransferProphet as TransferProphet,
|
PublicTransferProphet as TransferProphet,
|
||||||
PublicTransferProphetAggregated as TransferProphetAggregated,
|
PublicTransferProphetAggregated as TransferProphetAggregated,
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ import {
|
|||||||
metaTokenToCorrespondingStacksToken,
|
metaTokenToCorrespondingStacksToken,
|
||||||
} from "./metaUtils/peggingHelpers"
|
} from "./metaUtils/peggingHelpers"
|
||||||
import { KnownChainId, KnownTokenId } from "./utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "./utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "./xlinkSdkUtils/types"
|
import { StacksContractAddress } from "./sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "./xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "./sdkUtils/types.internal"
|
||||||
|
|
||||||
export {
|
export {
|
||||||
contractAssignedChainIdFromKnownChain,
|
contractAssignedChainIdFromKnownChain,
|
||||||
@@ -30,10 +30,10 @@ export {
|
|||||||
legacyAlexContractDeployerMainnet,
|
legacyAlexContractDeployerMainnet,
|
||||||
legacyAlexContractDeployerTestnet,
|
legacyAlexContractDeployerTestnet,
|
||||||
wrapContractAddress,
|
wrapContractAddress,
|
||||||
xlinkContractsDeployerMainnet,
|
contractsDeployerMainnet as brotocolContractsDeployerMainnet,
|
||||||
xlinkContractsDeployerTestnet,
|
contractsDeployerTestnet as brotocolContractsDeployerTestnet,
|
||||||
xlinkContractsMultisigMainnet,
|
contractsMultisigMainnet as brotocolContractsMultisigMainnet,
|
||||||
xlinkContractsMultisigTestnet,
|
contractsMultisigTestnet as brotocolContractsMultisigTestnet,
|
||||||
} from "./stacksUtils/stxContractAddresses"
|
} from "./stacksUtils/stxContractAddresses"
|
||||||
|
|
||||||
export {
|
export {
|
||||||
@@ -74,9 +74,9 @@ export {
|
|||||||
|
|
||||||
export { addressFromBuffer, addressToBuffer } from "./utils/addressHelpers"
|
export { addressFromBuffer, addressToBuffer } from "./utils/addressHelpers"
|
||||||
|
|
||||||
export { bridgeFromEVM_toLaunchpad } from "./xlinkSdkUtils/bridgeFromEVM"
|
export { bridgeFromEVM_toLaunchpad } from "./sdkUtils/bridgeFromEVM"
|
||||||
export { bridgeInfoFromEVM_toLaunchpad } from "./xlinkSdkUtils/bridgeInfoFromEVM"
|
export { bridgeInfoFromEVM_toLaunchpad } from "./sdkUtils/bridgeInfoFromEVM"
|
||||||
export { bridgeInfoFromBitcoin_toLaunchpad } from "./xlinkSdkUtils/bridgeInfoFromBitcoin"
|
export { bridgeInfoFromBitcoin_toLaunchpad } from "./sdkUtils/bridgeInfoFromBitcoin"
|
||||||
|
|
||||||
export { getBitcoinHardLinkageAddress } from "./bitcoinUtils/btcAddresses"
|
export { getBitcoinHardLinkageAddress } from "./bitcoinUtils/btcAddresses"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getStacksToken } from "../../stacksUtils/xlinkContractHelpers"
|
import { getStacksToken } from "../../stacksUtils/contractHelpers"
|
||||||
import { requestAPI } from "../../utils/apiHelpers"
|
import { requestAPI } from "../../utils/apiHelpers"
|
||||||
import { BigNumber } from "../../utils/BigNumber"
|
import { BigNumber } from "../../utils/BigNumber"
|
||||||
import { isNotNull } from "../../utils/typeHelpers"
|
import { isNotNull } from "../../utils/typeHelpers"
|
||||||
@@ -7,7 +7,7 @@ import {
|
|||||||
KnownChainId,
|
KnownChainId,
|
||||||
createBRC20Token,
|
createBRC20Token,
|
||||||
} from "../../utils/types/knownIds"
|
} from "../../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export interface BRC20SupportedRoute {
|
export interface BRC20SupportedRoute {
|
||||||
brc20Tick: string
|
brc20Tick: string
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getStacksToken } from "../../stacksUtils/xlinkContractHelpers"
|
import { getStacksToken } from "../../stacksUtils/contractHelpers"
|
||||||
import { requestAPI } from "../../utils/apiHelpers"
|
import { requestAPI } from "../../utils/apiHelpers"
|
||||||
import { BigNumber } from "../../utils/BigNumber"
|
import { BigNumber } from "../../utils/BigNumber"
|
||||||
import { isNotNull } from "../../utils/typeHelpers"
|
import { isNotNull } from "../../utils/typeHelpers"
|
||||||
@@ -7,8 +7,8 @@ import {
|
|||||||
KnownChainId,
|
KnownChainId,
|
||||||
KnownTokenId,
|
KnownTokenId,
|
||||||
} from "../../utils/types/knownIds"
|
} from "../../utils/types/knownIds"
|
||||||
import { RuneIdCombined } from "../../xlinkSdkUtils/types"
|
import { RuneIdCombined } from "../../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export interface RunesSupportedRoute {
|
export interface RunesSupportedRoute {
|
||||||
runesId: RuneIdCombined
|
runesId: RuneIdCombined
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
executeReadonlyCallXLINK,
|
executeReadonlyCallXLINK,
|
||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
numberFromStacksContractNumber,
|
numberFromStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
getAndCheckTransitStacksTokens,
|
getAndCheckTransitStacksTokens,
|
||||||
@@ -34,7 +34,7 @@ import {
|
|||||||
import {
|
import {
|
||||||
SDKGlobalContext,
|
SDKGlobalContext,
|
||||||
withGlobalContextCache,
|
withGlobalContextCache,
|
||||||
} from "../xlinkSdkUtils/types.internal"
|
} from "../sdkUtils/types.internal"
|
||||||
import { getBRC20SupportedRoutes } from "./apiHelpers/getBRC20SupportedRoutes"
|
import { getBRC20SupportedRoutes } from "./apiHelpers/getBRC20SupportedRoutes"
|
||||||
import { getRunesSupportedRoutes } from "./apiHelpers/getRunesSupportedRoutes"
|
import { getRunesSupportedRoutes } from "./apiHelpers/getRunesSupportedRoutes"
|
||||||
import { getMetaPegInAddress } from "./btcAddresses"
|
import { getMetaPegInAddress } from "./btcAddresses"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
getPossibleEVMDexAggregatorSwapParametersImpl,
|
getPossibleEVMDexAggregatorSwapParametersImpl,
|
||||||
} from "../utils/swapHelpers/evmDexAggregatorSwapParametersHelpers"
|
} from "../utils/swapHelpers/evmDexAggregatorSwapParametersHelpers"
|
||||||
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { getMeta2StacksFeeInfo } from "./peggingHelpers"
|
import { getMeta2StacksFeeInfo } from "./peggingHelpers"
|
||||||
|
|
||||||
export async function getALEXSwapParameters_FromMeta(
|
export async function getALEXSwapParameters_FromMeta(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { getRunesSupportedRoutes } from "./apiHelpers/getRunesSupportedRoutes"
|
import { getRunesSupportedRoutes } from "./apiHelpers/getRunesSupportedRoutes"
|
||||||
import { getBRC20SupportedRoutes } from "./apiHelpers/getBRC20SupportedRoutes"
|
import { getBRC20SupportedRoutes } from "./apiHelpers/getBRC20SupportedRoutes"
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { RuneIdCombined, toSDKNumberOrUndefined } from "./xlinkSdkUtils/types"
|
import { RuneIdCombined, toSDKNumberOrUndefined } from "./sdkUtils/types"
|
||||||
import {
|
import {
|
||||||
GetAvailableRuneUTXOFn as _GetAvailableRuneUTXOFn,
|
GetAvailableRuneUTXOFn as _GetAvailableRuneUTXOFn,
|
||||||
RuneInfo,
|
RuneInfo,
|
||||||
selectRuneUTXOs as _selectRuneUTXOs,
|
selectRuneUTXOs as _selectRuneUTXOs,
|
||||||
} from "./bitcoinUtils/selectRuneUTXOs"
|
} from "./bitcoinUtils/selectRuneUTXOs"
|
||||||
import { SDKNumber } from "./xlinkSdkUtils/types"
|
import { SDKNumber } from "./sdkUtils/types"
|
||||||
import { UTXOSpendable } from "./bitcoinHelpers"
|
import { UTXOSpendable } from "./bitcoinHelpers"
|
||||||
import { BigNumber } from "./utils/BigNumber"
|
import { BigNumber } from "./utils/BigNumber"
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ import {
|
|||||||
createBridgeOrder_MetaToStacks,
|
createBridgeOrder_MetaToStacks,
|
||||||
} from "../stacksUtils/createBridgeOrderFromMeta"
|
} from "../stacksUtils/createBridgeOrderFromMeta"
|
||||||
import { validateBridgeOrderFromMeta } from "../stacksUtils/validateBridgeOrderFromMeta"
|
import { validateBridgeOrderFromMeta } from "../stacksUtils/validateBridgeOrderFromMeta"
|
||||||
import { getStacksTokenContractInfo } from "../stacksUtils/xlinkContractHelpers"
|
import { getStacksTokenContractInfo } from "../stacksUtils/contractHelpers"
|
||||||
import { range } from "../utils/arrayHelpers"
|
import { range } from "../utils/arrayHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
@@ -641,7 +641,7 @@ async function broadcastBRC20Transaction(
|
|||||||
orderData: createdOrder.data,
|
orderData: createdOrder.data,
|
||||||
orderOutputIndex: tx.revealOutput.index,
|
orderOutputIndex: tx.revealOutput.index,
|
||||||
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
||||||
xlinkPegInAddress: pegInAddress,
|
pegInAddress: pegInAddress,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -656,7 +656,7 @@ async function broadcastBRC20Transaction(
|
|||||||
|
|
||||||
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"[xlink-sdk] Transaction id broadcasted by API and delegatee are different:",
|
"[bro-sdk] Transaction id broadcasted by API and delegatee are different:",
|
||||||
`API: ${apiBroadcastedTxId}, `,
|
`API: ${apiBroadcastedTxId}, `,
|
||||||
`Delegatee: ${delegateBroadcastedTxId}`,
|
`Delegatee: ${delegateBroadcastedTxId}`,
|
||||||
)
|
)
|
||||||
@@ -723,7 +723,7 @@ async function constructBRC20Transaction(
|
|||||||
vout: txOptions.revealOutput.index,
|
vout: txOptions.revealOutput.index,
|
||||||
satsAmount: txOptions.revealOutput.satsAmount,
|
satsAmount: txOptions.revealOutput.satsAmount,
|
||||||
orderData: info.orderData,
|
orderData: info.orderData,
|
||||||
xlinkPegInAddress: info.pegInAddress,
|
pegInAddress: info.pegInAddress,
|
||||||
})
|
})
|
||||||
|
|
||||||
await info
|
await info
|
||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
createBridgeOrder_BitcoinToStacks,
|
createBridgeOrder_BitcoinToStacks,
|
||||||
} from "../stacksUtils/createBridgeOrderFromBitcoin"
|
} from "../stacksUtils/createBridgeOrderFromBitcoin"
|
||||||
import { validateBridgeOrderFromBitcoin } from "../stacksUtils/validateBridgeOrderFromBitcoin"
|
import { validateBridgeOrderFromBitcoin } from "../stacksUtils/validateBridgeOrderFromBitcoin"
|
||||||
import { getStacksTokenContractInfo } from "../stacksUtils/xlinkContractHelpers"
|
import { getStacksTokenContractInfo } from "../stacksUtils/contractHelpers"
|
||||||
import { range } from "../utils/arrayHelpers"
|
import { range } from "../utils/arrayHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
@@ -462,7 +462,7 @@ async function broadcastBitcoinTransaction(
|
|||||||
orderData: createdOrder.data,
|
orderData: createdOrder.data,
|
||||||
orderOutputIndex: tx.revealOutput.index,
|
orderOutputIndex: tx.revealOutput.index,
|
||||||
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
||||||
xlinkPegInAddress: pegInAddress,
|
pegInAddress: pegInAddress,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -477,7 +477,7 @@ async function broadcastBitcoinTransaction(
|
|||||||
|
|
||||||
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"[xlink-sdk] Transaction id broadcasted by API and delegatee are different:",
|
"[bro-sdk] Transaction id broadcasted by API and delegatee are different:",
|
||||||
`API: ${apiBroadcastedTxId}, `,
|
`API: ${apiBroadcastedTxId}, `,
|
||||||
`Delegatee: ${delegateBroadcastedTxId}`,
|
`Delegatee: ${delegateBroadcastedTxId}`,
|
||||||
)
|
)
|
||||||
@@ -539,7 +539,7 @@ async function constructBitcoinTransaction(
|
|||||||
vout: txOptions.revealOutput.index,
|
vout: txOptions.revealOutput.index,
|
||||||
satsAmount: txOptions.revealOutput.satsAmount,
|
satsAmount: txOptions.revealOutput.satsAmount,
|
||||||
orderData: info.orderData,
|
orderData: info.orderData,
|
||||||
xlinkPegInAddress: info.pegInAddress,
|
pegInAddress: info.pegInAddress,
|
||||||
})
|
})
|
||||||
|
|
||||||
await info
|
await info
|
||||||
@@ -8,10 +8,10 @@ import {
|
|||||||
getEVMContractCallInfo,
|
getEVMContractCallInfo,
|
||||||
getEVMTokenContractInfo,
|
getEVMTokenContractInfo,
|
||||||
numberToSolidityContractNumber,
|
numberToSolidityContractNumber,
|
||||||
} from "../evmUtils/xlinkContractHelpers"
|
} from "../evmUtils/contractHelpers"
|
||||||
import { metaTokenToCorrespondingStacksToken } from "../metaUtils/peggingHelpers"
|
import { metaTokenToCorrespondingStacksToken } from "../metaUtils/peggingHelpers"
|
||||||
import { contractAssignedChainIdFromKnownChain } from "../stacksUtils/crossContractDataMapping"
|
import { contractAssignedChainIdFromKnownChain } from "../stacksUtils/crossContractDataMapping"
|
||||||
import { getStacksTokenContractInfo } from "../stacksUtils/xlinkContractHelpers"
|
import { getStacksTokenContractInfo } from "../stacksUtils/contractHelpers"
|
||||||
import { addressToBuffer } from "../utils/addressHelpers"
|
import { addressToBuffer } from "../utils/addressHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
createBridgeOrder_MetaToStacks,
|
createBridgeOrder_MetaToStacks,
|
||||||
} from "../stacksUtils/createBridgeOrderFromMeta"
|
} from "../stacksUtils/createBridgeOrderFromMeta"
|
||||||
import { validateBridgeOrderFromMeta } from "../stacksUtils/validateBridgeOrderFromMeta"
|
import { validateBridgeOrderFromMeta } from "../stacksUtils/validateBridgeOrderFromMeta"
|
||||||
import { getStacksTokenContractInfo } from "../stacksUtils/xlinkContractHelpers"
|
import { getStacksTokenContractInfo } from "../stacksUtils/contractHelpers"
|
||||||
import { range } from "../utils/arrayHelpers"
|
import { range } from "../utils/arrayHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
@@ -583,7 +583,7 @@ async function broadcastRunesTransaction(
|
|||||||
orderData: createdOrder.data,
|
orderData: createdOrder.data,
|
||||||
orderOutputIndex: tx.revealOutput.index,
|
orderOutputIndex: tx.revealOutput.index,
|
||||||
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
orderOutputSatsAmount: tx.revealOutput.satsAmount,
|
||||||
xlinkPegInAddress: pegInAddress,
|
pegInAddress: pegInAddress,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -598,7 +598,7 @@ async function broadcastRunesTransaction(
|
|||||||
|
|
||||||
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
if (apiBroadcastedTxId !== delegateBroadcastedTxId) {
|
||||||
console.warn(
|
console.warn(
|
||||||
"[xlink-sdk] Transaction id broadcasted by API and delegatee are different:",
|
"[bro-sdk] Transaction id broadcasted by API and delegatee are different:",
|
||||||
`API: ${apiBroadcastedTxId}, `,
|
`API: ${apiBroadcastedTxId}, `,
|
||||||
`Delegatee: ${delegateBroadcastedTxId}`,
|
`Delegatee: ${delegateBroadcastedTxId}`,
|
||||||
)
|
)
|
||||||
@@ -669,7 +669,7 @@ async function constructRunesTransaction(
|
|||||||
vout: txOptions.revealOutput.index,
|
vout: txOptions.revealOutput.index,
|
||||||
satsAmount: txOptions.revealOutput.satsAmount,
|
satsAmount: txOptions.revealOutput.satsAmount,
|
||||||
orderData: info.orderData,
|
orderData: info.orderData,
|
||||||
xlinkPegInAddress: info.pegInAddress,
|
pegInAddress: info.pegInAddress,
|
||||||
})
|
})
|
||||||
|
|
||||||
await info
|
await info
|
||||||
@@ -11,7 +11,7 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
numberToStacksContractNumber,
|
numberToStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import {
|
import {
|
||||||
checkRouteValid,
|
checkRouteValid,
|
||||||
KnownRoute_FromStacks_ToBitcoin,
|
KnownRoute_FromStacks_ToBitcoin,
|
||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
executeReadonlyCallXLINK,
|
executeReadonlyCallXLINK,
|
||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
numberFromStacksContractNumber,
|
numberFromStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import {
|
import {
|
||||||
getAndCheckTransitStacksTokens,
|
getAndCheckTransitStacksTokens,
|
||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
getEVMContractCallInfo,
|
getEVMContractCallInfo,
|
||||||
getEVMTokenContractInfo,
|
getEVMTokenContractInfo,
|
||||||
numberFromSolidityContractNumber,
|
numberFromSolidityContractNumber,
|
||||||
} from "../evmUtils/xlinkContractHelpers"
|
} from "../evmUtils/contractHelpers"
|
||||||
import { BigNumber } from "../utils/BigNumber"
|
import { BigNumber } from "../utils/BigNumber"
|
||||||
import { UnsupportedChainError } from "../utils/errors"
|
import { UnsupportedChainError } from "../utils/errors"
|
||||||
import { decodeHex } from "../utils/hexHelpers"
|
import { decodeHex } from "../utils/hexHelpers"
|
||||||
@@ -4,8 +4,8 @@ import {
|
|||||||
createStacksToken,
|
createStacksToken,
|
||||||
KnownTokenId,
|
KnownTokenId,
|
||||||
} from "../../utils/types/knownIds"
|
} from "../../utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "../../xlinkSdkUtils/types"
|
import { StacksContractAddress } from "../../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
|
|
||||||
export interface StacksTokenInfo {
|
export interface StacksTokenInfo {
|
||||||
stacksTokenId: KnownTokenId.StacksToken
|
stacksTokenId: KnownTokenId.StacksToken
|
||||||
|
|||||||
@@ -13,15 +13,15 @@ import {
|
|||||||
ParameterObjOfDescriptor,
|
ParameterObjOfDescriptor,
|
||||||
StringOnly,
|
StringOnly,
|
||||||
} from "clarity-codegen"
|
} from "clarity-codegen"
|
||||||
import { xlinkContracts } from "../../generated/smartContract/contracts_xlink"
|
import { broContracts } from "../../generated/smartContract/contracts_bro"
|
||||||
import { STACKS_MAINNET, STACKS_TESTNET } from "../config"
|
import { STACKS_MAINNET, STACKS_TESTNET } from "../config"
|
||||||
import { BigNumber, BigNumberSource } from "../utils/BigNumber"
|
|
||||||
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
|
||||||
import {
|
import {
|
||||||
isStacksContractAddressEqual,
|
isStacksContractAddressEqual,
|
||||||
StacksContractAddress,
|
StacksContractAddress,
|
||||||
} from "../xlinkSdkUtils/types"
|
} from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
|
import { BigNumber, BigNumberSource } from "../utils/BigNumber"
|
||||||
|
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
||||||
import { getAllStacksTokens } from "./apiHelpers/getAllStacksTokens"
|
import { getAllStacksTokens } from "./apiHelpers/getAllStacksTokens"
|
||||||
import {
|
import {
|
||||||
StacksContractName,
|
StacksContractName,
|
||||||
@@ -61,8 +61,8 @@ export interface ContractCallOptions {
|
|||||||
functionArgs: SerializedClarityValue[]
|
functionArgs: SerializedClarityValue[]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _composeTxXLINK = composeTxOptionsFactory(xlinkContracts, {})
|
const _composeTxBrotocol = composeTxOptionsFactory(broContracts, {})
|
||||||
export type ComposeTxOptionsFn<Contracts extends typeof xlinkContracts> = <
|
export type ComposeTxOptionsFn<Contracts extends typeof broContracts> = <
|
||||||
T extends StringOnly<keyof Contracts>,
|
T extends StringOnly<keyof Contracts>,
|
||||||
F extends StringOnly<keyof Contracts[T]>,
|
F extends StringOnly<keyof Contracts[T]>,
|
||||||
Descriptor extends Contracts[T][F],
|
Descriptor extends Contracts[T][F],
|
||||||
@@ -78,10 +78,10 @@ export type ComposeTxOptionsFn<Contracts extends typeof xlinkContracts> = <
|
|||||||
postConditions?: PC[]
|
postConditions?: PC[]
|
||||||
},
|
},
|
||||||
) => ContractCallOptions
|
) => ContractCallOptions
|
||||||
export const composeTxXLINK: ComposeTxOptionsFn<typeof xlinkContracts> = (
|
export const composeTxXLINK: ComposeTxOptionsFn<typeof broContracts> = (
|
||||||
...args
|
...args
|
||||||
) => {
|
) => {
|
||||||
const options = _composeTxXLINK(...args)
|
const options = _composeTxBrotocol(...args)
|
||||||
return {
|
return {
|
||||||
...options,
|
...options,
|
||||||
functionArgs: options.functionArgs.map(arg => serializeCVBytes(arg)),
|
functionArgs: options.functionArgs.map(arg => serializeCVBytes(arg)),
|
||||||
@@ -92,7 +92,7 @@ export const composeTxXLINK: ComposeTxOptionsFn<typeof xlinkContracts> = (
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const executeReadonlyCallXLINK = executeReadonlyCallFactory(
|
export const executeReadonlyCallXLINK = executeReadonlyCallFactory(
|
||||||
xlinkContracts,
|
broContracts,
|
||||||
{},
|
{},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,8 +22,8 @@ import {
|
|||||||
EVMAddress,
|
EVMAddress,
|
||||||
isEVMAddress,
|
isEVMAddress,
|
||||||
StacksContractAddress,
|
StacksContractAddress,
|
||||||
} from "../xlinkSdkUtils/types"
|
} from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { contractAssignedChainIdFromKnownChain } from "./crossContractDataMapping"
|
import { contractAssignedChainIdFromKnownChain } from "./crossContractDataMapping"
|
||||||
import { StacksContractName } from "./stxContractAddresses"
|
import { StacksContractName } from "./stxContractAddresses"
|
||||||
import {
|
import {
|
||||||
@@ -31,7 +31,7 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
numberToStacksContractNumber,
|
numberToStacksContractNumber,
|
||||||
} from "./xlinkContractHelpers"
|
} from "./contractHelpers"
|
||||||
|
|
||||||
export interface BridgeSwapRouteNode {
|
export interface BridgeSwapRouteNode {
|
||||||
poolId: bigint
|
poolId: bigint
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import {
|
|||||||
KnownChainId,
|
KnownChainId,
|
||||||
KnownTokenId,
|
KnownTokenId,
|
||||||
} from "../utils/types/knownIds"
|
} from "../utils/types/knownIds"
|
||||||
import { EVMAddress } from "../xlinkSdkUtils/types"
|
import { EVMAddress } from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { CreateBridgeOrderResult } from "./createBridgeOrderFromBitcoin"
|
import { CreateBridgeOrderResult } from "./createBridgeOrderFromBitcoin"
|
||||||
import { contractAssignedChainIdFromKnownChain } from "./crossContractDataMapping"
|
import { contractAssignedChainIdFromKnownChain } from "./crossContractDataMapping"
|
||||||
import { StacksContractName } from "./stxContractAddresses"
|
import { StacksContractName } from "./stxContractAddresses"
|
||||||
@@ -30,7 +30,7 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksTokenContractInfo,
|
getStacksTokenContractInfo,
|
||||||
numberToStacksContractNumber,
|
numberToStacksContractNumber,
|
||||||
} from "./xlinkContractHelpers"
|
} from "./contractHelpers"
|
||||||
|
|
||||||
export async function createBridgeOrderFromMeta(
|
export async function createBridgeOrderFromMeta(
|
||||||
sdkContext: SDKGlobalContext,
|
sdkContext: SDKGlobalContext,
|
||||||
|
|||||||
@@ -3,16 +3,16 @@ import {
|
|||||||
contractNameOverrides_testnet,
|
contractNameOverrides_testnet,
|
||||||
} from "../config"
|
} from "../config"
|
||||||
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "../xlinkSdkUtils/types"
|
import { StacksContractAddress } from "../sdkUtils/types"
|
||||||
|
|
||||||
export const xlinkContractsDeployerMainnet =
|
export const contractsDeployerMainnet =
|
||||||
"SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK"
|
"SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK"
|
||||||
export const xlinkContractsDeployerTestnet =
|
export const contractsDeployerTestnet =
|
||||||
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"
|
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"
|
||||||
|
|
||||||
export const xlinkContractsMultisigMainnet =
|
export const contractsMultisigMainnet =
|
||||||
"SP673Z4BPB4R73359K9HE55F2X91V5BJTN5SXZ5T"
|
"SP673Z4BPB4R73359K9HE55F2X91V5BJTN5SXZ5T"
|
||||||
export const xlinkContractsMultisigTestnet =
|
export const contractsMultisigTestnet =
|
||||||
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"
|
"ST2QXSK64YQX3CQPC530K79XWQ98XFAM9W3XKEH3N"
|
||||||
|
|
||||||
export const alexContractDeployerMainnet =
|
export const alexContractDeployerMainnet =
|
||||||
@@ -68,131 +68,131 @@ export enum StacksContractName {
|
|||||||
export const stxContractAddresses = {
|
export const stxContractAddresses = {
|
||||||
[StacksContractName.BTCPegInEndpoint]: {
|
[StacksContractName.BTCPegInEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpoint,
|
contractName: StacksContractName.BTCPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpoint,
|
contractName: StacksContractName.BTCPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.BTCPegInEndpointSwap]: {
|
[StacksContractName.BTCPegInEndpointSwap]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointSwap,
|
contractName: StacksContractName.BTCPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointSwap,
|
contractName: StacksContractName.BTCPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.BTCPegInEndpointAggregator]: {
|
[StacksContractName.BTCPegInEndpointAggregator]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointAggregator,
|
contractName: StacksContractName.BTCPegInEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointAggregator,
|
contractName: StacksContractName.BTCPegInEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.BTCPegInEndpointLaunchpad]: {
|
[StacksContractName.BTCPegInEndpointLaunchpad]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointLaunchpad,
|
contractName: StacksContractName.BTCPegInEndpointLaunchpad,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.BTCPegInEndpointLaunchpad,
|
contractName: StacksContractName.BTCPegInEndpointLaunchpad,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.BTCPegOutEndpoint]: {
|
[StacksContractName.BTCPegOutEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: StacksContractName.BTCPegOutEndpoint,
|
contractName: StacksContractName.BTCPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: StacksContractName.BTCPegOutEndpoint,
|
contractName: StacksContractName.BTCPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.EVMPegInEndpoint]: {
|
[StacksContractName.EVMPegInEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.EVMPegInEndpoint,
|
contractName: StacksContractName.EVMPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.EVMPegInEndpoint,
|
contractName: StacksContractName.EVMPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.EVMPegInEndpointSwap]: {
|
[StacksContractName.EVMPegInEndpointSwap]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.EVMPegInEndpointSwap,
|
contractName: StacksContractName.EVMPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.EVMPegInEndpointSwap,
|
contractName: StacksContractName.EVMPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.EVMPegOutEndpoint]: {
|
[StacksContractName.EVMPegOutEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: StacksContractName.EVMPegOutEndpoint,
|
contractName: StacksContractName.EVMPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: StacksContractName.EVMPegOutEndpoint,
|
contractName: StacksContractName.EVMPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.EVMPegOutEndpointAggregator]: {
|
[StacksContractName.EVMPegOutEndpointAggregator]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.EVMPegOutEndpointAggregator,
|
contractName: StacksContractName.EVMPegOutEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.EVMPegOutEndpointAggregator,
|
contractName: StacksContractName.EVMPegOutEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.MetaPegInEndpoint]: {
|
[StacksContractName.MetaPegInEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpoint,
|
contractName: StacksContractName.MetaPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpoint,
|
contractName: StacksContractName.MetaPegInEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.MetaPegInEndpointSwap]: {
|
[StacksContractName.MetaPegInEndpointSwap]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpointSwap,
|
contractName: StacksContractName.MetaPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpointSwap,
|
contractName: StacksContractName.MetaPegInEndpointSwap,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.MetaPegInEndpointAggregator]: {
|
[StacksContractName.MetaPegInEndpointAggregator]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpointAggregator,
|
contractName: StacksContractName.MetaPegInEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.MetaPegInEndpointAggregator,
|
contractName: StacksContractName.MetaPegInEndpointAggregator,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[StacksContractName.MetaPegOutEndpoint]: {
|
[StacksContractName.MetaPegOutEndpoint]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: StacksContractName.MetaPegOutEndpoint,
|
contractName: StacksContractName.MetaPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: StacksContractName.MetaPegOutEndpoint,
|
contractName: StacksContractName.MetaPegOutEndpoint,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -222,41 +222,41 @@ export const stxTokenContractAddresses_legacy: Record<
|
|||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.aBTC]: {
|
[KnownTokenId.Stacks.aBTC]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: "token-abtc",
|
contractName: "token-abtc",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: "token-abtc",
|
contractName: "token-abtc",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.sUSDT]: {
|
[KnownTokenId.Stacks.sUSDT]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: "token-susdt",
|
contractName: "token-susdt",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: "token-susdt",
|
contractName: "token-susdt",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.sLUNR]: {
|
[KnownTokenId.Stacks.sLUNR]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: "token-slunr",
|
contractName: "token-slunr",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: "token-slunr",
|
contractName: "token-slunr",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.sSKO]: {
|
[KnownTokenId.Stacks.sSKO]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsDeployerMainnet,
|
deployerAddress: contractsDeployerMainnet,
|
||||||
contractName: "token-ssko",
|
contractName: "token-ssko",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: "token-ssko",
|
contractName: "token-ssko",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -292,11 +292,11 @@ export const stxTokenContractAddresses_legacy: Record<
|
|||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.uBTC]: {
|
[KnownTokenId.Stacks.uBTC]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-ubtc",
|
contractName: "token-ubtc",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsDeployerTestnet,
|
deployerAddress: contractsDeployerTestnet,
|
||||||
contractName: "token-ubtc",
|
contractName: "token-ubtc",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@@ -332,51 +332,51 @@ export const stxTokenContractAddresses_legacy: Record<
|
|||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.TRUMP]: {
|
[KnownTokenId.Stacks.TRUMP]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "runes-trump",
|
contractName: "runes-trump",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "runes-trump",
|
contractName: "runes-trump",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.GHIBLICZ]: {
|
[KnownTokenId.Stacks.GHIBLICZ]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "bsc-ghiblicz",
|
contractName: "bsc-ghiblicz",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "bsc-ghiblicz",
|
contractName: "bsc-ghiblicz",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.ETH]: {
|
[KnownTokenId.Stacks.ETH]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-eth",
|
contractName: "token-eth",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "token-eth",
|
contractName: "token-eth",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.SOL]: {
|
[KnownTokenId.Stacks.SOL]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-sol",
|
contractName: "token-sol",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "token-sol",
|
contractName: "token-sol",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
[KnownTokenId.Stacks.LINK]: {
|
[KnownTokenId.Stacks.LINK]: {
|
||||||
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
[KnownChainId.Stacks.Mainnet]: wrapContractAddress("mainnet", {
|
||||||
deployerAddress: xlinkContractsMultisigMainnet,
|
deployerAddress: contractsMultisigMainnet,
|
||||||
contractName: "token-link",
|
contractName: "token-link",
|
||||||
}),
|
}),
|
||||||
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
[KnownChainId.Stacks.Testnet]: wrapContractAddress("testnet", {
|
||||||
deployerAddress: xlinkContractsMultisigTestnet,
|
deployerAddress: contractsMultisigTestnet,
|
||||||
contractName: "token-link",
|
contractName: "token-link",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import {
|
|||||||
SwapRouteViaEVMDexAggregator,
|
SwapRouteViaEVMDexAggregator,
|
||||||
} from "../utils/SwapRouteHelpers"
|
} from "../utils/SwapRouteHelpers"
|
||||||
import { KnownChainId } from "../utils/types/knownIds"
|
import { KnownChainId } from "../utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "../xlinkSdkUtils/types"
|
import { StacksContractAddress } from "../sdkUtils/types"
|
||||||
import { StacksContractName } from "./stxContractAddresses"
|
import { StacksContractName } from "./stxContractAddresses"
|
||||||
import {
|
import {
|
||||||
executeReadonlyCallXLINK,
|
executeReadonlyCallXLINK,
|
||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
} from "./xlinkContractHelpers"
|
} from "./contractHelpers"
|
||||||
import { checkNever } from "../utils/typeHelpers"
|
import { checkNever } from "../utils/typeHelpers"
|
||||||
|
|
||||||
export async function validateBridgeOrderFromBitcoin(info: {
|
export async function validateBridgeOrderFromBitcoin(info: {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import {
|
|||||||
SwapRouteViaEVMDexAggregator,
|
SwapRouteViaEVMDexAggregator,
|
||||||
} from "../utils/SwapRouteHelpers"
|
} from "../utils/SwapRouteHelpers"
|
||||||
import { getChainIdNetworkType, KnownChainId } from "../utils/types/knownIds"
|
import { getChainIdNetworkType, KnownChainId } from "../utils/types/knownIds"
|
||||||
import { StacksContractAddress } from "../xlinkSdkUtils/types"
|
import { StacksContractAddress } from "../sdkUtils/types"
|
||||||
import { StacksContractName } from "./stxContractAddresses"
|
import { StacksContractName } from "./stxContractAddresses"
|
||||||
import {
|
import {
|
||||||
executeReadonlyCallXLINK,
|
executeReadonlyCallXLINK,
|
||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
} from "./xlinkContractHelpers"
|
} from "./contractHelpers"
|
||||||
import { checkNever } from "../utils/typeHelpers"
|
import { checkNever } from "../utils/typeHelpers"
|
||||||
|
|
||||||
export async function validateBridgeOrderFromMeta(info: {
|
export async function validateBridgeOrderFromMeta(info: {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import {
|
|||||||
import { checkNever } from "./utils/typeHelpers"
|
import { checkNever } from "./utils/typeHelpers"
|
||||||
import { KnownChainId, KnownTokenId } from "./utils/types/knownIds"
|
import { KnownChainId, KnownTokenId } from "./utils/types/knownIds"
|
||||||
import { XLinkSDK } from "./XLinkSDK"
|
import { XLinkSDK } from "./XLinkSDK"
|
||||||
import { SDKNumber, toSDKNumberOrUndefined } from "./xlinkSdkUtils/types"
|
import { SDKNumber, toSDKNumberOrUndefined } from "./sdkUtils/types"
|
||||||
|
|
||||||
export interface ALEXSwapParameters
|
export interface ALEXSwapParameters
|
||||||
extends Omit<_ALEXSwapParameters, "fromAmount"> {
|
extends Omit<_ALEXSwapParameters, "fromAmount"> {
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import {
|
|||||||
getStacksContractCallInfo,
|
getStacksContractCallInfo,
|
||||||
getStacksToken,
|
getStacksToken,
|
||||||
numberFromStacksContractNumber,
|
numberFromStacksContractNumber,
|
||||||
} from "../stacksUtils/xlinkContractHelpers"
|
} from "../stacksUtils/contractHelpers"
|
||||||
import { SDKNumber, StacksContractAddress } from "../xlinkSdkUtils/types"
|
import { SDKNumber, StacksContractAddress } from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { last } from "./arrayHelpers"
|
import { last } from "./arrayHelpers"
|
||||||
import { BigNumber } from "./BigNumber"
|
import { BigNumber } from "./BigNumber"
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { backendAPIPrefix } from "../config"
|
import { backendAPIPrefix } from "../config"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
|
|
||||||
export async function requestAPI<T>(
|
export async function requestAPI<T>(
|
||||||
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
sdkContext: Pick<SDKGlobalContext, "backendAPI">,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { ChainId, TokenId } from "../xlinkSdkUtils/types"
|
import { ChainId, TokenId } from "../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { UnsupportedBridgeRouteError } from "./errors"
|
import { UnsupportedBridgeRouteError } from "./errors"
|
||||||
import { pMemoize } from "./pMemoize"
|
import { pMemoize } from "./pMemoize"
|
||||||
import { SwapRoute } from "./SwapRouteHelpers"
|
import { SwapRoute } from "./SwapRouteHelpers"
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { getEVMSupportedRoutesByChainType } from "../evmUtils/apiHelpers/getEVMSupportedRoutes"
|
import { getEVMSupportedRoutesByChainType } from "../evmUtils/apiHelpers/getEVMSupportedRoutes"
|
||||||
import { getBRC20SupportedRoutes } from "../metaUtils/apiHelpers/getBRC20SupportedRoutes"
|
import { getBRC20SupportedRoutes } from "../metaUtils/apiHelpers/getBRC20SupportedRoutes"
|
||||||
import { getRunesSupportedRoutes } from "../metaUtils/apiHelpers/getRunesSupportedRoutes"
|
import { getRunesSupportedRoutes } from "../metaUtils/apiHelpers/getRunesSupportedRoutes"
|
||||||
import { SDKGlobalContext } from "../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../sdkUtils/types.internal"
|
||||||
import { KnownRoute } from "./buildSupportedRoutes"
|
import { KnownRoute } from "./buildSupportedRoutes"
|
||||||
import { KnownChainId, KnownTokenId } from "./types/knownIds"
|
import { KnownChainId, KnownTokenId } from "./types/knownIds"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ChainId, TokenId } from "../xlinkSdkUtils/types"
|
import { ChainId, TokenId } from "../sdkUtils/types"
|
||||||
import {
|
import {
|
||||||
SwapRouteViaALEX,
|
SwapRouteViaALEX,
|
||||||
SwapRouteViaEVMDexAggregator,
|
SwapRouteViaEVMDexAggregator,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { getStacksTokenContractInfo } from "../../stacksUtils/xlinkContractHelpers"
|
import { getStacksTokenContractInfo } from "../../stacksUtils/contractHelpers"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
import { BigNumber } from "../BigNumber"
|
import { BigNumber } from "../BigNumber"
|
||||||
import { KnownRoute } from "../buildSupportedRoutes"
|
import { KnownRoute } from "../buildSupportedRoutes"
|
||||||
import { applyTransferProphet } from "../feeRateHelpers"
|
import { applyTransferProphet } from "../feeRateHelpers"
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import {
|
|||||||
getEvm2StacksFeeInfo,
|
getEvm2StacksFeeInfo,
|
||||||
getStacks2EvmFeeInfo,
|
getStacks2EvmFeeInfo,
|
||||||
} from "../../evmUtils/peggingHelpers"
|
} from "../../evmUtils/peggingHelpers"
|
||||||
import { getEVMTokenContractInfo } from "../../evmUtils/xlinkContractHelpers"
|
import { getEVMTokenContractInfo } from "../../evmUtils/contractHelpers"
|
||||||
import { evmNativeCurrencyAddress } from "../../xlinkSdkUtils/types"
|
import { evmNativeCurrencyAddress } from "../../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
import { hasAny, last } from "../arrayHelpers"
|
import { hasAny, last } from "../arrayHelpers"
|
||||||
import { BigNumber } from "../BigNumber"
|
import { BigNumber } from "../BigNumber"
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { toSDKNumberOrUndefined } from "../../../xlinkSdkUtils/types"
|
import { toSDKNumberOrUndefined } from "../../../sdkUtils/types"
|
||||||
import { arraySplit } from "../../arrayHelpers"
|
import { arraySplit } from "../../arrayHelpers"
|
||||||
import { BigNumber } from "../../BigNumber"
|
import { BigNumber } from "../../BigNumber"
|
||||||
import { XLinkSDKErrorBase } from "../../errors"
|
import { XLinkSDKErrorBase } from "../../errors"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { toSDKNumberOrUndefined } from "../../../xlinkSdkUtils/types"
|
import { toSDKNumberOrUndefined } from "../../../sdkUtils/types"
|
||||||
import { arraySplit } from "../../arrayHelpers"
|
import { arraySplit } from "../../arrayHelpers"
|
||||||
import { BigNumber } from "../../BigNumber"
|
import { BigNumber } from "../../BigNumber"
|
||||||
import { XLinkSDKErrorBase } from "../../errors"
|
import { XLinkSDKErrorBase } from "../../errors"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { toSDKNumberOrUndefined } from "../../../xlinkSdkUtils/types"
|
import { toSDKNumberOrUndefined } from "../../../sdkUtils/types"
|
||||||
import { arraySplit } from "../../arrayHelpers"
|
import { arraySplit } from "../../arrayHelpers"
|
||||||
import { BigNumber } from "../../BigNumber"
|
import { BigNumber } from "../../BigNumber"
|
||||||
import { XLinkSDKErrorBase } from "../../errors"
|
import { XLinkSDKErrorBase } from "../../errors"
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
import { readContract } from "viem/actions"
|
import { readContract } from "viem/actions"
|
||||||
import { ERC20Abi } from "../../../evmUtils/contractAbi/ERC20Abi"
|
import { ERC20Abi } from "../../../evmUtils/contractAbi/ERC20Abi"
|
||||||
import { evmChainIdFromKnownChainId } from "../../../evmUtils/evmClients"
|
import { evmChainIdFromKnownChainId } from "../../../evmUtils/evmClients"
|
||||||
import { getEVMTokenContractInfo } from "../../../evmUtils/xlinkContractHelpers"
|
import { getEVMTokenContractInfo } from "../../../evmUtils/contractHelpers"
|
||||||
import {
|
import {
|
||||||
EVMAddress,
|
EVMAddress,
|
||||||
evmNativeCurrencyAddress,
|
evmNativeCurrencyAddress,
|
||||||
SDKNumber,
|
SDKNumber,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
} from "../../../xlinkSdkUtils/types"
|
} from "../../../sdkUtils/types"
|
||||||
import { SDKGlobalContext } from "../../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../../sdkUtils/types.internal"
|
||||||
import { BigNumber } from "../../BigNumber"
|
import { BigNumber } from "../../BigNumber"
|
||||||
import { KnownChainId, KnownTokenId } from "../../types/knownIds"
|
import { KnownChainId, KnownTokenId } from "../../types/knownIds"
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { SDKGlobalContext } from "../../xlinkSdkUtils/types.internal"
|
import { SDKGlobalContext } from "../../sdkUtils/types.internal"
|
||||||
import { uniqBy } from "../arrayHelpers"
|
import { uniqBy } from "../arrayHelpers"
|
||||||
import { BigNumber } from "../BigNumber"
|
import { BigNumber } from "../BigNumber"
|
||||||
import { isNotNull } from "../typeHelpers"
|
import { isNotNull } from "../typeHelpers"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import {
|
|||||||
SDKNumber,
|
SDKNumber,
|
||||||
SDKNumberifyNestly,
|
SDKNumberifyNestly,
|
||||||
toSDKNumberOrUndefined,
|
toSDKNumberOrUndefined,
|
||||||
} from "../../xlinkSdkUtils/types"
|
} from "../../sdkUtils/types"
|
||||||
import { BigNumber } from "../BigNumber"
|
import { BigNumber } from "../BigNumber"
|
||||||
import { first, last } from "../arrayHelpers"
|
import { first, last } from "../arrayHelpers"
|
||||||
import { KnownRoute } from "../buildSupportedRoutes"
|
import { KnownRoute } from "../buildSupportedRoutes"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { ChainId, RuneIdCombined, TokenId } from "../../xlinkSdkUtils/types"
|
import { ChainId, RuneIdCombined, TokenId } from "../../sdkUtils/types"
|
||||||
import { checkNever } from "../typeHelpers"
|
import { checkNever } from "../typeHelpers"
|
||||||
|
|
||||||
const chainId = <const T extends string>(value: T): ChainId<T> => value as any
|
const chainId = <const T extends string>(value: T): ChainId<T> => value as any
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/tsconfig.json",
|
"$schema": "https://json.schemastore.org/tsconfig.json",
|
||||||
"extends": "@c4605/toolconfs/tsconfig-esModule",
|
"exclude": ["node_modules", "lib", "examples/cross-chain-swap"],
|
||||||
"exclude": ["lib", "examples/cross-chain-swap"],
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noImplicitReturns": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noFallthroughCasesInSwitch": true,
|
||||||
|
"noUncheckedIndexedAccess": false,
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"lib": ["ES2023", "WebWorker"],
|
"lib": ["ES2023", "WebWorker"],
|
||||||
"noEmit": true
|
"noEmit": true
|
||||||
|
|||||||
Reference in New Issue
Block a user