Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: hotfix release v1.623.0 #7206

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/chain-adapters/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ export type BuildSendApiTxInput<T extends KnownChainIds> = Omit<BuildSendTxInput

export type UtxoBuildSendApiTxInput<T extends UtxoChainId> = Omit<BuildSendTxInput<T>, 'wallet'> & {
xpub: string
/** Explicit skip of `to` address validation. Use with extreme care (ex. thorchain vault address) */
skipToAddressValidation?: boolean
}

export type ChainSpecificBuildTxData<T> = ChainSpecific<
Expand Down
12 changes: 10 additions & 2 deletions packages/chain-adapters/src/utxo/UtxoBaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,15 @@ export abstract class UtxoBaseAdapter<T extends UtxoChainId> implements IChainAd

async buildSendApiTransaction(input: UtxoBuildSendApiTxInput<T>): Promise<SignTx<T>> {
try {
const { value, to, xpub, accountNumber, sendMax = false, chainSpecific } = input
const {
value,
to,
xpub,
accountNumber,
sendMax = false,
chainSpecific,
skipToAddressValidation,
} = input
const { from, satoshiPerByte, accountType, opReturnData } = chainSpecific

if (!value) throw new Error('value is required')
Expand Down Expand Up @@ -305,7 +313,7 @@ export abstract class UtxoBaseAdapter<T extends UtxoChainId> implements IChainAd
}

const addresses = [...inputs, ...outputs, nextChangeAddressInput, nextReceiveAddressInput]
.map(({ address }) => address)
.map(({ address }) => (skipToAddressValidation && address === to ? null : address))
.filter(Boolean) as string[]

const uniqueAddresses = [...new Set(addresses)]
Expand Down
2 changes: 2 additions & 0 deletions src/lib/swapper/swappers/ThorchainSwapper/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ export const thorchainApi: SwapperApi = {
xpub: xpub!,
to: vault,
accountNumber,
// skip address validation for thorchain vault addresses as they may exceed the risk score threshold, but are still valid for use
skipToAddressValidation: true,
chainSpecific: {
accountType,
opReturnData,
Expand Down
Loading