Module

contract

Classes

AssembledTransaction
Client
SentTransaction
Spec

Interfaces

ErrorMessage
Result

Members

number

# static constant DEFAULT_TIMEOUT

The default timebounds, in seconds, during which a transaction will be valid. This is attached to the transaction before transaction simulation (it is needed for simulation to succeed). It is also re-calculated and re-added before transaction signing.

Default Value:
  • 300

View Source lib/contract/types.js, line 123

string

# static constant NULL_ACCOUNT

An impossible account on the Stellar network

Default Value:
  • GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF

View Source lib/contract/types.js, line 131

Methods

# static basicNodeSigner(keypair, networkPassphrase)

For use with Client and module:contract.AssembledTransaction. Implements signTransaction and signAuthEntry with signatures expected by those classes. This is useful for testing and maybe some simple Node applications. Feel free to use this as a starting point for your own Wallet/TransactionSigner implementation.

Parameters:
Name Type Description
keypair Keypair

Keypair to use to sign the transaction or auth entry

networkPassphrase string

passphrase of network to sign for

View Source lib/contract/basic_node_signer.js, line 20

Type Definitions

object

# ClientOptions

Options for a smart contract client.

Properties:
Name Type Attributes Description
publicKey string <optional>

The public key of the source account for this transaction. You can, override this for specific methods later; see MethodOptions.

signTransaction SignTransaction <optional>

A function to sign the transaction using the private key corresponding to, the given publicKey. You do not need to provide this, for read-only, calls, which only need to be simulated. If you do not provide it during, initialization, you can provide it later, either when you initialize a, method (see MethodOptions) or when you call, :contract.AssembledTransaction#signAndSend signAndSend., , Matches signature of signTransaction from Freighter.

signAuthEntry SignAuthEntry <optional>

A function to sign a specific auth entry for a transaction, using the, private key corresponding to the provided publicKey. This is only needed, for multi-auth transactions, in which one transaction is signed by, multiple parties. If you do not provide it during initialization, you can, provide it later either when you initialize a method (see MethodOptions), or when you call :contract.AssembledTransaction#signAuthEntries signAuthEntries., , Matches signature of signAuthEntry from Freighter.

contractId string

The address of the contract the client will interact with.

networkPassphrase string

The network passphrase for the Stellar network this contract is deployed, to.

rpcUrl string

The URL of the RPC instance that will be used to interact with this, contract.

allowHttp boolean <optional>

If true, will allow HTTP requests to the RPC. If false, will, only allow HTTPS requests.

headers Record.<string, string> <optional>

Optional headers to include in requests to the RPC.

errorTypes Record.<number, object> <optional>

This gets filled in automatically from the ContractSpec when you, instantiate a Client., , Background: If the contract you're calling uses the #[contracterror], macro to create an Error enum, then those errors get included in the, on-chain XDR that also describes your contract's methods. Each error will, have a specific number., , A Client makes method calls with an :contract.AssembledTransaction AssembledTransaction., When one of these method calls encounters an error, AssembledTransaction, will first attempt to parse the error as an "official" contracterror, error, by using this passed-in errorTypes object. See, :contract.AssembledTransaction#parseError parseError. If errorTypes is blank or no, matching error is found, then it will throw the raw error.

server Server <optional>

The Server instance to use for RPC calls. If not provided, one will be, created automatically from rpcUrl and serverOptions.

View Source lib/contract/types.d.ts, line 101

bigint

# Duration

An unsigned 64-bit integer.

View Source lib/contract/types.d.ts, line 58

object

# MethodOptions

Options for a smart contract method invocation.

Properties:
Name Type Attributes Description
fee string <optional>

The fee to pay for the transaction.

timeoutInSeconds number <optional>

The timebounds which should be set for transactions generated by this, contract client. :contract#.DEFAULT_TIMEOUT

simulate boolean <optional>

Whether to automatically simulate the transaction when constructing the, AssembledTransaction.

restore boolean <optional>

If true, will automatically attempt to restore the transaction if there, are archived entries that need renewal.

publicKey string <optional>

The public key of the source account for this transaction., , Default: the one provided to the Client in ClientOptions

signTransaction SignTransaction <optional>

A function to sign the transaction using the private key corresponding to, the given publicKey. You do not need to provide this, for read-only, calls, which only need to be simulated., , Matches signature of signTransaction from Freighter., , Default: the one provided to the Client in ClientOptions

signAuthEntry SignAuthEntry <optional>

A function to sign a specific auth entry for a transaction, using the, private key corresponding to the provided publicKey. This is only needed, for multi-auth transactions, in which one transaction is signed by, multiple parties., , Matches signature of signAuthEntry from Freighter., , Default: the one provided to the Client in ClientOptions

View Source lib/contract/types.d.ts, line 148

bigint

# Timepoint

An unsigned 64-bit integer.

View Source lib/contract/types.d.ts, line 53

bigint

# Typepoint

Deprecated:
  • Use Timepoint instead.

View Source lib/contract/types.d.ts, line 48

bigint

# i128

A signed 128-bit integer.

View Source lib/contract/types.d.ts, line 32

bigint

# i256

A signed 256-bit integer.

View Source lib/contract/types.d.ts, line 42

number

# i32

A signed 32-bit integer.

View Source lib/contract/types.d.ts, line 12

bigint

# i64

A signed 64-bit integer.

View Source lib/contract/types.d.ts, line 22

bigint

# u128

An unsigned 128-bit integer.

View Source lib/contract/types.d.ts, line 27

bigint

# u256

An unsigned 256-bit integer.

View Source lib/contract/types.d.ts, line 37

number

# u32

An unsigned 32-bit integer.

View Source lib/contract/types.d.ts, line 7

bigint

# u64

An unsigned 64-bit integer.

View Source lib/contract/types.d.ts, line 17