@glamsystems/glam-sdk 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +16 -6
- package/index.esm.js +16 -6
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -14647,7 +14647,9 @@ class DriftClient {
|
|
|
14647
14647
|
async fetchAndParseSpotMarkets(marketIndexes) {
|
|
14648
14648
|
const indexesToFetch = marketIndexes.filter((marketIndex)=>!this.spotMarkets.has(marketIndex));
|
|
14649
14649
|
if (indexesToFetch.length > 0) {
|
|
14650
|
-
|
|
14650
|
+
if (process.env.NODE_ENV === "development") {
|
|
14651
|
+
console.log("Fetching spot markets:", indexesToFetch);
|
|
14652
|
+
}
|
|
14651
14653
|
const marketPdas = indexesToFetch.map((marketIndex)=>this.getMarketPda(MarketType.SPOT, marketIndex));
|
|
14652
14654
|
const accounts = await this.base.provider.connection.getMultipleAccountsInfo(marketPdas);
|
|
14653
14655
|
accounts.forEach((account)=>{
|
|
@@ -14672,7 +14674,9 @@ class DriftClient {
|
|
|
14672
14674
|
async fetchAndParsePerpMarkets(marketIndexes) {
|
|
14673
14675
|
const indexesToFetch = marketIndexes.filter((marketIndex)=>!this.perpMarkets.has(marketIndex));
|
|
14674
14676
|
if (indexesToFetch.length > 0) {
|
|
14675
|
-
|
|
14677
|
+
if (process.env.NODE_ENV === "development") {
|
|
14678
|
+
console.log("Fetching perp markets:", indexesToFetch);
|
|
14679
|
+
}
|
|
14676
14680
|
const marketPdas = marketIndexes.map((marketIndex)=>this.getMarketPda(MarketType.PERP, marketIndex));
|
|
14677
14681
|
const accounts = await this.base.provider.connection.getMultipleAccountsInfo(marketPdas);
|
|
14678
14682
|
accounts.forEach((account)=>{
|
|
@@ -14682,7 +14686,9 @@ class DriftClient {
|
|
|
14682
14686
|
}
|
|
14683
14687
|
});
|
|
14684
14688
|
} else {
|
|
14685
|
-
|
|
14689
|
+
if (process.env.NODE_ENV === "development") {
|
|
14690
|
+
console.log("Requested perp markets already cached:", marketIndexes);
|
|
14691
|
+
}
|
|
14686
14692
|
}
|
|
14687
14693
|
return marketIndexes.map((marketIndex)=>this.perpMarkets.get(marketIndex)).filter((m)=>m);
|
|
14688
14694
|
}
|
|
@@ -14824,11 +14830,15 @@ class DriftClient {
|
|
|
14824
14830
|
}
|
|
14825
14831
|
const spotMarkets = await this.fetchAndParseSpotMarkets(spotMarketIndexes);
|
|
14826
14832
|
const perpMarkets = await this.fetchAndParsePerpMarkets(perpMarketIndexes);
|
|
14827
|
-
|
|
14833
|
+
if (process.env.NODE_ENV === "development") {
|
|
14834
|
+
console.log("[composeRemainingAccounts] perpMarkets:", perpMarkets);
|
|
14835
|
+
}
|
|
14828
14836
|
const oracles = spotMarkets.map((m)=>m.oracle).concat(perpMarkets.map((m)=>m.oracle));
|
|
14829
14837
|
const markets = spotMarkets.map((m)=>m.marketPda).concat(perpMarkets.map((m)=>m.marketPda));
|
|
14830
|
-
|
|
14831
|
-
|
|
14838
|
+
if (process.env.NODE_ENV === "development") {
|
|
14839
|
+
console.log("[composeRemainingAccounts] markets:", markets.map((m)=>m.toBase58()));
|
|
14840
|
+
console.log("[composeRemainingAccounts] oracles:", oracles.map((o)=>o.toBase58()));
|
|
14841
|
+
}
|
|
14832
14842
|
return oracles.map((o)=>({
|
|
14833
14843
|
pubkey: new web3_js.PublicKey(o),
|
|
14834
14844
|
isWritable: false,
|
package/index.esm.js
CHANGED
|
@@ -14626,7 +14626,9 @@ class DriftClient {
|
|
|
14626
14626
|
async fetchAndParseSpotMarkets(marketIndexes) {
|
|
14627
14627
|
const indexesToFetch = marketIndexes.filter((marketIndex)=>!this.spotMarkets.has(marketIndex));
|
|
14628
14628
|
if (indexesToFetch.length > 0) {
|
|
14629
|
-
|
|
14629
|
+
if (process.env.NODE_ENV === "development") {
|
|
14630
|
+
console.log("Fetching spot markets:", indexesToFetch);
|
|
14631
|
+
}
|
|
14630
14632
|
const marketPdas = indexesToFetch.map((marketIndex)=>this.getMarketPda(MarketType.SPOT, marketIndex));
|
|
14631
14633
|
const accounts = await this.base.provider.connection.getMultipleAccountsInfo(marketPdas);
|
|
14632
14634
|
accounts.forEach((account)=>{
|
|
@@ -14651,7 +14653,9 @@ class DriftClient {
|
|
|
14651
14653
|
async fetchAndParsePerpMarkets(marketIndexes) {
|
|
14652
14654
|
const indexesToFetch = marketIndexes.filter((marketIndex)=>!this.perpMarkets.has(marketIndex));
|
|
14653
14655
|
if (indexesToFetch.length > 0) {
|
|
14654
|
-
|
|
14656
|
+
if (process.env.NODE_ENV === "development") {
|
|
14657
|
+
console.log("Fetching perp markets:", indexesToFetch);
|
|
14658
|
+
}
|
|
14655
14659
|
const marketPdas = marketIndexes.map((marketIndex)=>this.getMarketPda(MarketType.PERP, marketIndex));
|
|
14656
14660
|
const accounts = await this.base.provider.connection.getMultipleAccountsInfo(marketPdas);
|
|
14657
14661
|
accounts.forEach((account)=>{
|
|
@@ -14661,7 +14665,9 @@ class DriftClient {
|
|
|
14661
14665
|
}
|
|
14662
14666
|
});
|
|
14663
14667
|
} else {
|
|
14664
|
-
|
|
14668
|
+
if (process.env.NODE_ENV === "development") {
|
|
14669
|
+
console.log("Requested perp markets already cached:", marketIndexes);
|
|
14670
|
+
}
|
|
14665
14671
|
}
|
|
14666
14672
|
return marketIndexes.map((marketIndex)=>this.perpMarkets.get(marketIndex)).filter((m)=>m);
|
|
14667
14673
|
}
|
|
@@ -14803,11 +14809,15 @@ class DriftClient {
|
|
|
14803
14809
|
}
|
|
14804
14810
|
const spotMarkets = await this.fetchAndParseSpotMarkets(spotMarketIndexes);
|
|
14805
14811
|
const perpMarkets = await this.fetchAndParsePerpMarkets(perpMarketIndexes);
|
|
14806
|
-
|
|
14812
|
+
if (process.env.NODE_ENV === "development") {
|
|
14813
|
+
console.log("[composeRemainingAccounts] perpMarkets:", perpMarkets);
|
|
14814
|
+
}
|
|
14807
14815
|
const oracles = spotMarkets.map((m)=>m.oracle).concat(perpMarkets.map((m)=>m.oracle));
|
|
14808
14816
|
const markets = spotMarkets.map((m)=>m.marketPda).concat(perpMarkets.map((m)=>m.marketPda));
|
|
14809
|
-
|
|
14810
|
-
|
|
14817
|
+
if (process.env.NODE_ENV === "development") {
|
|
14818
|
+
console.log("[composeRemainingAccounts] markets:", markets.map((m)=>m.toBase58()));
|
|
14819
|
+
console.log("[composeRemainingAccounts] oracles:", oracles.map((o)=>o.toBase58()));
|
|
14820
|
+
}
|
|
14811
14821
|
return oracles.map((o)=>({
|
|
14812
14822
|
pubkey: new PublicKey(o),
|
|
14813
14823
|
isWritable: false,
|