From a1266c87847b4254d7e03a22c9624128b2f32798 Mon Sep 17 00:00:00 2001 From: 0xSpaceShard <0xSpaceShard@users.noreply.github.com> Date: Thu, 5 Sep 2024 09:54:37 +0000 Subject: [PATCH] Deploy website - based on aba4bba750271624da10e3ffc837dd3977d97dad --- 404.html | 2 +- assets/js/28a0cb7e.5d79e79a.js | 1 + assets/js/28a0cb7e.7924471a.js | 1 - assets/js/4769fc4e.8cd2f5e8.js | 1 - assets/js/4769fc4e.d5e77644.js | 1 + ...90bb1.54661cca.js => 6d990bb1.6f96a3b4.js} | 2 +- assets/js/a5e062ff.0c80ff57.js | 1 + assets/js/a5e062ff.5a44be1d.js | 1 - assets/js/ba6851eb.524a5dc2.js | 1 - assets/js/ba6851eb.83c245c2.js | 1 + assets/js/bca784a7.31e0bae6.js | 1 - assets/js/bca784a7.6d0a4228.js | 1 + ...n.793f45c8.js => runtime~main.a6a3d067.js} | 2 +- docs/0.0.6/account-impersonation/index.html | 2 +- docs/0.0.6/api/index.html | 2 +- docs/0.0.6/balance/index.html | 2 +- docs/0.0.6/blocks/index.html | 2 +- docs/0.0.6/category/running/index.html | 2 +- docs/0.0.6/dump-load-restart/index.html | 2 +- docs/0.0.6/forking/index.html | 2 +- docs/0.0.6/historic-state/index.html | 2 +- docs/0.0.6/intro/index.html | 2 +- docs/0.0.6/lite/index.html | 2 +- docs/0.0.6/postman/index.html | 4 ++-- docs/0.0.6/predeployed/index.html | 2 +- docs/0.0.6/running/cli/index.html | 2 +- docs/0.0.6/running/docker/index.html | 2 +- docs/0.0.6/running/install/index.html | 2 +- docs/0.0.6/server-config/index.html | 2 +- docs/0.0.6/starknet-time/index.html | 2 +- docs/0.0.7/account-impersonation/index.html | 2 +- docs/0.0.7/api/index.html | 2 +- docs/0.0.7/balance/index.html | 2 +- docs/0.0.7/blocks/index.html | 2 +- docs/0.0.7/category/running/index.html | 2 +- docs/0.0.7/dump-load-restart/index.html | 2 +- docs/0.0.7/forking/index.html | 2 +- docs/0.0.7/historic-state/index.html | 2 +- docs/0.0.7/intro/index.html | 2 +- docs/0.0.7/lite/index.html | 2 +- docs/0.0.7/postman/index.html | 4 ++-- docs/0.0.7/predeployed/index.html | 2 +- docs/0.0.7/running/cli/index.html | 2 +- docs/0.0.7/running/docker/index.html | 2 +- docs/0.0.7/running/install/index.html | 2 +- docs/0.0.7/server-config/index.html | 2 +- docs/0.0.7/starknet-time/index.html | 2 +- docs/0.1.1/account-impersonation/index.html | 2 +- docs/0.1.1/api/index.html | 2 +- docs/0.1.1/balance/index.html | 2 +- docs/0.1.1/blocks/index.html | 2 +- docs/0.1.1/category/running/index.html | 2 +- docs/0.1.1/dump-load-restart/index.html | 2 +- docs/0.1.1/forking/index.html | 2 +- docs/0.1.1/historic-state/index.html | 2 +- docs/0.1.1/intro/index.html | 2 +- docs/0.1.1/lite/index.html | 2 +- docs/0.1.1/postman/index.html | 4 ++-- docs/0.1.1/predeployed/index.html | 2 +- docs/0.1.1/running/cli/index.html | 2 +- docs/0.1.1/running/docker/index.html | 2 +- docs/0.1.1/running/install/index.html | 2 +- docs/0.1.1/server-config/index.html | 2 +- docs/0.1.1/starknet-time/index.html | 2 +- docs/account-impersonation/index.html | 2 +- docs/api/index.html | 2 +- docs/balance/index.html | 2 +- docs/blocks/index.html | 2 +- docs/category/running/index.html | 2 +- docs/dump-load-restart/index.html | 2 +- docs/examples/index.html | 2 +- docs/forking/index.html | 2 +- docs/historic-state/index.html | 2 +- docs/intro/index.html | 2 +- docs/lite/index.html | 2 +- docs/next/account-impersonation/index.html | 2 +- docs/next/api/index.html | 2 +- docs/next/balance/index.html | 2 +- docs/next/blocks/index.html | 2 +- docs/next/category/running/index.html | 2 +- docs/next/dump-load-restart/index.html | 2 +- docs/next/examples/index.html | 2 +- docs/next/forking/index.html | 2 +- docs/next/gas/index.html | 2 +- docs/next/historic-state/index.html | 2 +- docs/next/intro/index.html | 2 +- docs/next/lite/index.html | 2 +- docs/next/postman/index.html | 21 ++++++++++--------- docs/next/predeployed/index.html | 2 +- docs/next/restrictive/index.html | 2 +- docs/next/running/cli/index.html | 2 +- docs/next/running/docker/index.html | 2 +- docs/next/running/install/index.html | 2 +- docs/next/server-config/index.html | 2 +- docs/next/starknet-time/index.html | 2 +- docs/postman/index.html | 4 ++-- docs/predeployed/index.html | 2 +- docs/running/cli/index.html | 2 +- docs/running/docker/index.html | 2 +- docs/running/install/index.html | 2 +- docs/server-config/index.html | 2 +- docs/starknet-time/index.html | 2 +- index.html | 2 +- 103 files changed, 112 insertions(+), 111 deletions(-) create mode 100644 assets/js/28a0cb7e.5d79e79a.js delete mode 100644 assets/js/28a0cb7e.7924471a.js delete mode 100644 assets/js/4769fc4e.8cd2f5e8.js create mode 100644 assets/js/4769fc4e.d5e77644.js rename assets/js/{6d990bb1.54661cca.js => 6d990bb1.6f96a3b4.js} (68%) create mode 100644 assets/js/a5e062ff.0c80ff57.js delete mode 100644 assets/js/a5e062ff.5a44be1d.js delete mode 100644 assets/js/ba6851eb.524a5dc2.js create mode 100644 assets/js/ba6851eb.83c245c2.js delete mode 100644 assets/js/bca784a7.31e0bae6.js create mode 100644 assets/js/bca784a7.6d0a4228.js rename assets/js/{runtime~main.793f45c8.js => runtime~main.a6a3d067.js} (95%) diff --git a/404.html b/404.html index ee454910a..9a2c5322d 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@ Page Not Found | Starknet Devnet - + diff --git a/assets/js/28a0cb7e.5d79e79a.js b/assets/js/28a0cb7e.5d79e79a.js new file mode 100644 index 000000000..037941028 --- /dev/null +++ b/assets/js/28a0cb7e.5d79e79a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[141],{5040:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.1.1/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.1.1/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.1.1/postman.md",tags:[],version:"0.1.1",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.1.1/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.1.1/predeployed"}},c={},i=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/l1-l2-postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/28a0cb7e.7924471a.js b/assets/js/28a0cb7e.7924471a.js deleted file mode 100644 index ff0797db7..000000000 --- a/assets/js/28a0cb7e.7924471a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[141],{5040:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.1.1/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.1.1/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.1.1/postman.md",tags:[],version:"0.1.1",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.1.1/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.1.1/predeployed"}},c={},i=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4769fc4e.8cd2f5e8.js b/assets/js/4769fc4e.8cd2f5e8.js deleted file mode 100644 index 06c87a04c..000000000 --- a/assets/js/4769fc4e.8cd2f5e8.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2627],{4570:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=s(4848),r=s(8453);const a={},o="L1-L2 interaction via Postman",i={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.0.6/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.0.6/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.0.6/postman.md",tags:[],version:"0.0.6",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.0.6/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.0.6/predeployed"}},d={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/4769fc4e.d5e77644.js b/assets/js/4769fc4e.d5e77644.js new file mode 100644 index 000000000..992a89f70 --- /dev/null +++ b/assets/js/4769fc4e.d5e77644.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2627],{4570:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=s(4848),r=s(8453);const a={},o="L1-L2 interaction via Postman",i={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.0.6/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.0.6/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.0.6/postman.md",tags:[],version:"0.0.6",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.0.6/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.0.6/predeployed"}},d={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/l1-l2-postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/6d990bb1.54661cca.js b/assets/js/6d990bb1.6f96a3b4.js similarity index 68% rename from assets/js/6d990bb1.54661cca.js rename to assets/js/6d990bb1.6f96a3b4.js index c7a2a9141..78cc144f3 100644 --- a/assets/js/6d990bb1.54661cca.js +++ b/assets/js/6d990bb1.6f96a3b4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2282],{7164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":"unreleased","badge":true,"noIndex":false,"className":"docs-version-current","isLast":false,"docsSidebars":{"docSidebar":[{"type":"link","label":"Intro","href":"/starknet-devnet-rs/docs/next/intro","docId":"intro","unlisted":false},{"type":"category","label":"Running","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Install and run","href":"/starknet-devnet-rs/docs/next/running/install","docId":"running/install","unlisted":false},{"type":"link","label":"Run with Docker","href":"/starknet-devnet-rs/docs/next/running/docker","docId":"running/docker","unlisted":false},{"type":"link","label":"CLI options","href":"/starknet-devnet-rs/docs/next/running/cli","docId":"running/cli","unlisted":false}],"href":"/starknet-devnet-rs/docs/next/category/running"},{"type":"link","label":"API","href":"/starknet-devnet-rs/docs/next/api","docId":"api","unlisted":false},{"type":"link","label":"Account impersonation","href":"/starknet-devnet-rs/docs/next/account-impersonation","docId":"account-impersonation","unlisted":false},{"type":"link","label":"Account balance","href":"/starknet-devnet-rs/docs/next/balance","docId":"balance","unlisted":false},{"type":"link","label":"Blocks","href":"/starknet-devnet-rs/docs/next/blocks","docId":"blocks","unlisted":false},{"type":"link","label":"Dump, load, restart","href":"/starknet-devnet-rs/docs/next/dump-load-restart","docId":"dump-load-restart","unlisted":false},{"type":"link","label":"Examples","href":"/starknet-devnet-rs/docs/next/examples","docId":"examples","unlisted":false},{"type":"link","label":"Forking","href":"/starknet-devnet-rs/docs/next/forking","docId":"forking","unlisted":false},{"type":"link","label":"Gas price modification","href":"/starknet-devnet-rs/docs/next/gas","docId":"gas","unlisted":false},{"type":"link","label":"Historic state support","href":"/starknet-devnet-rs/docs/next/historic-state","docId":"historic-state","unlisted":false},{"type":"link","label":"Lite mode","href":"/starknet-devnet-rs/docs/next/lite","docId":"lite","unlisted":false},{"type":"link","label":"L1-L2 interaction via Postman","href":"/starknet-devnet-rs/docs/next/postman","docId":"postman","unlisted":false},{"type":"link","label":"Predeployed contracts","href":"/starknet-devnet-rs/docs/next/predeployed","docId":"predeployed","unlisted":false},{"type":"link","label":"Restrictive mode","href":"/starknet-devnet-rs/docs/next/restrictive","docId":"restrictive","unlisted":false},{"type":"link","label":"Server config","href":"/starknet-devnet-rs/docs/next/server-config","docId":"server-config","unlisted":false},{"type":"link","label":"Starknet time","href":"/starknet-devnet-rs/docs/next/starknet-time","docId":"starknet-time","unlisted":false}]},"docs":{"account-impersonation":{"id":"account-impersonation","title":"Account impersonation","description":"This page is about account impersonation. To read about account class selection and deployment, click here.","sidebar":"docSidebar"},"api":{"id":"api","title":"API","description":"JSON-RPC API","sidebar":"docSidebar"},"balance":{"id":"balance","title":"Account balance","description":"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.","sidebar":"docSidebar"},"blocks":{"id":"blocks","title":"Blocks","description":"Genesis block","sidebar":"docSidebar"},"dump-load-restart":{"id":"dump-load-restart","title":"Dump, load, restart","description":"Dumping","sidebar":"docSidebar"},"examples":{"id":"examples","title":"Examples","description":"Usage examples relying on the starknet-devnet-js library can be found here.","sidebar":"docSidebar"},"forking":{"id":"forking","title":"Forking","description":"To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself.","sidebar":"docSidebar"},"gas":{"id":"gas","title":"Gas price modification","description":"The devnetsetGasPrice RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network\'s gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag generateblock indicates whether a new block should be generated immediately after setting the gas prices.","sidebar":"docSidebar"},"historic-state":{"id":"historic-state","title":"Historic state support","description":"With state archive capacity set to full, Devnet will store full state history, enabling its querying by block hash or number. The default mode is none, where no old states are stored and only the latest is available for querying.","sidebar":"docSidebar"},"intro":{"id":"intro","title":"Intro","description":"- Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)!","sidebar":"docSidebar"},"lite":{"id":"lite","title":"Lite mode","description":"To run Devnet in a minimal lite mode, provide the flag:","sidebar":"docSidebar"},"postman":{"id":"postman","title":"L1-L2 interaction via Postman","description":"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.","sidebar":"docSidebar"},"predeployed":{"id":"predeployed","title":"Predeployed contracts","description":"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.","sidebar":"docSidebar"},"restrictive":{"id":"restrictive","title":"Restrictive mode","description":"The --restrictive-mode argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet\'s behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403.","sidebar":"docSidebar"},"running/cli":{"id":"running/cli","title":"CLI options","description":"Configure your Devnet instance by specifying CLI parameters on startup. To read more about HTTP and logging configuration, check out the server config page.","sidebar":"docSidebar"},"running/docker":{"id":"running/docker","title":"Run with Docker","description":"Devnet is available as a Docker image (Docker Hub link). To download the latest image, run:","sidebar":"docSidebar"},"running/install":{"id":"running/install","title":"Install and run","description":"Requirements","sidebar":"docSidebar"},"server-config":{"id":"server-config","title":"Server config","description":"To read generally about ways to configure your Devnet instance, check out the CLI section.","sidebar":"docSidebar"},"starknet-time":{"id":"starknet-time","title":"Starknet time","description":"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime, /increasetime and JSON-RPC methods devnetsetTime, devnetincreaseTime generate a new block. This can be changed for /settime (devnetsetTime) by setting the optional parameter generate_block to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.","sidebar":"docSidebar"}}}}')}}]); \ No newline at end of file +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2282],{7164:e=>{e.exports=JSON.parse('{"version":{"pluginId":"default","version":"current","label":"Next","banner":"unreleased","badge":true,"noIndex":false,"className":"docs-version-current","isLast":false,"docsSidebars":{"docSidebar":[{"type":"link","label":"Intro","href":"/starknet-devnet-rs/docs/next/intro","docId":"intro","unlisted":false},{"type":"category","label":"Running","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Install and run","href":"/starknet-devnet-rs/docs/next/running/install","docId":"running/install","unlisted":false},{"type":"link","label":"Run with Docker","href":"/starknet-devnet-rs/docs/next/running/docker","docId":"running/docker","unlisted":false},{"type":"link","label":"CLI options","href":"/starknet-devnet-rs/docs/next/running/cli","docId":"running/cli","unlisted":false}],"href":"/starknet-devnet-rs/docs/next/category/running"},{"type":"link","label":"API","href":"/starknet-devnet-rs/docs/next/api","docId":"api","unlisted":false},{"type":"link","label":"Account impersonation","href":"/starknet-devnet-rs/docs/next/account-impersonation","docId":"account-impersonation","unlisted":false},{"type":"link","label":"Account balance","href":"/starknet-devnet-rs/docs/next/balance","docId":"balance","unlisted":false},{"type":"link","label":"Blocks","href":"/starknet-devnet-rs/docs/next/blocks","docId":"blocks","unlisted":false},{"type":"link","label":"Dump, load, restart","href":"/starknet-devnet-rs/docs/next/dump-load-restart","docId":"dump-load-restart","unlisted":false},{"type":"link","label":"Examples","href":"/starknet-devnet-rs/docs/next/examples","docId":"examples","unlisted":false},{"type":"link","label":"Forking","href":"/starknet-devnet-rs/docs/next/forking","docId":"forking","unlisted":false},{"type":"link","label":"Gas price modification","href":"/starknet-devnet-rs/docs/next/gas","docId":"gas","unlisted":false},{"type":"link","label":"Historic state support","href":"/starknet-devnet-rs/docs/next/historic-state","docId":"historic-state","unlisted":false},{"type":"link","label":"Lite mode","href":"/starknet-devnet-rs/docs/next/lite","docId":"lite","unlisted":false},{"type":"link","label":"L1-L2 interaction via Postman","href":"/starknet-devnet-rs/docs/next/postman","docId":"postman","unlisted":false},{"type":"link","label":"Predeployed contracts","href":"/starknet-devnet-rs/docs/next/predeployed","docId":"predeployed","unlisted":false},{"type":"link","label":"Restrictive mode","href":"/starknet-devnet-rs/docs/next/restrictive","docId":"restrictive","unlisted":false},{"type":"link","label":"Server config","href":"/starknet-devnet-rs/docs/next/server-config","docId":"server-config","unlisted":false},{"type":"link","label":"Starknet time","href":"/starknet-devnet-rs/docs/next/starknet-time","docId":"starknet-time","unlisted":false}]},"docs":{"account-impersonation":{"id":"account-impersonation","title":"Account impersonation","description":"This page is about account impersonation. To read about account class selection and deployment, click here.","sidebar":"docSidebar"},"api":{"id":"api","title":"API","description":"JSON-RPC API","sidebar":"docSidebar"},"balance":{"id":"balance","title":"Account balance","description":"Other than using prefunded predeployed accounts, you can also add funds to an account that you deployed yourself.","sidebar":"docSidebar"},"blocks":{"id":"blocks","title":"Blocks","description":"Genesis block","sidebar":"docSidebar"},"dump-load-restart":{"id":"dump-load-restart","title":"Dump, load, restart","description":"Dumping","sidebar":"docSidebar"},"examples":{"id":"examples","title":"Examples","description":"Usage examples relying on the starknet-devnet-js library can be found here.","sidebar":"docSidebar"},"forking":{"id":"forking","title":"Forking","description":"To interact with contracts deployed on mainnet or testnet, you can use forking. Simulate the origin and experiment with it locally, making no changes to the origin itself.","sidebar":"docSidebar"},"gas":{"id":"gas","title":"Gas price modification","description":"The devnetsetGasPrice RPC method allows users to modify the current gas prices on a running Devnet. This feature is particularly useful for testing purposes and for adjustments needed after forking to align with the forked network\'s gas prices. All parameters are optional, allowing you to choose which ones you want to set. A boolean flag generateblock indicates whether a new block should be generated immediately after setting the gas prices.","sidebar":"docSidebar"},"historic-state":{"id":"historic-state","title":"Historic state support","description":"With state archive capacity set to full, Devnet will store full state history, enabling its querying by block hash or number. The default mode is none, where no old states are stored and only the latest is available for querying.","sidebar":"docSidebar"},"intro":{"id":"intro","title":"Intro","description":"- Devnet should not be used as a replacement for official testnets. After testing on Devnet, be sure to test on a testnet (alpha-sepolia)!","sidebar":"docSidebar"},"lite":{"id":"lite","title":"Lite mode","description":"To run Devnet in a minimal lite mode, provide the flag:","sidebar":"docSidebar"},"postman":{"id":"postman","title":"L1-L2 interaction via Postman","description":"Postman is a Starknet utility that allows testing L1-L2 interaction. It is unrelated to the Postman API platform. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue to transmit the messages to their destinations. The functionality relies on two internal message queues: one for L1->L2 messages, another for L2->L1 messages.","sidebar":"docSidebar"},"predeployed":{"id":"predeployed","title":"Predeployed contracts","description":"Devnet predeploys a UDC, an ERC20 (fee token) contract and a set of predeployed funded accounts.","sidebar":"docSidebar"},"restrictive":{"id":"restrictive","title":"Restrictive mode","description":"The --restrictive-mode argument enables a restrictive mode for Devnet, allowing you to specify methods that are forbidden during execution. This option ensures that certain operations are restricted, enhancing control over Devnet\'s behavior. When a user sends a request to one of the restricted methods, Devnet will return either a JSON-RPC error with code -32604 or, if the method was targeted directly via the HTTP endpoint, a response with status 403.","sidebar":"docSidebar"},"running/cli":{"id":"running/cli","title":"CLI options","description":"Configure your Devnet instance by specifying CLI parameters on startup. To read more about HTTP and logging configuration, check out the server config page.","sidebar":"docSidebar"},"running/docker":{"id":"running/docker","title":"Run with Docker","description":"Devnet is available as a Docker image (Docker Hub link). To download the latest image, run:","sidebar":"docSidebar"},"running/install":{"id":"running/install","title":"Install and run","description":"Requirements","sidebar":"docSidebar"},"server-config":{"id":"server-config","title":"Server config","description":"To read generally about ways to configure your Devnet instance, check out the CLI section.","sidebar":"docSidebar"},"starknet-time":{"id":"starknet-time","title":"Starknet time","description":"Block and state timestamp can be manipulated by setting the exact time or setting the time offset. By default, timestamp methods /settime, /increasetime and JSON-RPC methods devnetsetTime, devnetincreaseTime generate a new block. This can be changed for /settime (devnetsetTime) by setting the optional parameter generate_block to false. This skips immediate new block generation, but will use the specified timestamp whenever the next block is supposed to be generated.","sidebar":"docSidebar"}}}}')}}]); \ No newline at end of file diff --git a/assets/js/a5e062ff.0c80ff57.js b/assets/js/a5e062ff.0c80ff57.js new file mode 100644 index 000000000..9c0ee11f6 --- /dev/null +++ b/assets/js/a5e062ff.0c80ff57.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3726],{6909:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=s(4848),r=s(8453);const a={},o="L1-L2 interaction via Postman",i={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.0.7/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.0.7/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.0.7/postman.md",tags:[],version:"0.0.7",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.0.7/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.0.7/predeployed"}},d={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/l1-l2-postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/a5e062ff.5a44be1d.js b/assets/js/a5e062ff.5a44be1d.js deleted file mode 100644 index 93d5a9fe9..000000000 --- a/assets/js/a5e062ff.5a44be1d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[3726],{6909:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>d,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var t=s(4848),r=s(8453);const a={},o="L1-L2 interaction via Postman",i={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.0.7/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/0.0.7/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.0.7/postman.md",tags:[],version:"0.0.7",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/0.0.7/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/0.0.7/predeployed"}},d={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-plugin",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-hardhat-plugin"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-hardhat-example/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>i});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function i(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ba6851eb.524a5dc2.js b/assets/js/ba6851eb.524a5dc2.js deleted file mode 100644 index 388c55b23..000000000 --- a/assets/js/ba6851eb.524a5dc2.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4033],{9685:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.1.2/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.1.2/postman.md",tags:[],version:"0.1.2",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/predeployed"}},c={},i=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/ba6851eb.83c245c2.js b/assets/js/ba6851eb.83c245c2.js new file mode 100644 index 000000000..0c28708f5 --- /dev/null +++ b/assets/js/ba6851eb.83c245c2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[4033],{9685:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>c,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>i});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/versioned_docs/version-0.1.2/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/versioned_docs/version-0.1.2/postman.md",tags:[],version:"0.1.2",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/predeployed"}},c={},i=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/l1-l2-postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "networkUrl": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"networkUrl"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef"\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"l1_contract_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bca784a7.31e0bae6.js b/assets/js/bca784a7.31e0bae6.js deleted file mode 100644 index afadc4b08..000000000 --- a/assets/js/bca784a7.31e0bae6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{5787:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>i,contentTitle:()=>d,default:()=>h,frontMatter:()=>a,metadata:()=>o,toc:()=>c});var t=s(4848),r=s(8453);const a={},d="L1-L2 interaction via Postman",o={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.",source:"@site/docs/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/next/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/postman.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/next/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"}},i={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue when needed. You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "network_url": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "network_url": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"network_url"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," specifier to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid otherwise new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually."]}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef",\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef",\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sending mock transactions from L2 to L1.\nDeployed L2 contract address ",(0,t.jsx)(n.code,{children:"from_address"})," and ",(0,t.jsx)(n.code,{children:"to_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "from_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "to_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "from_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "to_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>d,x:()=>o});var t=s(6540);const r={},a=t.createContext(r);function d(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/bca784a7.6d0a4228.js b/assets/js/bca784a7.6d0a4228.js new file mode 100644 index 000000000..346729475 --- /dev/null +++ b/assets/js/bca784a7.6d0a4228.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[8626],{5787:(e,n,s)=>{s.r(n),s.d(n,{assets:()=>i,contentTitle:()=>o,default:()=>h,frontMatter:()=>a,metadata:()=>d,toc:()=>c});var t=s(4848),r=s(8453);const a={},o="L1-L2 interaction via Postman",d={id:"postman",title:"L1-L2 interaction via Postman",description:"Postman is a Starknet utility that allows testing L1-L2 interaction. It is unrelated to the Postman API platform. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue to transmit the messages to their destinations. The functionality relies on two internal message queues: one for L1->L2 messages, another for L2->L1 messages.",source:"@site/docs/postman.md",sourceDirName:".",slug:"/postman",permalink:"/starknet-devnet-rs/docs/next/postman",draft:!1,unlisted:!1,editUrl:"https://github.com/0xSpaceShard/starknet-devnet-rs/blob/master/website/docs/postman.md",tags:[],version:"current",frontMatter:{},sidebar:"docSidebar",previous:{title:"Lite mode",permalink:"/starknet-devnet-rs/docs/next/lite"},next:{title:"Predeployed contracts",permalink:"/starknet-devnet-rs/docs/next/predeployed"}},i={},c=[{value:"Load",id:"load",level:2},{value:"Flush",id:"flush",level:2},{value:"Disclaimer",id:"disclaimer",level:2},{value:"Mock transactions",id:"mock-transactions",level:2},{value:"L1->L2",id:"l1-l2",level:3},{value:"L2->L1",id:"l2-l1",level:3}];function l(e){const n={a:"a",admonition:"admonition",code:"code",h1:"h1",h2:"h2",h3:"h3",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h1,{id:"l1-l2-interaction-via-postman",children:"L1-L2 interaction via Postman"}),"\n",(0,t.jsxs)(n.p,{children:["Postman is a Starknet utility that allows testing L1-L2 interaction. It is ",(0,t.jsx)(n.strong,{children:"unrelated"})," to the ",(0,t.jsx)(n.a,{href:"https://www.postman.com/",children:"Postman API platform"}),". Ensure you have an L1 node and a Devnet (L2 node) running, ",(0,t.jsx)(n.a,{href:"#load",children:"load"})," a messaging contract, and ",(0,t.jsx)(n.a,{href:"#flush",children:"flush"})," the queue to transmit the messages to their destinations. The functionality relies on two internal message queues: one for L1->L2 messages, another for L2->L1 messages."]}),"\n",(0,t.jsxs)(n.p,{children:["You can use ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js",children:(0,t.jsx)(n.strong,{children:(0,t.jsx)(n.code,{children:"starknet-devnet-js"})})})," to perform these actions, as witnessed in ",(0,t.jsx)(n.a,{href:"https://github.com/0xSpaceShard/starknet-devnet-js/blob/master/test/l1-l2-postman.test.ts",children:(0,t.jsx)(n.strong,{children:"this example"})}),", or directly send requests to the endpoints specified below."]}),"\n",(0,t.jsx)(n.h2,{id:"load",children:"Load"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/load_l1_messaging_contract\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-json",children:'{\n "network_url": "http://localhost:8545",\n "address": "0x123...def"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanLoad",\n "params": {\n "network_url": "http://localhost:8545",\n "address": "0x123...def"\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Loads a ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract. The ",(0,t.jsx)(n.code,{children:"address"})," parameter is optional; if provided, the ",(0,t.jsx)(n.code,{children:"MockStarknetMessaging"})," contract will be fetched from that address, otherwise a new one will be deployed."]}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"network_url"})," is the URL of the JSON-RPC API of the L1 node you've run locally or that already exists; possibilities include, and are not limited to:"]}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/foundry-rs/foundry/tree/master/crates/anvil",children:(0,t.jsx)(n.strong,{children:"Anvil"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://sepolia.etherscan.io/",children:(0,t.jsx)(n.strong,{children:"Sepolia testnet"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://www.npmjs.com/package/ganache",children:(0,t.jsx)(n.strong,{children:"Ganache"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://github.com/ethereum/go-ethereum#docker-quick-start",children:(0,t.jsx)(n.strong,{children:"Geth"})})}),"\n",(0,t.jsx)(n.li,{children:(0,t.jsx)(n.a,{href:"https://hardhat.org/hardhat-network/#running-stand-alone-in-order-to-support-wallets-and-other-software",children:(0,t.jsx)(n.strong,{children:"Hardhat node"})})}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"flush",children:"Flush"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush"\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["Goes through the newly enqueued messages since the last flush, consuming and sending them from L1 to L2 and from L2 to L1. Use it for end-to-end testing. Requires no body. Optionally, set the ",(0,t.jsx)(n.code,{children:"dry_run"})," boolean flag to just see the result of flushing, without actually triggering it:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/flush\n"})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "dry_run": true }\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanFlush",\n "params": {\n "dry_run": true\n }\n}\n'})}),"\n",(0,t.jsxs)(n.p,{children:["A running L1 node is required if ",(0,t.jsx)(n.code,{children:"dry_run"})," is not set."]}),"\n",(0,t.jsx)(n.h2,{id:"disclaimer",children:"Disclaimer"}),"\n",(0,t.jsxs)(n.p,{children:["This method of L1-L2 communication testing differs from how Starknet mainnet and testnets work. Taking ",(0,t.jsx)(n.a,{href:"https://github.com/MikeSpa/starknet-test/blob/6a68d033cd7ddb5df937154f860f1c06174e6860/L1L2Example.sol#L46",children:(0,t.jsx)(n.strong,{children:"L1L2Example.sol"})})," (originally from Starknet documentation, no longer available there):"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(IStarknetCore starknetCore_) public {\n starknetCore = starknetCore_;\n}\n"})}),"\n",(0,t.jsxs)(n.p,{children:["The constructor takes an ",(0,t.jsx)(n.code,{children:"IStarknetCore"})," contract as argument, however for Devnet's L1-L2 communication testing, this has to be replaced with the logic in ",(0,t.jsx)(n.a,{href:"https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/testing/MockStarknetMessaging.sol",children:(0,t.jsx)(n.strong,{children:"MockStarknetMessaging.sol"})}),":"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-solidity",children:"constructor(MockStarknetMessaging mockStarknetMessaging_) public {\n starknetCore = mockStarknetMessaging_;\n}\n"})}),"\n",(0,t.jsx)(n.h2,{id:"mock-transactions",children:"Mock transactions"}),"\n",(0,t.jsx)(n.h3,{id:"l1-l2",children:"L1->L2"}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsxs)(n.p,{children:["A running L1 node is ",(0,t.jsx)(n.strong,{children:"not"})," required for this operation."]})}),"\n",(0,t.jsxs)(n.p,{children:["Sends a mock transactions to L2, as if coming from L1, without the need for running L1. The deployed L2 contract address ",(0,t.jsx)(n.code,{children:"l2_contract_address"})," and ",(0,t.jsx)(n.code,{children:"entry_point_selector"})," must be valid, otherwise a new block will not be created."]}),"\n",(0,t.jsxs)(n.p,{children:["Normally ",(0,t.jsx)(n.code,{children:"nonce"})," is calculated by the L1 Starknet contract and it is used in L1 and L2. In this case, it needs to be provided manually."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/send_message_to_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef",\n "nonce":"0x0"\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanSendMessageToL2",\n "params": {\n "l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",\n "l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": [\n "0x1",\n "0x2"\n ],\n "paid_fee_on_l1": "0x123456abcdef",\n "nonce":"0x0"\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }\n'})}),"\n",(0,t.jsx)(n.h3,{id:"l2-l1",children:"L2->L1"}),"\n",(0,t.jsxs)(n.p,{children:["Sends a mock transaction from L2 to L1. The deployed L2 contract address ",(0,t.jsx)(n.code,{children:"from_address"})," and ",(0,t.jsx)(n.code,{children:"to_address"})," must be valid."]}),"\n",(0,t.jsx)(n.p,{children:"It is a mock message, but only in the sense that you are mocking an L2 contract's action, which would normally be triggered by invoking the contract via a transaction. So keep in mind the following:"}),"\n",(0,t.jsx)(n.admonition,{type:"note",children:(0,t.jsx)(n.p,{children:"A running L1 node is required for this operation."})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:"POST /postman/consume_message_from_l2\n"})}),"\n",(0,t.jsx)(n.p,{children:"Request:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{\n "from_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "to_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n}\n'})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{children:'JSON-RPC\n{\n "jsonrpc": "2.0",\n "id": "1",\n "method": "devnet_postmanConsumeMessageFromL2",\n "params": {\n "from_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",\n "to_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",\n "payload": ["0x0", "0x1", "0x3e8"],\n }\n}\n'})}),"\n",(0,t.jsx)(n.p,{children:"Response:"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-js",children:'{"message_hash": "0xae14f241131b524ac8d043d9cb4934253ac5c5589afef19f0d761816a9c7e26d"}\n'})})]})}function h(e={}){const{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(l,{...e})}):l(e)}},8453:(e,n,s)=>{s.d(n,{R:()=>o,x:()=>d});var t=s(6540);const r={},a=t.createContext(r);function o(e){const n=t.useContext(a);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),t.createElement(a.Provider,{value:n},e.children)}}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.793f45c8.js b/assets/js/runtime~main.a6a3d067.js similarity index 95% rename from assets/js/runtime~main.793f45c8.js rename to assets/js/runtime~main.a6a3d067.js index ce2988bfe..e4783de9e 100644 --- a/assets/js/runtime~main.793f45c8.js +++ b/assets/js/runtime~main.a6a3d067.js @@ -1 +1 @@ -(()=>{"use strict";var e,a,b,f,d,c={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var b=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(b.exports,b,b.exports,r),b.loaded=!0,b.exports}r.m=c,r.c=t,e=[],r.O=(a,b,f,d)=>{if(!b){var c=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](b[o])))?b.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[b,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var c={};a=a||[null,b({}),b([]),b(b)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=b(t))Object.getOwnPropertyNames(t).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,r.d(d,c),d},r.d=(e,a)=>{for(var b in a)r.o(a,b)&&!r.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,b)=>(r.f[b](e,a),a)),[])),r.u=e=>"assets/js/"+({134:"b7bb6147",141:"28a0cb7e",337:"3f194bb7",463:"682c6856",484:"673b87a5",562:"5fadd32f",579:"9bb1131a",598:"c25a813d",626:"005b2ed7",646:"7b998695",662:"645cda15",871:"9978e21e",952:"2d66ba60",1235:"a7456010",1316:"1b560adb",1437:"8e76450a",1475:"9c3aeb12",1527:"778bcc8b",1863:"b4513eec",1864:"09d5ad39",1914:"1151f991",2134:"c4d2e5c1",2282:"6d990bb1",2408:"9abfa349",2412:"16a2713f",2604:"b8663a1f",2627:"4769fc4e",2828:"49885c5e",2871:"3c883fc4",2916:"425e1ae2",2963:"922c21f9",3124:"ef2a8751",3332:"e28eadbb",3705:"c75c8ede",3726:"a5e062ff",3768:"e8953dad",3919:"f84fb341",3950:"b7007dab",3956:"a0ea14c4",3976:"0e384e19",4033:"ba6851eb",4290:"ae603a5f",4291:"93f3c2aa",4455:"993d6a8d",4583:"1df93b7f",4643:"f44adc48",4676:"24503201",4876:"17682634",5120:"a5ad27b1",5186:"b0477c6d",5348:"5402810c",5480:"80526ee6",5532:"e81f6410",5624:"9b932233",5634:"ef3b0775",5700:"b9f7b2ab",5742:"aba21aa0",5771:"8f2e4180",5864:"2ad05638",5960:"0657c530",6017:"8d981dc3",6131:"119a2918",6187:"e44e17f8",6286:"e2f00550",6439:"ad6bd692",6613:"38541689",6651:"18672b0b",6773:"2146f16f",6828:"9976ff42",6900:"cc3979e2",6928:"def2ee80",6969:"14eb3368",7098:"a7bd4aaa",7117:"224c8fe8",7229:"eb78b783",7230:"93f75803",7341:"e2db9f7a",7595:"0debafb6",7624:"5fbc5cf1",7780:"1e29fbdb",7817:"a56dc942",7883:"e2538a57",7969:"5985dcf4",8401:"17896441",8586:"b1ee2929",8626:"bca784a7",8704:"1c1cdb4e",8838:"f8ae958c",9048:"a94703ab",9167:"ba738306",9218:"cc2baa30",9308:"509bfc31",9337:"e120dcd9",9378:"5b870ab8",9440:"8d820236",9471:"e82252d2",9497:"e3e59843",9629:"9875b4b5",9647:"5e95c892",9736:"4adc7347",9891:"6bb6da1f",9998:"7923f30a"}[e]||e)+"."+{134:"290a582f",141:"7924471a",337:"22bfc72a",463:"6d8a69a6",484:"d8f6d2d7",562:"04fe94e0",579:"12332b9a",598:"dcaf95cd",626:"fff9bdb8",646:"77b6f90e",662:"f6ef4fb7",871:"44defd03",952:"b247a1f7",1235:"7b4b0a20",1316:"0fed137f",1437:"457a0c79",1475:"2ff5ffe7",1527:"6f445848",1863:"e8fccf27",1864:"836bb2d7",1914:"193b4b8f",2134:"6f189758",2237:"ede9a640",2282:"54661cca",2408:"620b16d7",2412:"f08ebda5",2604:"04e57222",2627:"8cd2f5e8",2828:"4bc7e5ad",2871:"d1c841d8",2916:"469cee91",2963:"08818fdb",3124:"0dc9d49a",3332:"9880c232",3705:"6fed968f",3726:"5a44be1d",3768:"d8af09d8",3919:"e4b03c02",3950:"dce48c7e",3956:"74b8c7b1",3976:"9f5b9cab",4033:"524a5dc2",4290:"fa5b263f",4291:"850dddd9",4455:"5534343a",4583:"f182b925",4643:"fe264cf6",4676:"df561d25",4876:"3d25384a",5120:"45ba4134",5186:"5a13a38e",5348:"3ad38ed6",5480:"b9a69f3d",5532:"60f06895",5624:"211be870",5634:"0187249f",5700:"fc7d833c",5742:"9ac6642b",5771:"6fb725c9",5864:"e7cacb2b",5960:"aa8fdf00",6017:"5d6a3cde",6131:"18512c2f",6187:"709607a7",6286:"8ca4e8a2",6439:"2d8efa6d",6613:"8921907a",6651:"03c22191",6773:"fed3c84a",6828:"8da5bc72",6900:"f2efdc37",6928:"5fd884cc",6969:"eeb6b7e2",7098:"b82ee0df",7117:"7ab239ae",7229:"33a8bdeb",7230:"260ce03e",7341:"810d7342",7595:"bf13c614",7624:"949f6d67",7780:"d5a6d9e6",7817:"d708dd89",7883:"b963a51d",7969:"70d866fa",8401:"dcdbd021",8586:"037d9b49",8626:"31e0bae6",8704:"8434c89b",8838:"5cbb1183",9048:"2668bc5b",9167:"fde851af",9218:"5b9b66e1",9308:"dad3f1e7",9337:"22e90422",9378:"e5b723a6",9440:"525617f1",9471:"9b22e8ad",9497:"a3e0afab",9629:"9ea44d6b",9647:"b1f5748f",9736:"7ae4e26a",9891:"d58d4f04",9998:"012c6902"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="website:",r.l=(e,a,b,c)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/starknet-devnet-rs/",r.gca=function(e){return e={17682634:"4876",17896441:"8401",24503201:"4676",38541689:"6613",b7bb6147:"134","28a0cb7e":"141","3f194bb7":"337","682c6856":"463","673b87a5":"484","5fadd32f":"562","9bb1131a":"579",c25a813d:"598","005b2ed7":"626","7b998695":"646","645cda15":"662","9978e21e":"871","2d66ba60":"952",a7456010:"1235","1b560adb":"1316","8e76450a":"1437","9c3aeb12":"1475","778bcc8b":"1527",b4513eec:"1863","09d5ad39":"1864","1151f991":"1914",c4d2e5c1:"2134","6d990bb1":"2282","9abfa349":"2408","16a2713f":"2412",b8663a1f:"2604","4769fc4e":"2627","49885c5e":"2828","3c883fc4":"2871","425e1ae2":"2916","922c21f9":"2963",ef2a8751:"3124",e28eadbb:"3332",c75c8ede:"3705",a5e062ff:"3726",e8953dad:"3768",f84fb341:"3919",b7007dab:"3950",a0ea14c4:"3956","0e384e19":"3976",ba6851eb:"4033",ae603a5f:"4290","93f3c2aa":"4291","993d6a8d":"4455","1df93b7f":"4583",f44adc48:"4643",a5ad27b1:"5120",b0477c6d:"5186","5402810c":"5348","80526ee6":"5480",e81f6410:"5532","9b932233":"5624",ef3b0775:"5634",b9f7b2ab:"5700",aba21aa0:"5742","8f2e4180":"5771","2ad05638":"5864","0657c530":"5960","8d981dc3":"6017","119a2918":"6131",e44e17f8:"6187",e2f00550:"6286",ad6bd692:"6439","18672b0b":"6651","2146f16f":"6773","9976ff42":"6828",cc3979e2:"6900",def2ee80:"6928","14eb3368":"6969",a7bd4aaa:"7098","224c8fe8":"7117",eb78b783:"7229","93f75803":"7230",e2db9f7a:"7341","0debafb6":"7595","5fbc5cf1":"7624","1e29fbdb":"7780",a56dc942:"7817",e2538a57:"7883","5985dcf4":"7969",b1ee2929:"8586",bca784a7:"8626","1c1cdb4e":"8704",f8ae958c:"8838",a94703ab:"9048",ba738306:"9167",cc2baa30:"9218","509bfc31":"9308",e120dcd9:"9337","5b870ab8":"9378","8d820236":"9440",e82252d2:"9471",e3e59843:"9497","9875b4b5":"9629","5e95c892":"9647","4adc7347":"9736","6bb6da1f":"9891","7923f30a":"9998"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,b)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((b,d)=>f=e[a]=[b,d]));b.push(f[2]=d);var c=r.p+r.u(a),t=new Error;r.l(c,(b=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=b&&("load"===b.type?"missing":b.type),c=b&&b.target&&b.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+c+")",t.name="ChunkLoadError",t.type=d,t.request=c,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,b)=>{var f,d,c=b[0],t=b[1],o=b[2],n=0;if(c.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(b);n{"use strict";var e,a,b,f,d,c={},t={};function r(e){var a=t[e];if(void 0!==a)return a.exports;var b=t[e]={id:e,loaded:!1,exports:{}};return c[e].call(b.exports,b,b.exports,r),b.loaded=!0,b.exports}r.m=c,r.c=t,e=[],r.O=(a,b,f,d)=>{if(!b){var c=1/0;for(i=0;i=d)&&Object.keys(r.O).every((e=>r.O[e](b[o])))?b.splice(o--,1):(t=!1,d0&&e[i-1][2]>d;i--)e[i]=e[i-1];e[i]=[b,f,d]},r.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return r.d(a,{a:a}),a},b=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,f){if(1&f&&(e=this(e)),8&f)return e;if("object"==typeof e&&e){if(4&f&&e.__esModule)return e;if(16&f&&"function"==typeof e.then)return e}var d=Object.create(null);r.r(d);var c={};a=a||[null,b({}),b([]),b(b)];for(var t=2&f&&e;"object"==typeof t&&!~a.indexOf(t);t=b(t))Object.getOwnPropertyNames(t).forEach((a=>c[a]=()=>e[a]));return c.default=()=>e,r.d(d,c),d},r.d=(e,a)=>{for(var b in a)r.o(a,b)&&!r.o(e,b)&&Object.defineProperty(e,b,{enumerable:!0,get:a[b]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((a,b)=>(r.f[b](e,a),a)),[])),r.u=e=>"assets/js/"+({134:"b7bb6147",141:"28a0cb7e",337:"3f194bb7",463:"682c6856",484:"673b87a5",562:"5fadd32f",579:"9bb1131a",598:"c25a813d",626:"005b2ed7",646:"7b998695",662:"645cda15",871:"9978e21e",952:"2d66ba60",1235:"a7456010",1316:"1b560adb",1437:"8e76450a",1475:"9c3aeb12",1527:"778bcc8b",1863:"b4513eec",1864:"09d5ad39",1914:"1151f991",2134:"c4d2e5c1",2282:"6d990bb1",2408:"9abfa349",2412:"16a2713f",2604:"b8663a1f",2627:"4769fc4e",2828:"49885c5e",2871:"3c883fc4",2916:"425e1ae2",2963:"922c21f9",3124:"ef2a8751",3332:"e28eadbb",3705:"c75c8ede",3726:"a5e062ff",3768:"e8953dad",3919:"f84fb341",3950:"b7007dab",3956:"a0ea14c4",3976:"0e384e19",4033:"ba6851eb",4290:"ae603a5f",4291:"93f3c2aa",4455:"993d6a8d",4583:"1df93b7f",4643:"f44adc48",4676:"24503201",4876:"17682634",5120:"a5ad27b1",5186:"b0477c6d",5348:"5402810c",5480:"80526ee6",5532:"e81f6410",5624:"9b932233",5634:"ef3b0775",5700:"b9f7b2ab",5742:"aba21aa0",5771:"8f2e4180",5864:"2ad05638",5960:"0657c530",6017:"8d981dc3",6131:"119a2918",6187:"e44e17f8",6286:"e2f00550",6439:"ad6bd692",6613:"38541689",6651:"18672b0b",6773:"2146f16f",6828:"9976ff42",6900:"cc3979e2",6928:"def2ee80",6969:"14eb3368",7098:"a7bd4aaa",7117:"224c8fe8",7229:"eb78b783",7230:"93f75803",7341:"e2db9f7a",7595:"0debafb6",7624:"5fbc5cf1",7780:"1e29fbdb",7817:"a56dc942",7883:"e2538a57",7969:"5985dcf4",8401:"17896441",8586:"b1ee2929",8626:"bca784a7",8704:"1c1cdb4e",8838:"f8ae958c",9048:"a94703ab",9167:"ba738306",9218:"cc2baa30",9308:"509bfc31",9337:"e120dcd9",9378:"5b870ab8",9440:"8d820236",9471:"e82252d2",9497:"e3e59843",9629:"9875b4b5",9647:"5e95c892",9736:"4adc7347",9891:"6bb6da1f",9998:"7923f30a"}[e]||e)+"."+{134:"290a582f",141:"5d79e79a",337:"22bfc72a",463:"6d8a69a6",484:"d8f6d2d7",562:"04fe94e0",579:"12332b9a",598:"dcaf95cd",626:"fff9bdb8",646:"77b6f90e",662:"f6ef4fb7",871:"44defd03",952:"b247a1f7",1235:"7b4b0a20",1316:"0fed137f",1437:"457a0c79",1475:"2ff5ffe7",1527:"6f445848",1863:"e8fccf27",1864:"836bb2d7",1914:"193b4b8f",2134:"6f189758",2237:"ede9a640",2282:"6f96a3b4",2408:"620b16d7",2412:"f08ebda5",2604:"04e57222",2627:"d5e77644",2828:"4bc7e5ad",2871:"d1c841d8",2916:"469cee91",2963:"08818fdb",3124:"0dc9d49a",3332:"9880c232",3705:"6fed968f",3726:"0c80ff57",3768:"d8af09d8",3919:"e4b03c02",3950:"dce48c7e",3956:"74b8c7b1",3976:"9f5b9cab",4033:"83c245c2",4290:"fa5b263f",4291:"850dddd9",4455:"5534343a",4583:"f182b925",4643:"fe264cf6",4676:"df561d25",4876:"3d25384a",5120:"45ba4134",5186:"5a13a38e",5348:"3ad38ed6",5480:"b9a69f3d",5532:"60f06895",5624:"211be870",5634:"0187249f",5700:"fc7d833c",5742:"9ac6642b",5771:"6fb725c9",5864:"e7cacb2b",5960:"aa8fdf00",6017:"5d6a3cde",6131:"18512c2f",6187:"709607a7",6286:"8ca4e8a2",6439:"2d8efa6d",6613:"8921907a",6651:"03c22191",6773:"fed3c84a",6828:"8da5bc72",6900:"f2efdc37",6928:"5fd884cc",6969:"eeb6b7e2",7098:"b82ee0df",7117:"7ab239ae",7229:"33a8bdeb",7230:"260ce03e",7341:"810d7342",7595:"bf13c614",7624:"949f6d67",7780:"d5a6d9e6",7817:"d708dd89",7883:"b963a51d",7969:"70d866fa",8401:"dcdbd021",8586:"037d9b49",8626:"6d0a4228",8704:"8434c89b",8838:"5cbb1183",9048:"2668bc5b",9167:"fde851af",9218:"5b9b66e1",9308:"dad3f1e7",9337:"22e90422",9378:"e5b723a6",9440:"525617f1",9471:"9b22e8ad",9497:"a3e0afab",9629:"9ea44d6b",9647:"b1f5748f",9736:"7ae4e26a",9891:"d58d4f04",9998:"012c6902"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),f={},d="website:",r.l=(e,a,b,c)=>{if(f[e])f[e].push(a);else{var t,o;if(void 0!==b)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var d=f[e];if(delete f[e],t.parentNode&&t.parentNode.removeChild(t),d&&d.forEach((e=>e(b))),a)return a(b)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=l.bind(null,t.onerror),t.onload=l.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/starknet-devnet-rs/",r.gca=function(e){return e={17682634:"4876",17896441:"8401",24503201:"4676",38541689:"6613",b7bb6147:"134","28a0cb7e":"141","3f194bb7":"337","682c6856":"463","673b87a5":"484","5fadd32f":"562","9bb1131a":"579",c25a813d:"598","005b2ed7":"626","7b998695":"646","645cda15":"662","9978e21e":"871","2d66ba60":"952",a7456010:"1235","1b560adb":"1316","8e76450a":"1437","9c3aeb12":"1475","778bcc8b":"1527",b4513eec:"1863","09d5ad39":"1864","1151f991":"1914",c4d2e5c1:"2134","6d990bb1":"2282","9abfa349":"2408","16a2713f":"2412",b8663a1f:"2604","4769fc4e":"2627","49885c5e":"2828","3c883fc4":"2871","425e1ae2":"2916","922c21f9":"2963",ef2a8751:"3124",e28eadbb:"3332",c75c8ede:"3705",a5e062ff:"3726",e8953dad:"3768",f84fb341:"3919",b7007dab:"3950",a0ea14c4:"3956","0e384e19":"3976",ba6851eb:"4033",ae603a5f:"4290","93f3c2aa":"4291","993d6a8d":"4455","1df93b7f":"4583",f44adc48:"4643",a5ad27b1:"5120",b0477c6d:"5186","5402810c":"5348","80526ee6":"5480",e81f6410:"5532","9b932233":"5624",ef3b0775:"5634",b9f7b2ab:"5700",aba21aa0:"5742","8f2e4180":"5771","2ad05638":"5864","0657c530":"5960","8d981dc3":"6017","119a2918":"6131",e44e17f8:"6187",e2f00550:"6286",ad6bd692:"6439","18672b0b":"6651","2146f16f":"6773","9976ff42":"6828",cc3979e2:"6900",def2ee80:"6928","14eb3368":"6969",a7bd4aaa:"7098","224c8fe8":"7117",eb78b783:"7229","93f75803":"7230",e2db9f7a:"7341","0debafb6":"7595","5fbc5cf1":"7624","1e29fbdb":"7780",a56dc942:"7817",e2538a57:"7883","5985dcf4":"7969",b1ee2929:"8586",bca784a7:"8626","1c1cdb4e":"8704",f8ae958c:"8838",a94703ab:"9048",ba738306:"9167",cc2baa30:"9218","509bfc31":"9308",e120dcd9:"9337","5b870ab8":"9378","8d820236":"9440",e82252d2:"9471",e3e59843:"9497","9875b4b5":"9629","5e95c892":"9647","4adc7347":"9736","6bb6da1f":"9891","7923f30a":"9998"}[e]||e,r.p+r.u(e)},(()=>{var e={5354:0,1869:0};r.f.j=(a,b)=>{var f=r.o(e,a)?e[a]:void 0;if(0!==f)if(f)b.push(f[2]);else if(/^(1869|5354)$/.test(a))e[a]=0;else{var d=new Promise(((b,d)=>f=e[a]=[b,d]));b.push(f[2]=d);var c=r.p+r.u(a),t=new Error;r.l(c,(b=>{if(r.o(e,a)&&(0!==(f=e[a])&&(e[a]=void 0),f)){var d=b&&("load"===b.type?"missing":b.type),c=b&&b.target&&b.target.src;t.message="Loading chunk "+a+" failed.\n("+d+": "+c+")",t.name="ChunkLoadError",t.type=d,t.request=c,f[1](t)}}),"chunk-"+a,a)}},r.O.j=a=>0===e[a];var a=(a,b)=>{var f,d,c=b[0],t=b[1],o=b[2],n=0;if(c.some((a=>0!==e[a]))){for(f in t)r.o(t,f)&&(r.m[f]=t[f]);if(o)var i=o(r)}for(a&&a(b);n Account impersonation | Starknet Devnet - + diff --git a/docs/0.0.6/api/index.html b/docs/0.0.6/api/index.html index 0b8b58d2e..d2cd99d9c 100644 --- a/docs/0.0.6/api/index.html +++ b/docs/0.0.6/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/0.0.6/balance/index.html b/docs/0.0.6/balance/index.html index f9e1547c7..a45a7604d 100644 --- a/docs/0.0.6/balance/index.html +++ b/docs/0.0.6/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/0.0.6/blocks/index.html b/docs/0.0.6/blocks/index.html index 1d58c6b4a..d07a10f9f 100644 --- a/docs/0.0.6/blocks/index.html +++ b/docs/0.0.6/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/0.0.6/category/running/index.html b/docs/0.0.6/category/running/index.html index ba5d04b05..c0139753c 100644 --- a/docs/0.0.6/category/running/index.html +++ b/docs/0.0.6/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/0.0.6/dump-load-restart/index.html b/docs/0.0.6/dump-load-restart/index.html index 4dacdb158..9f1e05473 100644 --- a/docs/0.0.6/dump-load-restart/index.html +++ b/docs/0.0.6/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/0.0.6/forking/index.html b/docs/0.0.6/forking/index.html index 3487629ee..c25ed106a 100644 --- a/docs/0.0.6/forking/index.html +++ b/docs/0.0.6/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/0.0.6/historic-state/index.html b/docs/0.0.6/historic-state/index.html index c08172b77..ad54f6949 100644 --- a/docs/0.0.6/historic-state/index.html +++ b/docs/0.0.6/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/0.0.6/intro/index.html b/docs/0.0.6/intro/index.html index cc4a63945..332f420b6 100644 --- a/docs/0.0.6/intro/index.html +++ b/docs/0.0.6/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/0.0.6/lite/index.html b/docs/0.0.6/lite/index.html index a186743d9..07972abea 100644 --- a/docs/0.0.6/lite/index.html +++ b/docs/0.0.6/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/0.0.6/postman/index.html b/docs/0.0.6/postman/index.html index 1c04b9c28..f74056c1a 100644 --- a/docs/0.0.6/postman/index.html +++ b/docs/0.0.6/postman/index.html @@ -4,12 +4,12 @@ L1-L2 interaction via Postman | Starknet Devnet - +
Version: 0.0.6

L1-L2 interaction via Postman

-

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

+

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

Load

POST /postman/load_l1_messaging_contract
{
"networkUrl": "http://localhost:8545",
"address": "0x123...def"
}
diff --git a/docs/0.0.6/predeployed/index.html b/docs/0.0.6/predeployed/index.html index abef8296a..1343e55ec 100644 --- a/docs/0.0.6/predeployed/index.html +++ b/docs/0.0.6/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/0.0.6/running/cli/index.html b/docs/0.0.6/running/cli/index.html index e49b59561..f817092b8 100644 --- a/docs/0.0.6/running/cli/index.html +++ b/docs/0.0.6/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/0.0.6/running/docker/index.html b/docs/0.0.6/running/docker/index.html index f84bf51c5..d0025a522 100644 --- a/docs/0.0.6/running/docker/index.html +++ b/docs/0.0.6/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/0.0.6/running/install/index.html b/docs/0.0.6/running/install/index.html index 1a8c151f6..3b7305964 100644 --- a/docs/0.0.6/running/install/index.html +++ b/docs/0.0.6/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/0.0.6/server-config/index.html b/docs/0.0.6/server-config/index.html index 738803f2f..f1004d2d8 100644 --- a/docs/0.0.6/server-config/index.html +++ b/docs/0.0.6/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/0.0.6/starknet-time/index.html b/docs/0.0.6/starknet-time/index.html index 3231a599b..5284fc27b 100644 --- a/docs/0.0.6/starknet-time/index.html +++ b/docs/0.0.6/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/docs/0.0.7/account-impersonation/index.html b/docs/0.0.7/account-impersonation/index.html index 9d4175411..5cba0273a 100644 --- a/docs/0.0.7/account-impersonation/index.html +++ b/docs/0.0.7/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/0.0.7/api/index.html b/docs/0.0.7/api/index.html index 0cd888f20..b4ea4199b 100644 --- a/docs/0.0.7/api/index.html +++ b/docs/0.0.7/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/0.0.7/balance/index.html b/docs/0.0.7/balance/index.html index 866db673d..685ea5889 100644 --- a/docs/0.0.7/balance/index.html +++ b/docs/0.0.7/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/0.0.7/blocks/index.html b/docs/0.0.7/blocks/index.html index 3c0251172..a8cd31d10 100644 --- a/docs/0.0.7/blocks/index.html +++ b/docs/0.0.7/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/0.0.7/category/running/index.html b/docs/0.0.7/category/running/index.html index 437ee87ad..cb4cc6b5a 100644 --- a/docs/0.0.7/category/running/index.html +++ b/docs/0.0.7/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/0.0.7/dump-load-restart/index.html b/docs/0.0.7/dump-load-restart/index.html index a8f12a72c..2680bbab6 100644 --- a/docs/0.0.7/dump-load-restart/index.html +++ b/docs/0.0.7/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/0.0.7/forking/index.html b/docs/0.0.7/forking/index.html index 6a5cf27ed..e631c0235 100644 --- a/docs/0.0.7/forking/index.html +++ b/docs/0.0.7/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/0.0.7/historic-state/index.html b/docs/0.0.7/historic-state/index.html index d3285a5df..135929889 100644 --- a/docs/0.0.7/historic-state/index.html +++ b/docs/0.0.7/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/0.0.7/intro/index.html b/docs/0.0.7/intro/index.html index e36d04e2b..91bd25f70 100644 --- a/docs/0.0.7/intro/index.html +++ b/docs/0.0.7/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/0.0.7/lite/index.html b/docs/0.0.7/lite/index.html index 19df80dca..f2a4dc666 100644 --- a/docs/0.0.7/lite/index.html +++ b/docs/0.0.7/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/0.0.7/postman/index.html b/docs/0.0.7/postman/index.html index 5f75773f7..ebcb1d1fa 100644 --- a/docs/0.0.7/postman/index.html +++ b/docs/0.0.7/postman/index.html @@ -4,12 +4,12 @@ L1-L2 interaction via Postman | Starknet Devnet - +
Version: 0.0.7

L1-L2 interaction via Postman

-

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

+

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-hardhat-plugin to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

Load

POST /postman/load_l1_messaging_contract
{
"networkUrl": "http://localhost:8545",
"address": "0x123...def"
}
diff --git a/docs/0.0.7/predeployed/index.html b/docs/0.0.7/predeployed/index.html index 74ff21ab6..6fd6df36d 100644 --- a/docs/0.0.7/predeployed/index.html +++ b/docs/0.0.7/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/0.0.7/running/cli/index.html b/docs/0.0.7/running/cli/index.html index ac949152a..a470071d6 100644 --- a/docs/0.0.7/running/cli/index.html +++ b/docs/0.0.7/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/0.0.7/running/docker/index.html b/docs/0.0.7/running/docker/index.html index 13131cb06..50d0be108 100644 --- a/docs/0.0.7/running/docker/index.html +++ b/docs/0.0.7/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/0.0.7/running/install/index.html b/docs/0.0.7/running/install/index.html index 1d68688b9..2e3b6bc5e 100644 --- a/docs/0.0.7/running/install/index.html +++ b/docs/0.0.7/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/0.0.7/server-config/index.html b/docs/0.0.7/server-config/index.html index 2fda8f53e..51f9abf8b 100644 --- a/docs/0.0.7/server-config/index.html +++ b/docs/0.0.7/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/0.0.7/starknet-time/index.html b/docs/0.0.7/starknet-time/index.html index bd4bdbf1f..5fd2d9440 100644 --- a/docs/0.0.7/starknet-time/index.html +++ b/docs/0.0.7/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/docs/0.1.1/account-impersonation/index.html b/docs/0.1.1/account-impersonation/index.html index 53e4de524..71220cae4 100644 --- a/docs/0.1.1/account-impersonation/index.html +++ b/docs/0.1.1/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/0.1.1/api/index.html b/docs/0.1.1/api/index.html index fa0b4960c..23b618fb4 100644 --- a/docs/0.1.1/api/index.html +++ b/docs/0.1.1/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/0.1.1/balance/index.html b/docs/0.1.1/balance/index.html index 25341efb1..0f04856ef 100644 --- a/docs/0.1.1/balance/index.html +++ b/docs/0.1.1/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/0.1.1/blocks/index.html b/docs/0.1.1/blocks/index.html index 2237ce546..996786c3e 100644 --- a/docs/0.1.1/blocks/index.html +++ b/docs/0.1.1/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/0.1.1/category/running/index.html b/docs/0.1.1/category/running/index.html index 1328f4afd..c865fad31 100644 --- a/docs/0.1.1/category/running/index.html +++ b/docs/0.1.1/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/0.1.1/dump-load-restart/index.html b/docs/0.1.1/dump-load-restart/index.html index e34c489ec..09a9f881a 100644 --- a/docs/0.1.1/dump-load-restart/index.html +++ b/docs/0.1.1/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/0.1.1/forking/index.html b/docs/0.1.1/forking/index.html index 8ebda1811..6677ec90f 100644 --- a/docs/0.1.1/forking/index.html +++ b/docs/0.1.1/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/0.1.1/historic-state/index.html b/docs/0.1.1/historic-state/index.html index 354c1eb41..8c4d70719 100644 --- a/docs/0.1.1/historic-state/index.html +++ b/docs/0.1.1/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/0.1.1/intro/index.html b/docs/0.1.1/intro/index.html index 9862373c8..9bee53558 100644 --- a/docs/0.1.1/intro/index.html +++ b/docs/0.1.1/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/0.1.1/lite/index.html b/docs/0.1.1/lite/index.html index 3874f3970..a9010fc72 100644 --- a/docs/0.1.1/lite/index.html +++ b/docs/0.1.1/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/0.1.1/postman/index.html b/docs/0.1.1/postman/index.html index 7463d9a76..b55ab6ccd 100644 --- a/docs/0.1.1/postman/index.html +++ b/docs/0.1.1/postman/index.html @@ -4,12 +4,12 @@ L1-L2 interaction via Postman | Starknet Devnet - +
Version: 0.1.1

L1-L2 interaction via Postman

-

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

+

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

Load

POST /postman/load_l1_messaging_contract
{
"networkUrl": "http://localhost:8545",
"address": "0x123...def"
}
diff --git a/docs/0.1.1/predeployed/index.html b/docs/0.1.1/predeployed/index.html index e9c15719f..5d8d21822 100644 --- a/docs/0.1.1/predeployed/index.html +++ b/docs/0.1.1/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/0.1.1/running/cli/index.html b/docs/0.1.1/running/cli/index.html index 9b8fad59c..adc41dc34 100644 --- a/docs/0.1.1/running/cli/index.html +++ b/docs/0.1.1/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/0.1.1/running/docker/index.html b/docs/0.1.1/running/docker/index.html index b64f2a4c1..7034cfb8a 100644 --- a/docs/0.1.1/running/docker/index.html +++ b/docs/0.1.1/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/0.1.1/running/install/index.html b/docs/0.1.1/running/install/index.html index 30dc21fbb..000877477 100644 --- a/docs/0.1.1/running/install/index.html +++ b/docs/0.1.1/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/0.1.1/server-config/index.html b/docs/0.1.1/server-config/index.html index 21905d941..64217f674 100644 --- a/docs/0.1.1/server-config/index.html +++ b/docs/0.1.1/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/0.1.1/starknet-time/index.html b/docs/0.1.1/starknet-time/index.html index acce37ea1..c330359a7 100644 --- a/docs/0.1.1/starknet-time/index.html +++ b/docs/0.1.1/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/docs/account-impersonation/index.html b/docs/account-impersonation/index.html index b57c5b051..da2c3e13c 100644 --- a/docs/account-impersonation/index.html +++ b/docs/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/api/index.html b/docs/api/index.html index ec8454964..20c548ff5 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/balance/index.html b/docs/balance/index.html index b59044182..6b127519a 100644 --- a/docs/balance/index.html +++ b/docs/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/blocks/index.html b/docs/blocks/index.html index 4965fd8f3..c5988de2d 100644 --- a/docs/blocks/index.html +++ b/docs/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/category/running/index.html b/docs/category/running/index.html index 5a2df8996..de44e1548 100644 --- a/docs/category/running/index.html +++ b/docs/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/dump-load-restart/index.html b/docs/dump-load-restart/index.html index dfc736f58..76be4a7e1 100644 --- a/docs/dump-load-restart/index.html +++ b/docs/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/examples/index.html b/docs/examples/index.html index 82690a57d..46b6806f0 100644 --- a/docs/examples/index.html +++ b/docs/examples/index.html @@ -4,7 +4,7 @@ Examples | Starknet Devnet - + diff --git a/docs/forking/index.html b/docs/forking/index.html index 25a8d5160..64fa688d0 100644 --- a/docs/forking/index.html +++ b/docs/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/historic-state/index.html b/docs/historic-state/index.html index a75ca365d..253fb5642 100644 --- a/docs/historic-state/index.html +++ b/docs/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/intro/index.html b/docs/intro/index.html index 2bebbd260..66d6c81c3 100644 --- a/docs/intro/index.html +++ b/docs/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/lite/index.html b/docs/lite/index.html index 28100cb3a..b7c483b66 100644 --- a/docs/lite/index.html +++ b/docs/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/next/account-impersonation/index.html b/docs/next/account-impersonation/index.html index f83f2a2f8..422d4b4db 100644 --- a/docs/next/account-impersonation/index.html +++ b/docs/next/account-impersonation/index.html @@ -4,7 +4,7 @@ Account impersonation | Starknet Devnet - + diff --git a/docs/next/api/index.html b/docs/next/api/index.html index 5e15849aa..a43c288e0 100644 --- a/docs/next/api/index.html +++ b/docs/next/api/index.html @@ -4,7 +4,7 @@ API | Starknet Devnet - + diff --git a/docs/next/balance/index.html b/docs/next/balance/index.html index 9e97f5bad..81abeae06 100644 --- a/docs/next/balance/index.html +++ b/docs/next/balance/index.html @@ -4,7 +4,7 @@ Account balance | Starknet Devnet - + diff --git a/docs/next/blocks/index.html b/docs/next/blocks/index.html index 8ddcef86a..9c03d3d49 100644 --- a/docs/next/blocks/index.html +++ b/docs/next/blocks/index.html @@ -4,7 +4,7 @@ Blocks | Starknet Devnet - + diff --git a/docs/next/category/running/index.html b/docs/next/category/running/index.html index 037e042b3..baa77d6e3 100644 --- a/docs/next/category/running/index.html +++ b/docs/next/category/running/index.html @@ -4,7 +4,7 @@ Running | Starknet Devnet - + diff --git a/docs/next/dump-load-restart/index.html b/docs/next/dump-load-restart/index.html index ef9b0aad9..4aeb7168a 100644 --- a/docs/next/dump-load-restart/index.html +++ b/docs/next/dump-load-restart/index.html @@ -4,7 +4,7 @@ Dump, load, restart | Starknet Devnet - + diff --git a/docs/next/examples/index.html b/docs/next/examples/index.html index 9adb98e6c..8e5d2c04b 100644 --- a/docs/next/examples/index.html +++ b/docs/next/examples/index.html @@ -4,7 +4,7 @@ Examples | Starknet Devnet - + diff --git a/docs/next/forking/index.html b/docs/next/forking/index.html index dd4be3929..511a10d6a 100644 --- a/docs/next/forking/index.html +++ b/docs/next/forking/index.html @@ -4,7 +4,7 @@ Forking | Starknet Devnet - + diff --git a/docs/next/gas/index.html b/docs/next/gas/index.html index b428a8230..05d142e33 100644 --- a/docs/next/gas/index.html +++ b/docs/next/gas/index.html @@ -4,7 +4,7 @@ Gas price modification | Starknet Devnet - + diff --git a/docs/next/historic-state/index.html b/docs/next/historic-state/index.html index dda6db480..98fa932b9 100644 --- a/docs/next/historic-state/index.html +++ b/docs/next/historic-state/index.html @@ -4,7 +4,7 @@ Historic state support | Starknet Devnet - + diff --git a/docs/next/intro/index.html b/docs/next/intro/index.html index 8174f3d6c..4c9e319d0 100644 --- a/docs/next/intro/index.html +++ b/docs/next/intro/index.html @@ -4,7 +4,7 @@ Intro | Starknet Devnet - + diff --git a/docs/next/lite/index.html b/docs/next/lite/index.html index 940d0799e..63c59372d 100644 --- a/docs/next/lite/index.html +++ b/docs/next/lite/index.html @@ -4,7 +4,7 @@ Lite mode | Starknet Devnet - + diff --git a/docs/next/postman/index.html b/docs/next/postman/index.html index 24d02cf54..248587091 100644 --- a/docs/next/postman/index.html +++ b/docs/next/postman/index.html @@ -3,13 +3,14 @@ -L1-L2 interaction via Postman | Starknet Devnet - +L1-L2 interaction via Postman | Starknet Devnet +
Version: Next

L1-L2 interaction via Postman

-

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

+

Postman is a Starknet utility that allows testing L1-L2 interaction. It is unrelated to the Postman API platform. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue to transmit the messages to their destinations. The functionality relies on two internal message queues: one for L1->L2 messages, another for L2->L1 messages.

+

You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

Load

POST /postman/load_l1_messaging_contract
{
"network_url": "http://localhost:8545",
"address": "0x123...def"
}
@@ -26,7 +27,7 @@

LoadFlush

POST /postman/flush
JSON-RPC
{
"jsonrpc": "2.0",
"id": "1",
"method": "devnet_postmanFlush"
}
-

Goes through the newly enqueued messages, sending them from L1 to L2 and from L2 to L1. Requires no body. Optionally, set the dry_run specifier to just see the result of flushing, without actually triggering it:

+

Goes through the newly enqueued messages since the last flush, consuming and sending them from L1 to L2 and from L2 to L1. Use it for end-to-end testing. Requires no body. Optionally, set the dry_run boolean flag to just see the result of flushing, without actually triggering it:

POST /postman/flush
{ "dry_run": true }
JSON-RPC
{
"jsonrpc": "2.0",
"id": "1",
"method": "devnet_postmanFlush",
"params": {
"dry_run": true
}
}
@@ -38,9 +39,9 @@

Disclaimer
constructor(MockStarknetMessaging mockStarknetMessaging_) public {
starknetCore = mockStarknetMessaging_;
}

Mock transactions

L1->L2

-

Sending mock transactions from L1 to L2 without the need for running L1. Deployed L2 contract address l2_contract_address and entry_point_selector must be valid otherwise new block will not be created.

-

Normally nonce is calculated by L1 StarknetContract and it's used in L1 and L2. In this case, we need to provide it manually.

-

A running L1 node is not required for this operation.

+
note

A running L1 node is not required for this operation.

+

Sends a mock transactions to L2, as if coming from L1, without the need for running L1. The deployed L2 contract address l2_contract_address and entry_point_selector must be valid, otherwise a new block will not be created.

+

Normally nonce is calculated by the L1 Starknet contract and it is used in L1 and L2. In this case, it needs to be provided manually.

POST /postman/send_message_to_l2

Request:

{
"l2_contract_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",
"entry_point_selector": "0xC73F681176FC7B3F9693986FD7B14581E8D540519E27400E88B8713932BE01",
"l1_contract_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"payload": [
"0x1",
"0x2"
],
"paid_fee_on_l1": "0x123456abcdef",
"nonce":"0x0"
}
@@ -48,9 +49,9 @@

L1->L2
{ "transaction_hash": "0x0548c761a9fd5512782998b2da6f44c42bf78fb88c3794eea330a91c9abb10bb" }

L2->L1

-

Sending mock transactions from L2 to L1. -Deployed L2 contract address from_address and to_address must be valid.

-

A running L1 node is required for this operation.

+

Sends a mock transaction from L2 to L1. The deployed L2 contract address from_address and to_address must be valid.

+

It is a mock message, but only in the sense that you are mocking an L2 contract's action, which would normally be triggered by invoking the contract via a transaction. So keep in mind the following:

+
note

A running L1 node is required for this operation.

POST /postman/consume_message_from_l2

Request:

{
"from_address": "0x00285ddb7e5c777b310d806b9b2a0f7c7ba0a41f12b420219209d97a3b7f25b2",
"to_address": "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512",
"payload": ["0x0", "0x1", "0x3e8"],
}
diff --git a/docs/next/predeployed/index.html b/docs/next/predeployed/index.html index cf80e8606..ca9912070 100644 --- a/docs/next/predeployed/index.html +++ b/docs/next/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/next/restrictive/index.html b/docs/next/restrictive/index.html index d6ee96dff..4ac7bc2dc 100644 --- a/docs/next/restrictive/index.html +++ b/docs/next/restrictive/index.html @@ -4,7 +4,7 @@ Restrictive mode | Starknet Devnet - + diff --git a/docs/next/running/cli/index.html b/docs/next/running/cli/index.html index e56cb31ce..75915c19a 100644 --- a/docs/next/running/cli/index.html +++ b/docs/next/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/next/running/docker/index.html b/docs/next/running/docker/index.html index ff28cc7f5..9396479dd 100644 --- a/docs/next/running/docker/index.html +++ b/docs/next/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/next/running/install/index.html b/docs/next/running/install/index.html index f46fc1b70..72a44a33c 100644 --- a/docs/next/running/install/index.html +++ b/docs/next/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/next/server-config/index.html b/docs/next/server-config/index.html index 66a4398df..7abe8c67c 100644 --- a/docs/next/server-config/index.html +++ b/docs/next/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/next/starknet-time/index.html b/docs/next/starknet-time/index.html index 4dbe40fdb..422a68f4e 100644 --- a/docs/next/starknet-time/index.html +++ b/docs/next/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/docs/postman/index.html b/docs/postman/index.html index 252162bd9..acc8bd9eb 100644 --- a/docs/postman/index.html +++ b/docs/postman/index.html @@ -4,12 +4,12 @@ L1-L2 interaction via Postman | Starknet Devnet - +
Version: 0.1.2

L1-L2 interaction via Postman

-

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

+

Postman is a Starknet utility that allows testing L1-L2 interaction. Ensure you have an L1 node and a Devnet (L2 node) running, load a messaging contract, and flush the queue when needed. You can use starknet-devnet-js to perform these actions, as witnessed in this example, or directly send requests to the endpoints specified below.

Load

POST /postman/load_l1_messaging_contract
{
"networkUrl": "http://localhost:8545",
"address": "0x123...def"
}
diff --git a/docs/predeployed/index.html b/docs/predeployed/index.html index f51e87614..28a8da2d2 100644 --- a/docs/predeployed/index.html +++ b/docs/predeployed/index.html @@ -4,7 +4,7 @@ Predeployed contracts | Starknet Devnet - + diff --git a/docs/running/cli/index.html b/docs/running/cli/index.html index db83a6fa7..cae7e3ca7 100644 --- a/docs/running/cli/index.html +++ b/docs/running/cli/index.html @@ -4,7 +4,7 @@ CLI options | Starknet Devnet - + diff --git a/docs/running/docker/index.html b/docs/running/docker/index.html index a2600bd2c..2dc4549e8 100644 --- a/docs/running/docker/index.html +++ b/docs/running/docker/index.html @@ -4,7 +4,7 @@ Run with Docker | Starknet Devnet - + diff --git a/docs/running/install/index.html b/docs/running/install/index.html index 5a239bbb3..3eab97eb0 100644 --- a/docs/running/install/index.html +++ b/docs/running/install/index.html @@ -4,7 +4,7 @@ Install and run | Starknet Devnet - + diff --git a/docs/server-config/index.html b/docs/server-config/index.html index 6305a9c01..470ec6f98 100644 --- a/docs/server-config/index.html +++ b/docs/server-config/index.html @@ -4,7 +4,7 @@ Server config | Starknet Devnet - + diff --git a/docs/starknet-time/index.html b/docs/starknet-time/index.html index df401f474..f6271529c 100644 --- a/docs/starknet-time/index.html +++ b/docs/starknet-time/index.html @@ -4,7 +4,7 @@ Starknet time | Starknet Devnet - + diff --git a/index.html b/index.html index f90407cc6..2d603b1d9 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Home | Starknet Devnet - +