@streamflow/distributor 7.0.0-alpha.15 → 7.0.0-alpha.17
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/solana/{client.js → clients/BaseDistributorClient.js} +65 -62
- package/dist/cjs/solana/clients/SolanaAlignedDistributorClient.js +98 -0
- package/dist/cjs/solana/clients/SolanaDistributorClient.js +17 -0
- package/dist/cjs/solana/clients/index.js +10 -0
- package/dist/cjs/solana/constants.js +4 -1
- package/dist/cjs/solana/descriptor/aligned_distributor.js +2 -0
- package/dist/cjs/solana/descriptor/idl/aligned_distributor.json +1242 -0
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +5 -5
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +31 -6
- package/dist/cjs/solana/index.js +2 -6
- package/dist/cjs/solana/utils.js +14 -6
- package/dist/esm/solana/clients/BaseDistributorClient.d.ts +38 -0
- package/dist/esm/solana/{client.js → clients/BaseDistributorClient.js} +65 -62
- package/dist/esm/solana/clients/SolanaAlignedDistributorClient.d.ts +12 -0
- package/dist/esm/solana/clients/SolanaAlignedDistributorClient.js +93 -0
- package/dist/esm/solana/clients/SolanaDistributorClient.d.ts +8 -0
- package/dist/esm/solana/clients/SolanaDistributorClient.js +11 -0
- package/dist/esm/solana/clients/index.d.ts +2 -0
- package/dist/esm/solana/clients/index.js +2 -0
- package/dist/esm/solana/constants.d.ts +4 -0
- package/dist/esm/solana/constants.js +3 -0
- package/dist/esm/solana/descriptor/aligned_distributor.d.ts +918 -0
- package/dist/esm/solana/descriptor/aligned_distributor.js +1 -0
- package/dist/esm/solana/descriptor/idl/aligned_distributor.json +1242 -0
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +6 -6
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +7 -7
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +36 -6
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +43 -8
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +1 -1
- package/dist/esm/solana/types.d.ts +40 -0
- package/dist/esm/solana/utils.d.ts +2 -0
- package/dist/esm/solana/utils.js +8 -2
- package/package.json +5 -4
- package/dist/esm/solana/client.d.ts +0 -38
|
@@ -16,8 +16,8 @@ export interface ClaimStatusFields {
|
|
|
16
16
|
lastAmountPerUnlock: BN;
|
|
17
17
|
/** Whether claim is closed */
|
|
18
18
|
closed: boolean;
|
|
19
|
-
/**
|
|
20
|
-
|
|
19
|
+
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
20
|
+
distributor: PublicKey;
|
|
21
21
|
/** Buffer for additional fields */
|
|
22
22
|
buffer2: Array<number>;
|
|
23
23
|
}
|
|
@@ -36,8 +36,8 @@ export interface ClaimStatusJSON {
|
|
|
36
36
|
lastAmountPerUnlock: string;
|
|
37
37
|
/** Whether claim is closed */
|
|
38
38
|
closed: boolean;
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
40
|
+
distributor: string;
|
|
41
41
|
/** Buffer for additional fields */
|
|
42
42
|
buffer2: Array<number>;
|
|
43
43
|
}
|
|
@@ -57,8 +57,8 @@ export declare class ClaimStatus {
|
|
|
57
57
|
readonly lastAmountPerUnlock: BN;
|
|
58
58
|
/** Whether claim is closed */
|
|
59
59
|
readonly closed: boolean;
|
|
60
|
-
/**
|
|
61
|
-
readonly
|
|
60
|
+
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
61
|
+
readonly distributor: PublicKey;
|
|
62
62
|
/** Buffer for additional fields */
|
|
63
63
|
readonly buffer2: Array<number>;
|
|
64
64
|
static readonly discriminator: Buffer;
|
|
@@ -18,8 +18,8 @@ export class ClaimStatus {
|
|
|
18
18
|
lastAmountPerUnlock;
|
|
19
19
|
/** Whether claim is closed */
|
|
20
20
|
closed;
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/** Distributor account for which ClaimStatus was created, useful to filter by in get_program_accounts */
|
|
22
|
+
distributor;
|
|
23
23
|
/** Buffer for additional fields */
|
|
24
24
|
buffer2;
|
|
25
25
|
static discriminator = Buffer.from([22, 183, 249, 157, 247, 95, 150, 96]);
|
|
@@ -31,7 +31,7 @@ export class ClaimStatus {
|
|
|
31
31
|
borsh.u64("lastClaimTs"),
|
|
32
32
|
borsh.u64("lastAmountPerUnlock"),
|
|
33
33
|
borsh.bool("closed"),
|
|
34
|
-
borsh.
|
|
34
|
+
borsh.publicKey("distributor"),
|
|
35
35
|
borsh.array(borsh.u8(), 32, "buffer2"),
|
|
36
36
|
]);
|
|
37
37
|
constructor(fields) {
|
|
@@ -42,7 +42,7 @@ export class ClaimStatus {
|
|
|
42
42
|
this.lastClaimTs = fields.lastClaimTs;
|
|
43
43
|
this.lastAmountPerUnlock = fields.lastAmountPerUnlock;
|
|
44
44
|
this.closed = fields.closed;
|
|
45
|
-
this.
|
|
45
|
+
this.distributor = fields.distributor;
|
|
46
46
|
this.buffer2 = fields.buffer2;
|
|
47
47
|
}
|
|
48
48
|
static async fetch(c, address, programId = PROGRAM_ID) {
|
|
@@ -80,7 +80,7 @@ export class ClaimStatus {
|
|
|
80
80
|
lastClaimTs: dec.lastClaimTs,
|
|
81
81
|
lastAmountPerUnlock: dec.lastAmountPerUnlock,
|
|
82
82
|
closed: dec.closed,
|
|
83
|
-
|
|
83
|
+
distributor: dec.distributor,
|
|
84
84
|
buffer2: dec.buffer2,
|
|
85
85
|
});
|
|
86
86
|
}
|
|
@@ -93,7 +93,7 @@ export class ClaimStatus {
|
|
|
93
93
|
lastClaimTs: this.lastClaimTs.toString(),
|
|
94
94
|
lastAmountPerUnlock: this.lastAmountPerUnlock.toString(),
|
|
95
95
|
closed: this.closed,
|
|
96
|
-
|
|
96
|
+
distributor: this.distributor.toString(),
|
|
97
97
|
buffer2: this.buffer2,
|
|
98
98
|
};
|
|
99
99
|
}
|
|
@@ -106,7 +106,7 @@ export class ClaimStatus {
|
|
|
106
106
|
lastClaimTs: new BN(obj.lastClaimTs),
|
|
107
107
|
lastAmountPerUnlock: new BN(obj.lastAmountPerUnlock),
|
|
108
108
|
closed: obj.closed,
|
|
109
|
-
|
|
109
|
+
distributor: new PublicKey(obj.distributor),
|
|
110
110
|
buffer2: obj.buffer2,
|
|
111
111
|
});
|
|
112
112
|
}
|
|
@@ -36,8 +36,18 @@ export interface MerkleDistributorFields {
|
|
|
36
36
|
clawedBack: boolean;
|
|
37
37
|
/** Whether claims are closable by the admin or not */
|
|
38
38
|
claimsClosable: boolean;
|
|
39
|
-
/**
|
|
40
|
-
|
|
39
|
+
/** Whether admin can update vesting duration */
|
|
40
|
+
canUpdateDuration: boolean;
|
|
41
|
+
/** Total amount of funds unlocked (cliff/instant) */
|
|
42
|
+
totalAmountUnlocked: BN;
|
|
43
|
+
/** Total amount of funds locked (vested) */
|
|
44
|
+
totalAmountLocked: BN;
|
|
45
|
+
/** Timestamp when update was last called */
|
|
46
|
+
lastDurationUpdateTs: BN;
|
|
47
|
+
/** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
|
|
48
|
+
totalClaimablePreUpdate: BN;
|
|
49
|
+
/** Timestamp when funds were clawed back */
|
|
50
|
+
clawedBackTs: BN;
|
|
41
51
|
/** Buffer for additional fields */
|
|
42
52
|
buffer2: Array<number>;
|
|
43
53
|
/** Buffer for additional fields */
|
|
@@ -78,8 +88,18 @@ export interface MerkleDistributorJSON {
|
|
|
78
88
|
clawedBack: boolean;
|
|
79
89
|
/** Whether claims are closable by the admin or not */
|
|
80
90
|
claimsClosable: boolean;
|
|
81
|
-
/**
|
|
82
|
-
|
|
91
|
+
/** Whether admin can update vesting duration */
|
|
92
|
+
canUpdateDuration: boolean;
|
|
93
|
+
/** Total amount of funds unlocked (cliff/instant) */
|
|
94
|
+
totalAmountUnlocked: string;
|
|
95
|
+
/** Total amount of funds locked (vested) */
|
|
96
|
+
totalAmountLocked: string;
|
|
97
|
+
/** Timestamp when update was last called */
|
|
98
|
+
lastDurationUpdateTs: string;
|
|
99
|
+
/** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
|
|
100
|
+
totalClaimablePreUpdate: string;
|
|
101
|
+
/** Timestamp when funds were clawed back */
|
|
102
|
+
clawedBackTs: string;
|
|
83
103
|
/** Buffer for additional fields */
|
|
84
104
|
buffer2: Array<number>;
|
|
85
105
|
/** Buffer for additional fields */
|
|
@@ -121,8 +141,18 @@ export declare class MerkleDistributor {
|
|
|
121
141
|
readonly clawedBack: boolean;
|
|
122
142
|
/** Whether claims are closable by the admin or not */
|
|
123
143
|
readonly claimsClosable: boolean;
|
|
124
|
-
/**
|
|
125
|
-
readonly
|
|
144
|
+
/** Whether admin can update vesting duration */
|
|
145
|
+
readonly canUpdateDuration: boolean;
|
|
146
|
+
/** Total amount of funds unlocked (cliff/instant) */
|
|
147
|
+
readonly totalAmountUnlocked: BN;
|
|
148
|
+
/** Total amount of funds locked (vested) */
|
|
149
|
+
readonly totalAmountLocked: BN;
|
|
150
|
+
/** Timestamp when update was last called */
|
|
151
|
+
readonly lastDurationUpdateTs: BN;
|
|
152
|
+
/** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
|
|
153
|
+
readonly totalClaimablePreUpdate: BN;
|
|
154
|
+
/** Timestamp when funds were clawed back */
|
|
155
|
+
readonly clawedBackTs: BN;
|
|
126
156
|
/** Buffer for additional fields */
|
|
127
157
|
readonly buffer2: Array<number>;
|
|
128
158
|
/** Buffer for additional fields */
|
|
@@ -38,8 +38,18 @@ export class MerkleDistributor {
|
|
|
38
38
|
clawedBack;
|
|
39
39
|
/** Whether claims are closable by the admin or not */
|
|
40
40
|
claimsClosable;
|
|
41
|
-
/**
|
|
42
|
-
|
|
41
|
+
/** Whether admin can update vesting duration */
|
|
42
|
+
canUpdateDuration;
|
|
43
|
+
/** Total amount of funds unlocked (cliff/instant) */
|
|
44
|
+
totalAmountUnlocked;
|
|
45
|
+
/** Total amount of funds locked (vested) */
|
|
46
|
+
totalAmountLocked;
|
|
47
|
+
/** Timestamp when update was last called */
|
|
48
|
+
lastDurationUpdateTs;
|
|
49
|
+
/** Total amount of locked amount claimable as of last duration update, ever increasing total, accumulates with each update */
|
|
50
|
+
totalClaimablePreUpdate;
|
|
51
|
+
/** Timestamp when funds were clawed back */
|
|
52
|
+
clawedBackTs;
|
|
43
53
|
/** Buffer for additional fields */
|
|
44
54
|
buffer2;
|
|
45
55
|
/** Buffer for additional fields */
|
|
@@ -63,8 +73,13 @@ export class MerkleDistributor {
|
|
|
63
73
|
borsh.publicKey("admin"),
|
|
64
74
|
borsh.bool("clawedBack"),
|
|
65
75
|
borsh.bool("claimsClosable"),
|
|
66
|
-
borsh.
|
|
67
|
-
borsh.
|
|
76
|
+
borsh.bool("canUpdateDuration"),
|
|
77
|
+
borsh.u64("totalAmountUnlocked"),
|
|
78
|
+
borsh.u64("totalAmountLocked"),
|
|
79
|
+
borsh.u64("lastDurationUpdateTs"),
|
|
80
|
+
borsh.u64("totalClaimablePreUpdate"),
|
|
81
|
+
borsh.u64("clawedBackTs"),
|
|
82
|
+
borsh.array(borsh.u8(), 23, "buffer2"),
|
|
68
83
|
borsh.array(borsh.u8(), 32, "buffer3"),
|
|
69
84
|
]);
|
|
70
85
|
constructor(fields) {
|
|
@@ -85,7 +100,12 @@ export class MerkleDistributor {
|
|
|
85
100
|
this.admin = fields.admin;
|
|
86
101
|
this.clawedBack = fields.clawedBack;
|
|
87
102
|
this.claimsClosable = fields.claimsClosable;
|
|
88
|
-
this.
|
|
103
|
+
this.canUpdateDuration = fields.canUpdateDuration;
|
|
104
|
+
this.totalAmountUnlocked = fields.totalAmountUnlocked;
|
|
105
|
+
this.totalAmountLocked = fields.totalAmountLocked;
|
|
106
|
+
this.lastDurationUpdateTs = fields.lastDurationUpdateTs;
|
|
107
|
+
this.totalClaimablePreUpdate = fields.totalClaimablePreUpdate;
|
|
108
|
+
this.clawedBackTs = fields.clawedBackTs;
|
|
89
109
|
this.buffer2 = fields.buffer2;
|
|
90
110
|
this.buffer3 = fields.buffer3;
|
|
91
111
|
}
|
|
@@ -134,7 +154,12 @@ export class MerkleDistributor {
|
|
|
134
154
|
admin: dec.admin,
|
|
135
155
|
clawedBack: dec.clawedBack,
|
|
136
156
|
claimsClosable: dec.claimsClosable,
|
|
137
|
-
|
|
157
|
+
canUpdateDuration: dec.canUpdateDuration,
|
|
158
|
+
totalAmountUnlocked: dec.totalAmountUnlocked,
|
|
159
|
+
totalAmountLocked: dec.totalAmountLocked,
|
|
160
|
+
lastDurationUpdateTs: dec.lastDurationUpdateTs,
|
|
161
|
+
totalClaimablePreUpdate: dec.totalClaimablePreUpdate,
|
|
162
|
+
clawedBackTs: dec.clawedBackTs,
|
|
138
163
|
buffer2: dec.buffer2,
|
|
139
164
|
buffer3: dec.buffer3,
|
|
140
165
|
});
|
|
@@ -158,7 +183,12 @@ export class MerkleDistributor {
|
|
|
158
183
|
admin: this.admin.toString(),
|
|
159
184
|
clawedBack: this.clawedBack,
|
|
160
185
|
claimsClosable: this.claimsClosable,
|
|
161
|
-
|
|
186
|
+
canUpdateDuration: this.canUpdateDuration,
|
|
187
|
+
totalAmountUnlocked: this.totalAmountUnlocked.toString(),
|
|
188
|
+
totalAmountLocked: this.totalAmountLocked.toString(),
|
|
189
|
+
lastDurationUpdateTs: this.lastDurationUpdateTs.toString(),
|
|
190
|
+
totalClaimablePreUpdate: this.totalClaimablePreUpdate.toString(),
|
|
191
|
+
clawedBackTs: this.clawedBackTs.toString(),
|
|
162
192
|
buffer2: this.buffer2,
|
|
163
193
|
buffer3: this.buffer3,
|
|
164
194
|
};
|
|
@@ -182,7 +212,12 @@ export class MerkleDistributor {
|
|
|
182
212
|
admin: new PublicKey(obj.admin),
|
|
183
213
|
clawedBack: obj.clawedBack,
|
|
184
214
|
claimsClosable: obj.claimsClosable,
|
|
185
|
-
|
|
215
|
+
canUpdateDuration: obj.canUpdateDuration,
|
|
216
|
+
totalAmountUnlocked: new BN(obj.totalAmountUnlocked),
|
|
217
|
+
totalAmountLocked: new BN(obj.totalAmountLocked),
|
|
218
|
+
lastDurationUpdateTs: new BN(obj.lastDurationUpdateTs),
|
|
219
|
+
totalClaimablePreUpdate: new BN(obj.totalClaimablePreUpdate),
|
|
220
|
+
clawedBackTs: new BN(obj.clawedBackTs),
|
|
186
221
|
buffer2: obj.buffer2,
|
|
187
222
|
buffer3: obj.buffer3,
|
|
188
223
|
});
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -3,6 +3,10 @@ import { Keypair } from "@solana/web3.js";
|
|
|
3
3
|
import { ITransactionResult } from "@streamflow/common";
|
|
4
4
|
import { ITransactionSolanaExt } from "@streamflow/common/solana";
|
|
5
5
|
import BN from "bn.js";
|
|
6
|
+
import { IdlTypes } from "@coral-xyz/anchor";
|
|
7
|
+
import { AlignedDistributor as AlignedDistributorIDL } from "./descriptor/aligned_distributor.js";
|
|
8
|
+
export type OracleType = IdlTypes<AlignedDistributorIDL>["oracleType"];
|
|
9
|
+
export type OracleTypeName = "none" | "pyth" | "switchboard" | "test";
|
|
6
10
|
export interface IInteractSolanaExt extends ITransactionSolanaExt {
|
|
7
11
|
invoker: SignerWalletAdapter | Keypair;
|
|
8
12
|
}
|
|
@@ -21,6 +25,42 @@ export interface ICreateDistributorData {
|
|
|
21
25
|
clawbackStartTs: number;
|
|
22
26
|
claimsClosable: boolean;
|
|
23
27
|
}
|
|
28
|
+
export interface AlignedDistributorData {
|
|
29
|
+
sender: string;
|
|
30
|
+
minPrice: number;
|
|
31
|
+
maxPrice: number;
|
|
32
|
+
minPercentage: number;
|
|
33
|
+
maxPercentage: number;
|
|
34
|
+
oracleType: OracleTypeName;
|
|
35
|
+
priceOracle: string | undefined;
|
|
36
|
+
updatePeriod: number;
|
|
37
|
+
clawedBack: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface NewAlignedDistributorArgs {
|
|
40
|
+
totalAmountLocked: BN;
|
|
41
|
+
totalAmountUnlocked: BN;
|
|
42
|
+
oracleType: OracleType;
|
|
43
|
+
minPrice: BN;
|
|
44
|
+
maxPrice: BN;
|
|
45
|
+
minPercentage: BN;
|
|
46
|
+
maxPercentage: BN;
|
|
47
|
+
tickSize: BN;
|
|
48
|
+
skipInitial: boolean;
|
|
49
|
+
updatePeriod: BN;
|
|
50
|
+
}
|
|
51
|
+
export interface ICreateAlignedDistributorData extends ICreateDistributorData {
|
|
52
|
+
minPrice: number;
|
|
53
|
+
maxPrice: number;
|
|
54
|
+
minPercentage: number;
|
|
55
|
+
maxPercentage: number;
|
|
56
|
+
oracleType: OracleTypeName;
|
|
57
|
+
oracleAddress: string;
|
|
58
|
+
totalAmountLocked: BN | number | string;
|
|
59
|
+
totalAmountUnlocked: BN | number | string;
|
|
60
|
+
updatePeriod?: number;
|
|
61
|
+
tickSize?: number;
|
|
62
|
+
skipInitial?: boolean;
|
|
63
|
+
}
|
|
24
64
|
export interface IClaimData {
|
|
25
65
|
id: string;
|
|
26
66
|
amountUnlocked: BN;
|
|
@@ -2,6 +2,8 @@ import { TransferFeeConfig } from "@solana/spl-token";
|
|
|
2
2
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
3
3
|
import { Connection, Keypair, PublicKey, Transaction, VersionedTransaction } from "@solana/web3.js";
|
|
4
4
|
import { ConfirmationParams, ThrottleParams } from "@streamflow/common/solana";
|
|
5
|
+
export declare const getAlignedDistributorPda: (programId: PublicKey, distributor: PublicKey) => PublicKey;
|
|
6
|
+
export declare const getTestOraclePda: (programId: PublicKey, mint: PublicKey, creator: PublicKey) => PublicKey;
|
|
5
7
|
export declare function getDistributorPda(programId: PublicKey, mint: PublicKey, version: number): PublicKey;
|
|
6
8
|
export declare function getClaimantStatusPda(programId: PublicKey, distributor: PublicKey, claimant: PublicKey): PublicKey;
|
|
7
9
|
export declare function getEventAuthorityPda(programId: PublicKey): PublicKey;
|
package/dist/esm/solana/utils.js
CHANGED
|
@@ -2,8 +2,14 @@ import { Buffer } from "buffer";
|
|
|
2
2
|
import { PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { ContractError, divCeilN } from "@streamflow/common";
|
|
4
4
|
import { signAndExecuteTransaction } from "@streamflow/common/solana";
|
|
5
|
-
import { fromTxError } from "./generated/errors";
|
|
6
|
-
import { ONE_IN_BASIS_POINTS } from "./constants";
|
|
5
|
+
import { fromTxError } from "./generated/errors/index.js";
|
|
6
|
+
import { ONE_IN_BASIS_POINTS, ALIGNED_DISTRIBUTOR_PREFIX, TEST_ORACLE_PREFIX } from "./constants.js";
|
|
7
|
+
export const getAlignedDistributorPda = (programId, distributor) => {
|
|
8
|
+
return PublicKey.findProgramAddressSync([ALIGNED_DISTRIBUTOR_PREFIX, distributor.toBuffer()], programId)[0];
|
|
9
|
+
};
|
|
10
|
+
export const getTestOraclePda = (programId, mint, creator) => {
|
|
11
|
+
return PublicKey.findProgramAddressSync([TEST_ORACLE_PREFIX, mint.toBuffer(), creator.toBuffer()], programId)[0];
|
|
12
|
+
};
|
|
7
13
|
export function getDistributorPda(programId, mint, version) {
|
|
8
14
|
// Constructing the seed for the PDA
|
|
9
15
|
const seeds = [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/distributor",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.17",
|
|
4
4
|
"description": "JavaScript SDK to interact with Streamflow Airdrop protocol.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -26,20 +26,21 @@
|
|
|
26
26
|
"lint": "eslint --fix .",
|
|
27
27
|
"prepublishOnly": "npm run lint && npm run build"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "ad633465d0c533b4dd582a96b52a08b3d8c4d8c7",
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@streamflow/eslint-config": "7.0.0-alpha.
|
|
31
|
+
"@streamflow/eslint-config": "7.0.0-alpha.17",
|
|
32
32
|
"@types/bn.js": "5.1.1",
|
|
33
33
|
"date-fns": "2.28.0",
|
|
34
34
|
"typescript": "^4.9.5"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@coral-xyz/anchor": "^0.30.0",
|
|
37
38
|
"@coral-xyz/borsh": "0.30.1",
|
|
38
39
|
"@solana/buffer-layout": "4.0.1 ",
|
|
39
40
|
"@solana/spl-token": "0.3.6",
|
|
40
41
|
"@solana/wallet-adapter-base": "0.9.19",
|
|
41
42
|
"@solana/web3.js": "1.90.2",
|
|
42
|
-
"@streamflow/common": "7.0.0-alpha.
|
|
43
|
+
"@streamflow/common": "7.0.0-alpha.17",
|
|
43
44
|
"bn.js": "5.2.1",
|
|
44
45
|
"borsh": "^2.0.0",
|
|
45
46
|
"bs58": "5.0.0",
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import PQueue from "p-queue";
|
|
2
|
-
import { PublicKey, TransactionInstruction, Commitment, ConnectionConfig } from "@solana/web3.js";
|
|
3
|
-
import { ICluster, ITransactionResult } from "@streamflow/common";
|
|
4
|
-
import { IProgramAccount } from "@streamflow/common/solana";
|
|
5
|
-
import { IClaimData, IClawbackData, ICreateDistributorData, ICreateDistributorResult, IGetClaimData, IGetDistributors, ICreateSolanaExt, IInteractSolanaExt, ISearchDistributors } from "./types";
|
|
6
|
-
import { ClaimStatus, MerkleDistributor } from "./generated/accounts";
|
|
7
|
-
interface IInitOptions {
|
|
8
|
-
clusterUrl: string;
|
|
9
|
-
cluster?: ICluster;
|
|
10
|
-
commitment?: Commitment | ConnectionConfig;
|
|
11
|
-
programId?: string;
|
|
12
|
-
sendRate?: number;
|
|
13
|
-
sendThrottler?: PQueue;
|
|
14
|
-
}
|
|
15
|
-
export default class SolanaDistributorClient {
|
|
16
|
-
private connection;
|
|
17
|
-
private programId;
|
|
18
|
-
private commitment;
|
|
19
|
-
private sendThrottler;
|
|
20
|
-
/**
|
|
21
|
-
* Create Stream instance
|
|
22
|
-
*/
|
|
23
|
-
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler, }: IInitOptions);
|
|
24
|
-
getCommitment(): Commitment | undefined;
|
|
25
|
-
create(data: ICreateDistributorData, extParams: ICreateSolanaExt): Promise<ICreateDistributorResult>;
|
|
26
|
-
prepareCreateInstructions(data: ICreateDistributorData, extParams: ICreateSolanaExt): Promise<{
|
|
27
|
-
distributorPublicKey: PublicKey;
|
|
28
|
-
ixs: TransactionInstruction[];
|
|
29
|
-
}>;
|
|
30
|
-
claim(data: IClaimData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
31
|
-
prepareClaimInstructions(data: IClaimData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
32
|
-
clawback(data: IClawbackData, extParams: IInteractSolanaExt): Promise<ITransactionResult>;
|
|
33
|
-
prepareClawbackInstructions(data: IClawbackData, extParams: IInteractSolanaExt): Promise<TransactionInstruction[]>;
|
|
34
|
-
getClaims(data: IGetClaimData[]): Promise<(ClaimStatus | null)[]>;
|
|
35
|
-
getDistributors(data: IGetDistributors): Promise<(MerkleDistributor | null)[]>;
|
|
36
|
-
searchDistributors(data: ISearchDistributors): Promise<IProgramAccount<MerkleDistributor>[]>;
|
|
37
|
-
}
|
|
38
|
-
export {};
|