aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-05 18:33:48 +0800
committerFabio Berger <me@fabioberger.com>2018-07-05 18:33:48 +0800
commit2a7b3aecc3886bb4b699df17a0efef984e633d1f (patch)
treeade60c329313350fcfb59d5372bf22f253eccff2 /packages
parent75babed69317ab1da02a10706871ab0bb2293883 (diff)
downloaddexon-0x-contracts-2a7b3aecc3886bb4b699df17a0efef984e633d1f.tar.gz
dexon-0x-contracts-2a7b3aecc3886bb4b699df17a0efef984e633d1f.tar.zst
dexon-0x-contracts-2a7b3aecc3886bb4b699df17a0efef984e633d1f.zip
Add CallData schema to json-schemas
Diffstat (limited to 'packages')
-rw-r--r--packages/json-schemas/CHANGELOG.json4
-rw-r--r--packages/json-schemas/schemas/call_data_schema.ts27
-rw-r--r--packages/json-schemas/src/schemas.ts2
3 files changed, 33 insertions, 0 deletions
diff --git a/packages/json-schemas/CHANGELOG.json b/packages/json-schemas/CHANGELOG.json
index 2b37e1836..dfefdfc77 100644
--- a/packages/json-schemas/CHANGELOG.json
+++ b/packages/json-schemas/CHANGELOG.json
@@ -5,6 +5,10 @@
{
"note": "Update schemas for V2",
"pr": 615
+ },
+ {
+ "note": "Added CallData schema",
+ "pr": 821
}
]
},
diff --git a/packages/json-schemas/schemas/call_data_schema.ts b/packages/json-schemas/schemas/call_data_schema.ts
new file mode 100644
index 000000000..e8fcc7512
--- /dev/null
+++ b/packages/json-schemas/schemas/call_data_schema.ts
@@ -0,0 +1,27 @@
+export const callDataSchema = {
+ 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: [],
+ type: 'object',
+ additionalProperties: false,
+};
diff --git a/packages/json-schemas/src/schemas.ts b/packages/json-schemas/src/schemas.ts
index 77ea88f5c..4e13aeafb 100644
--- a/packages/json-schemas/src/schemas.ts
+++ b/packages/json-schemas/src/schemas.ts
@@ -1,5 +1,6 @@
import { addressSchema, hexSchema, numberSchema } from '../schemas/basic_type_schemas';
import { blockParamSchema, blockRangeSchema } from '../schemas/block_range_schema';
+import { callDataSchema } from '../schemas/call_data_schema';
import { ecSignatureSchema } from '../schemas/ec_signature_schema';
import { indexFilterValuesSchema } from '../schemas/index_filter_values_schema';
import { orderCancellationRequestsSchema } from '../schemas/order_cancel_schema';
@@ -31,6 +32,7 @@ import { jsNumber, txDataSchema } from '../schemas/tx_data_schema';
export const schemas = {
numberSchema,
addressSchema,
+ callDataSchema,
hexSchema,
ecSignatureSchema,
indexFilterValuesSchema,