Skip to content

Commit

Permalink
Fix swift taker example
Browse files Browse the repository at this point in the history
  • Loading branch information
jordy25519 committed Jan 8, 2025
1 parent e9cb6f3 commit 602aed5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/experimental-bots/swift/takerExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ export class SwiftTaker {
stopLossOrderParams: null,
takeProfitOrderParams: null,
};
const signature =
this.driftClient.signSwiftOrderParamsMessage(orderMessage);
const encodedSwiftMessage =
this.driftClient.encodeSwiftOrderParamsMessage(orderMessage);
const signature = this.driftClient.signMessage(
Buffer.from(encodedSwiftMessage.toString('hex'))
);

const hash = digestSignature(Uint8Array.from(signature));
console.log(
Expand All @@ -84,9 +87,7 @@ export class SwiftTaker {
{
market_index: marketIndex,
market_type: 'perp',
message: this.driftClient
.encodeSwiftOrderParamsMessage(orderMessage)
.toString('base64'),
message: encodedSwiftMessage.toString('base64'),
signature: signature.toString('base64'),
taker_pubkey: this.driftClient.wallet.publicKey.toBase58(),
},
Expand Down

0 comments on commit 602aed5

Please sign in to comment.