@streamflow/common 9.0.3 → 10.0.0-alpha.p313.3ce4d29

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.
@@ -25,7 +25,7 @@ type ComputeLimitEstimate = (tx: VersionedTransaction) => Promise<number>;
25
25
  * - should be only when building instructions via `prepare` methods, as tx executing methods will fail without a signer;
26
26
  * - currently supported only when claiming an Airdrop;
27
27
  */
28
- interface ITransactionSolanaExt {
28
+ interface ITransactionExt {
29
29
  computePrice?: number | ComputePriceEstimate;
30
30
  computeLimit?: number | ComputeLimitEstimate | "autoSimulate";
31
31
  feePayer?: PublicKey;
@@ -34,16 +34,16 @@ interface ITransactionSolanaExt {
34
34
  * Acceptable type with resolved values.
35
35
  * Function types may be omitted if passed to destinations that do not support them.
36
36
  */
37
- type ITransactionSolanaExtResolvedValues = {
37
+ type ITransactionExtResolvedValues = {
38
38
  computePrice?: number | ComputePriceEstimate;
39
39
  computeLimit?: number | ComputeLimitEstimate;
40
40
  feePayer?: PublicKey;
41
41
  };
42
42
  type KeysNotOfA<T, ToExclude> = Pick<T, Exclude<keyof T, keyof ToExclude>>;
43
- type ITransactionSolanaExtResolved<T extends ITransactionSolanaExt = ITransactionSolanaExt> = {
44
- [AK in keyof KeysNotOfA<T, ITransactionSolanaExt>]: T[AK];
45
- } & ITransactionSolanaExtResolvedValues;
46
- interface IInteractSolanaExt extends ITransactionSolanaExt {
43
+ type ITransactionExtResolved<T extends ITransactionExt = ITransactionExt> = {
44
+ [AK in keyof KeysNotOfA<T, ITransactionExt>]: T[AK];
45
+ } & ITransactionExtResolvedValues;
46
+ interface IInteractExt extends ITransactionExt {
47
47
  invoker: {
48
48
  publicKey: string | PublicKey | null;
49
49
  };
@@ -84,6 +84,29 @@ interface IProgramAccount<T> {
84
84
  declare class TransactionFailedError extends Error {
85
85
  constructor(m: string);
86
86
  }
87
+ interface ITransactionResult {
88
+ ixs: TransactionInstruction[];
89
+ txId: string;
90
+ }
91
+ declare enum ICluster {
92
+ Mainnet = "mainnet",
93
+ Devnet = "devnet",
94
+ Testnet = "testnet",
95
+ Local = "local"
96
+ }
97
+ /**
98
+ * Error wrapper for calls made to the contract on chain
99
+ */
100
+ declare class ContractError extends Error {
101
+ contractErrorCode: string | null;
102
+ description: string | null;
103
+ /**
104
+ * Constructs the Error Wrapper
105
+ * @param error Original error raised probably by the chain SDK
106
+ * @param code extracted code from the error if managed to parse it
107
+ */
108
+ constructor(error: Error, code?: string | null, description?: string | null);
109
+ }
87
110
 
88
111
  declare const buildSendThrottler: (sendRate: number, sendInterval?: number) => PQueue;
89
112
  /**
@@ -247,7 +270,7 @@ declare function checkOrCreateAtaBatch(connection: Connection, owners: PublicKey
247
270
  * - sets compute price if `computePrice` is provided. If `computePrice` is a function, it will be ignored (the value must be resolved before calling this function).
248
271
  * - sets compute limit if `computeLimit` is provided. If `computeLimit` is a function, it will be ignored (the value must be resolved before calling this function).
249
272
  */
250
- declare function prepareBaseInstructions(connection: Connection, { computePrice, computeLimit }: ITransactionSolanaExt): TransactionInstruction[];
273
+ declare function prepareBaseInstructions(connection: Connection, { computePrice, computeLimit }: ITransactionExt): TransactionInstruction[];
251
274
  /**
252
275
  * Retrieve information about a mint and its program ID, support all Token Programs.
253
276
  *
@@ -298,8 +321,8 @@ declare const resolveTransactionAccounts: (tx: VersionedTransaction | Transactio
298
321
 
299
322
  declare const createTestTransaction: (ixs: Parameters<typeof createVersionedTransaction>[0], payer: Parameters<typeof createVersionedTransaction>[1], recentBlockhash?: Parameters<typeof createVersionedTransaction>[2], partialSigners?: Parameters<typeof createVersionedTransaction>[3]) => _solana_web3_js.VersionedTransaction;
300
323
  declare function estimateComputeUnitPrice(estimate: ComputePriceEstimate, testTx: ReturnType<typeof createTestTransaction>): Promise<number>;
301
- declare function createAndEstimateTransaction<ParamsT extends ITransactionSolanaExtResolved<IInteractSolanaExt>, CreateFn extends (extParams: ParamsT) => Promise<TransactionInstruction[]>>(createFn: CreateFn, extParams: ParamsT): Promise<Awaited<ReturnType<CreateFn>>>;
302
- declare function createAndEstimateTransaction<ParamsT extends ITransactionSolanaExtResolved<IInteractSolanaExt>, CreateFn extends (extParams: ParamsT) => Promise<any>>(createFn: CreateFn, extParams: ParamsT, select: (result: Awaited<ReturnType<CreateFn>>) => TransactionInstruction[]): Promise<Awaited<ReturnType<CreateFn>>>;
324
+ declare function createAndEstimateTransaction<ParamsT extends ITransactionExtResolved<IInteractExt>, CreateFn extends (extParams: ParamsT) => Promise<TransactionInstruction[]>>(createFn: CreateFn, extParams: ParamsT): Promise<Awaited<ReturnType<CreateFn>>>;
325
+ declare function createAndEstimateTransaction<ParamsT extends ITransactionExtResolved<IInteractExt>, CreateFn extends (extParams: ParamsT) => Promise<any>>(createFn: CreateFn, extParams: ParamsT, select: (result: Awaited<ReturnType<CreateFn>>) => TransactionInstruction[]): Promise<Awaited<ReturnType<CreateFn>>>;
303
326
 
304
327
  /**
305
328
  * Converts a string or PublicKey to a PublicKey object.
@@ -308,10 +331,10 @@ declare function createAndEstimateTransaction<ParamsT extends ITransactionSolana
308
331
  */
309
332
  declare const pk: (address: string | PublicKey) => PublicKey;
310
333
 
311
- type UnwrapAutoSimulate<T extends IInteractSolanaExt = IInteractSolanaExt> = Omit<T, "computeLimit"> & {
334
+ type UnwrapAutoSimulate<T extends IInteractExt = IInteractExt> = Omit<T, "computeLimit"> & {
312
335
  skipSimulation: boolean;
313
- computeLimit?: ITransactionSolanaExtResolved["computeLimit"];
336
+ computeLimit?: ITransactionExtResolved["computeLimit"];
314
337
  };
315
- declare const unwrapExecutionParams: <T extends IInteractSolanaExt>({ computeLimit, ...rest }: T, connection: Connection) => UnwrapAutoSimulate<T>;
338
+ declare const unwrapExecutionParams: <T extends IInteractExt>({ computeLimit, ...rest }: T, connection: Connection) => UnwrapAutoSimulate<T>;
316
339
 
317
- export { type Account, type AtaParams, type CheckAssociatedTokenAccountsData, type ComputeLimitEstimate, type ComputePriceEstimate, type ConfirmationParams, type IInteractSolanaExt, type IProgramAccount, type ITransactionSolanaExt, type ITransactionSolanaExtResolved, type ThrottleParams, type TransactionExecutionParams, TransactionFailedError, ata, ataBatchExist, buildSendThrottler, checkOrCreateAtaBatch, confirmAndEnsureTransaction, createAndEstimateTransaction, createAtaBatch, createVersionedTransaction, deserializeRawTransaction, enrichAtaParams, estimateComputeUnitPrice, executeMultipleTransactions, executeTransaction, generateCreateAtaBatchTx, getFilters, getMintAndProgram, getMultipleAccountsInfoBatched, getProgramAccounts, isSignerKeypair, isSignerWallet, isTransactionVersioned, pk, prepareBaseInstructions, prepareTransaction, prepareWrappedAccount, resolveTransactionAccounts, sendAndConfirmTransaction, signAndExecuteTransaction, signTransaction, simulateTransaction, unwrapExecutionParams };
340
+ export { type Account, type AtaParams, type CheckAssociatedTokenAccountsData, type ComputeLimitEstimate, type ComputePriceEstimate, type ConfirmationParams, ContractError, ICluster, type IInteractExt, type IProgramAccount, type ITransactionExt, type ITransactionExtResolved, type ITransactionResult, type ThrottleParams, type TransactionExecutionParams, TransactionFailedError, ata, ataBatchExist, buildSendThrottler, checkOrCreateAtaBatch, confirmAndEnsureTransaction, createAndEstimateTransaction, createAtaBatch, createVersionedTransaction, deserializeRawTransaction, enrichAtaParams, estimateComputeUnitPrice, executeMultipleTransactions, executeTransaction, generateCreateAtaBatchTx, getFilters, getMintAndProgram, getMultipleAccountsInfoBatched, getProgramAccounts, isSignerKeypair, isSignerWallet, isTransactionVersioned, pk, prepareBaseInstructions, prepareTransaction, prepareWrappedAccount, resolveTransactionAccounts, sendAndConfirmTransaction, signAndExecuteTransaction, signTransaction, simulateTransaction, unwrapExecutionParams };
@@ -1,37 +1,10 @@
1
- import { TransactionInstruction, PublicKey } from '@solana/web3.js';
1
+ import { ICluster } from './solana/index.js';
2
+ export { Account, AtaParams, CheckAssociatedTokenAccountsData, ComputeLimitEstimate, ComputePriceEstimate, ConfirmationParams, ContractError, IInteractExt, IProgramAccount, ITransactionExt, ITransactionExtResolved, ITransactionResult, ThrottleParams, TransactionExecutionParams, TransactionFailedError, ata, ataBatchExist, buildSendThrottler, checkOrCreateAtaBatch, confirmAndEnsureTransaction, createAndEstimateTransaction, createAtaBatch, createVersionedTransaction, deserializeRawTransaction, enrichAtaParams, estimateComputeUnitPrice, executeMultipleTransactions, executeTransaction, generateCreateAtaBatchTx, getFilters, getMintAndProgram, getMultipleAccountsInfoBatched, getProgramAccounts, isSignerKeypair, isSignerWallet, isTransactionVersioned, pk, prepareBaseInstructions, prepareTransaction, prepareWrappedAccount, resolveTransactionAccounts, sendAndConfirmTransaction, signAndExecuteTransaction, signTransaction, simulateTransaction, unwrapExecutionParams } from './solana/index.js';
3
+ import { PublicKey } from '@solana/web3.js';
2
4
  import BN from 'bn.js';
3
-
4
- interface ITransactionResult {
5
- ixs: TransactionInstruction[];
6
- txId: string;
7
- }
8
- declare enum ICluster {
9
- Mainnet = "mainnet",
10
- Devnet = "devnet",
11
- Testnet = "testnet",
12
- Local = "local"
13
- }
14
- declare enum IChain {
15
- Solana = "Solana",
16
- Aptos = "Aptos",
17
- Ethereum = "Ethereum",
18
- BNB = "BNB",
19
- Polygon = "Polygon",
20
- Sui = "Sui"
21
- }
22
- /**
23
- * Error wrapper for calls made to the contract on chain
24
- */
25
- declare class ContractError extends Error {
26
- contractErrorCode: string | null;
27
- description: string | null;
28
- /**
29
- * Constructs the Error Wrapper
30
- * @param error Original error raised probably by the chain SDK
31
- * @param code extracted code from the error if managed to parse it
32
- */
33
- constructor(error: Error, code?: string | null, description?: string | null);
34
- }
5
+ import 'p-queue';
6
+ import '@solana/spl-token';
7
+ import '@solana/wallet-adapter-base';
35
8
 
36
9
  declare const invariant: (condition: any, message?: string | (() => string)) => asserts condition;
37
10
  declare function assertHasPublicKey<T extends {
@@ -86,4 +59,4 @@ interface FetchTokenPriceOptions {
86
59
  }
87
60
  declare const fetchTokenPrice: (mintId: string, cluster?: ICluster, options?: FetchTokenPriceOptions) => Promise<TokenPriceResult>;
88
61
 
89
- export { ContractError, type FetchTokenPriceOptions, IChain, ICluster, type ITransactionResult, type TokenPriceResult, type TokensPricesResponse, assertHasPublicKey, divCeilN, fetchTokenPrice, getBN, getNumberFromBN, handleContractError, invariant, multiplyBigIntByNumber, sleep };
62
+ export { type FetchTokenPriceOptions, ICluster, type TokenPriceResult, type TokensPricesResponse, assertHasPublicKey, divCeilN, fetchTokenPrice, getBN, getNumberFromBN, handleContractError, invariant, multiplyBigIntByNumber, sleep };