@fogo/sessions-sdk 0.1.2 → 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/cjs/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type PublicKey, Connection as Web3Connection } from "@solana/web3.js";
1
+ import type { PublicKey, Connection as Web3Connection } from "@solana/web3.js";
2
2
  import type { Connection, SendTransactionOptions as SendTransactionBaseOptions, TransactionOrInstructions } from "./connection.js";
3
3
  export declare const SESSIONS_INTERNAL_PAYMASTER_DOMAIN = "sessions";
4
4
  export declare const createSessionContext: (options: {
package/cjs/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { TransactionError, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
- import { Connection, PublicKey } from "@solana/web3.js";
1
+ import type { Connection, TransactionError, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ import { PublicKey } from "@solana/web3.js";
3
3
  import type { Chain } from "@wormhole-foundation/sdk";
4
4
  import BN from "bn.js";
5
5
  import { z } from "zod";
@@ -1,4 +1,5 @@
1
- import { type PublicKey, TransactionInstruction } from "@solana/web3.js";
1
+ import type { PublicKey } from "@solana/web3.js";
2
+ import { TransactionInstruction } from "@solana/web3.js";
2
3
  /**
3
4
  * Creates the system program instruction `SessionWrap`, only available on Fogo, which allows a session key to transfer native token from its user's wallet to its user's wrapped token associated token account.
4
5
  * This instruction may be combined with the `CreateAssociatedTokenAccountIdempotent` and `SyncNative` instructions for a session to wrap tokens on behalf of its user.
package/esm/connection.js CHANGED
@@ -1,10 +1,11 @@
1
- import { AnchorProvider, BN, Wallet } 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/esm/context.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type PublicKey, Connection as Web3Connection } from "@solana/web3.js";
1
+ import type { PublicKey, Connection as Web3Connection } from "@solana/web3.js";
2
2
  import type { Connection, SendTransactionOptions as SendTransactionBaseOptions, TransactionOrInstructions } from "./connection.js";
3
3
  export declare const SESSIONS_INTERNAL_PAYMASTER_DOMAIN = "sessions";
4
4
  export declare const createSessionContext: (options: {
package/esm/context.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { AnchorProvider } from "@coral-xyz/anchor";
2
2
  import { ChainIdProgram } from "@fogo/sessions-idls";
3
- import { Keypair, Connection as Web3Connection, } from "@solana/web3.js";
3
+ import { Keypair } from "@solana/web3.js";
4
4
  // eslint-disable-next-line unicorn/no-typeof-undefined
5
5
  const IS_BROWSER = typeof globalThis.window !== "undefined";
6
6
  export const SESSIONS_INTERNAL_PAYMASTER_DOMAIN = "sessions";
package/esm/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { TransactionError, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
- import { Connection, PublicKey } from "@solana/web3.js";
1
+ import type { Connection, TransactionError, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ import { PublicKey } from "@solana/web3.js";
3
3
  import type { Chain } from "@wormhole-foundation/sdk";
4
4
  import BN from "bn.js";
5
5
  import { z } from "zod";
package/esm/index.js CHANGED
@@ -7,7 +7,7 @@ import { sha256 } from "@noble/hashes/sha2";
7
7
  import { fromLegacyPublicKey } from "@solana/compat";
8
8
  import { generateKeyPair, getAddressFromPublicKey, getProgramDerivedAddress, } from "@solana/kit";
9
9
  import { getAssociatedTokenAddressSync, getMint } from "@solana/spl-token";
10
- import { ComputeBudgetProgram, Connection, Ed25519Program, Keypair, PublicKey, } from "@solana/web3.js";
10
+ import { ComputeBudgetProgram, Ed25519Program, Keypair, PublicKey, } from "@solana/web3.js";
11
11
  import { routes, Wormhole, wormhole } from "@wormhole-foundation/sdk";
12
12
  import solanaSdk from "@wormhole-foundation/sdk/solana";
13
13
  import { contracts } from "@wormhole-foundation/sdk-base";
@@ -1,4 +1,5 @@
1
- import { type PublicKey, TransactionInstruction } from "@solana/web3.js";
1
+ import type { PublicKey } from "@solana/web3.js";
2
+ import { TransactionInstruction } from "@solana/web3.js";
2
3
  /**
3
4
  * Creates the system program instruction `SessionWrap`, only available on Fogo, which allows a session key to transfer native token from its user's wallet to its user's wrapped token associated token account.
4
5
  * This instruction may be combined with the `CreateAssociatedTokenAccountIdempotent` and `SyncNative` instructions for a session to wrap tokens on behalf of its user.
@@ -1,5 +1,5 @@
1
1
  import { createAssociatedTokenAccountIdempotentInstruction, createCloseAccountInstruction, createSyncNativeInstruction, getAssociatedTokenAddressSync, NATIVE_MINT, } from "@solana/spl-token";
2
- import { SystemProgram, TransactionInstruction, } from "@solana/web3.js";
2
+ import { SystemProgram, TransactionInstruction } from "@solana/web3.js";
3
3
  const SESSION_WRAP_DISCRIMINATOR = 4_000_000;
4
4
  function getNativeMintAssociatedTokenAddressSync(walletPublicKey) {
5
5
  return getAssociatedTokenAddressSync(NATIVE_MINT, walletPublicKey);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fogo/sessions-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A set of utilities for integrating with Fogo sessions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -49,6 +49,6 @@
49
49
  "bn.js": "^5.1.2",
50
50
  "bs58": "^6.0.0",
51
51
  "zod": "3.25.67",
52
- "@fogo/sessions-idls": "^0.1.1"
52
+ "@fogo/sessions-idls": "^0.1.2"
53
53
  }
54
54
  }