@chipi-stack/backend 14.10.1 → 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 CHANGED
@@ -387,6 +387,47 @@ interface MultisigAllowance {
387
387
  canExecuteNow?: boolean;
388
388
  [key: string]: unknown;
389
389
  }
390
+ /** One treasury as returned by `list()`. Mirrors chipi-back's `OrgTreasury`
391
+ * row plus the joined wallet projection. Dates arrive as ISO strings. */
392
+ interface TreasurySummary {
393
+ /** The id `forTreasury({ treasuryId })` expects. */
394
+ id: string;
395
+ organizationId: string;
396
+ name: string;
397
+ walletId: string;
398
+ createdAt: string;
399
+ updatedAt: string;
400
+ /** Non-null once archived. Archived treasuries are excluded unless
401
+ * `includeArchived` is set. */
402
+ archivedAt: string | null;
403
+ routineQuorum: number | null;
404
+ sensitiveQuorum: number | null;
405
+ wallet: {
406
+ id: string;
407
+ publicKey: string;
408
+ walletType: string;
409
+ isDeployed: boolean;
410
+ chain: string;
411
+ };
412
+ }
413
+ /** Page of treasuries owned by the api key's org. */
414
+ interface ListTreasuriesResult {
415
+ items: TreasurySummary[];
416
+ total: number;
417
+ page: number;
418
+ limit: number;
419
+ hasMore: boolean;
420
+ }
421
+ interface ListTreasuriesOptions {
422
+ /** 1-based. Defaults to 1 server-side. */
423
+ page?: number;
424
+ /** Server clamps to 1..100; defaults to 25. */
425
+ limit?: number;
426
+ /** Include archived treasuries. Defaults to false. */
427
+ includeArchived?: boolean;
428
+ /** A `sk_`. Falls back to the SDK's configured `apiSecretKey`. */
429
+ bearerToken?: string;
430
+ }
390
431
  /**
391
432
  * A transport bound to one treasury + the local owner's public key.
392
433
  * Structurally compatible with `@chipi-stack/chipi-react`'s `MultisigTransport`.
@@ -431,6 +472,28 @@ declare class ChipiTreasury {
431
472
  private base;
432
473
  /** Resolve a `sk_` for the secret-gated reads/execute, or fail loudly. */
433
474
  private secret;
475
+ /**
476
+ * List every treasury owned by the api key's organization (`sk_`).
477
+ *
478
+ * This is the discovery entry point for {@link ForTreasuryConfig.treasuryId}.
479
+ * The secret key resolves the org server-side, so there is no org id to
480
+ * pass and nothing to look up in the dashboard first. Use it to recover a
481
+ * `treasuryId` that fell out of your config, or to avoid pinning one in an
482
+ * environment variable at all.
483
+ *
484
+ * Server-only: it needs a `sk_`, so never call it from the browser.
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const { items } = await sdk.treasury.list();
489
+ * const ops = items.find((t) => t.name === "Ops Treasury");
490
+ * const transport = sdk.treasury.forTreasury({
491
+ * treasuryId: ops.id,
492
+ * ownerPubkey,
493
+ * });
494
+ * ```
495
+ */
496
+ list(options?: ListTreasuriesOptions): Promise<ListTreasuriesResult>;
434
497
  /**
435
498
  * Build a {@link TreasuryTransport} for one treasury + owner. Wire the
436
499
  * returned object directly into chipi-react's `useProposeAction` /
@@ -2572,4 +2635,4 @@ declare class ShhhAccount {
2572
2635
  */
2573
2636
  declare function submitViaAccount(funded: Account): ShhhSubmit;
2574
2637
 
2575
- export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type MultisigAllowance, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryProposal, type TreasuryProposalSignature, type TreasuryTransport, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
2638
+ export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, type ListTreasuriesOptions, type ListTreasuriesResult, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type MultisigAllowance, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryProposal, type TreasuryProposalSignature, type TreasurySummary, type TreasuryTransport, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
package/dist/index.d.ts CHANGED
@@ -387,6 +387,47 @@ interface MultisigAllowance {
387
387
  canExecuteNow?: boolean;
388
388
  [key: string]: unknown;
389
389
  }
390
+ /** One treasury as returned by `list()`. Mirrors chipi-back's `OrgTreasury`
391
+ * row plus the joined wallet projection. Dates arrive as ISO strings. */
392
+ interface TreasurySummary {
393
+ /** The id `forTreasury({ treasuryId })` expects. */
394
+ id: string;
395
+ organizationId: string;
396
+ name: string;
397
+ walletId: string;
398
+ createdAt: string;
399
+ updatedAt: string;
400
+ /** Non-null once archived. Archived treasuries are excluded unless
401
+ * `includeArchived` is set. */
402
+ archivedAt: string | null;
403
+ routineQuorum: number | null;
404
+ sensitiveQuorum: number | null;
405
+ wallet: {
406
+ id: string;
407
+ publicKey: string;
408
+ walletType: string;
409
+ isDeployed: boolean;
410
+ chain: string;
411
+ };
412
+ }
413
+ /** Page of treasuries owned by the api key's org. */
414
+ interface ListTreasuriesResult {
415
+ items: TreasurySummary[];
416
+ total: number;
417
+ page: number;
418
+ limit: number;
419
+ hasMore: boolean;
420
+ }
421
+ interface ListTreasuriesOptions {
422
+ /** 1-based. Defaults to 1 server-side. */
423
+ page?: number;
424
+ /** Server clamps to 1..100; defaults to 25. */
425
+ limit?: number;
426
+ /** Include archived treasuries. Defaults to false. */
427
+ includeArchived?: boolean;
428
+ /** A `sk_`. Falls back to the SDK's configured `apiSecretKey`. */
429
+ bearerToken?: string;
430
+ }
390
431
  /**
391
432
  * A transport bound to one treasury + the local owner's public key.
392
433
  * Structurally compatible with `@chipi-stack/chipi-react`'s `MultisigTransport`.
@@ -431,6 +472,28 @@ declare class ChipiTreasury {
431
472
  private base;
432
473
  /** Resolve a `sk_` for the secret-gated reads/execute, or fail loudly. */
433
474
  private secret;
475
+ /**
476
+ * List every treasury owned by the api key's organization (`sk_`).
477
+ *
478
+ * This is the discovery entry point for {@link ForTreasuryConfig.treasuryId}.
479
+ * The secret key resolves the org server-side, so there is no org id to
480
+ * pass and nothing to look up in the dashboard first. Use it to recover a
481
+ * `treasuryId` that fell out of your config, or to avoid pinning one in an
482
+ * environment variable at all.
483
+ *
484
+ * Server-only: it needs a `sk_`, so never call it from the browser.
485
+ *
486
+ * @example
487
+ * ```typescript
488
+ * const { items } = await sdk.treasury.list();
489
+ * const ops = items.find((t) => t.name === "Ops Treasury");
490
+ * const transport = sdk.treasury.forTreasury({
491
+ * treasuryId: ops.id,
492
+ * ownerPubkey,
493
+ * });
494
+ * ```
495
+ */
496
+ list(options?: ListTreasuriesOptions): Promise<ListTreasuriesResult>;
434
497
  /**
435
498
  * Build a {@link TreasuryTransport} for one treasury + owner. Wire the
436
499
  * returned object directly into chipi-react's `useProposeAction` /
@@ -2572,4 +2635,4 @@ declare class ShhhAccount {
2572
2635
  */
2573
2636
  declare function submitViaAccount(funded: Account): ShhhSubmit;
2574
2637
 
2575
- export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type MultisigAllowance, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryProposal, type TreasuryProposalSignature, type TreasuryTransport, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
2638
+ export { ANY_CALLER_FELT, APPLE_ISSUER, type AppleTokenResponse, type ApproveBody, BOOTSTRAP_DOMAIN_SEPARATOR, type BootstrapMessageParams, type BuildBootstrapSignedCallParams, type BuildMigrationCallsParams, ChipiBrowserSDK, ChipiClient, ChipiPaymasterAdapter, ChipiSDK, ChipiServerSDK, ChipiSessions, ChipiSkuPurchases, ChipiSkus, ChipiTransactions, ChipiTreasury, ChipiWallets, type ComputeAddressInput, DEFAULT_OP_EXPIRY_SECONDS, type Eip191Pubkey, type ExecuteResult, type ForTreasuryConfig, ISIGNER_CANONICAL_LABEL, ISIGNER_ID, ISRC9_V2_ID, type JwtAppleSubPubkey, type ListTreasuriesOptions, type ListTreasuriesResult, MAX_OE_VALIDITY_WINDOW_SECONDS, MIN_THRESHOLD_OWNERS, type MultisigAllowance, type NewOwnerInput, OE_DOMAIN_NAME, OE_DOMAIN_REVISION, OE_DOMAIN_VERSION, OP_ADD_OWNER, OP_REMOVE_OWNER, OP_ROTATE_OWNER, OP_SET_THRESHOLD, type OutsideExecution, type OwnerRole, type ProposeBody, ROLE_GUARDIAN, ROLE_OWNER, SIG_VERSION_V1_HEX_ASCII, SIG_VERSION_V2_SNIP12, SIG_VERSION_V2_THRESHOLD, STARKNET_MESSAGE_PREFIX, ShhhAccount, type ShhhAccountOptions, type ShhhExecuteOptions, type ShhhSignedExecution, type ShhhSubmit, type ShhhX402Wallet, TIMELOCK_SECONDS, type TreasuryProposal, type TreasuryProposalSignature, type TreasurySummary, type TreasuryTransport, VIEW_SELECTORS, type WebAuthnPubkey, X402Facilitator, type X402FacilitatorCreateOptions, type X402MiddlewareConfig, type X402MiddlewareFlatConfig, X402ShhhClient, type X402ShhhClientConfig, assertValidV2Snip12Envelope, buildBootstrapSignedCall, buildCancelPendingOpCall, buildCancelRecoveryCall, buildEd25519Envelope, buildEd25519EnvelopeFromSignature, buildEip191EnvelopeFromPrivateKey, buildEip191EnvelopeFromSignature, buildExecuteAddOwnerCall, buildExecuteRemoveOwnerCall, buildExecuteRotateOwnerCall, buildExecuteSetThresholdCall, buildFinalizeRecoveryCall, buildInitiateRecoveryCall, buildJwtAppleSubEnvelopeFromTestKey, buildJwtAppleSubEnvelopeFromTokenResponse, buildMigrationCalls, buildOutsideExecution, buildProposeAddOwnerCall, buildProposeRemoveOwnerCall, buildProposeRotateOwnerCall, buildProposeSetThresholdCall, buildStarkEnvelope, buildThresholdEnvelope, buildWebAuthnEnvelopeFromAssertion, buildWebAuthnEnvelopeFromPrivateKey, byteArrayToFelts, computeAddressSalt, computeBootstrapMessage, computeISignerId, computeOeHash, computeShhhAddress, computeSnip12Hash, decryptPrivateKey, ed25519OwnerId, ed25519OwnerPubkeyParam, ed25519PubkeyFelts, ed25519SignedBytes, eip191OwnerId, eip191OwnerPubkeyParam, eip191PubkeyFelts, encryptPrivateKey, estimateThresholdGasOverhead, executeShhhSponsoredRaw, hashCall, hashCalls, hashOutsideExecutionStruct, hashStarknetDomain, isReadyToExecute, jwtAppleSubHash, jwtAppleSubOwnerId, jwtAppleSubPubkeyFelts, labelToFelt, locateSubClaim, messageHashToNonceB64url, ownerCommitment, parseAppleIdToken, parseDerEcdsaSignature, parseEip191Signature, parseThresholdEnvelope, resolveShhhChainId, secondsUntilExecutable, serializeExecuteFromOutsideV2Calldata, signBootstrapMessage, signTypedData, signTypedDataArray, snip12HashToHexAsciiBytes, starkOwnerId, starkPubkeyFelts, submitViaAccount, webauthnOwnerId, webauthnOwnerPubkeyParam, webauthnPubkeyFelts, wrapV2Snip12Envelope, wrapV2ThresholdEnvelope, x402Middleware };
package/dist/index.js CHANGED
@@ -2863,6 +2863,42 @@ var ChipiTreasury = class {
2863
2863
  }
2864
2864
  return token;
2865
2865
  }
2866
+ /**
2867
+ * List every treasury owned by the api key's organization (`sk_`).
2868
+ *
2869
+ * This is the discovery entry point for {@link ForTreasuryConfig.treasuryId}.
2870
+ * The secret key resolves the org server-side, so there is no org id to
2871
+ * pass and nothing to look up in the dashboard first. Use it to recover a
2872
+ * `treasuryId` that fell out of your config, or to avoid pinning one in an
2873
+ * environment variable at all.
2874
+ *
2875
+ * Server-only: it needs a `sk_`, so never call it from the browser.
2876
+ *
2877
+ * @example
2878
+ * ```typescript
2879
+ * const { items } = await sdk.treasury.list();
2880
+ * const ops = items.find((t) => t.name === "Ops Treasury");
2881
+ * const transport = sdk.treasury.forTreasury({
2882
+ * treasuryId: ops.id,
2883
+ * ownerPubkey,
2884
+ * });
2885
+ * ```
2886
+ */
2887
+ async list(options = {}) {
2888
+ const { page, limit, includeArchived, bearerToken } = options;
2889
+ const params = {};
2890
+ if (page !== void 0) params.page = String(page);
2891
+ if (limit !== void 0) params.limit = String(limit);
2892
+ if (includeArchived !== void 0) {
2893
+ params.includeArchived = String(includeArchived);
2894
+ }
2895
+ const res = await this.client.get({
2896
+ endpoint: shared.API_ENDPOINTS.TREASURIES,
2897
+ params,
2898
+ bearerToken: this.secret(bearerToken)
2899
+ });
2900
+ return { ...res, items: res.items ?? [] };
2901
+ }
2866
2902
  /**
2867
2903
  * Build a {@link TreasuryTransport} for one treasury + owner. Wire the
2868
2904
  * returned object directly into chipi-react's `useProposeAction` /