@gala-chain/api ∙ API
API > DryRunDto
Class: DryRunDto
Contents
- Description
- Remarks
- Extends
- Constructors
- new DryRunDto()
- Properties
- callerPublicKey
- dto
- method
- prefix
- signature
- signerAddress
- signerPublicKey
- signing
- trace
- uniqueKey
- ENCODING
- Methods
- isSignatureValid()
- serialize()
- sign()
- signed()
- validate()
- validateOrReject()
- deserialize()
Description
Input for the DryRun
chaincode method defined on the GalaContract class.
Use a DryRunDto
and the DryRun
chaincode method to simulate the
execution of a chaincode contract method. The results of the DryRun
will not be written chain. Instead, the Read/Write set that would have resulted from
the transaction will be returned to the consuming client for analysis.
Remarks
Authorization is not checked for DryRun
execution. This allows application,
administrative, game server identities etc. to simulate a transaction result
without prompting the end user to sign the input first. This helps avoid
replay attacks (as the unique id would not be written to chain in a DryRun)
and also allows applications to present certain outcomes to the end user
before they decide to sign and authorize the transaction.
Example use case: Executing a DryRun
on a given method, and then processing
the results for FeeChannelPaymentReceipt
or FeeUserPaymentReceipt
objects
can yield the exepcted/estimated fee prior to executing a transaction. The
estimated fee can then be presented to an end user for them to decide whether
or not they want to authorize the transaction.
Extends
Constructors
new DryRunDto()
new DryRunDto():
DryRunDto
Inherited from
Properties
callerPublicKey
readonly
callerPublicKey:string
Description
The identity used for the transaction simulation.
Source
chain-api/src/types/dtos.ts:332
dto
dto?:
ChainCallDTO
Description
A input to be used for the DryRun
execution. For example, if the
method to be DryRun
is TransferToken
, then a TransferTokenDto
should
be provided here.
Source
chain-api/src/types/dtos.ts:344
method
readonly
method:string
Description
The contract method intended for DryRun
execution.
Example
Source
chain-api/src/types/dtos.ts:324
prefix
prefix?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:160
signature
signature?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:151
signerAddress
signerAddress?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:167
signerPublicKey
signerPublicKey?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:174
signing
signing?:
SigningScheme
Inherited from
Source
chain-api/src/types/dtos.ts:184
trace
trace?:
TraceContext
Inherited from
Source
chain-api/src/types/dtos.ts:126
uniqueKey
uniqueKey?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:141
ENCODING
static
readonly
ENCODING:"base64"
="base64"
Inherited from
Source
chain-api/src/types/dtos.ts:127
Methods
isSignatureValid()
isSignatureValid(
publicKey
):boolean
Parameters
▪ publicKey: string
Inherited from
Source
chain-api/src/types/dtos.ts:258
serialize()
serialize():
string
Returns
string
Inherited from
Description
Serialze this object to string in a determinsitic fashion. See Hyperledger Fabric's documentation on JSON Determinism for more details.
Source
chain-api/src/types/dtos.ts:208
sign()
sign(
privateKey
,useDer
):void
Parameters
▪ privateKey: string
▪ useDer: boolean
= false
Inherited from
Source
chain-api/src/types/dtos.ts:236
signed()
signed(
privateKey
,useDer
):DryRunDto
Creates a signed copy of current object.
Parameters
▪ privateKey: string
▪ useDer: boolean
= false
Inherited from
Source
chain-api/src/types/dtos.ts:252
validate()
validate():
Promise
\<ValidationError
[]>
Inherited from
Source
chain-api/src/types/dtos.ts:186
validateOrReject()
validateOrReject():
Promise
\<void
>
Inherited from
Source
chain-api/src/types/dtos.ts:190
deserialize()
static
deserialize\<T
>(constructor
,object
):T
Type parameters
▪ T
Parameters
▪ constructor: ClassConstructor
\<Inferred
\<T
, ChainCallDTO
>>
ClassConstructor
that extends ChainCallDTO
▪ object: string
| Record
\<string
, unknown
> | Record
\<string
, unknown
>[]
serialized string or plain object to be instantiated via the provided ClassConstructor
Returns
An instantiated class created with the provided ClassConstructor
Inherited from
Description
Instantiate a class instance from a serialized object using the provided ClassConstructor
.