> ## Documentation Index
> Fetch the complete documentation index at: https://trust-link-tsn.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# tcap-gpru-credit API

> Source-derived exports, parameter and result types, public methods and source links.

This reference is generated from the checked-out TypeScript exports. Types and signatures describe the package contract; source presence does not establish deployment or service availability. Error expressions below are direct throws, not an exhaustive list of failures from dependencies.

[Source module](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts). See the [reference index](https://trust-link-tsn.mintlify.site/sdk/api-reference.md) for package import boundaries and verification scope.

## assertSignedTcapGpruWalletDepositTransaction

Check the wallet's signed deposit before attachment to the same intent, without rewriting its approved bytes.

Import from `@trustlink/tsn-sdk`. [Implementation, line 134](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L134).

```ts theme={null}
assertSignedTcapGpruWalletDepositTransaction(wire: Uint8Array, fields: Parameters<typeof buildTcapGpruWalletDepositTransaction>[0], blockhashContext: SenderFundingBlockhashContext): void
```

Direct failure expressions:

```text theme={null}
new Error("TCAP_SIGNED_DEPOSIT_WIRE_INVALID")
new Error("TCAP_SIGNED_DEPOSIT_OWNER_SIGNATURE_INVALID")
new Error("TCAP_SIGNED_DEPOSIT_BLOCKHASH_DIFFERS_FROM_ISSUANCE")
new Error("TCAP_SIGNED_DEPOSIT_COUNT_INVALID")
new Error("TCAP_SIGNED_DEPOSIT_DIFFERS_FROM_APPROVAL")
new Error("TCAP_SIGNED_DEPOSIT_EXTRA_INSTRUCTION_INVALID")
new Error("TCAP_SIGNED_DEPOSIT_COMPUTE_BUDGET_INVALID")
```

## buildTcapAccountCreditEpochV1Instruction

Aggregate accounting has no Memo and changes liabilities once for a complete verified epoch.

Import from `@trustlink/tsn-sdk`. [Implementation, line 232](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L232).

```ts theme={null}
buildTcapAccountCreditEpochV1Instruction(f: { authority: PublicKey; mother: PublicKey; config: PublicKey; assetEntry: PublicKey; reserveState: PublicKey; epoch: PublicKey; total: bigint; proof: GpruTcapEpochProofV1; }): TransactionInstruction
```

Direct failure expressions:

```text theme={null}
new Error("INVALID_CREDIT_EPOCH_TOTAL_OR_PROOF")
```

## buildTcapGpruWalletDepositTransaction

Builds only the sender-signed reserve deposit. TIP settlement is Node-owned.

Import from `@trustlink/tsn-sdk`. [Implementation, line 105](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L105).

```ts theme={null}
buildTcapGpruWalletDepositTransaction(fields: { accounts: TcapGpruDepositAccounts; amountBaseUnits: bigint; fundingNoteCommitment: string; }): Transaction
```

Direct failure expressions:

```text theme={null}
new Error("TCAP_DEPOSIT_AMOUNT_MUST_BE_POSITIVE_U64")
new Error("TCAP_FUNDING_ROOT_NOT_CANONICAL")
```

## buildTsnTinCreditV1Instruction

Mother-authorized memo credit, fenced by TCAP's shared settlement root.

Import from `@trustlink/tsn-sdk`. [Implementation, line 184](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L184).

```ts theme={null}
buildTsnTinCreditV1Instruction(fields: { authority: PublicKey; motherEscrow: PublicKey; tcapProgramId?: PublicKey; commitmentRoot: PublicKey; assetEntry: PublicKey; reserveState: PublicKey; config: PublicKey; tipRouteRoot: PublicKey; fundingRootAccount: PublicKey; accountingEpoch: PublicKey; gpruVerifier: PublicKey; instructions?: PublicKey; gpruProgramId?: PublicKey; authorizationDigest: string; validAfterSlot: string | bigint; expiresAtSlot: string | bigint; previousTcapRoot: string; tcapRootSequence: string | bigint; tokenId: number; amountCommitment: string; nullifier: string; proof: GpruHiddenHeadProofV2; }): TransactionInstruction
```

Direct failure expressions:

```text theme={null}
new Error("PRIVATE_CREDIT_PROOF_ACTION_MISMATCH")
new Error("TCAP_FUNDING_ROOT_NOT_CANONICAL")
new Error("TCAP_CONFIG_NOT_CANONICAL")
```

## GPRU\_PROGRAM\_ID

Import from `@trustlink/tsn-sdk`. [Implementation, line 12](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L12).

```ts theme={null}
PublicKey
```

## GPRU\_TCAP\_PROGRAM\_ID

Import from `@trustlink/tsn-sdk`. [Implementation, line 9](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L9).

```ts theme={null}
PublicKey
```

## GpruHiddenHeadProofV2

Import from `@trustlink/tsn-sdk`. [Implementation, line 22](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L22).

```ts theme={null}
export type GpruHiddenHeadProofV2 = {
  publicInputs: readonly string[];
  proofA: string;
  proofB: string;
  proofC: string;
  actionKind: number;
  tokenId: number;
  amountCommitment: string;
  authorizationCommitment: string;
};
```

## GpruTcapEpochProofV1

Import from `@trustlink/tsn-sdk`. [Implementation, line 230](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L230).

```ts theme={null}
export type GpruTcapEpochProofV1={publicInputs:readonly string[];proofA:string;proofB:string;proofC:string};
```

## resolveTcapGpruDepositAccounts

Reads the canonical reserve and vault from TCAP's on-chain asset entry.
The reserve is never derived from an assetState PDA.

Import from `@trustlink/tsn-sdk`. [Implementation, line 58](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L58).

```ts theme={null}
resolveTcapGpruDepositAccounts(connection: Connection, fields: { depositor: PublicKey; mint: PublicKey; tokenProgram: PublicKey; tcapProgramId: PublicKey; }): Promise<{ depositor: PublicKey; tcapProgramId: PublicKey; config: PublicKey; registry: PublicKey; assetEntry: PublicKey; assetEntryAccount: AccountInfo<Buffer<ArrayBufferLike>>; reserveState: PublicKey; reserveAuthority: PublicKey; source: PublicKey; vault: PublicKey; mint: PublicKey; tokenProgram: PublicKey; fundingRootAccount: PublicKey; tokenId: number; decimals: number; }>
```

Direct failure expressions:

```text theme={null}
new Error("MINT_NOT_REGISTERED_IN_TCAP")
new Error("TCAP_ASSET_ENTRY_OWNER_MISMATCH")
new Error("TCAP_ASSET_ENTRY_LAYOUT_INVALID")
new Error("TCAP_ASSET_ENTRY_BINDING_MISMATCH")
new Error("TCAP_ASSET_NOT_ACTIVE_FOR_DEPOSITS")
new Error("TCAP_ASSET_ENTRY_RESERVE_NOT_CONFIGURED")
```

## TcapGpruDepositAccounts

Address projection used for one sender-approved reserve deposit.

Import from `@trustlink/tsn-sdk`. [Implementation, line 101](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/tcap-gpru-credit.ts#L101).

```ts theme={null}
export type TcapGpruDepositAccounts = Pick<Awaited<ReturnType<typeof resolveTcapGpruDepositAccounts>>,
  "depositor" | "tcapProgramId" | "config" | "assetEntry" | "reserveState" | "source" | "vault" | "mint" | "tokenProgram" | "fundingRootAccount">;
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.