Skip to content

Commit 90c1d75

Browse files
authored
Merge pull request #264 from fireflyprotocol/andrew/http2-js
Enables HTTP2 by default for node.js
2 parents f8560e4 + e46f872 commit 90c1d75

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

ts/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
"prepare": "npm run build"
5252
},
5353
"types": "./dist/types/index.d.ts",
54-
"version": "1.11.0"
54+
"version": "1.11.1"
5555
}

ts/sdk/src/sdk.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ import {
4343
// RewardsDistributorInteractor for reward claiming
4444
import { RewardsDistributorInteractor } from '@firefly-exchange/library-sui/index';
4545
import { toHex } from '@mysten/bcs';
46+
import globalAxios from 'axios';
47+
48+
// Enable HTTP/2 in Node.js environments for better performance
49+
// Only enable for Node.js specifically (not Bun, Deno, or browsers)
50+
// Axios HTTP/2 support is toggled via httpVersion in the http adapter
51+
if (
52+
typeof process !== 'undefined' &&
53+
process.versions &&
54+
process.versions.node
55+
) {
56+
globalAxios.defaults.httpVersion = 2;
57+
}
4658

4759
interface EnvironmentConfig {
4860
[key: string]: {
@@ -492,8 +504,7 @@ export class BluefinProSdk {
492504

493505
// Throw the error to let the caller handle it
494506
throw new Error(
495-
`Token refresh failed: ${
496-
e instanceof Error ? e.message : 'Unknown error'
507+
`Token refresh failed: ${e instanceof Error ? e.message : 'Unknown error'
497508
}`,
498509
);
499510
}
@@ -797,8 +808,8 @@ export class BluefinProSdk {
797808
this.txBuilder?.depositToAssetBank(
798809
assetSymbol,
799810
accountAddress ||
800-
this.currentAccountAddress ||
801-
this.bfSigner.getAddress(),
811+
this.currentAccountAddress ||
812+
this.bfSigner.getAddress(),
802813
amountE9,
803814
splitCoin,
804815
{

0 commit comments

Comments
 (0)