@xitadel-fi/sdk 0.2.5 → 0.2.13

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.
@@ -0,0 +1,38 @@
1
+ import { Connection, PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
2
+ import { SquadsContext, WalletMode } from './squads-wallet-modes';
3
+ import { SquadsProposalBundle } from './squads-wrap';
4
+ /**
5
+ * Options driving the submission strategy for an admin instruction.
6
+ *
7
+ * - eoa → caller assembles + signs a plain tx targeting xitadel.
8
+ * - squads → SDK wraps the instruction into a Squads proposal bundle.
9
+ * Caller is responsible for getting threshold approvals +
10
+ * submitting the bundle's three transactions.
11
+ */
12
+ export type AdminActionOpts = {
13
+ mode: 'eoa';
14
+ } | {
15
+ mode: 'squads';
16
+ squads: SquadsContext;
17
+ };
18
+ export interface AdminActionPlan {
19
+ mode: WalletMode;
20
+ /** Plain unsigned transaction for EOA mode. Undefined for Squads. */
21
+ eoaTx?: Transaction;
22
+ /** Squads proposal lifecycle bundle for Squads mode. Undefined for EOA. */
23
+ squads?: SquadsProposalBundle;
24
+ }
25
+ /**
26
+ * Produce the transaction(s) needed to perform `innerIx` under the chosen
27
+ * admin wallet mode. The function is purely transaction-building: callers
28
+ * are responsible for fetching blockhash, signing, sending, and waiting
29
+ * for confirmation. Keeps this SDK helper free of wallet-adapter coupling.
30
+ */
31
+ export declare function planAdminAction(innerIx: TransactionInstruction, opts: AdminActionOpts, connection: Connection): Promise<AdminActionPlan>;
32
+ /**
33
+ * Resolve the manager pubkey to embed as the signer slot inside the inner
34
+ * xitadel instruction. EOA mode uses the operator's wallet directly;
35
+ * Squads mode uses the derived vault PDA — Squads runs `invoke_signed`
36
+ * for it at execute time so Anchor's Signer<'info> accepts the same value.
37
+ */
38
+ export declare function resolveManagerSigner(opts: AdminActionOpts, operator: PublicKey): PublicKey;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.planAdminAction = planAdminAction;
4
+ exports.resolveManagerSigner = resolveManagerSigner;
5
+ const web3_js_1 = require("@solana/web3.js");
6
+ const squads_wallet_modes_1 = require("./squads-wallet-modes");
7
+ const squads_wrap_1 = require("./squads-wrap");
8
+ /**
9
+ * Produce the transaction(s) needed to perform `innerIx` under the chosen
10
+ * admin wallet mode. The function is purely transaction-building: callers
11
+ * are responsible for fetching blockhash, signing, sending, and waiting
12
+ * for confirmation. Keeps this SDK helper free of wallet-adapter coupling.
13
+ */
14
+ async function planAdminAction(innerIx, opts, connection) {
15
+ if (opts.mode === 'eoa') {
16
+ return {
17
+ mode: 'eoa',
18
+ eoaTx: new web3_js_1.Transaction().add(innerIx),
19
+ };
20
+ }
21
+ const bundle = await (0, squads_wrap_1.wrapWithSquads)(innerIx, opts.squads, connection);
22
+ return {
23
+ mode: 'squads',
24
+ squads: bundle,
25
+ };
26
+ }
27
+ /**
28
+ * Resolve the manager pubkey to embed as the signer slot inside the inner
29
+ * xitadel instruction. EOA mode uses the operator's wallet directly;
30
+ * Squads mode uses the derived vault PDA — Squads runs `invoke_signed`
31
+ * for it at execute time so Anchor's Signer<'info> accepts the same value.
32
+ */
33
+ function resolveManagerSigner(opts, operator) {
34
+ if (opts.mode === 'eoa')
35
+ return operator;
36
+ return (0, squads_wallet_modes_1.getSquadsVaultPda)(opts.squads);
37
+ }
@@ -22,17 +22,17 @@ exports.SEEDS = {
22
22
  };
23
23
  class XitadelProgram {
24
24
  constructor(provider, address) {
25
- if (process.env.NODE_ENV === 'development') {
26
- const workspace = require('@coral-xyz/anchor').workspace;
27
- this.program = workspace.Xitadel;
28
- }
29
- else {
30
- const idl = Object.assign(xitadel_json_1.default, {});
31
- if (address) {
32
- idl.address = address;
33
- }
34
- this.program = new anchor_1.Program(idl, provider);
25
+ // Always construct from bundled IDL + optional address override.
26
+ // The previous `NODE_ENV === 'development'` branch unconditionally
27
+ // pulled `anchor.workspace.Xitadel`, which silently ignored the
28
+ // caller-supplied `address` (e.g. NEXT_PUBLIC_PROGRAM_ID in `pnpm dev`).
29
+ // Workspace lookup is only meaningful inside `anchor test`, and tests
30
+ // can construct `Program` directly without this wrapper.
31
+ const idl = Object.assign(xitadel_json_1.default, {});
32
+ if (address) {
33
+ idl.address = address;
35
34
  }
35
+ this.program = new anchor_1.Program(idl, provider);
36
36
  }
37
37
  getProgramId() {
38
38
  return this.program.programId;
@@ -0,0 +1,21 @@
1
+ import { Connection, PublicKey, Transaction } from '@solana/web3.js';
2
+ export type ProposalStatusKind = 'Draft' | 'Active' | 'Approved' | 'Executing' | 'Executed' | 'Rejected' | 'Cancelled' | 'Unknown';
3
+ export interface ProposalState {
4
+ multisig: PublicKey;
5
+ proposalPda: PublicKey;
6
+ transactionIndex: bigint;
7
+ status: ProposalStatusKind;
8
+ approvedBy: PublicKey[];
9
+ rejectedBy: PublicKey[];
10
+ cancelledBy: PublicKey[];
11
+ /** Snapshot of multisig threshold at fetch time (caller may cache separately). */
12
+ threshold: number;
13
+ /** True once approvedBy.length >= threshold AND not yet executed. */
14
+ isExecutable: boolean;
15
+ }
16
+ /** Read on-chain Proposal + Multisig accounts; derive a flat status snapshot. */
17
+ export declare function fetchProposalState(multisigPda: PublicKey, transactionIndex: bigint, connection: Connection): Promise<ProposalState>;
18
+ /** Build a fresh approve tx for the given proposal — caller signs + sends. */
19
+ export declare function buildApproveTx(multisigPda: PublicKey, transactionIndex: bigint, member: PublicKey): Transaction;
20
+ /** Build an execute tx for an approved proposal — caller signs + sends. */
21
+ export declare function buildExecuteTx(multisigPda: PublicKey, transactionIndex: bigint, member: PublicKey, connection: Connection): Promise<Transaction>;
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.fetchProposalState = fetchProposalState;
37
+ exports.buildApproveTx = buildApproveTx;
38
+ exports.buildExecuteTx = buildExecuteTx;
39
+ const web3_js_1 = require("@solana/web3.js");
40
+ const multisig = __importStar(require("@sqds/multisig"));
41
+ /** Read on-chain Proposal + Multisig accounts; derive a flat status snapshot. */
42
+ async function fetchProposalState(multisigPda, transactionIndex, connection) {
43
+ const [proposalPda] = multisig.getProposalPda({
44
+ multisigPda,
45
+ transactionIndex,
46
+ });
47
+ const [proposal, multisigAccount] = await Promise.all([
48
+ multisig.accounts.Proposal.fromAccountAddress(connection, proposalPda),
49
+ multisig.accounts.Multisig.fromAccountAddress(connection, multisigPda),
50
+ ]);
51
+ const status = decodeStatus(proposal.status);
52
+ const approvedBy = proposal.approved;
53
+ const isExecutable = status === 'Approved' ||
54
+ (status === 'Active' && approvedBy.length >= multisigAccount.threshold);
55
+ return {
56
+ multisig: multisigPda,
57
+ proposalPda,
58
+ transactionIndex,
59
+ status,
60
+ approvedBy,
61
+ rejectedBy: proposal.rejected,
62
+ cancelledBy: proposal.cancelled,
63
+ threshold: multisigAccount.threshold,
64
+ isExecutable,
65
+ };
66
+ }
67
+ function decodeStatus(raw) {
68
+ if (!raw || typeof raw !== 'object')
69
+ return 'Unknown';
70
+ const key = Object.keys(raw)[0];
71
+ switch (key) {
72
+ case 'draft':
73
+ case 'Draft':
74
+ return 'Draft';
75
+ case 'active':
76
+ case 'Active':
77
+ return 'Active';
78
+ case 'approved':
79
+ case 'Approved':
80
+ return 'Approved';
81
+ case 'executing':
82
+ case 'Executing':
83
+ return 'Executing';
84
+ case 'executed':
85
+ case 'Executed':
86
+ return 'Executed';
87
+ case 'rejected':
88
+ case 'Rejected':
89
+ return 'Rejected';
90
+ case 'cancelled':
91
+ case 'Cancelled':
92
+ return 'Cancelled';
93
+ default:
94
+ return 'Unknown';
95
+ }
96
+ }
97
+ /** Build a fresh approve tx for the given proposal — caller signs + sends. */
98
+ function buildApproveTx(multisigPda, transactionIndex, member) {
99
+ const ix = multisig.instructions.proposalApprove({
100
+ multisigPda,
101
+ transactionIndex,
102
+ member,
103
+ });
104
+ return new web3_js_1.Transaction().add(ix);
105
+ }
106
+ /** Build an execute tx for an approved proposal — caller signs + sends. */
107
+ async function buildExecuteTx(multisigPda, transactionIndex, member, connection) {
108
+ const result = await multisig.instructions.vaultTransactionExecute({
109
+ connection,
110
+ multisigPda,
111
+ transactionIndex,
112
+ member,
113
+ });
114
+ return new web3_js_1.Transaction().add(result.instruction);
115
+ }
@@ -0,0 +1,46 @@
1
+ import { PublicKey } from '@solana/web3.js';
2
+ /**
3
+ * Admin wallet mode resolved at SDK/frontend layer.
4
+ *
5
+ * The xitadel program treats `Config.manager` as a single Pubkey and is
6
+ * mode-agnostic on-chain. This type lets callers select the correct
7
+ * transaction shape:
8
+ * - 'eoa' → submit instruction directly with manager as signer
9
+ * - 'squads' → wrap instruction as a Squads VaultTransaction proposal
10
+ */
11
+ export type WalletMode = 'eoa' | 'squads';
12
+ /**
13
+ * Squads V4 program ID — unified across devnet + mainnet.
14
+ * Re-exported from @sqds/multisig for caller convenience.
15
+ */
16
+ export declare const SQUADS_PROGRAM_ID: PublicKey;
17
+ /**
18
+ * The minimum information needed to identify a Squads vault PDA acting as
19
+ * xitadel admin. Both fields must be provided up-front by the operator
20
+ * (typically via app ENV) — vault PDAs are System-owned, so the SDK cannot
21
+ * infer them from on-chain state alone.
22
+ */
23
+ export interface SquadsBinding {
24
+ multisig: PublicKey;
25
+ vaultIndex: number;
26
+ }
27
+ /**
28
+ * Per-tx context bundling a binding with the wallet currently in use
29
+ * (a member of the multisig submitting / approving proposals).
30
+ */
31
+ export interface SquadsContext extends SquadsBinding {
32
+ proposer: PublicKey;
33
+ }
34
+ /**
35
+ * Derive the Squads vault PDA for a given binding. Thin wrapper around
36
+ * @sqds/multisig getVaultPda — aliased to avoid clashing with the existing
37
+ * SDK `getVaultPda` (Meteora pool vault).
38
+ */
39
+ export declare function getSquadsVaultPda(binding: SquadsBinding): PublicKey;
40
+ /**
41
+ * Confirm a given manager pubkey is actually the vault PDA of the
42
+ * supplied binding. Hard guard against silently routing admin actions
43
+ * through the wrong path — callers MUST check this before treating
44
+ * `Config.manager` as a Squads-managed authority.
45
+ */
46
+ export declare function verifySquadsBinding(manager: PublicKey, binding: SquadsBinding): boolean;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SQUADS_PROGRAM_ID = void 0;
37
+ exports.getSquadsVaultPda = getSquadsVaultPda;
38
+ exports.verifySquadsBinding = verifySquadsBinding;
39
+ const multisig = __importStar(require("@sqds/multisig"));
40
+ /**
41
+ * Squads V4 program ID — unified across devnet + mainnet.
42
+ * Re-exported from @sqds/multisig for caller convenience.
43
+ */
44
+ exports.SQUADS_PROGRAM_ID = multisig.PROGRAM_ID;
45
+ /**
46
+ * Derive the Squads vault PDA for a given binding. Thin wrapper around
47
+ * @sqds/multisig getVaultPda — aliased to avoid clashing with the existing
48
+ * SDK `getVaultPda` (Meteora pool vault).
49
+ */
50
+ function getSquadsVaultPda(binding) {
51
+ const [pda] = multisig.getVaultPda({
52
+ multisigPda: binding.multisig,
53
+ index: binding.vaultIndex,
54
+ });
55
+ return pda;
56
+ }
57
+ /**
58
+ * Confirm a given manager pubkey is actually the vault PDA of the
59
+ * supplied binding. Hard guard against silently routing admin actions
60
+ * through the wrong path — callers MUST check this before treating
61
+ * `Config.manager` as a Squads-managed authority.
62
+ */
63
+ function verifySquadsBinding(manager, binding) {
64
+ if (binding.vaultIndex < 0 || binding.vaultIndex > 255)
65
+ return false;
66
+ return getSquadsVaultPda(binding).equals(manager);
67
+ }
@@ -0,0 +1,40 @@
1
+ import { Connection, PublicKey, Transaction, TransactionInstruction } from '@solana/web3.js';
2
+ import { SquadsBinding, SquadsContext } from './squads-wallet-modes';
3
+ /**
4
+ * Bundle of the three Solana transactions required to push a single inner
5
+ * instruction through a Squads vault transaction lifecycle.
6
+ *
7
+ * 1. createTx — vaultTransactionCreate + proposalCreate (proposer signs)
8
+ * 2. approveTx — proposalApprove from the proposer (counts toward threshold)
9
+ * 3. executeTx — vaultTransactionExecute, callable once threshold met
10
+ *
11
+ * Callers submit createTx + approveTx immediately; remaining members
12
+ * approve separately; finally any member submits executeTx.
13
+ */
14
+ export interface SquadsProposalBundle {
15
+ multisig: PublicKey;
16
+ vaultPda: PublicKey;
17
+ transactionIndex: bigint;
18
+ proposalPda: PublicKey;
19
+ transactionPda: PublicKey;
20
+ createTx: Transaction;
21
+ approveTx: Transaction;
22
+ executeTx: Transaction;
23
+ }
24
+ /**
25
+ * Wrap a single xitadel instruction as a Squads VaultTransaction proposal.
26
+ *
27
+ * The inner instruction MUST list the vault PDA (derived from the binding)
28
+ * as the signer for any account that would normally be signed by
29
+ * `Config.manager`. Anchor's `Signer<'info>` constraint accepts the PDA
30
+ * identically once Squads runs `invoke_signed` at execute time.
31
+ *
32
+ * Throws if the binding does not match the on-chain vault PDA — defensive
33
+ * guard against silently routing admin actions through the wrong path.
34
+ */
35
+ export declare function wrapWithSquads(innerIx: TransactionInstruction, ctx: SquadsContext, connection: Connection): Promise<SquadsProposalBundle>;
36
+ /** Refetch the threshold + member count to render Squads(N/M) badges. */
37
+ export declare function fetchSquadsThreshold(binding: SquadsBinding, connection: Connection): Promise<{
38
+ threshold: number;
39
+ memberCount: number;
40
+ }>;
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.wrapWithSquads = wrapWithSquads;
37
+ exports.fetchSquadsThreshold = fetchSquadsThreshold;
38
+ const web3_js_1 = require("@solana/web3.js");
39
+ const multisig = __importStar(require("@sqds/multisig"));
40
+ const squads_wallet_modes_1 = require("./squads-wallet-modes");
41
+ /**
42
+ * Wrap a single xitadel instruction as a Squads VaultTransaction proposal.
43
+ *
44
+ * The inner instruction MUST list the vault PDA (derived from the binding)
45
+ * as the signer for any account that would normally be signed by
46
+ * `Config.manager`. Anchor's `Signer<'info>` constraint accepts the PDA
47
+ * identically once Squads runs `invoke_signed` at execute time.
48
+ *
49
+ * Throws if the binding does not match the on-chain vault PDA — defensive
50
+ * guard against silently routing admin actions through the wrong path.
51
+ */
52
+ async function wrapWithSquads(innerIx, ctx, connection) {
53
+ const vaultPda = (0, squads_wallet_modes_1.getSquadsVaultPda)(ctx);
54
+ if (!(0, squads_wallet_modes_1.verifySquadsBinding)(vaultPda, ctx)) {
55
+ throw new Error('Squads binding mismatch: derived vault PDA does not match the supplied multisig + vaultIndex');
56
+ }
57
+ // Read current transactionIndex; next proposal sits at + 1.
58
+ const multisigAccount = await multisig.accounts.Multisig.fromAccountAddress(connection, ctx.multisig);
59
+ const currentIndex = BigInt(multisigAccount.transactionIndex.toString());
60
+ const transactionIndex = currentIndex + 1n;
61
+ // Wrap inner ix into a v0 TransactionMessage with vault PDA as payer.
62
+ // recentBlockhash here is a placeholder consumed by Squads serializer;
63
+ // the on-chain execute step does not enforce it.
64
+ const transactionMessage = new web3_js_1.TransactionMessage({
65
+ payerKey: vaultPda,
66
+ recentBlockhash: web3_js_1.PublicKey.default.toBase58(),
67
+ instructions: [innerIx],
68
+ });
69
+ const createIx = multisig.instructions.vaultTransactionCreate({
70
+ multisigPda: ctx.multisig,
71
+ transactionIndex,
72
+ creator: ctx.proposer,
73
+ vaultIndex: ctx.vaultIndex,
74
+ ephemeralSigners: 0,
75
+ transactionMessage,
76
+ });
77
+ const proposalIx = multisig.instructions.proposalCreate({
78
+ multisigPda: ctx.multisig,
79
+ creator: ctx.proposer,
80
+ transactionIndex,
81
+ });
82
+ const approveIx = multisig.instructions.proposalApprove({
83
+ multisigPda: ctx.multisig,
84
+ transactionIndex,
85
+ member: ctx.proposer,
86
+ });
87
+ const executeResult = await multisig.instructions.vaultTransactionExecute({
88
+ connection,
89
+ multisigPda: ctx.multisig,
90
+ transactionIndex,
91
+ member: ctx.proposer,
92
+ });
93
+ const [transactionPda] = multisig.getTransactionPda({
94
+ multisigPda: ctx.multisig,
95
+ index: transactionIndex,
96
+ });
97
+ const [proposalPda] = multisig.getProposalPda({
98
+ multisigPda: ctx.multisig,
99
+ transactionIndex,
100
+ });
101
+ const createTx = new web3_js_1.Transaction().add(createIx, proposalIx);
102
+ const approveTx = new web3_js_1.Transaction().add(approveIx);
103
+ const executeTx = new web3_js_1.Transaction().add(executeResult.instruction);
104
+ return {
105
+ multisig: ctx.multisig,
106
+ vaultPda,
107
+ transactionIndex,
108
+ proposalPda,
109
+ transactionPda,
110
+ createTx,
111
+ approveTx,
112
+ executeTx,
113
+ };
114
+ }
115
+ /** Refetch the threshold + member count to render Squads(N/M) badges. */
116
+ async function fetchSquadsThreshold(binding, connection) {
117
+ const account = await multisig.accounts.Multisig.fromAccountAddress(connection, binding.multisig);
118
+ return {
119
+ threshold: account.threshold,
120
+ memberCount: account.members.length,
121
+ };
122
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@xitadel-fi/sdk",
4
- "version": "0.2.5",
4
+ "version": "0.2.13",
5
5
  "description": "SDK for interacting with the Xitadel program",
6
6
  "main": "dist/sdk/src/index.js",
7
7
  "types": "dist/sdk/src/index.d.ts",
@@ -13,8 +13,8 @@
13
13
  "url": "git+https://github.com/xitadel-fi/xitadel-svm.git"
14
14
  },
15
15
  "publishConfig": {
16
- "registry": "https://registry.npmjs.org/",
17
- "access": "public"
16
+ "registry": "https://npm.pkg.github.com/",
17
+ "access": "restricted"
18
18
  },
19
19
  "scripts": {
20
20
  "build": "tsc",