Skip to content

Commit

Permalink
toSendResult looks at platform
Browse files Browse the repository at this point in the history
  • Loading branch information
artursapek committed Jun 28, 2024
1 parent bb38562 commit 07fcd1e
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions wormhole-connect/src/routes/sdkv2/signer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,28 @@ export class SDKv2Signer<N extends Network, C extends Chain>
}

private toSendResult(tx: UnsignedTransaction<N, C>): SendResult {
let serialized = ethers6.Transaction.from({
to: tx.transaction.to,
data: tx.transaction.data,
}).unsignedSerialized;
let tx5: ethers5.Transaction = ethers5.utils.parseTransaction(serialized);
let unsignedTx: Deferrable<TransactionRequest> = {
to: tx5.to,
type: tx5.type as number,
chainId: tx5.chainId,
data: tx5.data,
};
return unsignedTx as SendResult;
const platform = chainToPlatform(tx.chain);

switch (platform) {
case 'Evm':
// TODO switch multi-provider to ethers 6
let serialized = ethers6.Transaction.from({
to: tx.transaction.to,
data: tx.transaction.data,
}).unsignedSerialized;
let tx5: ethers5.Transaction =
ethers5.utils.parseTransaction(serialized);
let unsignedTx: Deferrable<TransactionRequest> = {
to: tx5.to,
type: tx5.type as number,
chainId: tx5.chainId,
data: tx5.data,
};
return unsignedTx as SendResult;
default:
console.warn(`toSendResult is unimplemented for platform ${platform}`);
return tx as SendResult;
}
}

chain() {
Expand Down

0 comments on commit 07fcd1e

Please sign in to comment.