aboutsummaryrefslogtreecommitdiffstats
path: root/packages/json-schemas/schemas/tx_data_schema.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/json-schemas/schemas/tx_data_schema.ts')
-rw-r--r--packages/json-schemas/schemas/tx_data_schema.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/packages/json-schemas/schemas/tx_data_schema.ts b/packages/json-schemas/schemas/tx_data_schema.ts
new file mode 100644
index 000000000..41eaadd3c
--- /dev/null
+++ b/packages/json-schemas/schemas/tx_data_schema.ts
@@ -0,0 +1,42 @@
+export const jsNumber = {
+ id: '/JsNumber',
+ type: 'number',
+ minimum: 0,
+};
+
+export const txDataSchema = {
+ id: '/TxData',
+ properties: {
+ from: {$ref: '/Address'},
+ to: {$ref: '/Address'},
+ value: {
+ oneOf: [
+ {$ref: '/Number'},
+ {$ref: '/JsNumber'},
+ ],
+ },
+ gas: {
+ oneOf: [
+ {$ref: '/Number'},
+ {$ref: '/JsNumber'},
+ ],
+ },
+ gasPrice: {
+ oneOf: [
+ {$ref: '/Number'},
+ {$ref: '/JsNumber'},
+ ],
+ },
+ data: {
+ type: 'string',
+ pattern: '^0x[0-9a-f]*$',
+ },
+ nonce: {
+ type: 'number',
+ minimum: 0,
+ },
+ },
+ required: ['from'],
+ type: 'object',
+ additionalProperties: false,
+};