Skip to content

Commit

Permalink
docs: add pc builder tsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
janniks committed Jul 24, 2023
1 parent 3c819c2 commit 2b8dda8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/transactions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions packages/transactions/src/pc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand Down Expand Up @@ -192,6 +195,9 @@ class PartialPcWithPrincipal {
}
}

/**
* Not meant to be used directly. Start from `Pc.principal(…)` instead.
*/
class PartialPcFtWithCode {
constructor(
private address: string,
Expand Down Expand Up @@ -236,6 +242,9 @@ class PartialPcFtWithCode {
}
}

/**
* Not meant to be used directly. Start from `Pc.principal(…)` instead.
*/
class PartialPcNftWithCode {
constructor(
private principal: string,
Expand Down

0 comments on commit 2b8dda8

Please sign in to comment.