mirror of
https://github.com/Brotocol-xyz/bro-sdk.git
synced 2026-04-30 04:15:13 +08:00
feat: update EVM > BRC20/Runes order data schema
This commit is contained in:
@@ -5,6 +5,6 @@ export const sendMessageAbi = parseAbi([
|
||||
"function transferToEVM(uint256 destChainId, address destToken, address destAddress) pure returns (uint256)",
|
||||
"function transferToStacks(string calldata to) pure returns (uint256)",
|
||||
"function transferToBTC(bytes calldata btcAddress) pure returns (uint256)",
|
||||
"function transferToBRC20(bytes calldata btcAddress) pure returns (uint256)",
|
||||
"function transferToRunes(bytes calldata btcAddress) pure returns (uint256)",
|
||||
"function transferToBRC20(bytes calldata btcAddress, string calldata destStacksTokenAddress) pure returns (uint256)",
|
||||
"function transferToRunes(bytes calldata btcAddress, string calldata destStacksTokenAddress) pure returns (uint256)",
|
||||
])
|
||||
|
||||
@@ -44,6 +44,7 @@ import {
|
||||
toSDKNumberOrUndefined,
|
||||
} from "./types"
|
||||
import { SDKGlobalContext } from "./types.internal"
|
||||
import { metaTokenToCorrespondingStacksToken } from "../metaUtils/peggingHelpers"
|
||||
|
||||
export const supportedRoutes = buildSupportedRoutes(
|
||||
[
|
||||
@@ -621,10 +622,29 @@ async function bridgeFromEVM_toMeta(
|
||||
info.fromChain,
|
||||
info.fromToken,
|
||||
)
|
||||
|
||||
const toTokenCorrespondingStacksToken =
|
||||
await metaTokenToCorrespondingStacksToken(ctx, {
|
||||
chain: info.toChain as any,
|
||||
token: info.toToken as any,
|
||||
})
|
||||
const toTokenStacksAddress =
|
||||
toTokenCorrespondingStacksToken == null
|
||||
? undefined
|
||||
: await getStacksTokenContractInfo(
|
||||
ctx,
|
||||
KnownChainId.isEVMMainnetChain(info.fromChain)
|
||||
? KnownChainId.Stacks.Mainnet
|
||||
: KnownChainId.Stacks.Testnet,
|
||||
toTokenCorrespondingStacksToken,
|
||||
)
|
||||
|
||||
if (
|
||||
bridgeEndpointAddress == null ||
|
||||
fromTokenContractInfo == null ||
|
||||
fromTokenContractInfo.tokenContractAddress === nativeCurrencyAddress
|
||||
fromTokenContractInfo.tokenContractAddress === nativeCurrencyAddress ||
|
||||
toTokenCorrespondingStacksToken == null ||
|
||||
toTokenStacksAddress == null
|
||||
) {
|
||||
throw new UnsupportedBridgeRouteError(
|
||||
info.fromChain,
|
||||
@@ -657,7 +677,10 @@ async function bridgeFromEVM_toMeta(
|
||||
functionName: KnownChainId.isBRC20Chain(info.toChain)
|
||||
? "transferToBRC20"
|
||||
: "transferToRunes",
|
||||
args: [toAddressHex],
|
||||
args: [
|
||||
toAddressHex,
|
||||
`${toTokenStacksAddress.deployerAddress}.${toTokenStacksAddress.contractName}`,
|
||||
],
|
||||
})
|
||||
const functionData = await encodeFunctionData({
|
||||
abi: BridgeEndpointAbi,
|
||||
|
||||
Reference in New Issue
Block a user