Casper.Network.SDK
Show / Hide Table of Contents

Class DeployTemplates

Create a Deploy based on one of the existing templates for the most common actions: transfers, contract deployment, contract call, delegation and undelegation.

Inheritance
System.Object
DeployTemplates
Namespace: Casper.Network.SDK
Assembly: Casper.Network.SDK.dll
Syntax
public class DeployTemplates : object

Methods

ContractCall(HashKey, String, List<NamedArg>, PublicKey, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call an entry point in a contract. The contract is referenced by the contract hash.

Declaration
public static Deploy ContractCall(HashKey contractHash, string contractEntryPoint, List<NamedArg> args, PublicKey fromKey, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
HashKey contractHash

The contract hash key.

System.String contractEntryPoint

The entry point called in the contract.

List<NamedArg> args

List of the input runtime arguments.

PublicKey fromKey

Public key of the caller account.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the contract call.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to call a contract in the network.

ContractCall(String, String, List<NamedArg>, PublicKey, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call an entry point in a contract. The contract is referenced by a named key in the caller's account.

Declaration
public static Deploy ContractCall(string contractName, string contractEntryPoint, List<NamedArg> args, PublicKey fromKey, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
System.String contractName

The named key in the caller account that contains a reference to the contract hash key.

System.String contractEntryPoint

The entry point called in the contract.

List<NamedArg> args

List of the input runtime arguments.

PublicKey fromKey

Public key of the caller account.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the contract call.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to call a contract in the network.

ContractDeploy(Byte[], PublicKey, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to deploy a contract in the network. The code of the contract must be compiled previously in wasm bytecode.

Declaration
public static Deploy ContractDeploy(byte[] wasmBytes, PublicKey fromKey, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
System.Byte[] wasmBytes

Array of bytes containing the compiled contract (in wasm).

PublicKey fromKey

Public key of the account that deploys the contract.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the contract deployment.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to deploy a contract in the network.

DelegateTokens(HashKey, PublicKey, PublicKey, BigInteger, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call the auction contract to delegate tokens to a validator for staking. Make sure you use the correct contract hash for the network you're sending the deploy!

Declaration
public static Deploy DelegateTokens(HashKey contractHash, PublicKey fromKey, PublicKey validatorPK, BigInteger amount, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
HashKey contractHash

Hash of the delegation contract in the network.

PublicKey fromKey

Public key of the account that delegates the tokens.

PublicKey validatorPK

Public key of the validator to which the tokens are delegated for staking.

BigInteger amount

Amount of $CSPR (in motes) to delegate.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the delegation deployment.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to delegate tokens to a validator for staking.

DelegateTokens(Byte[], PublicKey, PublicKey, BigInteger, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to delegate tokens to a validator for staking.

Declaration
public static Deploy DelegateTokens(byte[] delegateContractWasmBytes, PublicKey fromKey, PublicKey validatorPK, BigInteger amount, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
System.Byte[] delegateContractWasmBytes

Array of bytes containing the delegation contract (compiled in wasm).

PublicKey fromKey

Public key of the account that delegates the tokens.

PublicKey validatorPK

Public key of the validator to which the tokens are delegated for staking.

BigInteger amount

Amount of $CSPR (in motes) to delegate.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the delegation deployment.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to delegate tokens to a validator for staking.

StandardTransfer(PublicKey, PublicKey, BigInteger, BigInteger, String, Nullable<UInt64>, UInt64, UInt64)

Creates a Deploy to make a Transfer of $CSPR between two accounts. Sign the deploy with 'fromKey' private key before sending it to the network.

Declaration
public static Deploy StandardTransfer(PublicKey fromKey, PublicKey toKey, BigInteger amount, BigInteger paymentAmount, string chainName, ulong? idTransfer = null, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
PublicKey fromKey

Source account public key.

PublicKey toKey

Target account public key.

BigInteger amount

Amount of $CSPR (in motes) to transfer.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the transfer.

System.String chainName

Name of the network that will execute the Deploy.

System.Nullable<System.UInt64> idTransfer

Id number of the transfer. Or null if no id is needed.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to make a transfer of $CSPR between two accounts.

UndelegateTokens(HashKey, PublicKey, PublicKey, BigInteger, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call the auction contract to delegate tokens to a validator for staking. Make sure you use the correct contract hash for the network you're sending the deploy!

Declaration
public static Deploy UndelegateTokens(HashKey contractHash, PublicKey fromKey, PublicKey validatorPK, BigInteger amount, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
HashKey contractHash

Hash of the delegation contract in the network.

PublicKey fromKey

Public key of the account that delegates the tokens.

PublicKey validatorPK

Public key of the validator to which the tokens are delegated for staking.

BigInteger amount

Amount of $CSPR (in motes) to delegate.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the delegation deployment.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to delegate tokens to a validator for staking.

UndelegateTokens(Byte[], PublicKey, PublicKey, BigInteger, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to undelegate tokens from a validator.

Declaration
public static Deploy UndelegateTokens(byte[] undelegateContractWasmBytes, PublicKey fromKey, PublicKey validatorPK, BigInteger amount, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
System.Byte[] undelegateContractWasmBytes

Array of bytes containing the "undelegation" contract (compiled in wasm).

PublicKey fromKey

Public key of the account that undelegates the tokens.

PublicKey validatorPK

Public key of the validator from which the tokens are undelegated.

BigInteger amount

Amount of $CSPR (in motes) to undelegate.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the delegation deployment.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to undelegate tokens from a validator.

VersionedContractCall(HashKey, Nullable<UInt32>, String, List<NamedArg>, PublicKey, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call an entry point in a versioned contract. The contract is referenced by the contract package hash.

Declaration
public static Deploy VersionedContractCall(HashKey contractHash, uint? version, string contractEntryPoint, List<NamedArg> args, PublicKey fromKey, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
HashKey contractHash

The contract package hash key.

System.Nullable<System.UInt32> version

Version number in the contract package to call.

System.String contractEntryPoint

The entry point called in the contract.

List<NamedArg> args

List of the input runtime arguments.

PublicKey fromKey

Public key of the caller account.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the contract call.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to call a versioned contract in the network.

VersionedContractCall(String, Nullable<UInt32>, String, List<NamedArg>, PublicKey, BigInteger, String, UInt64, UInt64)

Creates a Deploy object to call an entry point in a versioned contract. The contract is referenced by a named key in the caller's account containing the contract package hash.

Declaration
public static Deploy VersionedContractCall(string contractName, uint? version, string contractEntryPoint, List<NamedArg> args, PublicKey fromKey, BigInteger paymentAmount, string chainName, ulong gasPrice = null, ulong ttl = null)
Parameters
Type Name Description
System.String contractName

The named key in the caller account that contains a reference to the contract package key.

System.Nullable<System.UInt32> version

Version number in the contract package to call.

System.String contractEntryPoint

The entry point called in the contract.

List<NamedArg> args

List of the input runtime arguments.

PublicKey fromKey

Public key of the caller account.

BigInteger paymentAmount

Amount of $CSPR (in motes) to pay for the contract call.

System.String chainName

Name of the network that will execute the Deploy.

System.UInt64 gasPrice

Gas price. Use 1 unless you need a different value.

System.UInt64 ttl

Validity of the Deploy since the creation (in milliseconds).

Returns
Type Description
Deploy

A deploy configured to call a versioned contract in the network.

In This Article
Back to top Maintained by MAKE Technology LLC