thruput-xdr 0.63.0

Bindings for Thruput protocol structures
Documentation
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
{
  "SHA256": {
    "description": [
      "Returns the SHA256 hash of the input buffer."
    ],
    "errors": []
  },
  "GetMsgSender": {
    "description": [
      "Returns the contract address of the contract that invoked the current call frame."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeIsRootTransaction",
        "description": [
          "The syscall was called from a root transaction. There is no caller address in this case."
        ]
      }
    ]
  },
  "GetCalldataLen": {
    "description": [
      "Returns the length of the calldata supplied to the invocation associated with the current call frame. Also returns the number N of auth tokens supplied to the invocation, which are the current frame's auth token ids 0..N-1."
    ],
    "errors": []
  },
  "GetCalldata": {
    "description": [
      "Returns the calldata supplied to the invocation associated with the current call frame.\nwritten_len is the full length of the calldata, not the number of bytes copied: at most buffer.len() bytes are written, and a written_len greater than buffer.len() means the output was truncated.\nAlso returns the number N of auth tokens supplied to the invocation. Auth token ids are local to each call frame, and the supplied tokens are the current frame's ids 0..N-1, in the order the caller listed them."
    ],
    "errors": []
  },
  "ConsoleLog": {
    "description": [
      "Logs the input buffer to the console. This is a no-op on release builds or when deployed on-chain.\nThis will not cause an error if a contract inadvertently includes this syscall in a production contract deployment (if, for example, a contract built in debug mode is uploaded), but there is no reason to do so."
    ],
    "errors": []
  },
  "Invoke": {
    "description": [
      "Invokes the specified method of the contract at the specified\naddress, with the supplied parameters. Creates a new invocation\nframe, which terminates upon conclusion of the Invoke() syscall.",
      "The frame will be limited to the minimum of gas_limit units\nof gas and the remaining gas in the current frame.\nThe SDK sets the default gas limit as UINT64_MAX, meaning i.e.\nall of the remaining gas in the current frame.\nAny unused gas will be returned to the caller.",
      "The entrypoint is the entrypoint_id field of inputs, a u64 holding the\nbig-endian interpretation of the ContractEntrypointID ([u8; 8]) bytes\n(ContractEntrypointID::into_u64 in the Rust bindings).",
      "The list of auth tokens is passed as a span, which should be\ninterpreted as a [u32] slice."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The invocation was rejected before any child frame ran: the contract was not found, the invoke flags were invalid, the calldata is longer than kConfigParamMaxCalldataLen, more auth token ids were supplied than kConfigParamMaxAuthTokens, or one or more of the supplied auth token ids are malformed, duplicated, or not owned by the current frame. The syscall is a complete no-op in this case."
        ]
      },
      {
        "code": "kSyscallErrorCodeReentrance",
        "description": [
          "The invoked address is already on the stack. The invocation is rejected before any child frame runs and the syscall is a no-op."
        ]
      },
      {
        "code": "kSyscallErrorCodeInvokeDepthExceeded",
        "description": [
          "The transaction already holds kConfigParamMaxCrossInvokeDepth invocation frames open, so admitting another would exceed the network's cross-invoke depth bound. This is a resource limit rather than a malformed call -- the same invocation succeeds from a shallower frame. The invocation is rejected before any child frame runs and the syscall is a no-op."
        ]
      }
    ]
  },
  "Return": {
    "description": [
      "Returns data from the current call frame and optionally marks the frame for revert. The return buffer will be available to the caller via GetReturnedBuffer. Immediately terminates execution of the current invocation.\nThe syscall never returns an error. Instead, the frame faults with a deterministic error (equivalent to Exit) if the buffer is longer than kConfigParamMaxReturnBufferLen, if auth tokens are returned from a frame marked for revert, or if the returned auth token id list is longer than kConfigParamMaxAuthTokens, malformed, duplicated, or names tokens the current frame does not own."
    ],
    "errors": []
  },
  "GetReturnedBuffer": {
    "description": [
      "Returns the return buffer from the most recent subcall invocation that ended with Return, including a Return that marked the frame for revert.\nwritten_len is the full length of the return buffer, not the number of bytes copied: at most buffer.len() bytes are written, and a written_len greater than buffer.len() means the output was truncated.\nAlso returns the auth tokens that subcall returned, as the current frame's auth token ids start..start+count-1. The returned tokens join the frame under consecutive new ids, in the order the subcall listed them."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeNoReturnBufferAvailable",
        "description": [
          "No return buffer is available. Either the most recent subcall faulted (for example by trapping or calling Exit), or there have been no subcalls within this call frame."
        ]
      }
    ]
  },
  "Exit": {
    "description": [
      "Terminates execution of the current call frame immediately. The current call frame reverts, returning a deterministic error to the caller (with no return buffer available). Equivalent to a guest trap."
    ],
    "errors": []
  },
  "GetDeployAddress": {
    "description": [
      "Computes the address that would be deployed for a contract with the given deployer address, nonce, and contract hash. This is a pure computation and does not actually deploy the contract. If caller_address is omitted, the current contract's address is used, giving the address DeployContract would use."
    ],
    "errors": []
  },
  "DeployContract": {
    "description": [
      "Deploys a contract with the specified nonce and contract hash to a computed address. The contract must be provided in the transaction's contracts_to_deploy field."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The requested contract was not available for deployment, or the contract is a special precompiled (native) contract that cannot be deployed (i.e. the native token contract).\nTo deploy a contract, that contract must either already exist on chain or must be provided in the transaction's contracts_to_deploy field."
        ]
      },
      {
        "code": "kSyscallErrorCodeContractAlreadyDeployed",
        "description": [
          "A contract with the same nonce and contract hash has already been deployed at the computed address, either in a previous block or earlier in this transaction.\nA contract can be deployed multiple times concurrently in the same block.  If a contract must be initialized only once, then that contract should run some initialization process and that initialization should acquire a semaphore."
        ]
      }
    ]
  },
  "GetSourceTransactionHash": {
    "description": [
      "Returns the hash of the transaction that initiated the current execution: sha256 of the XDR-encoded Transaction, the same TransactionHash that identifies it network-wide."
    ],
    "errors": []
  },
  "VerifySignature": {
    "description": [
      "Verifies a cryptographic signature against a public key and message. Returns kSyscallErrorCodeNone if verification succeeds, otherwise returns an error."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The signature verification failed, or the input parameters are invalid (e.g., incorrect key/signature size for the specified scheme, or unsupported scheme)."
        ]
      }
    ]
  },
  "BytestringGetLen": {
    "description": [
      "Returns the length of the bytestring stored at the specified key."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeStorageKeyNotExist",
        "description": [
          "The storage key does not exist in the current transaction's view."
        ]
      },
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The storage key exists but contains a different type (e.g., NNInt instead of bytestring)."
        ]
      }
    ]
  },
  "BytestringGet": {
    "description": [
      "Retrieves the bytestring stored at the specified key.\nwritten_len is the full length of the bytestring, not the number of bytes copied: at most bytestring.len() bytes are written, and a written_len greater than bytestring.len() means the output was truncated."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeStorageKeyNotExist",
        "description": [
          "The storage key does not exist or has been deleted."
        ]
      },
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The storage key exists but contains a different type (e.g., NNInt instead of bytestring)."
        ]
      }
    ]
  },
  "BytestringSet": {
    "description": [
      "Sets the bytestring value at the specified storage key. Note that this will overwrite any existing value at that key, *even if* that value has a different type."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The bytestring is too long."
        ]
      }
    ]
  },
  "NonnegativeIntGet": {
    "description": [
      "Retrieves the nonnegative integer value at the specified storage key.\ncurrent_set_opt reports whether current_set holds a value; when it is false, current_set carries no information and should be ignored.\nIf force_load_from_snapshot is true, then current_set_opt is always true on success. If the snapshot value is not an NNInt, or the previous write on that key was not an NNInt, then the syscall returns kSyscallErrorCodeInvalidSyscallInput. If the snapshot value does not exist, or has been deleted by the prior write, then it returns kSyscallErrorCodeStorageKeyNotExist.\nIf force_load_from_snapshot is false, then the prior state of the item is ignored unless the prior write on that key is an NNInt write (in which case the parameters of that write are returned). If the prior write is not an NNInt, or was a deletion, then current_set_opt is false and current_add is 0."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeStorageKeyNotExist",
        "description": [
          "The storage key does not exist or has been deleted. Only returned if force_load_from_snapshot is true."
        ]
      },
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The storage key exists but contains a different type (e.g., bytestring instead of NNInt). Only returned if force_load_from_snapshot is true."
        ]
      }
    ]
  },
  "NonnegativeIntSetAdd": {
    "description": [
      "Sets or modifies a nonnegative integer at the specified storage key. The set_value (if provided) sets the base value, and add_value is added as a delta. The final value must remain nonnegative. Will overwrite any value of that key, *even if* that value has a different type."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The operation would always result in a negative value (i.e. set_add(1, -2))."
        ]
      }
    ]
  },
  "DeleteObject": {
    "description": [
      "Deletes the object at the specified storage key."
    ],
    "errors": []
  },
  "GetCurrentAddress": {
    "description": [
      "Returns the contract address of the current call frame."
    ],
    "errors": []
  },
  "RetrocausalQueueInsert": {
    "description": [
      "Inserts an entry into the retrocausal queue at the specified storage key. Like any storage write, this replaces a value of another type at the key. A queue with no live entries does not exist."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The queue entry is too large, or too many entries are inserted in the current transaction."
        ]
      }
    ]
  },
  "RetrocausalQueueConsume": {
    "description": [
      "Consumes (or peeks at) the next entry from the retrocausal queue at the specified storage key. If peek is true, the entry is not removed from the queue. A read never changes the type of the key; a same-block conversion by another transaction is visible only from the next block.\nwritten_len is the full length of the entry, not the number of bytes copied: at most queue_entry.len() bytes are written, and a written_len greater than queue_entry.len() means the output was truncated. A consumed entry is removed even if it was truncated, so size queue_entry with RetrocausalQueuePeekLen first."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeNoRetrocausalQueueEntry",
        "description": [
          "The retrocausal queue is empty and has no entries to consume."
        ]
      },
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The storage key exists but contains a different type."
        ]
      },
      {
        "code": "kSyscallErrorCodeRetrocausalQueueReadLimitReached",
        "description": [
          "The transaction has read the maximum number of concurrent retrocausal-queue entries allowed per transaction. Returning this does not fail the transaction; a contract may use it as a stop condition."
        ]
      }
    ]
  },
  "GetTransactionStatistics": {
    "description": [
      "Returns a transaction statistic value. Note that statistics may be disabled in release builds or production execution, and may return nondeterministic values in test configurations. Nondeterministic stats will be disabled in production settings."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The requested statistic does not exist or is not available in this configuration."
        ]
      }
    ]
  },
  "ChangePublicKeyRegistration": {
    "description": [
      "Changes the public key registration for the current contract address at the specified key index. If key_scheme is None, the key is removed. Otherwise, the key is set with the provided scheme, bytes, and weight."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The public key registration is invalid, or the input key index is out of bounds."
        ]
      }
    ]
  },
  "LogEvent": {
    "description": [
      "Logs an event with up to 3 topics and additional data. Constructs a TxEmittedEvent where the serialized_event field contains the topics prepended to the data: topic0 || topic1 || topic2 || data. The num_topics field indicates how many leading 32-byte chunks are topics, enabling downstream indexers to efficiently filter events. Events are stored in the transaction's event log and accumulated into a per-block merkle-patricia trie."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The serialized event (32 bytes per supplied topic plus the data) is longer than kMaxEventLength, the transaction has already emitted kMaxEventsPerTransaction events, or topics are not supplied in a continuous sequence (e.g., topic0 and topic2 provided without topic1)."
        ]
      }
    ]
  },
  "GetAuthClaim": {
    "description": [
      "Returns the authentication claim associated with the current transaction."
    ],
    "errors": []
  },
  "SHA256Update": {
    "description": [
      "Updates the SHA256 hash computation at the specified index with the provided buffer. If reset is true, the hash input is reset before updating. The buffer must exist if reset is false. There is no cumulative byte limit."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "This error will be returned if any of the following\nconditions are met:\n- The queried hash buffer does not exist and reset is false.\n- There are too many active hash buffers."
        ]
      }
    ]
  },
  "SHA256Finalize": {
    "description": [
      "Finalizes the SHA256 hash computation at the specified index and returns the hash. Removes the hash buffer after finalization."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "Returns an error if the queried hash buffer does not exist. For example, if finalize is called twice on the same buffer without an intervening reset, then the second call will return this error."
        ]
      }
    ]
  },
  "WriteAddressRequiredWeight": {
    "description": [
      "Writes the required weight threshold for the current contract address. This is the minimum total weight of signing keys needed to authorize a transaction from this address."
    ],
    "errors": []
  },
  "GetBlockHeight": {
    "description": [
      "Returns the current block height."
    ],
    "errors": []
  },
  "RetrocausalQueuePeekLen": {
    "description": [
      "Returns the byte length of the next entry in the retrocausal queue at the specified storage key, without consuming it: the queue_entry buffer size RetrocausalQueueConsume needs to read that entry whole."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The storage key exists but contains a different type."
        ]
      },
      {
        "code": "kSyscallErrorCodeNoRetrocausalQueueEntry",
        "description": [
          "The retrocausal queue is empty and has no entries to peek."
        ]
      },
      {
        "code": "kSyscallErrorCodeRetrocausalQueueReadLimitReached",
        "description": [
          "The transaction has read the maximum number of concurrent retrocausal-queue entries allowed per transaction. Returning this does not fail the transaction; a contract may use it as a stop condition."
        ]
      }
    ]
  },
  "MintAuthToken": {
    "description": [
      "Mints an authentication token for the current contract address."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The serialized authentication token fails to parse as a valid AuthToken, expiry height is in the past, or the number of auth tokens minted would exceed the maximum for the transaction."
        ]
      }
    ]
  },
  "ConsumeAuthToken": {
    "description": [
      "Consumes an authentication token for the current contract address. Returns any nested tokens unwrapped by the token.\nauth_payload_written_len is the full length of the token's payload, not the number of bytes copied: at most auth_payload.len() bytes are written, and a larger value means the payload was truncated. The token is consumed either way, so a truncated payload cannot be read again."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The authentication token is not owned by the current contract address, or the auth token has expired."
        ]
      }
    ]
  },
  "SHA256Copy": {
    "description": [
      "Copies the in-progress SHA256 hash computation at src_index to dst_index, replacing any hash computation already at dst_index. Both computations can then be extended and finalized independently. Copying an index onto itself succeeds and changes nothing."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "This error will be returned if any of the following\nconditions are met:\n- The hash computation at src_index does not exist.\n- dst_index does not already hold a hash computation and\n  there are too many active hash buffers."
        ]
      }
    ]
  },
  "GetNetworkHash": {
    "description": [
      "Returns the hash of the network name, the identifier that separates this network's blocks from those of every other network. It is fixed for the life of the network, so it is constant across every block and every invocation.\nTransaction signatures already commit to this value (the signature preimage is `cxs(DomainSeparator(\"Transaction\")) || network_hash || xdr(tx)`). Exposing it to contracts lets a contract bind its own off-chain signed messages to this network the same way, so a message signed for one network cannot be replayed against a contract at the same address on another."
    ],
    "errors": []
  },
  "GetBlockTimepoint": {
    "description": [
      "Returns the timepoint of the block currently executing. The value is fixed by the coordinator before execution begins and is carried in the block's ProposalHeader, so it is part of the block identity and is identical for every invocation in the block.\nLike a block height, this is consensus data rather than a trusted clock: it is chosen by the proposer within whatever bounds the network's validators enforce. Contracts should treat it as coarse-grained wall-clock time -- suitable for expiries, vesting schedules and deadlines -- and must not rely on it for fine-grained ordering or as a source of randomness."
    ],
    "errors": []
  },
  "SetStorageFlags": {
    "description": [
      "Adds flags (a bitwise OR) to the storage flags the current transaction requests for the key. Writes never change a key's flags: every change the transaction commits on the key carries the flags accumulated here, whichever write produced it. ClearStorageFlags removes them.\nA write to the key must be pending in the current call frame's view of the transaction: one made earlier in this frame, or inherited from a caller or from a successful callee. A pending deletion qualifies; a value that exists only in the block snapshot does not. Flags set in a frame that aborts are discarded along with that frame's writes."
    ],
    "errors": [
      {
        "code": "kSyscallErrorCodeInvalidSyscallInput",
        "description": [
          "The flags are invalid, or no write to the key is pending in the current call frame's view of the transaction."
        ]
      }
    ]
  },
  "GetStorageFlags": {
    "description": [
      "Returns the storage flags the current transaction requests for the key, as visible in the current call frame. A key with no pending write has no flags, so it reads as StorageDeltaFlags::None, the same as a pending write without flags."
    ],
    "errors": []
  },
  "ClearStorageFlags": {
    "description": [
      "Clears every storage flag the current transaction requests for the key, as visible in the current call frame. Does nothing if no write to the key is pending, since such a key has no flags. As with SetStorageFlags, a clear made in a frame that aborts is discarded with that frame."
    ],
    "errors": []
  }
}