@@ -17,164 +17,6 @@ blockchain running the AVM.
17
17
18
18
## Methods
19
19
20
- ### ` avm.buildGenesis `
21
-
22
- Given a JSON representation of this Virtual Machine’s genesis state, create the byte representation
23
- of that state.
24
-
25
- #### ** Endpoint**
26
-
27
- This call is made to the AVM’s static API endpoint:
28
-
29
- ` /ext/vm/avm `
30
-
31
- Note: addresses should not include a chain prefix (that is ` X- ` ) in calls to the static API endpoint
32
- because these prefixes refer to a specific chain.
33
-
34
- ** Signature:**
35
-
36
- ``` sh
37
- avm.buildGenesis({
38
- networkID: int,
39
- genesisData: JSON,
40
- encoding: string, //optional
41
- }) -> {
42
- bytes: string,
43
- encoding: string,
44
- }
45
- ```
46
-
47
- Encoding specifies the encoding format to use for arbitrary bytes, that is the genesis bytes that are
48
- returned. Can only be ` hex ` when a value is provided.
49
-
50
- ` genesisData ` has this form:
51
-
52
- ``` json
53
- {
54
- "genesisData" :
55
- {
56
- "assetAlias1" : { // Each object defines an asset
57
- "name" : " human readable name" ,
58
- "symbol" :" AVAL" , // Symbol is between 0 and 4 characters
59
- "initialState" : {
60
- "fixedCap" : [ // Choose the asset type.
61
- { // Can be "fixedCap", "variableCap", "limitedTransfer", "nonFungible"
62
- "amount" :1000 , // At genesis, address A has
63
- "address" :" A" // 1000 units of asset
64
- },
65
- {
66
- "amount" :5000 , // At genesis, address B has
67
- "address" :" B" // 1000 units of asset
68
- },
69
- ... // Can have many initial holders
70
- ]
71
- }
72
- },
73
- "assetAliasCanBeAnythingUnique" : { // Asset alias can be used in place of assetID in calls
74
- "name" : " human readable name" , // names need not be unique
75
- "symbol" : " AVAL" , // symbols need not be unique
76
- "initialState" : {
77
- "variableCap" : [ // No units of the asset exist at genesis
78
- {
79
- "minters" : [ // The signature of A or B can mint more of
80
- " A" , // the asset.
81
- " B"
82
- ],
83
- "threshold" :1
84
- },
85
- {
86
- "minters" : [ // The signatures of 2 of A, B and C can mint
87
- " A" , // more of the asset
88
- " B" ,
89
- " C"
90
- ],
91
- "threshold" :2
92
- },
93
- ... // Can have many minter sets
94
- ]
95
- }
96
- },
97
- ... // Can list more assets
98
- }
99
- }
100
- ```
101
-
102
- ** Example Call:**
103
-
104
- ``` sh
105
- curl -X POST --data ' {
106
- "jsonrpc": "2.0",
107
- "id" : 1,
108
- "method" : "avm.buildGenesis",
109
- "params" : {
110
- "networkId": 16,
111
- "genesisData": {
112
- "asset1": {
113
- "name": "myFixedCapAsset",
114
- "symbol":"MFCA",
115
- "initialState": {
116
- "fixedCap" : [
117
- {
118
- "amount":100000,
119
- "address": "avax13ery2kvdrkd2nkquvs892gl8hg7mq4a6ufnrn6"
120
- },
121
- {
122
- "amount":100000,
123
- "address": "avax1rvks3vpe4cm9yc0rrk8d5855nd6yxxutfc2h2r"
124
- },
125
- {
126
- "amount":50000,
127
- "address": "avax1ntj922dj4crc4pre4e0xt3dyj0t5rsw9uw0tus"
128
- },
129
- {
130
- "amount":50000,
131
- "address": "avax1yk0xzmqyyaxn26sqceuky2tc2fh2q327vcwvda"
132
- }
133
- ]
134
- }
135
- },
136
- "asset2": {
137
- "name": "myVarCapAsset",
138
- "symbol":"MVCA",
139
- "initialState": {
140
- "variableCap" : [
141
- {
142
- "minters": [
143
- "avax1kcfg6avc94ct3qh2mtdg47thsk8nrflnrgwjqr",
144
- "avax14e2s22wxvf3c7309txxpqs0qe9tjwwtk0dme8e"
145
- ],
146
- "threshold":1
147
- },
148
- {
149
- "minters": [
150
- "avax1y8pveyn82gjyqr7kqzp72pqym6xlch9gt5grck",
151
- "avax1c5cmm0gem70rd8dcnpel63apzfnfxye9kd4wwe",
152
- "avax12euam2lwtwa8apvfdl700ckhg86euag2hlhmyw"
153
- ],
154
- "threshold":2
155
- }
156
- ]
157
- }
158
- }
159
- },
160
- "encoding": "hex"
161
- }
162
- }' -H ' content-type:application/json;' 127.0.0.1:9650/ext/vm/avm
163
- ```
164
-
165
- ** Example Response:**
166
-
167
- ``` json
168
- {
169
- "jsonrpc" : " 2.0" ,
170
- "result" : {
171
- "bytes" : " 0x0000000000010006617373657431000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f6d794669786564436170417373657400044d464341000000000100000000000000010000000700000000000186a10000000000000000000000010000000152b219bc1b9ab0a9f2e3f9216e4460bd5db8d153bfa57c3c" ,
172
- "encoding" : " hex"
173
- },
174
- "id" : 1
175
- }
176
- ```
177
-
178
20
### ` avm.getAllBalances `
179
21
180
22
<Callout type =" warn " >
0 commit comments