Skip to main content

WalletSigner

@opcat-labs/scrypt-ts-opcat v1.0.4


@opcat-labs/scrypt-ts-opcat / WalletSigner

Class: WalletSigner

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:30

a [signer][https://docs.opcatlabs.io/how-to-deploy-and-call-a-contract/#signer](https://docs.opcatlabs.io/how-to-deploy-and-call-a-contract/#signer) which implemented the protocol with the [Unisat wallet][https://opcat.io](https://opcat.io), and dapps can use to interact with the Unisat wallet

Implements

Constructors

new WalletSigner()

new WalletSigner(opcat): WalletSigner

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:33

Parameters

opcat

OpcatAPI

Returns

WalletSigner

Methods

getAddress()

getAddress(): Promise\<string>

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:55

Gets the address from the Unisat wallet API.

Returns

Promise\<string>

A promise that resolves to the first account address string.

Implementation of

Signer.getAddress


getOpcatAPI()

getOpcatAPI(): OpcatAPI

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:42

Retrieves the Unisat API instance from either the cached property or global window object.

Returns

OpcatAPI

The Unisat API instance.

Throws

If Unisat API is not available (not installed).


getPublicKey()

getPublicKey(): Promise\<string>

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:64

Retrieves the public key from the Unisat wallet API.

Returns

Promise\<string>

A promise that resolves to the public key as a string.

Implementation of

Signer.getPublicKey


signPsbt()

signPsbt(psbtHex, options?): Promise\<string>

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:75

Signs a PSBT (Partially Signed Opcat Transaction) using the Unisat wallet API.

Parameters

psbtHex

string

The PSBT in hexadecimal format to be signed.

options?

SignOptions

Optional signing options (e.g., specific inputs to sign).

Returns

Promise\<string>

A Promise resolving to the signed PSBT in hexadecimal format.

Implementation of

Signer.signPsbt


signPsbts()

signPsbts(reqs): Promise\<string[]>

Defined in: packages/scrypt-ts-opcat/src/signers/walletSigner.ts:85

Signs multiple PSBTs (Partially Signed Opcat Transactions) using the Unisat wallet API.

Parameters

reqs

object[]

Array of objects containing PSBT hex strings and optional signing options

Returns

Promise\<string[]>

Promise resolving to an array of signed PSBT hex strings

Implementation of

Signer.signPsbts