@chipi-stack/backend 14.10.0 → 14.11.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.
- package/dist/index.d.mts +64 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2858,6 +2858,42 @@ var ChipiTreasury = class {
|
|
|
2858
2858
|
}
|
|
2859
2859
|
return token;
|
|
2860
2860
|
}
|
|
2861
|
+
/**
|
|
2862
|
+
* List every treasury owned by the api key's organization (`sk_`).
|
|
2863
|
+
*
|
|
2864
|
+
* This is the discovery entry point for {@link ForTreasuryConfig.treasuryId}.
|
|
2865
|
+
* The secret key resolves the org server-side, so there is no org id to
|
|
2866
|
+
* pass and nothing to look up in the dashboard first. Use it to recover a
|
|
2867
|
+
* `treasuryId` that fell out of your config, or to avoid pinning one in an
|
|
2868
|
+
* environment variable at all.
|
|
2869
|
+
*
|
|
2870
|
+
* Server-only: it needs a `sk_`, so never call it from the browser.
|
|
2871
|
+
*
|
|
2872
|
+
* @example
|
|
2873
|
+
* ```typescript
|
|
2874
|
+
* const { items } = await sdk.treasury.list();
|
|
2875
|
+
* const ops = items.find((t) => t.name === "Ops Treasury");
|
|
2876
|
+
* const transport = sdk.treasury.forTreasury({
|
|
2877
|
+
* treasuryId: ops.id,
|
|
2878
|
+
* ownerPubkey,
|
|
2879
|
+
* });
|
|
2880
|
+
* ```
|
|
2881
|
+
*/
|
|
2882
|
+
async list(options = {}) {
|
|
2883
|
+
const { page, limit, includeArchived, bearerToken } = options;
|
|
2884
|
+
const params = {};
|
|
2885
|
+
if (page !== void 0) params.page = String(page);
|
|
2886
|
+
if (limit !== void 0) params.limit = String(limit);
|
|
2887
|
+
if (includeArchived !== void 0) {
|
|
2888
|
+
params.includeArchived = String(includeArchived);
|
|
2889
|
+
}
|
|
2890
|
+
const res = await this.client.get({
|
|
2891
|
+
endpoint: API_ENDPOINTS.TREASURIES,
|
|
2892
|
+
params,
|
|
2893
|
+
bearerToken: this.secret(bearerToken)
|
|
2894
|
+
});
|
|
2895
|
+
return { ...res, items: res.items ?? [] };
|
|
2896
|
+
}
|
|
2861
2897
|
/**
|
|
2862
2898
|
* Build a {@link TreasuryTransport} for one treasury + owner. Wire the
|
|
2863
2899
|
* returned object directly into chipi-react's `useProposeAction` /
|