Skip to content

Commit

Permalink
master -> mainnet (#282)
Browse files Browse the repository at this point in the history
* send taker message that hashes before signing

* prettify

* Bumping sdk and jit dependencies to 2.98.0-beta.17 and 0.11.18

---------

Co-authored-by: Nour Alharithi <[email protected]>
Co-authored-by: GitHub Actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent e7ddf8b commit c0a4b76
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "lib/index.js",
"license": "Apache-2.0",
"dependencies": {
"@drift-labs/jit-proxy": "0.11.17",
"@drift-labs/sdk": "2.98.0-beta.16",
"@drift-labs/jit-proxy": "0.11.18",
"@drift-labs/sdk": "2.98.0-beta.17",
"@opentelemetry/api": "^1.1.0",
"@opentelemetry/auto-instrumentations-node": "^0.31.1",
"@opentelemetry/exporter-prometheus": "^0.31.0",
Expand Down
11 changes: 7 additions & 4 deletions src/experimental-bots/swift/takerExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class SwiftTaker {
Math.random() > 0.5 ? PositionDirection.LONG : PositionDirection.SHORT;
console.log('Sending order in slot:', slot, Date.now());
const oracleInfo = this.driftClient.getOracleDataForPerpMarket(0);
const orderMessage = this.driftClient.encodeSwiftOrderParamsMessage({
const orderMessage = {
swiftOrderParams: getMarketOrderParams({
marketIndex: 0,
marketType: MarketType.PERP,
Expand All @@ -47,15 +47,18 @@ export class SwiftTaker {
subAccountId: 0,
stopLossOrderParams: null,
takeProfitOrderParams: null,
});
};
const signature =
this.driftClient.signSwiftOrderParamsMessage(orderMessage);

const signature = this.driftClient.signMessage(orderMessage);
const response = await axios.default.post(
'https://master.swift.drift.trade/orders',
{
market_index: 0,
market_type: 'perp',
message: orderMessage.toString('base64'),
message: this.driftClient
.encodeSwiftOrderParamsMessage(orderMessage)
.toString('base64'),
signature: signature.toString('base64'),
taker_pubkey: this.driftClient.wallet.publicKey.toBase58(),
},
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -197,19 +197,19 @@
enabled "2.0.x"
kuler "^2.0.0"

"@drift-labs/[email protected].17":
version "0.11.17"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.11.17.tgz#664960671e151e2d01502965ba81e3438d36e8c3"
integrity sha512-82+vvLJ1H0v8XrBpAgeSd+9hChIXlJ/eCefxLOif5jOSM7DRFwTmPER9deF55FfdwdHtDKwmpiLIv7IvpOOOCg==
"@drift-labs/[email protected].18":
version "0.11.18"
resolved "https://registry.yarnpkg.com/@drift-labs/jit-proxy/-/jit-proxy-0.11.18.tgz#7500f61332d9243e96a2602646b400dcee580432"
integrity sha512-2zE1F9LiIuO1XZzngjl+NG5ZjeCWEtW1VgV37KGBZo0KusUhfDLfcRnmPf+lDoTrnIPrdJ7smwMJaEELnXpyWA==
dependencies:
"@coral-xyz/anchor" "^0.26.0"
"@drift-labs/sdk" "2.98.0-beta.16"
"@drift-labs/sdk" "2.98.0-beta.17"
"@solana/web3.js" "1.91.7"

"@drift-labs/[email protected].16":
version "2.98.0-beta.16"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.98.0-beta.16.tgz#9dc0bcfef98adb4dd22a28859db083e143f07c85"
integrity sha512-ErL1H057BvjaotsccvRRWiFuof0wVGp7QhmfDi0Tbz0fRRS+eVQ1aIFkCzEfIfRbuhhcC7/Dk3u8mJ89tmVkVw==
"@drift-labs/[email protected].17":
version "2.98.0-beta.17"
resolved "https://registry.yarnpkg.com/@drift-labs/sdk/-/sdk-2.98.0-beta.17.tgz#d0855ed6485190150fc93b6bd84d252521fef0f8"
integrity sha512-+6gOd1RARxN8z5PjHVih6JiVC0Z7JWPFmjsLOqtCfR3Ll96XEPEddM1VpuzLEuFykKdlP/uyshwSa5Oq/UpeSg==
dependencies:
"@coral-xyz/anchor" "0.28.0"
"@coral-xyz/anchor-30" "npm:@coral-xyz/[email protected]"
Expand Down

0 comments on commit c0a4b76

Please sign in to comment.