-
Notifications
You must be signed in to change notification settings - Fork 6
/
LogicApp
160 lines (160 loc) · 5.68 KB
/
LogicApp
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{
"$connections": {
"value": {
"azurequeues": {
<YOUR-CONNECTION>
},
"blockchainethereum": {
<YOUR-CONNECTION>
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Execute_smart_contract_function_(incurring_gas_cost)": {
"inputs": {
"body": {
"to": "@triggerOutputs()['relativePathParameters']['address']",
"tokenId": "@variables('token_id')",
"tokenURI": "@variables('metadata_url')"
},
"host": {
"connection": {
"name": "@parameters('$connections')['blockchainethereum']['connectionId']"
}
},
"method": "post",
"path": "/contract/functions/@{encodeURIComponent(encodeURIComponent('mintWithTokenURI'))}/execute",
"queries": {
"abi": "[{\"constant\":false,\"inputs\":[{\"name\":\"to\",\"type\":\"address\"},{\"name\":\"tokenId\",\"type\":\"uint256\"},{\"name\":\"tokenURI\",\"type\":\"string\"}],\"name\":\"mintWithTokenURI\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]",
"contractAddress": "@variables('contract_address')"
}
},
"runAfter": {
"For_each": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"For_each": {
"actions": {
"Set_variable": {
"inputs": {
"name": "metadata_url",
"value": "@items('For_each')?['MessageText']"
},
"runAfter": {},
"type": "SetVariable"
}
},
"foreach": "@body('Get_messages')?['QueueMessagesList']?['QueueMessage']",
"runAfter": {
"Get_messages": [
"Succeeded"
]
},
"type": "Foreach"
},
"Get_messages": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azurequeues']['connectionId']"
}
},
"method": "get",
"path": "/@{encodeURIComponent('metadataurls')}/messages",
"queries": {
"numofmessages": "1"
}
},
"runAfter": {
"Initialize_metadata_url": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Initialize_metadata_url": {
"inputs": {
"variables": [
{
"name": "metadata_url",
"type": "String"
}
]
},
"runAfter": {
"Initialize_token_id": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Initialize_token_id": {
"inputs": {
"variables": [
{
"name": "token_id",
"type": "String",
"value": "@{rand(0,2147483647)}"
}
]
},
"runAfter": {
"Set_contract_address": [
"Succeeded"
]
},
"type": "InitializeVariable"
},
"Response": {
"inputs": {
"body": "https://rinkeby.opensea.io/assets/@{variables('contract_address')}/@{variables('token_id')}",
"statusCode": 200
},
"kind": "Http",
"runAfter": {
"Execute_smart_contract_function_(incurring_gas_cost)": [
"Succeeded"
]
},
"type": "Response"
},
"Set_contract_address": {
"inputs": {
"variables": [
{
"name": "contract_address",
"type": "String",
"value": "<YOUR CONTRACT ADDRESS>"
}
]
},
"runAfter": {},
"type": "InitializeVariable"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"manual": {
"inputs": {
"method": "GET",
"relativePath": "/address/{address}",
"schema": {}
},
"kind": "Http",
"type": "Request"
}
}
}
}