deployFromExternalRef

suspend fun deployFromExternalRef(executableOwner: String, tag: String, constructorArgs: List<SCValXdr> = emptyList(), source: String, signer: KeyPair, network: Network, rpcUrl: String, salt: ByteArray = secureRandomBytes(32), loadSpec: Boolean = true): ContractClient

Deploys a contract instance from a CAP-85 external reference (Protocol 28) and returns a ContractClient for it.

The executable of the new instance names an owner contract and a tag; the owner's persistent entry under that tag holds the hash of the WASM the instance runs. Nothing is installed as part of the deployment; the owner contract already holds the tag entry.

The reference is resolved through SorobanServer.getExternalRefWasmHash before the transaction is built, so an unresolvable reference fails here instead of on-chain. The contract spec is loaded from the resolved WASM before submission, like deployFromWasmId.

The tag bytes put on the wire are the UTF-8 encoding of tag; the ByteArray overload carries arbitrary tag bytes.

Return

A ContractClient for the newly deployed contract

Parameters

executableOwner

The contract holding the executable tag entry ("C..." contract id)

tag

The tag the owner holds the executable entry under, as text

constructorArgs

Optional arguments passed to the contract constructor

source

The account id the deployment is issued from

signer

The keypair signing the deployment transaction

network

The network the contract is deployed to

rpcUrl

The Soroban RPC endpoint

salt

32 byte salt for contract id generation; random if not provided

loadSpec

Whether to load the contract spec for the returned client

Throws

if executableOwner is not a valid address, or is not a contract address (before any request is issued)

if the reference cannot be resolved (the tag entry is missing, is not a contract data entry, or does not hold a 32-byte hash; the message names the owner and the tag), or if deployment fails

if the network refuses the deployment transaction at submission


suspend fun deployFromExternalRef(executableOwner: String, tag: ByteArray, constructorArgs: List<SCValXdr> = emptyList(), source: String, signer: KeyPair, network: Network, rpcUrl: String, salt: ByteArray = secureRandomBytes(32), loadSpec: Boolean = true): ContractClient

Deploys a contract instance from a CAP-85 external reference (Protocol 28) and returns a ContractClient for it.

The executable of the new instance names an owner contract and a tag; the owner's persistent entry under that tag holds the hash of the WASM the instance runs. Nothing is installed as part of the deployment; the owner contract already holds the tag entry.

The reference is resolved through SorobanServer.getExternalRefWasmHash before the transaction is built, so an unresolvable reference fails here instead of on-chain. The contract spec is loaded from the resolved WASM before submission, like deployFromWasmId.

The one tag value feeds both the resolution and the built operation, so the entry the deployment names on-chain is the entry that resolved: the bytes reach both byte for byte, whether or not they are valid UTF-8.

Return

A ContractClient for the newly deployed contract

Parameters

executableOwner

The contract holding the executable tag entry ("C..." contract id)

tag

The tag bytes the owner holds the executable entry under; matched byte for byte

constructorArgs

Optional arguments passed to the contract constructor

source

The account id the deployment is issued from

signer

The keypair signing the deployment transaction

network

The network the contract is deployed to

rpcUrl

The Soroban RPC endpoint

salt

32 byte salt for contract id generation; random if not provided

loadSpec

Whether to load the contract spec for the returned client

Throws

if executableOwner is not a valid address, or is not a contract address (before any request is issued)

if the reference cannot be resolved (the tag entry is missing, is not a contract data entry, or does not hold a 32-byte hash; the message names the owner and the tag), or if deployment fails

if the network refuses the deployment transaction at submission