@streamflow/distributor 7.0.0-alpha.16 → 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/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/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
|
@@ -3,20 +3,17 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const bs58_1 = __importDefault(require("bs58"));
|
|
7
6
|
const bn_js_1 = __importDefault(require("bn.js"));
|
|
8
|
-
const spl_token_1 = require("@solana/spl-token");
|
|
9
7
|
const web3_js_1 = require("@solana/web3.js");
|
|
10
8
|
const common_1 = require("@streamflow/common");
|
|
11
9
|
const solana_1 = require("@streamflow/common/solana");
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
10
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
11
|
+
const bs58_1 = __importDefault(require("bs58"));
|
|
12
|
+
const constants_1 = require("../constants");
|
|
13
|
+
const instructions_1 = require("../generated/instructions");
|
|
14
|
+
const accounts_1 = require("../generated/accounts");
|
|
15
|
+
const utils_1 = require("../utils");
|
|
16
|
+
class BaseDistributorClient {
|
|
20
17
|
constructor({ clusterUrl, cluster = common_1.ICluster.Mainnet, commitment = "confirmed", programId = "", sendRate = 1, sendThrottler, }) {
|
|
21
18
|
this.commitment = commitment;
|
|
22
19
|
this.connection = new web3_js_1.Connection(clusterUrl, this.commitment);
|
|
@@ -26,46 +23,22 @@ class SolanaDistributorClient {
|
|
|
26
23
|
getCommitment() {
|
|
27
24
|
return typeof this.commitment == "string" ? this.commitment : this.commitment.commitment;
|
|
28
25
|
}
|
|
29
|
-
async create(data, extParams) {
|
|
30
|
-
const { ixs, distributorPublicKey } = await this.prepareCreateInstructions(data, extParams);
|
|
31
|
-
const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
|
|
32
|
-
const signature = await (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, extParams.invoker, tx, {
|
|
33
|
-
hash,
|
|
34
|
-
context,
|
|
35
|
-
commitment: this.getCommitment(),
|
|
36
|
-
}, { sendThrottler: this.sendThrottler });
|
|
37
|
-
return {
|
|
38
|
-
ixs,
|
|
39
|
-
txId: signature,
|
|
40
|
-
metadataId: distributorPublicKey.toBase58(),
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
26
|
async prepareCreateInstructions(data, extParams) {
|
|
44
27
|
if (!extParams.invoker.publicKey) {
|
|
45
28
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
46
29
|
}
|
|
30
|
+
const { version, mint } = data;
|
|
47
31
|
const ixs = (0, solana_1.prepareBaseInstructions)(this.connection, extParams);
|
|
48
|
-
const
|
|
49
|
-
const { mint: mintAccount, tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection,
|
|
32
|
+
const mintPublicKey = extParams.isNative ? spl_token_1.NATIVE_MINT : new web3_js_1.PublicKey(mint);
|
|
33
|
+
const { mint: mintAccount, tokenProgramId } = await (0, solana_1.getMintAndProgram)(this.connection, mintPublicKey);
|
|
50
34
|
const transferFeeConfig = (0, spl_token_1.getTransferFeeConfig)(mintAccount);
|
|
51
|
-
const distributorPublicKey = (0, utils_1.getDistributorPda)(this.programId,
|
|
52
|
-
const tokenVault = await (0, solana_1.ata)(
|
|
53
|
-
const senderTokens = await (0, solana_1.ata)(
|
|
54
|
-
const args = {
|
|
55
|
-
version: new bn_js_1.default(data.version),
|
|
56
|
-
root: data.root,
|
|
57
|
-
maxTotalClaim: new bn_js_1.default(data.maxTotalClaim),
|
|
58
|
-
maxNumNodes: new bn_js_1.default(data.maxNumNodes),
|
|
59
|
-
unlockPeriod: new bn_js_1.default(data.unlockPeriod),
|
|
60
|
-
startVestingTs: new bn_js_1.default(data.startVestingTs),
|
|
61
|
-
endVestingTs: new bn_js_1.default(data.endVestingTs),
|
|
62
|
-
clawbackStartTs: new bn_js_1.default(data.clawbackStartTs),
|
|
63
|
-
claimsClosable: data.claimsClosable,
|
|
64
|
-
};
|
|
35
|
+
const distributorPublicKey = (0, utils_1.getDistributorPda)(this.programId, mintPublicKey, version);
|
|
36
|
+
const tokenVault = await (0, solana_1.ata)(mintPublicKey, distributorPublicKey, tokenProgramId);
|
|
37
|
+
const senderTokens = await (0, solana_1.ata)(mintPublicKey, extParams.invoker.publicKey, tokenProgramId);
|
|
65
38
|
const accounts = {
|
|
66
39
|
distributor: distributorPublicKey,
|
|
67
40
|
clawbackReceiver: senderTokens,
|
|
68
|
-
mint,
|
|
41
|
+
mint: mintPublicKey,
|
|
69
42
|
tokenVault,
|
|
70
43
|
admin: extParams.invoker.publicKey,
|
|
71
44
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
@@ -75,22 +48,31 @@ class SolanaDistributorClient {
|
|
|
75
48
|
if (extParams.isNative) {
|
|
76
49
|
ixs.push(...(await (0, solana_1.prepareWrappedAccount)(this.connection, extParams.invoker.publicKey, new bn_js_1.default(data.maxTotalClaim))));
|
|
77
50
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
|
|
81
|
-
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
82
|
-
throw new Error("The unlock period cannot be longer than the total vesting duration!");
|
|
83
|
-
}
|
|
84
|
-
ixs.push((0, instructions_1.newDistributor)(args, accounts, this.programId));
|
|
51
|
+
const newDistributorInstruction = await this.getNewDistributorInstruction(data, accounts);
|
|
52
|
+
ixs.push(newDistributorInstruction);
|
|
85
53
|
if (transferFeeConfig) {
|
|
86
54
|
const { transferAmount, feeCharged } = await (0, utils_1.calculateAmountWithTransferFees)(this.connection, transferFeeConfig, BigInt(data.maxTotalClaim.toString()));
|
|
87
|
-
ixs.push((0, spl_token_1.createTransferCheckedWithFeeInstruction)(senderTokens,
|
|
55
|
+
ixs.push((0, spl_token_1.createTransferCheckedWithFeeInstruction)(senderTokens, mintPublicKey, tokenVault, extParams.invoker.publicKey, transferAmount, mintAccount.decimals, feeCharged, undefined, tokenProgramId));
|
|
88
56
|
}
|
|
89
57
|
else {
|
|
90
|
-
ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens,
|
|
58
|
+
ixs.push((0, spl_token_1.createTransferCheckedInstruction)(senderTokens, mintPublicKey, tokenVault, extParams.invoker.publicKey, BigInt(data.maxTotalClaim.toString()), mintAccount.decimals, undefined, tokenProgramId));
|
|
91
59
|
}
|
|
92
60
|
return { distributorPublicKey, ixs };
|
|
93
61
|
}
|
|
62
|
+
async create(data, extParams) {
|
|
63
|
+
const { ixs, distributorPublicKey } = await this.prepareCreateInstructions(data, extParams);
|
|
64
|
+
const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
|
|
65
|
+
const signature = await (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, extParams.invoker, tx, {
|
|
66
|
+
hash,
|
|
67
|
+
context,
|
|
68
|
+
commitment: this.getCommitment(),
|
|
69
|
+
}, { sendThrottler: this.sendThrottler });
|
|
70
|
+
return {
|
|
71
|
+
ixs,
|
|
72
|
+
txId: signature,
|
|
73
|
+
metadataId: distributorPublicKey.toBase58(),
|
|
74
|
+
};
|
|
75
|
+
}
|
|
94
76
|
async claim(data, extParams) {
|
|
95
77
|
const ixs = await this.prepareClaimInstructions(data, extParams);
|
|
96
78
|
const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
|
|
@@ -144,16 +126,6 @@ class SolanaDistributorClient {
|
|
|
144
126
|
}
|
|
145
127
|
return ixs;
|
|
146
128
|
}
|
|
147
|
-
async clawback(data, extParams) {
|
|
148
|
-
const ixs = await this.prepareClawbackInstructions(data, extParams);
|
|
149
|
-
const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
|
|
150
|
-
const signature = await (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, extParams.invoker, tx, {
|
|
151
|
-
hash,
|
|
152
|
-
context,
|
|
153
|
-
commitment: this.getCommitment(),
|
|
154
|
-
}, { sendThrottler: this.sendThrottler });
|
|
155
|
-
return { ixs, txId: signature };
|
|
156
|
-
}
|
|
157
129
|
async prepareClawbackInstructions(data, extParams) {
|
|
158
130
|
if (!extParams.invoker.publicKey) {
|
|
159
131
|
throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
|
|
@@ -175,9 +147,20 @@ class SolanaDistributorClient {
|
|
|
175
147
|
systemProgram: web3_js_1.SystemProgram.programId,
|
|
176
148
|
tokenProgram: tokenProgramId,
|
|
177
149
|
};
|
|
178
|
-
|
|
150
|
+
const clawbackInstruction = await this.getClawbackInstruction(accounts);
|
|
151
|
+
ixs.push(clawbackInstruction);
|
|
179
152
|
return ixs;
|
|
180
153
|
}
|
|
154
|
+
async clawback(data, extParams) {
|
|
155
|
+
const ixs = await this.prepareClawbackInstructions(data, extParams);
|
|
156
|
+
const { tx, hash, context } = await (0, solana_1.prepareTransaction)(this.connection, ixs, extParams.invoker.publicKey);
|
|
157
|
+
const signature = await (0, utils_1.wrappedSignAndExecuteTransaction)(this.connection, extParams.invoker, tx, {
|
|
158
|
+
hash,
|
|
159
|
+
context,
|
|
160
|
+
commitment: this.getCommitment(),
|
|
161
|
+
}, { sendThrottler: this.sendThrottler });
|
|
162
|
+
return { ixs, txId: signature };
|
|
163
|
+
}
|
|
181
164
|
async getClaims(data) {
|
|
182
165
|
const claimStatusPublicKeys = data.map(({ id, recipient }) => {
|
|
183
166
|
return (0, utils_1.getClaimantStatusPda)(this.programId, new web3_js_1.PublicKey(id), new web3_js_1.PublicKey(recipient));
|
|
@@ -212,5 +195,25 @@ class SolanaDistributorClient {
|
|
|
212
195
|
account: accounts_1.MerkleDistributor.decode(account.data),
|
|
213
196
|
}));
|
|
214
197
|
}
|
|
198
|
+
getNewDistributorArgs(data) {
|
|
199
|
+
const args = {
|
|
200
|
+
version: new bn_js_1.default(data.version),
|
|
201
|
+
root: data.root,
|
|
202
|
+
maxTotalClaim: new bn_js_1.default(data.maxTotalClaim),
|
|
203
|
+
maxNumNodes: new bn_js_1.default(data.maxNumNodes),
|
|
204
|
+
unlockPeriod: new bn_js_1.default(data.unlockPeriod),
|
|
205
|
+
startVestingTs: new bn_js_1.default(data.startVestingTs),
|
|
206
|
+
endVestingTs: new bn_js_1.default(data.endVestingTs),
|
|
207
|
+
clawbackStartTs: new bn_js_1.default(data.clawbackStartTs),
|
|
208
|
+
claimsClosable: data.claimsClosable,
|
|
209
|
+
};
|
|
210
|
+
const nowTs = new bn_js_1.default(Math.floor(Date.now() / 1000));
|
|
211
|
+
const endVestingTs = args.endVestingTs.isZero() ? nowTs : args.endVestingTs;
|
|
212
|
+
const startVestingTs = args.startVestingTs.isZero() ? nowTs : args.startVestingTs;
|
|
213
|
+
if (endVestingTs.gt(startVestingTs) && endVestingTs.sub(startVestingTs).lt(args.unlockPeriod)) {
|
|
214
|
+
throw new Error("The unlock period cannot be longer than the total vesting duration!");
|
|
215
|
+
}
|
|
216
|
+
return args;
|
|
217
|
+
}
|
|
215
218
|
}
|
|
216
|
-
exports.default =
|
|
219
|
+
exports.default = BaseDistributorClient;
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
const bn_js_1 = __importDefault(require("bn.js"));
|
|
7
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
8
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
9
|
+
const common_1 = require("@streamflow/common");
|
|
10
|
+
const BaseDistributorClient_js_1 = __importDefault(require("./BaseDistributorClient.js"));
|
|
11
|
+
const aligned_distributor_json_1 = __importDefault(require("../descriptor/idl/aligned_distributor.json"));
|
|
12
|
+
const constants_js_1 = require("../constants.js");
|
|
13
|
+
const utils_js_1 = require("../utils.js");
|
|
14
|
+
class SolanaAlignedDistributorClient extends BaseDistributorClient_js_1.default {
|
|
15
|
+
constructor({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler }) {
|
|
16
|
+
super({ clusterUrl, cluster, commitment, programId, sendRate, sendThrottler });
|
|
17
|
+
const alignedAirdropsProgram = {
|
|
18
|
+
...aligned_distributor_json_1.default,
|
|
19
|
+
};
|
|
20
|
+
this.alignedProxyProgram = new anchor_1.Program(alignedAirdropsProgram, { connection: this.connection });
|
|
21
|
+
}
|
|
22
|
+
async getAlignedDistributorData(distributorAddress) {
|
|
23
|
+
const distributorKey = new web3_js_1.PublicKey(distributorAddress);
|
|
24
|
+
const alignedDistributorKey = (0, utils_js_1.getAlignedDistributorPda)(this.alignedProxyProgram.programId, distributorKey);
|
|
25
|
+
const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
|
|
26
|
+
(0, common_1.invariant)(alignedProxy, "Aligned Distributor proxy account not found");
|
|
27
|
+
const oracleType = Object.keys(alignedProxy.priceOracleType).find((key) => !!key);
|
|
28
|
+
return {
|
|
29
|
+
oracleType,
|
|
30
|
+
minPrice: (0, common_1.getNumberFromBN)(alignedProxy.minPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
31
|
+
maxPrice: (0, common_1.getNumberFromBN)(alignedProxy.maxPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
32
|
+
minPercentage: (0, common_1.getNumberFromBN)(alignedProxy.minPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
33
|
+
maxPercentage: (0, common_1.getNumberFromBN)(alignedProxy.maxPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
34
|
+
priceOracle: oracleType === "none" ? undefined : alignedProxy.priceOracle.toBase58(),
|
|
35
|
+
sender: alignedProxy.admin.toBase58(),
|
|
36
|
+
updatePeriod: (0, common_1.getNumberFromBN)(alignedProxy.updatePeriod, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
37
|
+
clawedBack: alignedProxy.distributorClawedBack,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async getNewDistributorInstruction(data, accounts) {
|
|
41
|
+
const { distributor, mint, clawbackReceiver, tokenProgram, tokenVault, admin } = accounts;
|
|
42
|
+
const baseArgs = this.getNewDistributorArgs(data);
|
|
43
|
+
const alignedArgs = this.getNewAlignedDistributorArgs(data);
|
|
44
|
+
const oracle = data.oracleAddress
|
|
45
|
+
? new web3_js_1.PublicKey(data.oracleAddress)
|
|
46
|
+
: (0, utils_js_1.getTestOraclePda)(this.alignedProxyProgram.programId, mint, admin);
|
|
47
|
+
const newDistributorIx = await this.alignedProxyProgram.methods
|
|
48
|
+
.newDistributor({
|
|
49
|
+
...baseArgs,
|
|
50
|
+
...alignedArgs,
|
|
51
|
+
})
|
|
52
|
+
.accounts({
|
|
53
|
+
admin,
|
|
54
|
+
tokenVault,
|
|
55
|
+
distributor,
|
|
56
|
+
clawbackReceiver,
|
|
57
|
+
mint,
|
|
58
|
+
tokenProgram,
|
|
59
|
+
priceOracle: oracle,
|
|
60
|
+
})
|
|
61
|
+
.instruction();
|
|
62
|
+
return newDistributorIx;
|
|
63
|
+
}
|
|
64
|
+
async getClawbackInstruction(accounts) {
|
|
65
|
+
const { distributor, from, to, mint, tokenProgram, admin } = accounts;
|
|
66
|
+
const alignedDistributorKey = (0, utils_js_1.getAlignedDistributorPda)(this.alignedProxyProgram.programId, distributor);
|
|
67
|
+
const alignedProxy = await this.alignedProxyProgram.account.alignedDistributor.fetch(alignedDistributorKey);
|
|
68
|
+
(0, common_1.invariant)(alignedProxy, "Aligned Distributor proxy account not found");
|
|
69
|
+
const clawbackInstruction = await this.alignedProxyProgram.methods
|
|
70
|
+
.clawback()
|
|
71
|
+
.accounts({
|
|
72
|
+
admin,
|
|
73
|
+
distributor,
|
|
74
|
+
from,
|
|
75
|
+
to,
|
|
76
|
+
mint,
|
|
77
|
+
tokenProgram,
|
|
78
|
+
})
|
|
79
|
+
.instruction();
|
|
80
|
+
return clawbackInstruction;
|
|
81
|
+
}
|
|
82
|
+
getNewAlignedDistributorArgs(data) {
|
|
83
|
+
const { oracleType, minPrice, maxPrice, minPercentage, maxPercentage, tickSize, skipInitial, totalAmountLocked, totalAmountUnlocked, unlockPeriod, } = data;
|
|
84
|
+
return {
|
|
85
|
+
totalAmountLocked: new bn_js_1.default(totalAmountLocked),
|
|
86
|
+
totalAmountUnlocked: new bn_js_1.default(totalAmountUnlocked),
|
|
87
|
+
oracleType: (!!oracleType ? { [oracleType]: {} } : { none: {} }),
|
|
88
|
+
minPrice: (0, common_1.getBN)(minPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
89
|
+
maxPrice: (0, common_1.getBN)(maxPrice, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
90
|
+
minPercentage: (0, common_1.getBN)(minPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
91
|
+
maxPercentage: (0, common_1.getBN)(maxPercentage, constants_js_1.ALIGNED_PRECISION_FACTOR_POW),
|
|
92
|
+
tickSize: new bn_js_1.default(tickSize || 1),
|
|
93
|
+
skipInitial: skipInitial ?? false,
|
|
94
|
+
updatePeriod: unlockPeriod < 30 ? new bn_js_1.default(30) : new bn_js_1.default(unlockPeriod),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
exports.default = SolanaAlignedDistributorClient;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
const instructions_1 = require("../generated/instructions");
|
|
7
|
+
const BaseDistributorClient_js_1 = __importDefault(require("./BaseDistributorClient.js"));
|
|
8
|
+
class SolanaDistributorClient extends BaseDistributorClient_js_1.default {
|
|
9
|
+
async getNewDistributorInstruction(data, accounts) {
|
|
10
|
+
const args = this.getNewDistributorArgs(data);
|
|
11
|
+
return (0, instructions_1.newDistributor)(args, accounts, this.programId);
|
|
12
|
+
}
|
|
13
|
+
async getClawbackInstruction(accounts) {
|
|
14
|
+
return (0, instructions_1.clawback)(accounts, this.programId);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = SolanaDistributorClient;
|
|
@@ -0,0 +1,10 @@
|
|
|
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.SolanaAlignedDistributorClient = exports.SolanaDistributorClient = void 0;
|
|
7
|
+
var SolanaDistributorClient_js_1 = require("./SolanaDistributorClient.js");
|
|
8
|
+
Object.defineProperty(exports, "SolanaDistributorClient", { enumerable: true, get: function () { return __importDefault(SolanaDistributorClient_js_1).default; } });
|
|
9
|
+
var SolanaAlignedDistributorClient_js_1 = require("./SolanaAlignedDistributorClient.js");
|
|
10
|
+
Object.defineProperty(exports, "SolanaAlignedDistributorClient", { enumerable: true, get: function () { return __importDefault(SolanaAlignedDistributorClient_js_1).default; } });
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DISTRIBUTOR_PROGRAM_ID = exports.ONE_IN_BASIS_POINTS = exports.DISTRIBUTOR_ADMIN_OFFSET = exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET = void 0;
|
|
3
|
+
exports.DISTRIBUTOR_PROGRAM_ID = exports.ONE_IN_BASIS_POINTS = exports.ALIGNED_PRECISION_FACTOR_POW = exports.TEST_ORACLE_PREFIX = exports.ALIGNED_DISTRIBUTOR_PREFIX = exports.DISTRIBUTOR_ADMIN_OFFSET = exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET = void 0;
|
|
4
4
|
const common_1 = require("@streamflow/common");
|
|
5
5
|
exports.ANCHOR_DISCRIMINATOR_OFFSET = 8;
|
|
6
6
|
exports.DISTRIBUTOR_MINT_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET + 41;
|
|
7
7
|
exports.DISTRIBUTOR_ADMIN_OFFSET = exports.ANCHOR_DISCRIMINATOR_OFFSET + 201;
|
|
8
|
+
exports.ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "utf-8");
|
|
9
|
+
exports.TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
|
|
10
|
+
exports.ALIGNED_PRECISION_FACTOR_POW = 9;
|
|
8
11
|
exports.ONE_IN_BASIS_POINTS = BigInt(10000);
|
|
9
12
|
exports.DISTRIBUTOR_PROGRAM_ID = {
|
|
10
13
|
[common_1.ICluster.Devnet]: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
|