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 108

string

# static constant NULL_ACCOUNT

An impossible account on the Stellar network

Default Value:
  • GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF

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

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 account that will send this transaction. You can, override this for specific methods later, like, [signAndSend]:contract.AssembledTransaction#signAndSend and, [signAuthEntries]:contract.AssembledTransaction#signAuthEntries.

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 need to sign and, send, there is no need to provide this. If you do not provide it during, initialization, you can provide it later 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 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 Soroban network. If false, will, only allow HTTPS requests.

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.

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

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.

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

bigint

# i128

A signed 128-bit integer.

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

bigint

# i256

A signed 256-bit integer.

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

number

# i32

A signed 32-bit integer.

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

bigint

# i64

A signed 64-bit integer.

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

bigint

# u128

An unsigned 128-bit integer.

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

bigint

# u256

An unsigned 256-bit integer.

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

number

# u32

An unsigned 32-bit integer.

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

bigint

# u64

An unsigned 64-bit integer.

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