> ## 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.

# gpru/tin-debit-opening 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/gpru/tin-debit-opening.ts). See the [reference index](https://trust-link-tsn.mintlify.site/sdk/api-reference.md) for package import boundaries and verification scope.

## buildTinDebitApprovalMessageV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 75](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L75).

```ts theme={null}
buildTinDebitApprovalMessageV1(authorizationCommitment: string): Uint8Array
```

## buildTinDebitOpeningMessageV1

Sender consent to disclose this opening for one exact transfer statement.

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 112](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L112).

```ts theme={null}
buildTinDebitOpeningMessageV1(value: TinDebitOpeningPacketV1): Uint8Array
```

## deriveGpruTinDebitAmountCommitmentV1

Matches the offline core's TSN\_TIN\_DEBIT\_VALUE\_V1 commitment, using base units.

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 39](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L39).

```ts theme={null}
deriveGpruTinDebitAmountCommitmentV1(tokenId: number, amountBaseUnits: string, amountBlinding: string, nullifier: string): string
```

## deriveGpruTinDebitCommitmentsV1

Build the exact private-transfer commitments before owner approval; no transaction is built.

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 47](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L47).

```ts theme={null}
deriveGpruTinDebitCommitmentsV1(params: { senderRouteKeyCommitment: string; recipientRouteKeyCommitment: string; tokenId: number; amountBaseUnits: string; nonce: string; amountBlinding: string; deploymentCommitment: string; validAfterSlot: string; expiresAtSlot: string; }): { nullifier: string; amountCommitment: string; authorizationCommitment: string; actionCommitment: string; }
```

Direct failure expressions:

```text theme={null}
new Error("Transfer requires two distinct hidden-head indices")
new Error("Transfer authorization interval is reversed")
```

## GPRU\_TIN\_DEBIT\_FIELD\_V1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 11](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L11).

```ts theme={null}
21888242871839275222246405745257275088548364400416034343698204186575808495617n
```

## GPRU\_TIN\_DEBIT\_SUBORDER\_V1

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

```ts theme={null}
2736030358979909402780800718157159386076813972158567259200215660948447373041n
```

## GpruTinDebitOwnerOpeningV1

Accumulated balances are u128; individual transfer amounts and head sequences remain u64.

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 85](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L85).

```ts theme={null}
export type GpruTinDebitOwnerOpeningV1 = {
  tokenId: number; balance: string; blinding: string; sequence: string; previousMemoCommitment: string;
};
```

## SignedTinDebitOpeningPacketV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 92](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L92).

```ts theme={null}
export type SignedTinDebitOpeningPacketV1 = TinDebitOpeningPacketV1 & { ownerPublicKey: string; signature: string };
```

## signTinDebitOpeningV1

Recover the sender's opening before consent; the recipient supplies no opening or approval.

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 129](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L129).

```ts theme={null}
signTinDebitOpeningV1(packet: TinDebitOpeningPacketV1, ownerWallet: TinBalanceWallet): Promise<SignedTinDebitOpeningPacketV1>
```

Direct failure expressions:

```text theme={null}
new Error("Transfer opening consent is not from the connected owner")
```

## tinDebitDecimalV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 19](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L19).

```ts theme={null}
tinDebitDecimalV1(value: unknown, label: string, maximum: bigint, positive?: boolean): bigint
```

Direct failure expressions:

```text theme={null}
new Error(`${label} must be a canonical decimal string`)
new Error(`${label} is outside its unsigned range`)
```

## tinDebitHexV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 26](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L26).

```ts theme={null}
tinDebitHexV1(value: unknown, label: string, field?: boolean, positive?: boolean): string
```

Direct failure expressions:

```text theme={null}
new Error(`${label} must be canonical lowercase 32-byte hex`)
new Error(`${label} is outside its field range`)
```

## TinDebitOpeningPacketV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 88](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L88).

```ts theme={null}
export type TinDebitOpeningPacketV1 = GpruTinDebitOwnerOpeningV1 & {
  version: 1; recordType: "tsn-gpru-tin-debit-opening-v1"; leg: 0; authorizationCommitment: string;
  routeKeyCommitment: string;
};
```

## validateTinDebitOpeningPacketV1

Import from `@trustlink/tsn-sdk` or `@trustlink/tsn-sdk/gpru/tin-debit-opening`. [Implementation, line 95](https://github.com/bigdreamsweb3/trustlink-pay/blob/main/tsn-protocol/sdks/tsn-sdk/src/gpru/tin-debit-opening.ts#L95).

```ts theme={null}
validateTinDebitOpeningPacketV1(value: unknown): TinDebitOpeningPacketV1
```

Direct failure expressions:

```text theme={null}
new Error("Transfer opening packet has an unsupported field set")
new Error("Unsupported transfer opening packet")
new Error("Transfer opening consent is required only from the sender")
new Error("Transfer owner sequence and predecessor Memo disagree")
```


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