@streamflow/launchpad 7.5.3-alpha.p284.a97c5d6 → 7.5.3

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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.deriveVaultPDA = exports.deriveDepositPDA = exports.deriveLaunchpadPDA = void 0;
7
+ const web3_js_1 = require("@solana/web3.js");
8
+ // eslint-disable-next-line no-restricted-imports
9
+ const bn_js_1 = __importDefault(require("bn.js"));
10
+ const constants_js_1 = require("../constants.js");
11
+ const deriveLaunchpadPDA = (programId, baseMint, nonce) => {
12
+ return web3_js_1.PublicKey.findProgramAddressSync([constants_js_1.LAUNCHPAD_PREFIX, baseMint.toBuffer(), new bn_js_1.default(nonce).toArrayLike(Buffer, "le", 1)], programId)[0];
13
+ };
14
+ exports.deriveLaunchpadPDA = deriveLaunchpadPDA;
15
+ const deriveDepositPDA = (programId, launchpad, owner) => {
16
+ return web3_js_1.PublicKey.findProgramAddressSync([constants_js_1.DEPOSIT_PREFIX, launchpad.toBuffer(), owner.toBuffer()], programId)[0];
17
+ };
18
+ exports.deriveDepositPDA = deriveDepositPDA;
19
+ const deriveVaultPDA = (programId, launchpad) => {
20
+ return web3_js_1.PublicKey.findProgramAddressSync([constants_js_1.VAULT_PREFIX, launchpad.toBuffer()], programId)[0];
21
+ };
22
+ exports.deriveVaultPDA = deriveVaultPDA;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,148 +1,4 @@
1
- import { IdlAccounts, Address, Program, ProgramAccount } from '@coral-xyz/anchor';
2
- import { Keypair, Connection, Commitment, ConnectionConfig, PublicKey, TransactionInstruction } from '@solana/web3.js';
3
- import { ICluster, ITransactionResult } from '@streamflow/common';
4
- import PQueue from 'p-queue';
5
- import { StreamflowLaunchpad } from './solana/descriptor/streamflow_launchpad.js';
6
- import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
7
- import { ITransactionSolanaExt } from '@streamflow/common/solana';
8
- import { OracleTypeName } from '@streamflow/stream';
9
- import BN from 'bn.js';
10
-
11
- declare const LAUNCHPAD_PREFIX: Buffer;
12
- declare const VAULT_PREFIX: Buffer;
13
- declare const DEPOSIT_PREFIX: Buffer;
14
- declare const ANCHOR_DISCRIMINATOR_OFFSET = 8;
15
- declare const LAUNCHPAD_BASE_MINT_OFFSET: number;
16
- declare const LAUNCHPAD_QUOTE_MINT_OFFSET: number;
17
- declare const LAUNCHPAD_BYTE_OFFSETS: {
18
- readonly baseMint: number;
19
- readonly quoteMint: number;
20
- };
21
- declare const PROGRAM_ID: Record<ICluster, string>;
22
-
23
- declare const constants_ANCHOR_DISCRIMINATOR_OFFSET: typeof ANCHOR_DISCRIMINATOR_OFFSET;
24
- declare const constants_DEPOSIT_PREFIX: typeof DEPOSIT_PREFIX;
25
- declare const constants_LAUNCHPAD_BASE_MINT_OFFSET: typeof LAUNCHPAD_BASE_MINT_OFFSET;
26
- declare const constants_LAUNCHPAD_BYTE_OFFSETS: typeof LAUNCHPAD_BYTE_OFFSETS;
27
- declare const constants_LAUNCHPAD_PREFIX: typeof LAUNCHPAD_PREFIX;
28
- declare const constants_LAUNCHPAD_QUOTE_MINT_OFFSET: typeof LAUNCHPAD_QUOTE_MINT_OFFSET;
29
- declare const constants_PROGRAM_ID: typeof PROGRAM_ID;
30
- declare const constants_VAULT_PREFIX: typeof VAULT_PREFIX;
31
- declare namespace constants {
32
- export { constants_ANCHOR_DISCRIMINATOR_OFFSET as ANCHOR_DISCRIMINATOR_OFFSET, constants_DEPOSIT_PREFIX as DEPOSIT_PREFIX, constants_LAUNCHPAD_BASE_MINT_OFFSET as LAUNCHPAD_BASE_MINT_OFFSET, constants_LAUNCHPAD_BYTE_OFFSETS as LAUNCHPAD_BYTE_OFFSETS, constants_LAUNCHPAD_PREFIX as LAUNCHPAD_PREFIX, constants_LAUNCHPAD_QUOTE_MINT_OFFSET as LAUNCHPAD_QUOTE_MINT_OFFSET, constants_PROGRAM_ID as PROGRAM_ID, constants_VAULT_PREFIX as VAULT_PREFIX };
33
- }
34
-
35
- type Launchpad = IdlAccounts<StreamflowLaunchpad>["launchpad"];
36
- type DepositAccount = IdlAccounts<StreamflowLaunchpad>["depositAccount"];
37
- interface IInteractSolanaExt extends ITransactionSolanaExt {
38
- invoker: SignerWalletAdapter | Keypair;
39
- }
40
- interface ILaunchpad {
41
- launchpad: Address;
42
- baseMint?: Address;
43
- quoteMint?: Address;
44
- }
45
- interface IOwner {
46
- owner?: Address;
47
- }
48
- interface ITokenProgram {
49
- tokenProgramId?: Address;
50
- }
51
- interface ICreateLaunchpad extends ITokenProgram {
52
- baseMint: Address;
53
- quoteMint: Address;
54
- receiver?: Address;
55
- priceOracle?: Address;
56
- nonce: number;
57
- price: BN;
58
- individualDepositingCap: BN;
59
- maxDepositingCap: BN;
60
- depositingStartTs: number | BN;
61
- depositingEndTs: number | BN;
62
- vestingStartTs: number | BN;
63
- vestingEndTs: number | BN;
64
- vestingPeriod: number | BN;
65
- oracleType?: OracleTypeName;
66
- minPrice: number;
67
- maxPrice: number;
68
- minPercentage: number;
69
- maxPercentage: number;
70
- tickSize: number;
71
- skipInitial: boolean;
72
- isMemoRequired: boolean;
73
- }
74
- interface IFundLaunchpad extends ILaunchpad, ITokenProgram {
75
- amount: BN;
76
- }
77
- interface IDeposit extends ILaunchpad, IOwner, ITokenProgram {
78
- amount: BN;
79
- autoCap?: boolean;
80
- memo?: string;
81
- }
82
- interface IClaimDeposits extends ILaunchpad, ITokenProgram {
83
- }
84
- interface IClaimAllocatedVested extends ILaunchpad, IOwner, ITokenProgram {
85
- }
86
- interface IClaimAllocatedInstant extends ILaunchpad, IOwner, ITokenProgram {
87
- }
88
-
89
- interface IInitOptions {
90
- clusterUrl?: string;
91
- cluster?: ICluster;
92
- commitment?: Commitment | ConnectionConfig;
93
- programIds?: {
94
- launchpad?: string;
95
- vesting?: string;
96
- dynamicVesting?: string;
97
- };
98
- sendRate?: number;
99
- sendThrottler?: PQueue;
100
- }
101
- type CreationResult = ITransactionResult & {
102
- metadataId: PublicKey;
103
- };
104
- declare class SolanaLaunchpadClient {
105
- connection: Connection;
106
- cluster: ICluster;
107
- private readonly commitment;
108
- private readonly sendThrottler;
109
- private readonly dynamicVestingId;
110
- private readonly vestingId;
111
- readonly program: Program<StreamflowLaunchpad>;
112
- constructor({ clusterUrl, cluster, commitment, programIds, sendRate, sendThrottler, }: IInitOptions);
113
- getCurrentProgramId(): PublicKey;
114
- getCommitment(): Commitment | undefined;
115
- getLaunchpad(id: Address): Promise<Launchpad>;
116
- searchLaunchpads(criteria?: Partial<Pick<Launchpad, keyof typeof LAUNCHPAD_BYTE_OFFSETS>>): Promise<ProgramAccount<Launchpad>[]>;
117
- getDepositAccount(id: Address): Promise<DepositAccount>;
118
- createLaunchpad(data: ICreateLaunchpad, extParams: IInteractSolanaExt): Promise<CreationResult>;
119
- prepareCreateLaunchpadInstructions({ baseMint: baseMintKey, quoteMint: quoteMintKey, receiver, priceOracle, nonce, price, individualDepositingCap, maxDepositingCap, depositingStartTs, depositingEndTs, vestingStartTs, vestingEndTs, vestingPeriod, oracleType, minPrice, maxPrice, minPercentage, maxPercentage, tickSize, skipInitial, isMemoRequired, tokenProgramId, }: ICreateLaunchpad, extParams: IInteractSolanaExt): Promise<{
120
- ixs: TransactionInstruction[];
121
- publicKey: PublicKey;
122
- }>;
123
- fundLaunchpad(data: IFundLaunchpad, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
124
- prepareFundLaunchpadInstructions({ launchpad: launchpadKey, amount, baseMint: baseMintKey, tokenProgramId }: IFundLaunchpad, extParams: IInteractSolanaExt): Promise<{
125
- ixs: TransactionInstruction[];
126
- }>;
127
- deposit(data: IDeposit, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
128
- prepareDepositInstructions({ launchpad: launchpadKey, quoteMint: quoteMintKey, amount, autoCap, memo, owner, tokenProgramId, }: IDeposit, extParams: IInteractSolanaExt): Promise<{
129
- ixs: TransactionInstruction[];
130
- publicKey: PublicKey;
131
- }>;
132
- claimDeposits(data: IClaimDeposits, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
133
- prepareClaimDepositsInstructions({ launchpad: launchpadKey, tokenProgramId }: IClaimDeposits, extParams: IInteractSolanaExt): Promise<{
134
- ixs: TransactionInstruction[];
135
- }>;
136
- claimAllocatedVested(data: IClaimAllocatedVested, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
137
- prepareClaimAllocatedVestedInstructions({ launchpad: launchpadKey, baseMint: baseMintKey, owner, tokenProgramId }: IClaimAllocatedVested, extParams: IInteractSolanaExt): Promise<{
138
- ixs: TransactionInstruction[];
139
- streamKeypair: Keypair;
140
- }>;
141
- private execute;
142
- }
143
-
144
- declare const deriveLaunchpadPDA: (programId: PublicKey, baseMint: PublicKey, nonce: number) => PublicKey;
145
- declare const deriveDepositPDA: (programId: PublicKey, launchpad: PublicKey, owner: PublicKey) => PublicKey;
146
- declare const deriveVaultPDA: (programId: PublicKey, launchpad: PublicKey) => PublicKey;
147
-
148
- export { type DepositAccount, type IClaimAllocatedInstant, type IClaimAllocatedVested, type IClaimDeposits, type ICreateLaunchpad, type IDeposit, type IFundLaunchpad, type IInteractSolanaExt, type Launchpad, SolanaLaunchpadClient, constants, deriveDepositPDA, deriveLaunchpadPDA, deriveVaultPDA };
1
+ export { SolanaLaunchpadClient } from "./solana/client.js";
2
+ export * from "./solana/types.js";
3
+ export * from "./solana/lib/derive-accounts.js";
4
+ export * as constants from "./solana/constants.js";