pub struct GlobalDeployBuilder {
code: Vec<u8>,
}Fields§
§code: Vec<u8>Implementations§
Source§impl GlobalDeployBuilder
impl GlobalDeployBuilder
pub const fn new(code: Vec<u8>) -> Self
Sourcepub fn as_hash(self) -> SelfActionBuilder
pub fn as_hash(self) -> SelfActionBuilder
Prepares a transaction to deploy a code to the global contract code storage and reference it by hash.
The code is immutable and cannot be changed once deployed.
§Example
use near_api::*;
let code = std::fs::read("path/to/your/contract.wasm")?;
let signer = Signer::new(Signer::from_ledger())?;
let result = Contract::deploy_global_contract_code(code)
.as_hash()
.with_signer("some-account.testnet".parse()?, signer)
.send_to_testnet()
.await?;Sourcepub fn as_account_id(self, signer_id: AccountId) -> ConstructTransaction
pub fn as_account_id(self, signer_id: AccountId) -> ConstructTransaction
Prepares a transaction to deploy a code to the global contract code storage and reference it by account-id.
You would be able to change the code later on. Please note that every subsequent upgrade will charge full deployment cost.
§Example
use near_api::*;
let code = std::fs::read("path/to/your/contract.wasm")?;
let signer = Signer::new(Signer::from_ledger())?;
let result = Contract::deploy_global_contract_code(code)
.as_account_id("some-account.testnet".parse()?)
.with_signer(signer)
.send_to_testnet()
.await?;Trait Implementations§
Source§impl Clone for GlobalDeployBuilder
impl Clone for GlobalDeployBuilder
Source§fn clone(&self) -> GlobalDeployBuilder
fn clone(&self) -> GlobalDeployBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for GlobalDeployBuilder
impl RefUnwindSafe for GlobalDeployBuilder
impl Send for GlobalDeployBuilder
impl Sync for GlobalDeployBuilder
impl Unpin for GlobalDeployBuilder
impl UnwindSafe for GlobalDeployBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more