@streamflow/distributor 7.0.0-alpha.1 → 7.0.0-alpha.10
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/README.md +20 -5
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/solana/client.js +199 -347
- package/dist/cjs/solana/constants.js +11 -9
- package/dist/cjs/solana/generated/accounts/ClaimStatus.js +52 -110
- package/dist/cjs/solana/generated/accounts/MerkleDistributor.js +67 -125
- package/dist/cjs/solana/generated/errors/anchor.js +540 -717
- package/dist/cjs/solana/generated/errors/custom.js +171 -243
- package/dist/cjs/solana/generated/errors/index.js +12 -51
- package/dist/cjs/solana/generated/instructions/claimLocked.js +7 -8
- package/dist/cjs/solana/generated/instructions/clawback.js +8 -9
- package/dist/cjs/solana/generated/instructions/closeClaim.js +8 -9
- package/dist/cjs/solana/generated/instructions/newClaim.js +10 -11
- package/dist/cjs/solana/generated/instructions/newDistributor.js +17 -12
- package/dist/cjs/solana/generated/instructions/setAdmin.js +8 -9
- package/dist/cjs/solana/generated/instructions/setClawbackReceiver.js +8 -9
- package/dist/cjs/solana/generated/programId.js +1 -1
- package/dist/cjs/solana/index.js +6 -6
- package/dist/cjs/solana/utils.js +38 -92
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/solana/client.d.ts +3 -1
- package/dist/esm/solana/client.js +44 -18
- package/dist/esm/solana/constants.d.ts +3 -0
- package/dist/esm/solana/constants.js +3 -0
- package/dist/esm/solana/generated/accounts/ClaimStatus.d.ts +11 -11
- package/dist/esm/solana/generated/accounts/ClaimStatus.js +6 -6
- package/dist/esm/solana/generated/accounts/MerkleDistributor.d.ts +19 -19
- package/dist/esm/solana/generated/accounts/MerkleDistributor.js +10 -10
- package/dist/esm/solana/generated/instructions/newClaim.d.ts +3 -3
- package/dist/esm/solana/generated/instructions/newDistributor.d.ts +8 -8
- package/dist/esm/solana/generated/instructions/newDistributor.js +6 -0
- package/dist/esm/solana/index.d.ts +6 -6
- package/dist/esm/solana/index.js +6 -6
- package/dist/esm/solana/types.d.ts +9 -5
- package/package.json +7 -8
package/README.md
CHANGED
|
@@ -19,12 +19,13 @@ or
|
|
|
19
19
|
## Documentation
|
|
20
20
|
API Documentation available here: [docs site →](https://streamflow-finance.github.io/js-sdk/)
|
|
21
21
|
|
|
22
|
+
Automated Airdrop Creation: [notion doc →](https://streamflow.notion.site/Automated-Airdrop-Creation-45b84bfd2dda4d7196be5dd02eed29c8)
|
|
23
|
+
|
|
22
24
|
## Import SDK
|
|
23
25
|
|
|
24
26
|
Most common imports:
|
|
25
27
|
|
|
26
28
|
```javascript
|
|
27
|
-
import { BN } from "bn.js";
|
|
28
29
|
import { ICluster } from "@streamflow/common";
|
|
29
30
|
import { SolanaDistributorClient } from "@streamflow/distributor/solana";
|
|
30
31
|
```
|
|
@@ -60,8 +61,8 @@ const res = await client.create(
|
|
|
60
61
|
54, 218, 49, 68, 131, 214, 250, 113, 37, 143, 167, 73, 17, 54, 233, 26, 141, 93, 28, 186, 137, 211, 251, 205,
|
|
61
62
|
240, 192, 134, 208, 108, 246, 0, 191,
|
|
62
63
|
], // Merkle root
|
|
63
|
-
maxNumNodes:
|
|
64
|
-
maxTotalClaim:
|
|
64
|
+
maxNumNodes: 4, // Number of recipients
|
|
65
|
+
maxTotalClaim: "4000000000", // Total amount to distribute
|
|
65
66
|
unlockPeriod: 1, // Unlock period in seconds
|
|
66
67
|
startVestingTs: 0, // Timestamp when Airdrop starts
|
|
67
68
|
endVestingTs: now + 3600 * 24 * 7, // Timestamp when Airdrop ends
|
|
@@ -92,8 +93,8 @@ const claimRes = await client.claim(
|
|
|
92
93
|
43, 104, 75, 183, 12, 38, 37, 153,
|
|
93
94
|
],
|
|
94
95
|
], // Merkle Proof used to verify claim
|
|
95
|
-
amountUnlocked:
|
|
96
|
-
amountLocked:
|
|
96
|
+
amountUnlocked: "0", // Total amount unlocked for a Recipient
|
|
97
|
+
amountLocked: "1000000000", // Total amount locked for a Recipient
|
|
97
98
|
},
|
|
98
99
|
solanaParams,
|
|
99
100
|
);
|
|
@@ -112,6 +113,20 @@ const solanaParams = {
|
|
|
112
113
|
const clawbackRes = await client.clawback({ id: res.metadataId }, solanaParams);
|
|
113
114
|
```
|
|
114
115
|
|
|
116
|
+
## Search Airdrops
|
|
117
|
+
|
|
118
|
+
As all the data is stored on-chain you can also search Airdrops with `searchDistributors` method:
|
|
119
|
+
|
|
120
|
+
```javascript
|
|
121
|
+
// All parameters are optional, so in theory you just fetch all Distributors
|
|
122
|
+
const params = {
|
|
123
|
+
mint: "BZLbGTNCSFfoth2GYDtwr7e4imWzpR5jqcUuGEwr646K",
|
|
124
|
+
admin: "s3pWmY359mDrNRnDBZ3v5TrrqqxvxiW2t4U2WZyxRoA"
|
|
125
|
+
};
|
|
126
|
+
// Return an Array of objects {publicKey: PublicKey, account: Distributor}
|
|
127
|
+
const disributors = await client.searchDistributors(params);
|
|
128
|
+
```
|
|
129
|
+
|
|
115
130
|
## Handling errors
|
|
116
131
|
|
|
117
132
|
`GenericStreamClient` wraps all errors when making on-chain calls with `ContractError` error class:
|
package/dist/cjs/index.js
CHANGED
|
@@ -24,4 +24,4 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.StreamflowDistributorSolana = void 0;
|
|
27
|
-
exports.StreamflowDistributorSolana = __importStar(require("./solana"));
|
|
27
|
+
exports.StreamflowDistributorSolana = __importStar(require("./solana/index.js"));
|