@streamflow/distributor 11.0.0-alpha.p334.45cbb4e → 11.0.0-alpha.p334.7c3dbf7
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/dist/cjs/index.cjs +8 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/solana/index.cjs +8 -2
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +12 -17
- package/dist/esm/index.js +8 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +12 -17
- package/dist/esm/solana/index.js +8 -2
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Keypair, PublicKey, Connection, Commitment, ConnectionConfig, TransactionInstruction } from '@solana/web3.js';
|
|
2
2
|
import { SignerWalletAdapter } from '@solana/wallet-adapter-base';
|
|
3
|
-
import { ITransactionExt, ITransactionResult, PartnerOracleTypes, PartnerOracle, ICluster, ITransactionExtResolved, IProgramAccount, unwrapExecutionParams, signAndExecuteTransaction } from '@streamflow/common';
|
|
3
|
+
import { IdlAccountsOfMethod, ITransactionExt, ITransactionResult, PartnerOracleTypes, IdlArgsOfMethod, IdlInstruction, PartnerOracle, ICluster, ITransactionExtResolved, IProgramAccount, unwrapExecutionParams, signAndExecuteTransaction } from '@streamflow/common';
|
|
4
4
|
import BN from 'bn.js';
|
|
5
|
-
import {
|
|
5
|
+
import { IdlTypes, IdlAccounts, Program } from '@coral-xyz/anchor';
|
|
6
6
|
import { AlignedDistributor } from './descriptor/aligned_distributor.cjs';
|
|
7
7
|
import { MerkleDistributor as MerkleDistributor$1 } from './descriptor/merkle_distributor.cjs';
|
|
8
8
|
import PQueue from 'p-queue';
|
|
@@ -25,19 +25,14 @@ type CompressedClaimStatus = MerkleDistributorAccountTypes["compressedClaimStatu
|
|
|
25
25
|
* @inline
|
|
26
26
|
*/
|
|
27
27
|
type MerkleDistributor = MerkleDistributorAccountTypes["merkleDistributor"];
|
|
28
|
-
type
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
type AccountsOfMethod<M extends keyof Program<MerkleDistributor$1>["methods"]> = Parameters<ReturnType<Program<MerkleDistributor$1>["methods"][M]>["accounts"]>[0];
|
|
32
|
-
type ArgsOfMethod<M extends keyof Program<MerkleDistributor$1>["methods"]> = Parameters<Program<MerkleDistributor$1>["methods"][M]>;
|
|
33
|
-
type NewDistributorAccounts = AccountsOfMethod<"newDistributor">;
|
|
34
|
-
type NewDistributorArgs = ArgsOfMethod<"newDistributor">;
|
|
35
|
-
type NewClaimAccounts = AccountsOfMethod<"newClaim">;
|
|
28
|
+
type NewDistributorAccounts = IdlAccountsOfMethod<MerkleDistributor$1, "newDistributor">;
|
|
29
|
+
type NewDistributorArgs = IdlArgsOfMethod<MerkleDistributor$1, "newDistributor">;
|
|
30
|
+
type NewClaimAccounts = IdlAccountsOfMethod<MerkleDistributor$1, "newClaim">;
|
|
36
31
|
type NewClaimArgs = IdlInstruction<MerkleDistributor$1, "newClaim">["args"];
|
|
37
|
-
type ClaimLockedV2Accounts =
|
|
38
|
-
type ClaimLockedAccounts =
|
|
39
|
-
type ClawbackAccounts =
|
|
40
|
-
type CloseClaimAccounts =
|
|
32
|
+
type ClaimLockedV2Accounts = IdlAccountsOfMethod<MerkleDistributor$1, "claimLockedV2">;
|
|
33
|
+
type ClaimLockedAccounts = IdlAccountsOfMethod<MerkleDistributor$1, "claimLocked">;
|
|
34
|
+
type ClawbackAccounts = IdlAccountsOfMethod<MerkleDistributor$1, "clawback">;
|
|
35
|
+
type CloseClaimAccounts = IdlAccountsOfMethod<MerkleDistributor$1, "closeClaim">;
|
|
41
36
|
type CloseClaimArgs = IdlInstruction<MerkleDistributor$1, "closeClaim">["args"];
|
|
42
37
|
/**
|
|
43
38
|
* @type
|
|
@@ -322,7 +317,7 @@ declare abstract class BaseDistributorClient {
|
|
|
322
317
|
protected apiUrl: string;
|
|
323
318
|
protected apiKey?: string;
|
|
324
319
|
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, apiUrl, apiKey, }: IInitOptions);
|
|
325
|
-
protected abstract getNewDistributorInstruction(data: ICreateDistributorData | ICreateAlignedDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
320
|
+
protected abstract getNewDistributorInstruction(data: ICreateDistributorData | ICreateAlignedDistributorData, accounts: Required<NewDistributorAccounts>): Promise<TransactionInstruction>;
|
|
326
321
|
protected abstract getClawbackInstruction(account: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
327
322
|
getConnection(): Connection;
|
|
328
323
|
getCommitment(): Commitment | undefined;
|
|
@@ -379,7 +374,7 @@ declare abstract class BaseDistributorClient {
|
|
|
379
374
|
}
|
|
380
375
|
|
|
381
376
|
declare class SolanaDistributorClient extends BaseDistributorClient {
|
|
382
|
-
protected getNewDistributorInstruction(data: ICreateDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
377
|
+
protected getNewDistributorInstruction(data: ICreateDistributorData, accounts: Required<NewDistributorAccounts>): Promise<TransactionInstruction>;
|
|
383
378
|
protected getClawbackInstruction(accounts: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
384
379
|
}
|
|
385
380
|
|
|
@@ -389,7 +384,7 @@ declare class SolanaAlignedDistributorClient extends BaseDistributorClient {
|
|
|
389
384
|
getAlignedDistributorProgramId(): PublicKey;
|
|
390
385
|
getAlignedDistributorAddress(distributorAddress: string): PublicKey;
|
|
391
386
|
getAlignedDistributorData(distributorAddress: string): Promise<AlignedDistributorData>;
|
|
392
|
-
protected getNewDistributorInstruction(data: ICreateAlignedDistributorData, accounts: NewDistributorAccounts): Promise<TransactionInstruction>;
|
|
387
|
+
protected getNewDistributorInstruction(data: ICreateAlignedDistributorData, accounts: Required<NewDistributorAccounts>): Promise<TransactionInstruction>;
|
|
393
388
|
protected getClawbackInstruction(accounts: ClawbackAccounts): Promise<TransactionInstruction>;
|
|
394
389
|
protected getNewAlignedDistributorArgs(data: ICreateAlignedDistributorData): NewAlignedDistributorArgs;
|
|
395
390
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PublicKey, Connection, SystemProgram } from '@solana/web3.js';
|
|
2
2
|
import BN from 'bn.js';
|
|
3
3
|
import '@solana/wallet-adapter-base';
|
|
4
|
-
import { ICluster, multiplyBigIntByNumber, fetchTokenPrice, signAndExecuteTransaction, ContractError, divCeilN, invariant, getNumberFromBN, pk, getBN, buildPartnerOracle, buildSendThrottler, prepareBaseInstructions, getMintAndProgram, ata, prepareWrappedAccount, createAndEstimateTransaction, prepareTransaction, checkOrCreateAtaBatch, unwrapExecutionParams } from '@streamflow/common';
|
|
5
4
|
import { parseIdlErrors, translateError, Program } from '@coral-xyz/anchor';
|
|
6
5
|
import { NATIVE_MINT, getAssociatedTokenAddressSync, getTransferFeeConfig, createTransferCheckedWithFeeInstruction, createTransferCheckedInstruction } from '@solana/spl-token';
|
|
6
|
+
import { ICluster, multiplyBigIntByNumber, fetchTokenPrice, signAndExecuteTransaction, ContractError, divCeilN, invariant, getNumberFromBN, pk, getBN, buildPartnerOracle, buildSendThrottler, prepareBaseInstructions, getMintAndProgram, ata, prepareWrappedAccount, createAndEstimateTransaction, prepareTransaction, checkOrCreateAtaBatch, unwrapExecutionParams } from '@streamflow/common';
|
|
7
7
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
8
8
|
|
|
9
9
|
var __defProp = Object.defineProperty;
|
|
@@ -4797,7 +4797,13 @@ var BaseDistributorClient = class {
|
|
|
4797
4797
|
async getFees(pubkey) {
|
|
4798
4798
|
const feeConfig = await this.getFeeConfig();
|
|
4799
4799
|
const nowTs = new BN(Math.trunc(Date.now() / 1e3));
|
|
4800
|
-
|
|
4800
|
+
const filteredPartners = feeConfig.partners.filter(
|
|
4801
|
+
(partner) => partner.pubkey.equals(pubkey) && (partner.expiryTs.eqn(0) || partner.expiryTs.gt(nowTs))
|
|
4802
|
+
);
|
|
4803
|
+
if (filteredPartners.length > 1) {
|
|
4804
|
+
throw new Error("More than one partner found, fees fetching is not possible.");
|
|
4805
|
+
}
|
|
4806
|
+
return filteredPartners[0] ?? null;
|
|
4801
4807
|
}
|
|
4802
4808
|
prepareClaimFeeInstruction(payer, fee = AIRDROP_CLAIM_FEE) {
|
|
4803
4809
|
return SystemProgram.transfer({
|