@glamsystems/glam-sdk 0.1.13 → 0.1.16

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 CHANGED
@@ -13149,7 +13149,7 @@ class BaseClient {
13149
13149
  console.log("Tx (base64):", tx.serialize({
13150
13150
  verifySignatures: false
13151
13151
  }).toString("base64"));
13152
- console.error("Simulation failed.");
13152
+ console.error("Simulation failed. If error message is too obscure, inspect the tx in explorer (https://explorer.solana.com/tx/inspector)");
13153
13153
  throw e;
13154
13154
  }
13155
13155
  }
@@ -15022,7 +15022,7 @@ class StateClient {
15022
15022
  }).transaction();
15023
15023
  const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
15024
15024
  const txSig = await this.base.sendAndConfirm(vTx);
15025
- const addMintTxs = await Promise.all((mints || []).map(async (mint, j)=>{
15025
+ await Promise.all((mints || []).map(async (mint, j)=>{
15026
15026
  const newMint = this.base.getMintPda(glamState, j);
15027
15027
  const tx = await this.base.program.methods.addMint(mint).accounts({
15028
15028
  glamState,
@@ -15033,14 +15033,15 @@ class StateClient {
15033
15033
  const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
15034
15034
  return await this.base.sendAndConfirm(vTx);
15035
15035
  }));
15036
- console.log("addMintTxs", addMintTxs);
15037
15036
  return [
15038
15037
  txSig,
15039
15038
  glamState
15040
15039
  ];
15041
15040
  }
15042
15041
  async updateState(glamState, updated, txOptions = {}) {
15043
- console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
15042
+ if (process.env.NODE_ENV === "development") {
15043
+ console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
15044
+ }
15044
15045
  const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
15045
15046
  return await this.base.sendAndConfirm(tx);
15046
15047
  }
@@ -15286,8 +15287,8 @@ class StateClient {
15286
15287
  class MintClient {
15287
15288
  // `getTokenAccounts` is a helius only RPC endpoint, we have to hardcode the URL here
15288
15289
  // We cannot use NEXT_PUBLIC_SOLANA_RPC because users may choose to use a non-helius RPC
15289
- async fetchTokenHolders(state) {
15290
- const mint = this.base.getMintPda(state, 0);
15290
+ async fetchTokenHolders(state, mintId = 0) {
15291
+ const mint = this.base.getMintPda(state, mintId);
15291
15292
  const response = await fetch(`https://${this.base.cluster}.helius-rpc.com/?api-key=${process.env.NEXT_PUBLIC_HELIUS_API_KEY}`, {
15292
15293
  method: "POST",
15293
15294
  headers: {
package/index.esm.js CHANGED
@@ -13128,7 +13128,7 @@ class BaseClient {
13128
13128
  console.log("Tx (base64):", tx.serialize({
13129
13129
  verifySignatures: false
13130
13130
  }).toString("base64"));
13131
- console.error("Simulation failed.");
13131
+ console.error("Simulation failed. If error message is too obscure, inspect the tx in explorer (https://explorer.solana.com/tx/inspector)");
13132
13132
  throw e;
13133
13133
  }
13134
13134
  }
@@ -15001,7 +15001,7 @@ class StateClient {
15001
15001
  }).transaction();
15002
15002
  const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
15003
15003
  const txSig = await this.base.sendAndConfirm(vTx);
15004
- const addMintTxs = await Promise.all((mints || []).map(async (mint, j)=>{
15004
+ await Promise.all((mints || []).map(async (mint, j)=>{
15005
15005
  const newMint = this.base.getMintPda(glamState, j);
15006
15006
  const tx = await this.base.program.methods.addMint(mint).accounts({
15007
15007
  glamState,
@@ -15012,14 +15012,15 @@ class StateClient {
15012
15012
  const vTx = await this.base.intoVersionedTransaction(tx, txOptions);
15013
15013
  return await this.base.sendAndConfirm(vTx);
15014
15014
  }));
15015
- console.log("addMintTxs", addMintTxs);
15016
15015
  return [
15017
15016
  txSig,
15018
15017
  glamState
15019
15018
  ];
15020
15019
  }
15021
15020
  async updateState(glamState, updated, txOptions = {}) {
15022
- console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
15021
+ if (process.env.NODE_ENV === "development") {
15022
+ console.log(`await glam.state.updateState("${glamState.toString()}", ${JSON.stringify(updated)}, ${JSON.stringify(txOptions)});`);
15023
+ }
15023
15024
  const tx = await this.updateStateTx(getPublicKey(glamState), updated, txOptions);
15024
15025
  return await this.base.sendAndConfirm(tx);
15025
15026
  }
@@ -15265,8 +15266,8 @@ class StateClient {
15265
15266
  class MintClient {
15266
15267
  // `getTokenAccounts` is a helius only RPC endpoint, we have to hardcode the URL here
15267
15268
  // We cannot use NEXT_PUBLIC_SOLANA_RPC because users may choose to use a non-helius RPC
15268
- async fetchTokenHolders(state) {
15269
- const mint = this.base.getMintPda(state, 0);
15269
+ async fetchTokenHolders(state, mintId = 0) {
15270
+ const mint = this.base.getMintPda(state, mintId);
15270
15271
  const response = await fetch(`https://${this.base.cluster}.helius-rpc.com/?api-key=${process.env.NEXT_PUBLIC_HELIUS_API_KEY}`, {
15271
15272
  method: "POST",
15272
15273
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glamsystems/glam-sdk",
3
- "version": "0.1.13",
3
+ "version": "0.1.16",
4
4
  "description": "TypeScript SDK for the GLAM Protocol",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
@@ -22,14 +22,14 @@
22
22
  "@coral-xyz/borsh": "^0.31.0",
23
23
  "@drift-labs/sdk": "2.118.0-beta.7",
24
24
  "@marinade.finance/marinade-ts-sdk": "^5.0.15",
25
- "@pythnetwork/client": "^2.21.1",
26
25
  "@solana/spl-stake-pool": "^1.1.5",
27
26
  "@solana/spl-token": "^0.4.9",
28
27
  "@solana/spl-token-metadata": "^0.1.4",
29
28
  "@solana/web3.js": "^1.98.0",
30
29
  "@meteora-ag/dlmm": "^1.4.11",
31
30
  "bs58": "^5.0.0",
32
- "buffer": "^6.0.3"
31
+ "buffer": "^6.0.3",
32
+ "@switchboard-xyz/common": "^3.0.0"
33
33
  },
34
34
  "engines": {
35
35
  "node": ">=20.18.0"
@@ -5,7 +5,7 @@ import { MintModel } from "../models";
5
5
  export declare class MintClient {
6
6
  readonly base: BaseClient;
7
7
  constructor(base: BaseClient);
8
- fetchTokenHolders(state: PublicKey): Promise<TokenAccount[]>;
8
+ fetchTokenHolders(state: PublicKey, mintId?: number): Promise<TokenAccount[]>;
9
9
  getHolders(state: PublicKey, mintId?: number): Promise<TokenAccount[]>;
10
10
  update(glamState: PublicKey, mintId: number, mintModel: Partial<MintModel>): Promise<string>;
11
11
  closeMintIx(glamState: PublicKey, mintId?: number): Promise<anchor.web3.TransactionInstruction>;