@streamflow/distributor 12.4.0 → 12.5.0

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.
@@ -2,11 +2,11 @@
2
2
 
3
3
  var web3_js = require('@solana/web3.js');
4
4
  var BN = require('bn.js');
5
+ var buffer = require('buffer');
5
6
  require('@solana/wallet-adapter-base');
6
7
  var anchor = require('@coral-xyz/anchor');
7
8
  var splToken = require('@solana/spl-token');
8
9
  var common = require('@streamflow/common');
9
- var buffer = require('buffer');
10
10
 
11
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
12
 
@@ -37,9 +37,12 @@ __export(solana_exports, {
37
37
  constants: () => constants_exports,
38
38
  fetchAirdropFee: () => fetchAirdropFee,
39
39
  getAlignedDistributorPda: () => getAlignedDistributorPda,
40
+ getAttestationNonce: () => getAttestationNonce,
41
+ getAttestationPda: () => getAttestationPda,
40
42
  getClaimantStatusPda: () => getClaimantStatusPda,
41
43
  getDistributorPda: () => getDistributorPda,
42
44
  getEventAuthorityPda: () => getEventAuthorityPda,
45
+ getKycNonceBytes: () => getKycNonceBytes,
43
46
  getTestOraclePda: () => getTestOraclePda,
44
47
  isCompressedClaimStatus: () => isCompressedClaimStatus,
45
48
  resolveAirdropFeeLamportsUsingApi: () => resolveAirdropFeeLamportsUsingApi,
@@ -137,6 +140,7 @@ __export(constants_exports, {
137
140
  ALIGNED_DISTRIBUTOR_PROGRAM_ID: () => ALIGNED_DISTRIBUTOR_PROGRAM_ID,
138
141
  ALIGNED_PRECISION_FACTOR_POW: () => ALIGNED_PRECISION_FACTOR_POW,
139
142
  ANCHOR_DISCRIMINATOR_OFFSET: () => ANCHOR_DISCRIMINATOR_OFFSET,
143
+ ATTESTATION_PREFIX: () => ATTESTATION_PREFIX,
140
144
  CLAIM_STATUS_PREFIX: () => CLAIM_STATUS_PREFIX,
141
145
  DISTRIBUTOR_ADMIN_OFFSET: () => DISTRIBUTOR_ADMIN_OFFSET,
142
146
  DISTRIBUTOR_MINT_OFFSET: () => DISTRIBUTOR_MINT_OFFSET,
@@ -146,6 +150,7 @@ __export(constants_exports, {
146
150
  MERKLE_DISTRIBUTOR_ERRORS: () => MERKLE_DISTRIBUTOR_ERRORS,
147
151
  ONE_IN_BASIS_POINTS: () => ONE_IN_BASIS_POINTS,
148
152
  PARTNER_ORACLE_PROGRAM_ID: () => PARTNER_ORACLE_PROGRAM_ID,
153
+ SOLANA_ATTESTATION_SERVICE_PROGRAM_ID: () => SOLANA_ATTESTATION_SERVICE_PROGRAM_ID,
149
154
  SOL_FEE_PROGRAM_VERSION: () => SOL_FEE_PROGRAM_VERSION,
150
155
  STREAMFLOW_TREASURY_PUBLIC_KEY: () => STREAMFLOW_TREASURY_PUBLIC_KEY,
151
156
  TEST_ORACLE_PREFIX: () => TEST_ORACLE_PREFIX
@@ -156,7 +161,7 @@ var merkle_distributor_default = {
156
161
  address: "MErKy6nZVoVAkryxAejJz2juifQ4ArgLgHmaJCQkU7N",
157
162
  metadata: {
158
163
  name: "merkle_distributor",
159
- version: "1.9.0",
164
+ version: "1.10.0",
160
165
  spec: "0.1.0",
161
166
  description: "A Solana program for distributing tokens according to a Merkle root.",
162
167
  repository: "https://github.com/streamflow-finance/distributor"
@@ -1082,6 +1087,81 @@ var merkle_distributor_default = {
1082
1087
  ],
1083
1088
  args: []
1084
1089
  },
1090
+ {
1091
+ name: "disable_kyc",
1092
+ discriminator: [
1093
+ 204,
1094
+ 167,
1095
+ 59,
1096
+ 181,
1097
+ 11,
1098
+ 7,
1099
+ 254,
1100
+ 148
1101
+ ],
1102
+ accounts: [
1103
+ {
1104
+ name: "distributor",
1105
+ docs: [
1106
+ "The [MerkleDistributor]."
1107
+ ],
1108
+ writable: true
1109
+ },
1110
+ {
1111
+ name: "admin",
1112
+ docs: [
1113
+ "Admin signer."
1114
+ ],
1115
+ writable: true,
1116
+ signer: true
1117
+ }
1118
+ ],
1119
+ args: []
1120
+ },
1121
+ {
1122
+ name: "enable_kyc",
1123
+ discriminator: [
1124
+ 28,
1125
+ 10,
1126
+ 11,
1127
+ 99,
1128
+ 6,
1129
+ 44,
1130
+ 96,
1131
+ 77
1132
+ ],
1133
+ accounts: [
1134
+ {
1135
+ name: "distributor",
1136
+ docs: [
1137
+ "The [MerkleDistributor]."
1138
+ ],
1139
+ writable: true
1140
+ },
1141
+ {
1142
+ name: "admin",
1143
+ docs: [
1144
+ "Admin signer."
1145
+ ],
1146
+ writable: true,
1147
+ signer: true
1148
+ },
1149
+ {
1150
+ name: "credential"
1151
+ },
1152
+ {
1153
+ name: "schema"
1154
+ }
1155
+ ],
1156
+ args: [
1157
+ {
1158
+ name: "nonce",
1159
+ type: {
1160
+ option: "bytes"
1161
+ }
1162
+ }
1163
+ ]
1164
+ },
1085
1165
  {
1086
1166
  name: "new_claim",
1087
1167
  discriminator: [
@@ -2787,6 +2867,31 @@ var merkle_distributor_default = {
2787
2867
  code: 6033,
2788
2868
  name: "ClawbackRequestDelayPending",
2789
2869
  msg: "Clawback request delay has not passed yet"
2870
+ },
2871
+ {
2872
+ code: 6034,
2873
+ name: "MissingAttestation",
2874
+ msg: "Attestation is required for this Distributor"
2875
+ },
2876
+ {
2877
+ code: 6035,
2878
+ name: "InvalidAttestation",
2879
+ msg: "Invalid attestation account"
2880
+ },
2881
+ {
2882
+ code: 6036,
2883
+ name: "AttestationExpired",
2884
+ msg: "Attestation has expired"
2885
+ },
2886
+ {
2887
+ code: 6037,
2888
+ name: "InvalidAttestationCredentialSchema",
2889
+ msg: "Invalid attestation credential or schema"
2890
+ },
2891
+ {
2892
+ code: 6038,
2893
+ name: "KycNonceTooLong",
2894
+ msg: "KYC nonce is too long"
2790
2895
  }
2791
2896
  ],
2792
2897
  types: [
@@ -3050,6 +3155,69 @@ var merkle_distributor_default = {
3050
3155
  ]
3051
3156
  }
3052
3157
  },
3158
+ {
3159
+ name: "KycConfig",
3160
+ docs: [
3161
+ "Configuration for kyc-gated (claim) Airdrops."
3162
+ ],
3163
+ type: {
3164
+ kind: "struct",
3165
+ fields: [
3166
+ {
3167
+ name: "is_set",
3168
+ docs: [
3169
+ "Whether KYC is required to claim the Airdrop"
3170
+ ],
3171
+ type: "bool"
3172
+ },
3173
+ {
3174
+ name: "credential",
3175
+ docs: [
3176
+ "SAS Credential account used to create attestations"
3177
+ ],
3178
+ type: "pubkey"
3179
+ },
3180
+ {
3181
+ name: "schema",
3182
+ docs: [
3183
+ "SAS Schema account that attestation must conform to"
3184
+ ],
3185
+ type: "pubkey"
3186
+ },
3187
+ {
3188
+ name: "nonce_len",
3189
+ docs: [
3190
+ "Length of the custom nonce portion; zero means the claimant address is used directly."
3191
+ ],
3192
+ type: "u8"
3193
+ },
3194
+ {
3195
+ name: "nonce",
3196
+ docs: [
3197
+ 'Optional custom nonce portion used as sha256("claimant_address:nonce") for SAS attestation nonce.'
3198
+ ],
3199
+ type: {
3200
+ array: [
3201
+ "u8",
3202
+ 32
3203
+ ]
3204
+ }
3205
+ },
3206
+ {
3207
+ name: "buffer",
3208
+ docs: [
3209
+ "Buffer for additional fields"
3210
+ ],
3211
+ type: {
3212
+ array: [
3213
+ "u8",
3214
+ 32
3215
+ ]
3216
+ }
3217
+ }
3218
+ ]
3219
+ }
3220
+ },
3053
3221
  {
3054
3222
  name: "MerkleDistributor",
3055
3223
  docs: [
@@ -3342,10 +3510,18 @@ var merkle_distributor_default = {
3342
3510
  type: "u64"
3343
3511
  },
3344
3512
  {
3345
- name: "buffer_1",
3513
+ name: "kyc_config",
3346
3514
  docs: [
3347
3515
  "Buffers for additional fields"
3348
3516
  ],
3517
+ type: {
3518
+ defined: {
3519
+ name: "KycConfig"
3520
+ }
3521
+ }
3522
+ },
3523
+ {
3524
+ name: "buffer_1",
3349
3525
  type: {
3350
3526
  array: [
3351
3527
  "u8",
@@ -3361,6 +3537,15 @@ var merkle_distributor_default = {
3361
3537
  32
3362
3538
  ]
3363
3539
  }
3540
+ },
3541
+ {
3542
+ name: "buffer_3",
3543
+ type: {
3544
+ array: [
3545
+ "u8",
3546
+ 32
3547
+ ]
3548
+ }
3364
3549
  }
3365
3550
  ]
3366
3551
  }
@@ -3412,7 +3597,7 @@ var aligned_distributor_default = {
3412
3597
  address: "aMERKpFAWoChCi5oZwPvgsSCoGpZKBiU7fi76bdZjt2",
3413
3598
  metadata: {
3414
3599
  name: "aligned_distributor",
3415
- version: "1.9.0",
3600
+ version: "1.10.0",
3416
3601
  spec: "0.1.0",
3417
3602
  description: "Proxy for merkle distributor that updates Vesting duration according to token market performance."
3418
3603
  },
@@ -4680,6 +4865,69 @@ var aligned_distributor_default = {
4680
4865
  ]
4681
4866
  }
4682
4867
  },
4868
+ {
4869
+ name: "KycConfig",
4870
+ docs: [
4871
+ "Configuration for kyc-gated (claim) Airdrops."
4872
+ ],
4873
+ type: {
4874
+ kind: "struct",
4875
+ fields: [
4876
+ {
4877
+ name: "is_set",
4878
+ docs: [
4879
+ "Whether KYC is required to claim the Airdrop"
4880
+ ],
4881
+ type: "bool"
4882
+ },
4883
+ {
4884
+ name: "credential",
4885
+ docs: [
4886
+ "SAS Credential account used to create attestations"
4887
+ ],
4888
+ type: "pubkey"
4889
+ },
4890
+ {
4891
+ name: "schema",
4892
+ docs: [
4893
+ "SAS Schema account that attestation must conform to"
4894
+ ],
4895
+ type: "pubkey"
4896
+ },
4897
+ {
4898
+ name: "nonce_len",
4899
+ docs: [
4900
+ "Length of the custom nonce portion; zero means the claimant address is used directly."
4901
+ ],
4902
+ type: "u8"
4903
+ },
4904
+ {
4905
+ name: "nonce",
4906
+ docs: [
4907
+ 'Optional custom nonce portion used as sha256("claimant_address:nonce") for SAS attestation nonce.'
4908
+ ],
4909
+ type: {
4910
+ array: [
4911
+ "u8",
4912
+ 32
4913
+ ]
4914
+ }
4915
+ },
4916
+ {
4917
+ name: "buffer",
4918
+ docs: [
4919
+ "Buffer for additional fields"
4920
+ ],
4921
+ type: {
4922
+ array: [
4923
+ "u8",
4924
+ 32
4925
+ ]
4926
+ }
4927
+ }
4928
+ ]
4929
+ }
4930
+ },
4683
4931
  {
4684
4932
  name: "MerkleDistributor",
4685
4933
  docs: [
@@ -4972,10 +5220,18 @@ var aligned_distributor_default = {
4972
5220
  type: "u64"
4973
5221
  },
4974
5222
  {
4975
- name: "buffer_1",
5223
+ name: "kyc_config",
4976
5224
  docs: [
4977
5225
  "Buffers for additional fields"
4978
5226
  ],
5227
+ type: {
5228
+ defined: {
5229
+ name: "KycConfig"
5230
+ }
5231
+ }
5232
+ },
5233
+ {
5234
+ name: "buffer_1",
4979
5235
  type: {
4980
5236
  array: [
4981
5237
  "u8",
@@ -4991,6 +5247,15 @@ var aligned_distributor_default = {
4991
5247
  32
4992
5248
  ]
4993
5249
  }
5250
+ },
5251
+ {
5252
+ name: "buffer_3",
5253
+ type: {
5254
+ array: [
5255
+ "u8",
5256
+ 32
5257
+ ]
5258
+ }
4994
5259
  }
4995
5260
  ]
4996
5261
  }
@@ -5181,9 +5446,11 @@ var DISTRIBUTOR_PREFIX = Buffer.from("MerkleDistributor", "utf-8");
5181
5446
  var ALIGNED_DISTRIBUTOR_PREFIX = Buffer.from("aligned-distributor", "utf-8");
5182
5447
  var TEST_ORACLE_PREFIX = Buffer.from("test-oracle", "utf-8");
5183
5448
  var CLAIM_STATUS_PREFIX = Buffer.from("ClaimStatus", "utf-8");
5449
+ var ATTESTATION_PREFIX = Buffer.from("attestation", "utf-8");
5184
5450
  var ALIGNED_PRECISION_FACTOR_POW = 9;
5185
5451
  var AIRDROP_CLAIM_FEE = BigInt(1e7);
5186
5452
  var STREAMFLOW_TREASURY_PUBLIC_KEY = new web3_js.PublicKey("5SEpbdjFK5FxwTvfsGMXVQTD2v4M2c5tyRTxhdsPkgDw");
5453
+ var SOLANA_ATTESTATION_SERVICE_PROGRAM_ID = new web3_js.PublicKey("22zoJMtdu4tQc2PzL74ZUT7FrwgB1Udec8DdW4yw4BdG");
5187
5454
  var ONE_IN_BASIS_POINTS = BigInt(1e4);
5188
5455
  var SOL_FEE_PROGRAM_VERSION = 1;
5189
5456
  var ALIGNED_DISTRIBUTOR_PROGRAM_ID = {
@@ -5382,6 +5649,46 @@ function getClaimantStatusPda(programId, distributor, claimant) {
5382
5649
  const seeds = [CLAIM_STATUS_PREFIX, claimant.toBuffer(), distributor.toBuffer()];
5383
5650
  return web3_js.PublicKey.findProgramAddressSync(seeds, programId)[0];
5384
5651
  }
5652
+ function getKycNonceBytes(nonce) {
5653
+ if (nonce == null) {
5654
+ return null;
5655
+ }
5656
+ if (typeof nonce === "string") {
5657
+ return buffer.Buffer.from(nonce);
5658
+ }
5659
+ const nonceBytes = Array.from(nonce);
5660
+ for (const byte of nonceBytes) {
5661
+ if (!Number.isInteger(byte) || byte < 0 || byte > 255) {
5662
+ throw new Error("KYC nonce must contain only bytes");
5663
+ }
5664
+ }
5665
+ return buffer.Buffer.from(nonceBytes);
5666
+ }
5667
+ async function getAttestationNonce({
5668
+ claimant,
5669
+ nonce
5670
+ }) {
5671
+ const nonceBytes = getKycNonceBytes(nonce);
5672
+ if (!nonceBytes || nonceBytes.length === 0) {
5673
+ return claimant;
5674
+ }
5675
+ const hash = await globalThis.crypto.subtle.digest(
5676
+ "SHA-256",
5677
+ buffer.Buffer.concat([buffer.Buffer.from(`${claimant.toString()}:`), nonceBytes])
5678
+ );
5679
+ return new web3_js.PublicKey(new Uint8Array(hash));
5680
+ }
5681
+ function getAttestationPda({
5682
+ credential,
5683
+ schema,
5684
+ nonce,
5685
+ programId = SOLANA_ATTESTATION_SERVICE_PROGRAM_ID
5686
+ }) {
5687
+ return web3_js.PublicKey.findProgramAddressSync(
5688
+ [ATTESTATION_PREFIX, credential.toBuffer(), schema.toBuffer(), nonce.toBuffer()],
5689
+ programId
5690
+ )[0];
5691
+ }
5385
5692
  function getEventAuthorityPda(programId) {
5386
5693
  const seeds = [buffer.Buffer.from("__event_authority")];
5387
5694
  return web3_js.PublicKey.findProgramAddressSync(seeds, programId)[0];
@@ -5591,29 +5898,45 @@ var BaseDistributorClient = class {
5591
5898
  extParams.invoker.publicKey
5592
5899
  );
5593
5900
  const claimStatus = await this.getClaim(claimStatusPublicKey);
5594
- if (!claimStatus) {
5595
- ixs.push(
5596
- await this.merkleDistributorProgram.methods.newClaim(new BN__default.default(data.amountUnlocked), new BN__default.default(data.amountLocked), data.proof).accounts({
5597
- distributor: distributorPublicKey,
5598
- to: invokerTokens,
5901
+ let attestation = data.attestation;
5902
+ if (!attestation && distributor.kycConfig.isSet) {
5903
+ attestation = getAttestationPda({
5904
+ credential: distributor.kycConfig.credential,
5905
+ schema: distributor.kycConfig.schema,
5906
+ nonce: await getAttestationNonce({
5599
5907
  claimant: extParams.invoker.publicKey,
5600
- tokenProgram: tokenProgramId,
5601
- program: this.programId
5602
- }).instruction()
5603
- );
5908
+ nonce: distributor.kycConfig.nonce.slice(0, distributor.kycConfig.nonceLen)
5909
+ })
5910
+ });
5911
+ }
5912
+ const remainingAccounts = this.getClaimRemainingAccounts(data, attestation);
5913
+ if (!claimStatus) {
5914
+ let newClaimMethod = this.merkleDistributorProgram.methods.newClaim(new BN__default.default(data.amountUnlocked), new BN__default.default(data.amountLocked), data.proof).accounts({
5915
+ distributor: distributorPublicKey,
5916
+ to: invokerTokens,
5917
+ claimant: extParams.invoker.publicKey,
5918
+ tokenProgram: tokenProgramId,
5919
+ program: this.programId
5920
+ });
5921
+ if (remainingAccounts.length > 0) {
5922
+ newClaimMethod = newClaimMethod.remainingAccounts(remainingAccounts);
5923
+ }
5924
+ ixs.push(await newClaimMethod.instruction());
5604
5925
  }
5605
5926
  const nowTs = new BN__default.default(Math.floor(Date.now() / 1e3));
5606
5927
  if (claimStatus || new BN__default.default(data.amountLocked).gtn(0) && nowTs.sub(distributor.startTs).gte(distributor.unlockPeriod)) {
5607
5928
  const claimMethod = distributor.programVersion >= SOL_FEE_PROGRAM_VERSION ? this.merkleDistributorProgram.methods.claimLockedV2 : this.merkleDistributorProgram.methods.claimLocked;
5608
- ixs.push(
5609
- await claimMethod().accounts({
5610
- distributor: distributorPublicKey,
5611
- to: invokerTokens,
5612
- claimant: extParams.invoker.publicKey,
5613
- tokenProgram: tokenProgramId,
5614
- program: this.programId
5615
- }).instruction()
5616
- );
5929
+ let claimLockedMethod = claimMethod().accounts({
5930
+ distributor: distributorPublicKey,
5931
+ to: invokerTokens,
5932
+ claimant: extParams.invoker.publicKey,
5933
+ tokenProgram: tokenProgramId,
5934
+ program: this.programId
5935
+ });
5936
+ if (remainingAccounts.length > 0) {
5937
+ claimLockedMethod = claimLockedMethod.remainingAccounts(remainingAccounts);
5938
+ }
5939
+ ixs.push(await claimLockedMethod.instruction());
5617
5940
  }
5618
5941
  if (distributor.programVersion >= SOL_FEE_PROGRAM_VERSION) {
5619
5942
  return ixs;
@@ -5692,6 +6015,78 @@ var BaseDistributorClient = class {
5692
6015
  );
5693
6016
  return ixs;
5694
6017
  }
6018
+ async enableKyc(data, extParams) {
6019
+ const executionParams = this.unwrapExecutionParams(extParams);
6020
+ const invoker = executionParams.invoker.publicKey;
6021
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
6022
+ const ixs = await common.createAndEstimateTransaction(
6023
+ (params) => this.prepareEnableKycInstructions(data, params),
6024
+ executionParams
6025
+ );
6026
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
6027
+ const signature = await wrappedSignAndExecuteTransaction(
6028
+ this.connection,
6029
+ executionParams.invoker,
6030
+ tx,
6031
+ {
6032
+ hash,
6033
+ context,
6034
+ commitment: this.getCommitment()
6035
+ },
6036
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
6037
+ );
6038
+ return { ixs, txId: signature };
6039
+ }
6040
+ async prepareEnableKycInstructions(data, extParams) {
6041
+ if (!extParams.invoker.publicKey) {
6042
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
6043
+ }
6044
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
6045
+ ixs.push(
6046
+ await this.merkleDistributorProgram.methods.enableKyc(getKycNonceBytes(data.nonce)).accounts({
6047
+ distributor: common.pk(data.id),
6048
+ admin: extParams.invoker.publicKey,
6049
+ credential: common.pk(data.credential),
6050
+ schema: common.pk(data.schema)
6051
+ }).instruction()
6052
+ );
6053
+ return ixs;
6054
+ }
6055
+ async disableKyc(data, extParams) {
6056
+ const executionParams = this.unwrapExecutionParams(extParams);
6057
+ const invoker = executionParams.invoker.publicKey;
6058
+ common.invariant(invoker, "Invoker's PublicKey is not available, check passed wallet adapter!");
6059
+ const ixs = await common.createAndEstimateTransaction(
6060
+ (params) => this.prepareDisableKycInstructions(data, params),
6061
+ executionParams
6062
+ );
6063
+ const { tx, hash, context } = await common.prepareTransaction(this.connection, ixs, invoker);
6064
+ const signature = await wrappedSignAndExecuteTransaction(
6065
+ this.connection,
6066
+ executionParams.invoker,
6067
+ tx,
6068
+ {
6069
+ hash,
6070
+ context,
6071
+ commitment: this.getCommitment()
6072
+ },
6073
+ { sendThrottler: this.sendThrottler, skipSimulation: executionParams.skipSimulation }
6074
+ );
6075
+ return { ixs, txId: signature };
6076
+ }
6077
+ async prepareDisableKycInstructions(data, extParams) {
6078
+ if (!extParams.invoker.publicKey) {
6079
+ throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
6080
+ }
6081
+ const ixs = common.prepareBaseInstructions(this.connection, extParams);
6082
+ ixs.push(
6083
+ await this.merkleDistributorProgram.methods.disableKyc().accounts({
6084
+ distributor: common.pk(data.id),
6085
+ admin: extParams.invoker.publicKey
6086
+ }).instruction()
6087
+ );
6088
+ return ixs;
6089
+ }
5695
6090
  async prepareClawbackInstructions(data, extParams) {
5696
6091
  if (!extParams.invoker.publicKey) {
5697
6092
  throw new Error("Invoker's PublicKey is not available, check passed wallet adapter!");
@@ -5828,6 +6223,11 @@ var BaseDistributorClient = class {
5828
6223
  async getClaim(claimStatus) {
5829
6224
  return this.connection.getAccountInfo(common.pk(claimStatus)).then((account) => this.decodeClaimStatus(account));
5830
6225
  }
6226
+ async getKycConfig(distributor) {
6227
+ const distributorAccount = await this.merkleDistributorProgram.account.merkleDistributor.fetch(common.pk(distributor));
6228
+ common.invariant(distributorAccount, "Distributor account not found");
6229
+ return distributorAccount.kycConfig;
6230
+ }
5831
6231
  async getClaims(data) {
5832
6232
  const claimStatusPublicKeys = data.map(({ id, recipient }) => {
5833
6233
  return getClaimantStatusPda(this.programId, new web3_js.PublicKey(id), new web3_js.PublicKey(recipient));
@@ -5919,6 +6319,25 @@ var BaseDistributorClient = class {
5919
6319
  unwrapExecutionParams(extParams) {
5920
6320
  return common.unwrapExecutionParams(extParams, this.connection);
5921
6321
  }
6322
+ /**
6323
+ * Claim support multiple remaining accounts:
6324
+ * - attestation when an Airdrop requires a KYC;
6325
+ * - partner link accounts for custom fee derivation;
6326
+ */
6327
+ getClaimRemainingAccounts(data, attestation) {
6328
+ const remainingAccounts = [];
6329
+ if (attestation) {
6330
+ remainingAccounts.push({ pubkey: common.pk(attestation), isSigner: false, isWritable: false });
6331
+ }
6332
+ if (data.partnerLink) {
6333
+ remainingAccounts.push({
6334
+ pubkey: common.pk(data.partnerLink.address),
6335
+ isSigner: data.partnerLink.isSigner,
6336
+ isWritable: false
6337
+ });
6338
+ }
6339
+ return remainingAccounts;
6340
+ }
5922
6341
  decodeClaimStatus(account) {
5923
6342
  if (!account) {
5924
6343
  return null;