@fogo/sessions-sdk 0.1.3 → 0.1.4

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/cjs/connection.js CHANGED
@@ -1,4 +1,7 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.createSessionConnection = exports.TransactionResultType = void 0;
4
7
  const anchor_1 = require("@coral-xyz/anchor");
@@ -8,6 +11,7 @@ const compat_1 = require("@solana/compat");
8
11
  const kit_1 = require("@solana/kit");
9
12
  const spl_token_1 = require("@solana/spl-token");
10
13
  const web3_js_1 = require("@solana/web3.js");
14
+ const bn_js_1 = __importDefault(require("bn.js"));
11
15
  const zod_1 = require("zod");
12
16
  const mints_js_1 = require("./mints.js");
13
17
  const network_js_1 = require("./network.js");
@@ -142,7 +146,7 @@ const getDomainTollRecipientAddress = (domain) => {
142
146
  return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("toll_recipient"), Buffer.from([0]), hash], new web3_js_1.PublicKey(sessions_idls_1.TollboothIdl.address))[0];
143
147
  };
144
148
  const buildTollboothInstructionIfNeeded = async ({ sessionKeyAddress, walletPublicKey, domain, feeMint, feeAmount, }) => {
145
- if (feeAmount.gt(new anchor_1.BN(0)) && sessionKeyAddress !== undefined) {
149
+ if (feeAmount.gt(new bn_js_1.default(0)) && sessionKeyAddress !== undefined) {
146
150
  const userTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(feeMint, walletPublicKey);
147
151
  const recipient = getDomainTollRecipientAddress(domain);
148
152
  const instruction = await new sessions_idls_1.TollboothProgram(new anchor_1.AnchorProvider({}, {})).methods
@@ -219,14 +223,14 @@ const getFee = async (options, domain, variation, mint) => {
219
223
  url.searchParams.set("mint", mint.toBase58());
220
224
  const response = await fetch(url);
221
225
  if (response.status === 200) {
222
- return new anchor_1.BN(await response.text());
226
+ return new bn_js_1.default(await response.text());
223
227
  }
224
228
  else {
225
229
  throw new PaymasterResponseError(response.status, await response.text());
226
230
  }
227
231
  }
228
232
  else {
229
- return new anchor_1.BN(0);
233
+ return new bn_js_1.default(0);
230
234
  }
231
235
  };
232
236
  const getAddressLookupTable = async (connection, addressLookupTableCache, addressLookupTableAddress) => {
package/esm/connection.js CHANGED
@@ -1,10 +1,11 @@
1
- import { AnchorProvider, BN } from "@coral-xyz/anchor";
1
+ import { AnchorProvider } from "@coral-xyz/anchor";
2
2
  import { TollboothIdl, TollboothProgram } from "@fogo/sessions-idls";
3
3
  import { sha256 } from "@noble/hashes/sha2";
4
4
  import { fromLegacyKeypair, fromLegacyPublicKey, fromLegacyTransactionInstruction, fromVersionedTransaction, } from "@solana/compat";
5
5
  import { addSignersToTransactionMessage, appendTransactionMessageInstructions, compressTransactionMessageUsingAddressLookupTables, createSignerFromKeyPair, createSolanaRpc, createTransactionMessage, getAddressFromPublicKey, getBase64EncodedWireTransaction, partiallySignTransaction, partiallySignTransactionMessageWithSigners, pipe, setTransactionMessageFeePayer, setTransactionMessageLifetimeUsingBlockhash, } from "@solana/kit";
6
6
  import { getAssociatedTokenAddressSync } from "@solana/spl-token";
7
7
  import { Keypair, PublicKey, TransactionInstruction, VersionedTransaction, Connection as Web3Connection, } from "@solana/web3.js";
8
+ import BN from "bn.js";
8
9
  import { z } from "zod";
9
10
  import { USDC_MINT } from "./mints.js";
10
11
  import { Network } from "./network.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fogo/sessions-sdk",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "A set of utilities for integrating with Fogo sessions",
5
5
  "repository": {
6
6
  "type": "git",