instantiate_old_weight

Call v334 → current #2

Legacy instantiate using old weight format (deprecated).

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: developers

The Big Picture

Legacy version of instantiate for backward compatibility. Use the current version for new development.

Use Cases

  • Support old tools/libraries not updated to new weight format
  • Backward compatibility during transition periods

From Chain Metadata

Deprecated version if [`Self::instantiate`] for use in an in-storage `Call`.

Input Parameters

#NameTypeDescription
0
value
Compact<u64> Cpt BalanceOf<T>value: Balance in chain native currency (RAO for TAO; ÷10⁹) (RAO -> TAO (/ 10^9))
1
gas_limit
Compact<u64> Cpt OldWeightgas_limit: Legacy Substrate weight (pre-WeightV2) (SCALE compact -> integer)
2
storage_deposit_limit
Option Option<<BalanceOf<T> as codec::HasCompact>::Type>storage_deposit_limit (Option)
3
code_hash
H256 CodeHash<T>code_hash: Contract code hash
4
data
Vec<u8> Vec data (Vec<u8>)
5
salt
Vec<u8> Vec salt (Vec<u8>)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Same as Contracts.instantiate

Effects

Events Emitted

Postconditions

  • Same as Contracts.instantiate

Side Effects

  • Same as Contracts.instantiate

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Build instantiate_old_weight call (typed, named args)
const value = 0n;
const gas_limit = 0n;
const storage_deposit_limit = undefined;
const code_hash = "0x0000000000000000000000000000000000000000000000000000000000000000";
const data = Binary.fromOpaque(new Uint8Array(0));
const salt = Binary.fromOpaque(new Uint8Array(0));

const tx = api.tx.Contracts.instantiate_old_weight({
  value,
  gas_limit,
  storage_deposit_limit,
  code_hash,
  data,
  salt,
});

Runtime Info

Pallet Index
29
Call Index
2
First Version
v334
Current Version
v411