Skip to content

Commit a78a192

Browse files
committed
chore: rfq gw or rfq executor updates
1 parent 2209811 commit a78a192

2 files changed

Lines changed: 55 additions & 0 deletions

File tree

packages/sdk-ts/src/core/tx/broadcaster/MsgBroadcasterWithPk.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,12 +454,52 @@ export class MsgBroadcasterWithPk {
454454
feePayerSig: string
455455
accountNumber: number
456456
tx: Uint8Array | string
457+
}) {
458+
return this.broadcastDirectSignWithFeePayerSig({
459+
tx,
460+
feePayerSig,
461+
accountNumber,
462+
})
463+
}
464+
465+
/**
466+
* EIP-712 (EVM wallet) path for broadcastWithFeePayerSig.
467+
* Not yet implemented — EVM wallets sign via eth_signTypedData_v4,
468+
* which requires a different pre-built tx format.
469+
*/
470+
private async broadcastEip712WithFeePayerSig(_params: {
471+
tx: Uint8Array | string
472+
feePayerSig: string
473+
accountNumber: number
474+
}): Promise<never> {
475+
throw new GeneralException(
476+
new Error(
477+
'broadcastWithFeePayerSig for EVM wallets is not yet implemented.',
478+
),
479+
)
480+
}
481+
482+
/**
483+
* SIGN_MODE_DIRECT path for broadcastWithFeePayerSig.
484+
* Signs the pre-built tx with the private key directly, appends the fee payer
485+
* signature, and broadcasts to chain.
486+
*/
487+
private async broadcastDirectSignWithFeePayerSig({
488+
tx,
489+
feePayerSig,
490+
accountNumber,
491+
}: {
492+
feePayerSig: string
493+
accountNumber: number
494+
tx: Uint8Array | string
457495
}) {
458496
const { chainId, privateKey } = this
459497

460498
const txBytes = typeof tx === 'string' ? base64ToUint8Array(tx) : tx
461499
const txRaw = CosmosTxV1Beta1TxPb.TxRaw.fromBinary(txBytes)
462500

501+
console.log('injective-ts, autosign - doing signing')
502+
463503
const signDoc = CosmosTxV1Beta1TxPb.SignDoc.create({
464504
chainId,
465505
bodyBytes: txRaw.bodyBytes,
@@ -470,12 +510,16 @@ export class MsgBroadcasterWithPk {
470510
const signDocBytes = CosmosTxV1Beta1TxPb.SignDoc.toBinary(signDoc)
471511
const signature = await privateKey.sign(signDocBytes)
472512

513+
console.log('injective-ts - autosign - privateKey.sign response', signature)
514+
473515
const feePayerSigBytes = feePayerSig.startsWith('0x')
474516
? hexToUint8Array(feePayerSig.slice(2))
475517
: base64ToUint8Array(feePayerSig)
476518

477519
txRaw.signatures = [signature, feePayerSigBytes]
478520

521+
console.log('injective-ts - autosign - broadcast txRaw', txRaw)
522+
479523
return await this.broadcastTxRaw(txRaw)
480524
}
481525

packages/wallets/wallet-core/src/broadcaster/MsgBroadcaster.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,13 @@ export class MsgBroadcaster {
458458
WalletStrategyEmitterEventType.TransactionPreparationStart,
459459
)
460460

461+
console.log('injective-ts - doing signing', {
462+
txRaw,
463+
chainId,
464+
accountNumber,
465+
address: injectiveAddress,
466+
})
467+
461468
const directSignResponse = (await walletStrategy.signCosmosTransaction({
462469
txRaw,
463470
chainId,
@@ -469,6 +476,8 @@ export class MsgBroadcaster {
469476
WalletStrategyEmitterEventType.TransactionPreparationEnd,
470477
)
471478

479+
console.log('injective-ts - directSignResponse', directSignResponse)
480+
472481
const signedTxRaw = CosmosTxV1Beta1TxPb.TxRaw.create()
473482
signedTxRaw.bodyBytes = directSignResponse.signed.bodyBytes
474483
signedTxRaw.authInfoBytes = directSignResponse.signed.authInfoBytes
@@ -486,6 +495,8 @@ export class MsgBroadcaster {
486495
WalletStrategyEmitterEventType.TransactionBroadcastStart,
487496
)
488497

498+
console.log('injective-ts - endpoints.grpc', endpoints.grpc)
499+
489500
const txResponse = await new TxGrpcApi(endpoints.grpc).broadcast(
490501
signedTxRaw,
491502
{ txTimeout: txTimeoutInBlocks },

0 commit comments

Comments
 (0)