on master help sign in
release: early-out if there is no linear batch
29f4a14fang
src/lib/starRelease.js+5−1
@@ -114,9 +114,13 @@ export async function getConditional(contracts, address) {
114}
114}
115
115
116export async function getLinear(contracts, address) {
116export async function getLinear(contracts, address) {
117+ const batch = await linearSR.getBatch(contracts, address);
118+ if (batch.amount === 0) {
119+ return { available: 0, withdrawn: 0, total: 0 };
120+ }
121+
117 const remaining = (await linearSR.getRemainingStars(contracts, address))
122 const remaining = (await linearSR.getRemainingStars(contracts, address))
118 .length;
123 .length;
119− const batch = await linearSR.getBatch(contracts, address);
120 const { amount, withdrawn } = batch;
124 const { amount, withdrawn } = batch;
121
125
122 const limit = await linearSR.getWithdrawLimit(contracts, address);
126 const limit = await linearSR.getWithdrawLimit(contracts, address);