/
contract_invoke.go
41 lines (34 loc) · 1.55 KB
/
contract_invoke.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package protocol
import (
"encoding/json"
"github.com/iden3/iden3comm"
)
const (
// ContractInvokeRequestMessageType defines contract invoke request type of the communication protocol
ContractInvokeRequestMessageType iden3comm.ProtocolMessage = iden3comm.Iden3Protocol + "proofs/1.0/contract-invoke-request"
)
// ContractInvokeRequestMessage is struct the represents iden3message contract invoke request
type ContractInvokeRequestMessage struct {
ID string `json:"id"`
Typ iden3comm.MediaType `json:"typ,omitempty"`
Type iden3comm.ProtocolMessage `json:"type"`
ThreadID string `json:"thid,omitempty"`
Body ContractInvokeRequestMessageBody `json:"body,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
}
// ContractInvokeRequestMessageBody is body for contract invoke request
type ContractInvokeRequestMessageBody struct {
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
TransactionData TransactionData `json:"transaction_data"`
DIDDoc json.RawMessage `json:"did_doc,omitempty"`
Scope []ZeroKnowledgeProofRequest `json:"scope"`
}
// TransactionData represents structure for on chain verification
type TransactionData struct {
ContractAddress string `json:"contract_address"`
MethodID string `json:"method_id"`
ChainID int `json:"chain_id"`
Network string `json:"network"`
}