@fogo/sessions-sdk 0.1.0 → 0.1.1

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/esm/index.js CHANGED
@@ -17,12 +17,16 @@ import { NTT } from "@wormhole-foundation/sdk-solana-ntt";
17
17
  import BN from "bn.js";
18
18
  import bs58 from "bs58";
19
19
  import { z } from "zod";
20
- import { Network, TransactionResultType } from "./connection.js";
20
+ import { TransactionResultType } from "./connection.js";
21
21
  import { SESSIONS_INTERNAL_PAYMASTER_DOMAIN } from "./context.js";
22
22
  import { importKey, signMessageWithKey, verifyMessageWithKey, } from "./crypto.js";
23
23
  import { createSessionUnwrapInstruction, createSessionWrapInstructions, createSystemProgramSessionWrapInstruction, } from "./instructions.js";
24
- export { createSessionConnection, Network, TransactionResultType, } from "./connection.js";
24
+ import { USDC_DECIMALS, USDC_MINT } from "./mints.js";
25
+ import { Network } from "./network.js";
26
+ export { createSessionConnection, TransactionResultType, } from "./connection.js";
25
27
  export { createSessionContext, } from "./context.js";
28
+ export { createSessionUnwrapInstruction, createSessionWrapInstructions, createSystemProgramSessionWrapInstruction, } from "./instructions.js";
29
+ export { Network } from "./network.js";
26
30
  const MESSAGE_HEADER = `Fogo Sessions:
27
31
  Signing this intent will allow this app to interact with your on-chain balances. Please make sure you trust this app and the domain in the message matches the domain of the current web application.
28
32
  `;
@@ -61,7 +65,7 @@ export const establishSession = async (options) => {
61
65
  }
62
66
  };
63
67
  const sendSessionEstablishTransaction = async (options, sessionKey, instructions, sessionEstablishmentLookupTable) => {
64
- const result = await options.context.sendTransaction(sessionKey, instructions, {
68
+ const result = await options.context.sendTransaction(sessionKey, instructions, options.walletPublicKey, {
65
69
  variation: "Session Establishment",
66
70
  addressLookupTable: sessionEstablishmentLookupTable ??
67
71
  SESSION_ESTABLISHMENT_LOOKUP_TABLE_ADDRESS[options.context.network],
@@ -91,7 +95,7 @@ export const revokeSession = async (options) => {
91
95
  session: options.session.sessionPublicKey,
92
96
  })
93
97
  .instruction();
94
- return options.context.sendTransaction(options.session.sessionKey, [instruction], {
98
+ return options.context.sendTransaction(options.session.sessionKey, [instruction], options.session.walletPublicKey, {
95
99
  variation: "Session Revocation",
96
100
  });
97
101
  }
@@ -121,7 +125,7 @@ const createSession = async (context, walletPublicKey, sessionKey) => {
121
125
  getSessionUnwrapInstructions: () => [
122
126
  createSessionUnwrapInstruction(sessionPublicKey, walletPublicKey),
123
127
  ],
124
- sendTransaction: (instructions, extraConfig) => context.sendTransaction(sessionKey, instructions, extraConfig),
128
+ sendTransaction: (instructions, extraConfig) => context.sendTransaction(sessionKey, instructions, walletPublicKey, extraConfig),
125
129
  sessionInfo,
126
130
  };
127
131
  };
@@ -487,11 +491,6 @@ const EstablishSessionResult = {
487
491
  error,
488
492
  }),
489
493
  };
490
- const USDC_MINT = {
491
- [Network.Mainnet]: "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
492
- [Network.Testnet]: "ELNbJ1RtERV2fjtuZjbTscDekWhVzkQ1LjmiPsxp5uND",
493
- };
494
- const USDC_DECIMALS = 6;
495
494
  export const getTransferFee = async (context) => {
496
495
  const { fee, ...config } = await getFee(context);
497
496
  return {
@@ -554,7 +553,7 @@ export const sendTransfer = async (options) => {
554
553
  symbol === undefined ? null : new PublicKey(metadataAddress),
555
554
  })
556
555
  .instruction(),
557
- ], {
556
+ ], options.walletPublicKey, {
558
557
  variation: "Intent Transfer",
559
558
  paymasterDomain: SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
560
559
  });
@@ -590,7 +589,7 @@ export const sendNativeTransfer = async (options) => {
590
589
  sponsor: options.context.internalPayer,
591
590
  })
592
591
  .instruction(),
593
- ], {
592
+ ], options.walletPublicKey, {
594
593
  variation: "Intent Transfer",
595
594
  paymasterDomain: SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
596
595
  });
@@ -653,7 +652,7 @@ export const bridgeOut = async (options) => {
653
652
  return options.context.sendTransaction(options.sessionKey, [
654
653
  ComputeBudgetProgram.setComputeUnitLimit({ units: BRIDGE_OUT_CUS }),
655
654
  ...instructions,
656
- ], {
655
+ ], options.walletPublicKey, {
657
656
  variation: "Intent NTT Bridge",
658
657
  paymasterDomain: SESSIONS_INTERNAL_PAYMASTER_DOMAIN,
659
658
  extraSigners: [outboxItem],
package/esm/mints.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export declare const USDC_MINT: {
2
+ 1: string;
3
+ 0: string;
4
+ };
5
+ export declare const USDC_DECIMALS = 6;
package/esm/mints.js ADDED
@@ -0,0 +1,6 @@
1
+ import { Network } from "./network.js";
2
+ export const USDC_MINT = {
3
+ [Network.Mainnet]: "uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG",
4
+ [Network.Testnet]: "ELNbJ1RtERV2fjtuZjbTscDekWhVzkQ1LjmiPsxp5uND",
5
+ };
6
+ export const USDC_DECIMALS = 6;
@@ -0,0 +1,4 @@
1
+ export declare enum Network {
2
+ Testnet = 0,
3
+ Mainnet = 1
4
+ }
package/esm/network.js ADDED
@@ -0,0 +1,5 @@
1
+ export var Network;
2
+ (function (Network) {
3
+ Network[Network["Testnet"] = 0] = "Testnet";
4
+ Network[Network["Mainnet"] = 1] = "Mainnet";
5
+ })(Network || (Network = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fogo/sessions-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A set of utilities for integrating with Fogo sessions",
5
5
  "repository": {
6
6
  "type": "git",