From 169a1909d441e69bb6845c1099b4cb51fe5e7720 Mon Sep 17 00:00:00 2001 From: Chase Fleming Date: Tue, 16 Jan 2024 17:12:27 -0800 Subject: [PATCH] Add EVM page (#515) * Add EVM page * Remove cadence in top nav * Change to "EVM" * Fix url * Remove * Move to own page * Remove page and add redirect * Add slash to url * Change old links * Fix grammar * Remove unused category * Fix links * Add positioni * Add to sidebars --------- Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com> --- docs/build/basics/transactions.md | 2 +- .../cadence-reference/_category_.yml | 1 - .../cadence-reference/json-cadence-spec.md | 871 ------------------ docs/evm/about.md | 45 + docs/networks/node-ops/nodes/access-api.md | 10 +- .../node-ops/nodes/archive-access-api.md | 4 +- .../flow-cli/accounts/account-add-contract.md | 4 +- .../accounts/account-update-contract.md | 4 +- docs/tools/flow-cli/flix.md | 2 +- .../tools/flow-cli/scripts/execute-scripts.md | 4 +- .../transactions/build-transactions.md | 4 +- .../transactions/send-transactions.md | 4 +- docs/tutorials/dapp-infrastructure.md | 4 +- docusaurus.config.js | 5 +- sidebars.js | 1 + vercel.json | 5 + 16 files changed, 75 insertions(+), 895 deletions(-) delete mode 100644 docs/build/smart-contracts/cadence-reference/_category_.yml delete mode 100644 docs/build/smart-contracts/cadence-reference/json-cadence-spec.md create mode 100644 docs/evm/about.md diff --git a/docs/build/basics/transactions.md b/docs/build/basics/transactions.md index 050d560ccf..4b558ec492 100644 --- a/docs/build/basics/transactions.md +++ b/docs/build/basics/transactions.md @@ -40,7 +40,7 @@ transaction(greeting: String) { **Arguments** -Transactions may declare parameters it needs during execution, these must be provided as input arguments when sending a transaction. You can think of them as function arguments. Currently, we provide [arguments in the JSON-Cadence Data Interchange Format](../smart-contracts/cadence-reference/json-cadence-spec.md). Which is a human-readable JSON format. The sample script from above accepts a single `String` argument. +Transactions may declare parameters it needs during execution, these must be provided as input arguments when sending a transaction. You can think of them as function arguments. Currently, we provide [arguments in the JSON-Cadence Data Interchange Format](https://cadencelang.dev/docs/1.0/json-cadence-spec). Which is a human-readable JSON format. The sample script from above accepts a single `String` argument. **Reference Block** diff --git a/docs/build/smart-contracts/cadence-reference/_category_.yml b/docs/build/smart-contracts/cadence-reference/_category_.yml deleted file mode 100644 index e50ac98c5b..0000000000 --- a/docs/build/smart-contracts/cadence-reference/_category_.yml +++ /dev/null @@ -1 +0,0 @@ -label: Cadence Reference \ No newline at end of file diff --git a/docs/build/smart-contracts/cadence-reference/json-cadence-spec.md b/docs/build/smart-contracts/cadence-reference/json-cadence-spec.md deleted file mode 100644 index 69541262c6..0000000000 --- a/docs/build/smart-contracts/cadence-reference/json-cadence-spec.md +++ /dev/null @@ -1,871 +0,0 @@ ---- -title: JSON-Cadence Data Interchange Format -sidebar_label: JSON-Cadence format ---- - -# JSON-Cadence Data Interchange Format - -> Version 0.3.1 - -JSON-Cadence is a data interchange format used to represent Cadence values as language-independent JSON objects. - -This format includes less type information than a complete [ABI](https://en.wikipedia.org/wiki/Application_binary_interface), and instead promotes the following tenets: - -- **Human-readability** - JSON-Cadence is easy to read and comprehend, which speeds up development and debugging. -- **Compatibility** - JSON is a common format with built-in support in most high-level programming languages, making it easy to parse on a variety of platforms. -- **Portability** - JSON-Cadence is self-describing and thus can be transported and decoded without accompanying type definitions (i.e. an ABI). - -## Values - ---- - -### Void - -```json -{ - "type": "Void" -} -``` - -#### Example - -```json -{ - "type": "Void" -} -``` - ---- - -### Optional - -```json -{ - "type": "Optional", - "value": null | -} -``` - -#### Example - -```json -// Non-nil - -{ - "type": "Optional", - "value": { - "type": "UInt8", - "value": "123" - } -} - -// Nil - -{ - "type": "Optional", - "value": null -} -``` - ---- - -### Bool - -```json -{ - "type": "Bool", - "value": true | false -} -``` - -#### Example - -```json -{ - "type": "Bool", - "value": true -} -``` - ---- - -### String - -```json -{ - "type": "String", - "value": "..." -} - -``` - -#### Example - -```json -{ - "type": "String", - "value": "Hello, world!" -} -``` - ---- - -### Address - -```json -{ - "type": "Address", - "value": "0x0" // as hex-encoded string with 0x prefix -} -``` - -#### Example - -```json -{ - "type": "Address", - "value": "0x1234" -} -``` - ---- - -### Integers - -`[U]Int`, `[U]Int8`, `[U]Int16`, `[U]Int32`,`[U]Int64`,`[U]Int128`, `[U]Int256`, `Word8`, `Word16`, `Word32`, or `Word64` - -Although JSON supports integer literals up to 64 bits, all integer types are encoded as strings for consistency. - -While the static type is not strictly required for decoding, it is provided to inform client of potential range. - -```json -{ - "type": "", - "value": "" -} -``` - -#### Example - -```json -{ - "type": "UInt8", - "value": "123" -} -``` - ---- - -### Fixed Point Numbers - -`[U]Fix64` - -Although fixed point numbers are implemented as integers, JSON-Cadence uses a decimal string representation for readability. - -```json -{ - "type": "[U]Fix64", - "value": "." -} -``` - -#### Example - -```json -{ - "type": "Fix64", - "value": "12.3" -} -``` - ---- - -### Array - -```json -{ - "type": "Array", - "value": [ - , - - // ... - ] -} -``` - -#### Example - -```json -{ - "type": "Array", - "value": [ - { - "type": "Int16", - "value": "123" - }, - { - "type": "String", - "value": "test" - }, - { - "type": "Bool", - "value": true - } - ] -} -``` - ---- - -### Dictionary - -Dictionaries are encoded as a list of key-value pairs to preserve the deterministic ordering implemented by Cadence. - -```json -{ - "type": "Dictionary", - "value": [ - { - "key": "", - "value": - }, - ... - ] -} -``` - -#### Example - -```json -{ - "type": "Dictionary", - "value": [ - { - "key": { - "type": "UInt8", - "value": "123" - }, - "value": { - "type": "String", - "value": "test" - } - } - ], - // ... -} -``` - ---- - -### Composites (Struct, Resource, Event, Contract, Enum) - -Composite fields are encoded as a list of name-value pairs in the order in which they appear in the composite type declaration. - -```json -{ - "type": "Struct" | "Resource" | "Event" | "Contract" | "Enum", - "value": { - "id": "", - "fields": [ - { - "name": "", - "value": - }, - // ... - ] - } -} -``` - -#### Example - -```json -{ - "type": "Resource", - "value": { - "id": "0x3.GreatContract.GreatNFT", - "fields": [ - { - "name": "power", - "value": {"type": "Int", "value": "1"} - } - ] - } -} -``` - ---- - -### Path - -```json -{ - "type": "Path", - "value": { - "domain": "storage" | "private" | "public", - "identifier": "..." - } -} -``` - -#### Example - -```json -{ - "type": "Path", - "value": { - "domain": "storage", - "identifier": "flowTokenVault" - } -} -``` - ---- - -### Type Value - -```json -{ - "type": "Type", - "value": { - "staticType": - } -} -``` - -#### Example - -```json -{ - "type": "Type", - "value": { - "staticType": { - "kind": "Int", - } - } -} -``` - ---- - -### Capability - -```json -{ - "type": "Capability", - "value": { - "path": , - "address": "0x0", // as hex-encoded string with 0x prefix - "borrowType": , - } -} -``` - -#### Example - -```json -{ - "type": "Capability", - "value": { - "path": { - "type": "Path", - "value": { - "domain": "public", - "identifier": "someInteger" - } - }, - "address": "0x1", - "borrowType": { - "kind": "Int" - } - } -} -``` - ---- - -### Functions - -```json -{ - "type": "Function", - "value": { - "functionType": - } -} -``` - -Function values can only be exported, they cannot be imported. - -#### Example - -```json -{ - "type": "Function", - "value": { - "functionType": { - "kind": "Function", - "typeID": "(():Void)", - "parameters": [], - "return": { - "kind": "Void" - } - } - } -} -``` - ---- - -## Types - -### Simple Types - -These are basic types like `Int`, `String`, or `StoragePath`. - -```json -{ - "kind": "Any" | "AnyStruct" | "AnyResource" | "AnyStructAttachment" | "AnyResourceAttachment" | "Type" | - "Void" | "Never" | "Bool" | "String" | "Character" | - "Bytes" | "Address" | "Number" | "SignedNumber" | - "Integer" | "SignedInteger" | "FixedPoint" | - "SignedFixedPoint" | "Int" | "Int8" | "Int16" | - "Int32" | "Int64" | "Int128" | "Int256" | "UInt" | - "UInt8" | "UInt16" | "UInt32" | "UInt64" | "UInt128" | - "UInt256" | "Word8" | "Word16" | "Word32" | "Word64" | - "Fix64" | "UFix64" | "Path" | "CapabilityPath" | "StoragePath" | - "PublicPath" | "PrivatePath" | "AuthAccount" | "PublicAccount" | - "AuthAccount.Keys" | "PublicAccount.Keys" | "AuthAccount.Contracts" | - "PublicAccount.Contracts" | "DeployedContract" | "AccountKey" | "Block" -} -``` - -#### Example - -```json -{ - "kind": "UInt8" -} -``` - ---- - -### Optional Types - -```json -{ - "kind": "Optional", - "type": -} -``` - -#### Example - -```json -{ - "kind": "Optional", - "type": { - "kind": "String" - } -} -``` - ---- - -### Variable Sized Array Types - -```json -{ - "kind": "VariableSizedArray", - "type": -} -``` - -#### Example - -```json -{ - "kind": "VariableSizedArray", - "type": { - "kind": "String" - } -} -``` - ---- - -### Constant Sized Array Types - -```json -{ - "kind": "ConstantSizedArray", - "type": , - "size": , -} -``` - -#### Example - -```json -{ - "kind": "ConstantSizedArray", - "type": { - "kind": "String" - }, - "size":3 -} -``` - ---- - -### Dictionary Types - -```json -{ - "kind": "Dictionary", - "key": , - "value": -} -``` - -#### Example - -```json -{ - "kind": "Dictionary", - "key": { - "kind": "String" - }, - "value": { - "kind": "UInt16" - }, -} -``` - ---- - -### Composite Types - -```json -{ - "kind": "Struct" | "Resource" | "Event" | "Contract" | "StructInterface" | "ResourceInterface" | "ContractInterface", - "type": "", // this field exists only to keep parity with the enum structure below; the value must be the empty string - "typeID": "", - "initializers": [ - , - - // ... - ], - "fields": [ - , - - // ... - ], -} -``` - -#### Example - -```json -{ - "kind": "Resource", - "type": "", - "typeID": "0x3.GreatContract.GreatNFT", - "initializers":[ - [ - { - "label": "foo", - "id": "bar", - "type": { - "kind": "String" - } - } - ] - ], - "fields": [ - { - "id": "foo", - "type": { - "kind": "String" - } - } - ] -} -``` - ---- - -### Field Types - -```json -{ - "id": "", - "type": -} -``` - -#### Example - -```json -{ - "id": "foo", - "type": { - "kind": "String" - } -} -``` - ---- - -### Parameter Types - -```json -{ - "label": "