@gala-chain/api ∙ API
API > DryRunDto
Class: DryRunDto
Contents
- Description
- Remarks
- Extends
- Constructors
- new DryRunDto()
- Properties
- callerPublicKey
- dto
- method
- prefix
- signature
- signerAddress
- signerPublicKey
- signing
- uniqueKey
- 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:337
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:349
method
readonly
method:string
Description
The contract method intended for DryRun
execution.
Example
Source
chain-api/src/types/dtos.ts:329
prefix
prefix?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:159
signature
signature?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:150
signerAddress
signerAddress?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:166
signerPublicKey
signerPublicKey?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:173
signing
signing?:
SigningScheme
Inherited from
Source
chain-api/src/types/dtos.ts:183
uniqueKey
uniqueKey?:
string
Inherited from
Source
chain-api/src/types/dtos.ts:140
Methods
isSignatureValid()
isSignatureValid(
publicKey
):boolean
Parameters
▪ publicKey: string
Inherited from
Source
chain-api/src/types/dtos.ts:257
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:207
sign()
sign(
privateKey
,useDer
):void
Parameters
▪ privateKey: string
▪ useDer: boolean
= false
Inherited from
Source
chain-api/src/types/dtos.ts:235
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:251
validate()
validate():
Promise
\<ValidationError
[]>
Inherited from
Source
chain-api/src/types/dtos.ts:185
validateOrReject()
validateOrReject():
Promise
\<void
>
Inherited from
Source
chain-api/src/types/dtos.ts:189
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
.