Skip to content

DeployResubmitter

Source

Retry and resubmission logic for non-read-only deploys.

Related exports: ResubmitNodeManager, ResubmitConfig, ResubmitResult.

Types

Interface ResubmitConfig:

FieldTypeDescription
phloPricenumberGas price per unit of phlogiston.
deployValiditySecondsnumberDeploy expiry time in seconds.
deployRetriesnumberMaximum retry attempts per node.
deployIntervalSecondsnumberDelay between retry attempts.
pollingIntervalSecondsnumberInterval between status polls.
nodeSelectionAttemptsnumberNumber of node selection attempts.
useRandomNodebooleanWhether to pick a random node from the pool.

ResubmitResult:

FieldTypeDescription
successbooleanWhether the deploy was confirmed.
deployIdstring | undefinedDeploy ID if successful.
deployStatusDeployStatus | undefinedFinal deploy status.
errorErrorDetail | undefinedError details if failed.

Interface ErrorDetail:

FieldTypeDescription
blockchainError{ type: DeploymentErrorType; message: string } | undefinedParsed blockchain error with classified type and human-readable message.
exceededTimeoutFatalDeployErrors.DEPLOY_SUBMIT_TIMEOUT | FatalDeployErrors.BLOCK_INCLUSION_TIMEOUT | undefinedSet when the deploy exceeded a timeout threshold.

See Error Types for DeploymentErrorType and FatalDeployErrors details.

Constructor

ts
new DeployResubmitter(config: ResubmitConfig, availableNodesUrls: string[])

Parameters:

NameTypeRequiredDescription
configResubmitConfigYesRetry and polling configuration.
availableNodesUrlsstring[]YesPool of validator node URLs for resubmission.

Throws: Error("BlockchainGateway is not initialized") — if BlockchainGateway.init() was not called.

resubmit

ts
resubmit(
  rholangCode: string,
  wallet: Wallet,
  passwordProvider: PasswordProvider,
  phloLimit?: number
): Promise<ResubmitResult>

Submits a Rholang deploy with automatic retry and status polling. Does not throw — all errors are captured in the returned ResubmitResult.

Parameters:

NameTypeRequiredDescription
rholangCodestringYesRholang smart contract code to deploy.
walletWalletYesWallet used to sign the deploy.
passwordProviderPasswordProviderYesAsync callback returning the wallet password.
phloLimitnumberNoGas limit. Defaults to DEFAULT_PHLO_LIMIT.

Returns: Promise<ResubmitResult>{ success, deployId?, deployStatus?, error? }.

Flow:

  1. Connects to a node (default or random from pool).
  2. Signs and submits the deploy; retries up to deployRetries times with deployIntervalSeconds delay.
  3. Polls for block inclusion every pollingIntervalSeconds until deployValiditySeconds expires.
  4. Returns result with final status.

ASI:Chain DevNet - Development Network