upgrade_contract
Upgrade a NEAR contract by deploying new WASM code, with optional post-upgrade migration. Requires signer ownership of the contract.
Instructions
Upgrade an existing contract with new WASM code. The contract must be owned by the signer.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"contract_id": "<contract_id>"
},
"name": "upgrade_contract"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| network | No | NEAR network (default: testnet) | |
| wasm_path | No | Path to the new compiled WASM file | |
| contract_id | Yes | The NEAR account ID of the contract to upgrade | |
| private_key | No | Optional: Private key for signing | |
| wasm_base64 | No | Alternative: Base64-encoded new WASM bytes | |
| migrate_args | No | Optional: Arguments for migration method | |
| migrate_method | No | Optional: Migration method to call after upgrade (e.g., "migrate") |