near-sdk-gr

Context.currentAccountId

currentAccountId : () -> String

Gets the account ID of the current contract that we are executing. This function will overwrite the contents of register 0.

Returns:

type description
String The account ID

Examples:

Context.currentAccountId()

Context.signerAccountId

signerAccountId : () -> String

All contract calls are a result of some transaction that was signed by some account using some access key and submitted into a memory pool (either through the wallet using RPC or by a node itself). This function returns the ID of that account. This function will overwrite the contents of register 0.

Returns:

type description
String The account ID

Examples:

Context.signerAccountId()

Context.signerAccountPublicKey

signerAccountPublicKey : () -> Bytes

Saves the public key of the access key that was used by the signer into the register. In rare situations smart contract might want to know the exact access key that was used to send the original transaction, e.g. to increase the allowance or manipulate with the public key. This function will overwrite the contents of register 0.

Returns:

type description
Bytes The account public key

Examples:

Context.signerAccountPublicKey()

Context.predecessorAccountId

predecessorAccountId : () -> String

All contract calls are a result of a receipt, this receipt might be created by a transaction that does function invocation on the contract or another contract as a result of cross-contract call. This function will overwrite the contents of register 0.

Returns:

type description
String The account ID

Examples:

Context.predecessorAccountId()

Context.blockHeight

blockHeight : () -> Int64

Returns the current block height.

Returns:

type description
Int64 The current block height

Examples:

Context.blockHeight()

Context.blockTimestamp

blockTimestamp : () -> Int64

Returns the current block timestamp (number of non-leap-nanoseconds since January 1, 1970 0:00:00 UTC).

Returns:

type description
Int64 The current block timestamp

Examples:

Context.blockTimestamp()

Context.epochHeight

epochHeight : () -> Int64

Returns the current epoch height.

Returns:

type description
Int64 The current epoch height

Examples:

Context.epochHeight()

Context.storageUsage

storageUsage : () -> Int64

Returns the number of bytes used by the contract if it was saved to the trie as of the invocation. This includes:

Returns:

type description
Int64 The current storage usage

Examples:

Context.storageUsage()

Context.inputBytes

inputBytes : () -> Bytes

Reads the input to the contract call, formatted as a byte sequence. This function overwrites the contents of register 0.

Returns:

type description
Bytes The input to the contract

Examples:

Context.inputBytes()

Context.inputStringUnsafe

inputStringUnsafe : () -> String

Reads the input to the contract call, formatted as a string. This function is “unsafe” because it does not perform any validation on the input byte sequence to ensure that it is a valid UTF-8 string. This function overwrites the contents of register 0.

Returns:

type description
String The input to the contract

Examples:

Context.inputStringUnsafe()