From 2b8dda8df21cdcd91893fa982986b9a7c5f6955f Mon Sep 17 00:00:00 2001 From: janniks Date: Mon, 24 Jul 2023 20:28:52 +0200 Subject: [PATCH] docs: add pc builder tsdoc --- packages/transactions/src/index.ts | 16 ++++++++++++++++ packages/transactions/src/pc.ts | 9 +++++++++ 2 files changed, 25 insertions(+) diff --git a/packages/transactions/src/index.ts b/packages/transactions/src/index.ts index c00333128..9a8f1603a 100644 --- a/packages/transactions/src/index.ts +++ b/packages/transactions/src/index.ts @@ -30,6 +30,22 @@ export { isTokenTransferPayload, serializePayload, } from './payload'; +/** + * ### `Pc.` Post Condition Builder + * @beta Interface may be subject to change in future releases. + * + * The Pc namespace is provided as a convenience to build post conditions. + * The pattern chains methods together to build a post condition. + * `PRINCIPAL -> [AMOUNT] -> CODE -> ASSET` + * + * The builder starts with the {@link Pc.principal} method. + * + * @example + * ``` + * import { Pc } from '@stacks/transactions'; + * Pc.principal('STB44HYPYAT2BB2QE513NSP81HTMYWBJP02HPGK6').willSendEq(100).stx(); + * ``` + */ export * as Pc from './pc'; export { createFungiblePostCondition, diff --git a/packages/transactions/src/pc.ts b/packages/transactions/src/pc.ts index 8ed151e56..e3673a44e 100644 --- a/packages/transactions/src/pc.ts +++ b/packages/transactions/src/pc.ts @@ -55,6 +55,9 @@ export function principal(principal: AddressString | ContractIdString) { return new PartialPcWithPrincipal(principal, undefined); } +/** + * Not meant to be used directly. Start from `Pc.principal(…)` instead. + */ class PartialPcWithPrincipal { constructor(private address: string, private contractName?: string) {} @@ -192,6 +195,9 @@ class PartialPcWithPrincipal { } } +/** + * Not meant to be used directly. Start from `Pc.principal(…)` instead. + */ class PartialPcFtWithCode { constructor( private address: string, @@ -236,6 +242,9 @@ class PartialPcFtWithCode { } } +/** + * Not meant to be used directly. Start from `Pc.principal(…)` instead. + */ class PartialPcNftWithCode { constructor( private principal: string,