Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

migrate

Migrate a contract to a new code hash. Only the contract's admin can call this.

Signature

function migrate(
  client: Client<Signer>,
  parameters: {
    sender: Address
    contract: Address
    newCodeHash: Hex
    msg: Json
    typedData?: TypedDataParameter
  },
): Promise<{ hash: Uint8Array } & TxData>

Example

import { createSignerClient, createTransport, testnet, PrivateKeySigner } from "@left-curve/sdk"
import type { Address } from "@left-curve/sdk"
 
const client = createSignerClient({
  chain: testnet,
  transport: createTransport(),
  signer: PrivateKeySigner.fromMnemonic(process.env.DANGO_MNEMONIC!),
})
const sender: Address = "0x1234567890abcdef1234567890abcdef12345678"
const contract: Address = "0xabcdef1234567890abcdef1234567890abcdef12"
 
await client.migrate({
  sender,
  contract,
  newCodeHash: "0xdef...456",
  msg: { migrate: {} },
})

Parameters

senderAddress. Must equal the contract's admin.

contractAddress. The contract to migrate.

newCodeHashHex. Hash of the new Wasm code (already stored).

msgJson. Migrate message (camelCase).

typedDataTypedDataParameter, optional. Override the EIP-712 body schema.

Returns

{ hash: Uint8Array } & TxData — see broadcastTxSync.

See also