@thecorporation/corp-tools 26.3.35 → 26.3.37

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/index.js CHANGED
@@ -2744,11 +2744,35 @@ async function issueEquity(client, args) {
2744
2744
  steps
2745
2745
  };
2746
2746
  }
2747
- const instrument = resolveInstrumentForGrant2(
2748
- instruments,
2749
- args.grantType,
2750
- args.instrumentId
2751
- );
2747
+ let instrument;
2748
+ try {
2749
+ instrument = resolveInstrumentForGrant2(
2750
+ instruments,
2751
+ args.grantType,
2752
+ args.instrumentId
2753
+ );
2754
+ } catch (resolveErr) {
2755
+ const kinds = expectedInstrumentKinds2(args.grantType);
2756
+ if (kinds.includes("option_grant") && !args.instrumentId) {
2757
+ const issuerLegalEntityId2 = capTable.issuer_legal_entity_id;
2758
+ if (!issuerLegalEntityId2) throw resolveErr;
2759
+ const created = await client.createInstrument({
2760
+ entity_id: args.entityId,
2761
+ issuer_legal_entity_id: issuerLegalEntityId2,
2762
+ kind: "option_grant",
2763
+ symbol: "OPTION-PLAN",
2764
+ authorized_units: 1e7
2765
+ });
2766
+ instrument = created;
2767
+ steps.push({
2768
+ name: "auto_create_instrument",
2769
+ status: "ok",
2770
+ detail: `Auto-created option_grant instrument OPTION-PLAN`
2771
+ });
2772
+ } else {
2773
+ throw resolveErr;
2774
+ }
2775
+ }
2752
2776
  const instrumentId = instrument.instrument_id;
2753
2777
  steps.push({
2754
2778
  name: "resolve_instrument",