Skip to content

Commit 501014d

Browse files
committed
refactor: eliminate explicit variable
Since it's only used in one place we can inline.
1 parent 0193b79 commit 501014d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/client.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ export class HypercertClient implements HypercertClientInterface {
161161
mintHypercert = async ({ metaData, totalUnits, transferRestriction, allowList, overrides }: MintParams) => {
162162
const { account } = this.getConnected();
163163

164-
let root;
165164
let tree;
166165

167166
if (allowList) {
@@ -189,10 +188,13 @@ export class HypercertClient implements HypercertClientInterface {
189188

190189
allowListEntries = lines.map((line) => {
191190
const values = line.split(",");
192-
const entry = headers.reduce((acc, header, i) => {
193-
acc[header] = values[i];
194-
return acc;
195-
}, {} as Record<string, string>);
191+
const entry = headers.reduce(
192+
(acc, header, i) => {
193+
acc[header] = values[i];
194+
return acc;
195+
},
196+
{} as Record<string, string>,
197+
);
196198
const { address, units } = entry;
197199
return { address, units: BigInt(units) };
198200
});
@@ -206,8 +208,6 @@ export class HypercertClient implements HypercertClientInterface {
206208
if (!tree) {
207209
throw new ClientError("Invalid or no contents found for the provided allow list", { allowList });
208210
}
209-
210-
root = tree.root;
211211
}
212212

213213
if (allowList && !tree) {
@@ -236,7 +236,7 @@ export class HypercertClient implements HypercertClientInterface {
236236
const method = allowList && tree ? "createAllowlist" : "mintClaim";
237237
const params =
238238
allowList && tree
239-
? [account?.address, totalUnits, root, cid, transferRestriction]
239+
? [account?.address, totalUnits, tree.root, cid, transferRestriction]
240240
: [account?.address, totalUnits, cid, transferRestriction];
241241

242242
const request = await this.simulateRequest(account, method, params, overrides);

0 commit comments

Comments
 (0)