From d5c8e9ed9eb87cfe65d3252b8f68ef4968c23b86 Mon Sep 17 00:00:00 2001 From: adel Date: Sun, 3 Nov 2024 14:27:00 +0100 Subject: [PATCH 1/5] feat: Etherscan verification (#89) * feat(etherscan_verify): Added automatic verify * feat(etherscan_verify): * feat(etherscan_verify): Refacto * feat(etherscan_verify): Added verify command * feat(etherscan_verify): Better docs * feat(etherscan_verify): TODOs * feat(etherscan_verify): Updated solidity licenses + Fixed compiler version --- deployments/holesky/pragma.json | 4 +- deployments/sepolia/pragma.json | 4 + solidity/src/Hyperlane.sol | 4 +- solidity/src/Pragma.sol | 4 +- solidity/src/PragmaDecoder.sol | 4 +- solidity/src/interfaces/IHyperlane.sol | 4 +- solidity/src/interfaces/IPragma.sol | 4 +- solidity/src/interfaces/PragmaStructs.sol | 4 +- solidity/src/libraries/BytesLib.sol | 4 +- solidity/src/libraries/ConstantsLib.sol | 4 +- solidity/src/libraries/DataParser.sol | 2 +- solidity/src/libraries/ErrorsLib.sol | 4 +- solidity/src/libraries/EventsLib.sol | 4 +- solidity/src/libraries/MerkleTree.sol | 4 +- solidity/src/libraries/UnsafeBytesLib.sol | 4 +- .../src/libraries/UnsafeCalldataBytesLib.sol | 4 +- typescript/pragma-deployer/.env.example | 2 + .../.openzeppelin/holesky.json | 485 ------------------ typescript/pragma-deployer/README.md | 11 + typescript/pragma-deployer/hardhat.config.ts | 5 +- typescript/pragma-deployer/package.json | 3 +- .../src/deployers/dispatcher.ts | 9 + .../src/deployers/interface.ts | 2 + .../pragma-deployer/src/deployers/oracle.ts | 9 + .../pragma-deployer/src/deployers/pragma.ts | 78 ++- typescript/pragma-deployer/src/index.ts | 47 +- typescript/pragma-deployer/src/manager.ts | 18 + .../pragma-deployer/src/utils/evm_verify.ts | 87 ++++ typescript/pragma-deployer/src/utils/index.ts | 1 + 29 files changed, 290 insertions(+), 529 deletions(-) create mode 100644 deployments/sepolia/pragma.json delete mode 100644 typescript/pragma-deployer/.openzeppelin/holesky.json create mode 100644 typescript/pragma-deployer/src/utils/evm_verify.ts create mode 100644 typescript/pragma-deployer/src/utils/index.ts diff --git a/deployments/holesky/pragma.json b/deployments/holesky/pragma.json index e9ce0567..dab21eea 100644 --- a/deployments/holesky/pragma.json +++ b/deployments/holesky/pragma.json @@ -1,4 +1,4 @@ { - "Hyperlane": "0x8bA20dB35218bEF1c33Ae6bd129a07f157c71B2D", - "Pragma": "0x50fEbf423F5Fc61C2512bb5F9c6B1878d37C50DF" + "Hyperlane": "0x330ec0B08B74a4F34Fd76B0917A55169885624Be", + "Pragma": "0xcD025F607AdB9542B77C69A29B7b9Aa32Bf06811" } diff --git a/deployments/sepolia/pragma.json b/deployments/sepolia/pragma.json new file mode 100644 index 00000000..a394cbc8 --- /dev/null +++ b/deployments/sepolia/pragma.json @@ -0,0 +1,4 @@ +{ + "Hyperlane": "0x858FA2FacF63A3e529cAb4F5a02ceaFb590db2c1", + "Pragma": "0x78EA64467F0C4DB1b08b6A2E880f92135Deb4126" +} diff --git a/solidity/src/Hyperlane.sol b/solidity/src/Hyperlane.sol index 178cb115..1f709c56 100644 --- a/solidity/src/Hyperlane.sol +++ b/solidity/src/Hyperlane.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; pragma experimental ABIEncoderV2; import {IHyperlane} from "./interfaces/IHyperlane.sol"; diff --git a/solidity/src/Pragma.sol b/solidity/src/Pragma.sol index 63f27cc6..d78a93e8 100644 --- a/solidity/src/Pragma.sol +++ b/solidity/src/Pragma.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import {IPragma, DataFeed} from "./interfaces/IPragma.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; diff --git a/solidity/src/PragmaDecoder.sol b/solidity/src/PragmaDecoder.sol index ffdf804d..78bf8ea0 100644 --- a/solidity/src/PragmaDecoder.sol +++ b/solidity/src/PragmaDecoder.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import {DataFeed, DataFeedType} from "./interfaces/IPragma.sol"; import {HyMsg, IHyperlane} from "./interfaces/IHyperlane.sol"; diff --git a/solidity/src/interfaces/IHyperlane.sol b/solidity/src/interfaces/IHyperlane.sol index 3fd6b937..e5ffe110 100644 --- a/solidity/src/interfaces/IHyperlane.sol +++ b/solidity/src/interfaces/IHyperlane.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import "./PragmaStructs.sol"; diff --git a/solidity/src/interfaces/IPragma.sol b/solidity/src/interfaces/IPragma.sol index 92cd28b0..e9a0b946 100644 --- a/solidity/src/interfaces/IPragma.sol +++ b/solidity/src/interfaces/IPragma.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import "./PragmaStructs.sol"; diff --git a/solidity/src/interfaces/PragmaStructs.sol b/solidity/src/interfaces/PragmaStructs.sol index 7e7a7824..b82db031 100644 --- a/solidity/src/interfaces/PragmaStructs.sol +++ b/solidity/src/interfaces/PragmaStructs.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; struct DataFeed { bytes32 feedId; diff --git a/solidity/src/libraries/BytesLib.sol b/solidity/src/libraries/BytesLib.sol index 3fb3d0b6..7de63b0b 100644 --- a/solidity/src/libraries/BytesLib.sol +++ b/solidity/src/libraries/BytesLib.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: UNLICENSED /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá @@ -6,7 +6,7 @@ * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ -pragma solidity >=0.8.0 <0.9.0; +pragma solidity 0.8.28; library BytesLib { function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) { diff --git a/solidity/src/libraries/ConstantsLib.sol b/solidity/src/libraries/ConstantsLib.sol index 6b1fb928..f4181a9d 100644 --- a/solidity/src/libraries/ConstantsLib.sol +++ b/solidity/src/libraries/ConstantsLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; /// @title ConstantsLib /// @author Pragma Labs diff --git a/solidity/src/libraries/DataParser.sol b/solidity/src/libraries/DataParser.sol index 691c5842..cb6f20bb 100644 --- a/solidity/src/libraries/DataParser.sol +++ b/solidity/src/libraries/DataParser.sol @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import "./BytesLib.sol"; import "../interfaces/PragmaStructs.sol"; diff --git a/solidity/src/libraries/ErrorsLib.sol b/solidity/src/libraries/ErrorsLib.sol index 85d1977a..15adc7d0 100644 --- a/solidity/src/libraries/ErrorsLib.sol +++ b/solidity/src/libraries/ErrorsLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; /// @title ErrorsLib /// @author Pragma Labs diff --git a/solidity/src/libraries/EventsLib.sol b/solidity/src/libraries/EventsLib.sol index c64c9271..8c66eb01 100644 --- a/solidity/src/libraries/EventsLib.sol +++ b/solidity/src/libraries/EventsLib.sol @@ -1,5 +1,5 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -pragma solidity ^0.8.0; +// SPDX-License-Identifier: MIT +pragma solidity 0.8.28; import "./DataParser.sol"; // Import DataParser to use the structs diff --git a/solidity/src/libraries/MerkleTree.sol b/solidity/src/libraries/MerkleTree.sol index c82481fe..2e6db5c5 100644 --- a/solidity/src/libraries/MerkleTree.sol +++ b/solidity/src/libraries/MerkleTree.sol @@ -1,6 +1,6 @@ -// SPDX-License-Identifier: Apache 2 +// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +pragma solidity 0.8.28; import "./UnsafeCalldataBytesLib.sol"; diff --git a/solidity/src/libraries/UnsafeBytesLib.sol b/solidity/src/libraries/UnsafeBytesLib.sol index 720288f2..ea195189 100644 --- a/solidity/src/libraries/UnsafeBytesLib.sol +++ b/solidity/src/libraries/UnsafeBytesLib.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: UNLICENSED /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá @@ -9,7 +9,7 @@ * @notice This is the **unsafe** version of BytesLib which removed all the checks (out of bound, ...) * to be more gas efficient. */ -pragma solidity >=0.8.0 <0.9.0; +pragma solidity 0.8.28; library UnsafeBytesLib { function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) { diff --git a/solidity/src/libraries/UnsafeCalldataBytesLib.sol b/solidity/src/libraries/UnsafeCalldataBytesLib.sol index efc3dc45..3ffd6bba 100644 --- a/solidity/src/libraries/UnsafeCalldataBytesLib.sol +++ b/solidity/src/libraries/UnsafeCalldataBytesLib.sol @@ -1,4 +1,4 @@ -// SPDX-License-Identifier: Unlicense +// SPDX-License-Identifier: UNLICENSED /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá @@ -9,7 +9,7 @@ * @notice This is the **unsafe** version of BytesLib which removed all the checks (out of bound, ...) * to be more gas efficient. */ -pragma solidity >=0.8.0 <0.9.0; +pragma solidity 0.8.28; library UnsafeCalldataBytesLib { function slice(bytes calldata _bytes, uint256 _start, uint256 _length) internal pure returns (bytes calldata) { diff --git a/typescript/pragma-deployer/.env.example b/typescript/pragma-deployer/.env.example index af540777..d42cbc82 100644 --- a/typescript/pragma-deployer/.env.example +++ b/typescript/pragma-deployer/.env.example @@ -3,3 +3,5 @@ ETH_PRIVATE_KEY= STARKNET_ACCOUNT_ADDRESS= STARKNET_PRIVATE_KEY= + +ETHERSCAN_API_KEY= diff --git a/typescript/pragma-deployer/.openzeppelin/holesky.json b/typescript/pragma-deployer/.openzeppelin/holesky.json deleted file mode 100644 index 07926e06..00000000 --- a/typescript/pragma-deployer/.openzeppelin/holesky.json +++ /dev/null @@ -1,485 +0,0 @@ -{ - "manifestVersion": "3.2", - "proxies": [ - { - "address": "0x50fEbf423F5Fc61C2512bb5F9c6B1878d37C50DF", - "txHash": "0x921505a172497903b95f277df783c3dff49ff0c982f529a9bf0575efa2af5b8c", - "kind": "uups" - } - ], - "impls": { - "b5ab5cd846aa7bc3bea49327720f444577d04a15eb79a2a87188c1895818b2a2": { - "address": "0x099A81Ac22bA360270DF227031804BF08B458114", - "txHash": "0xc39b999f7bcc6c2cf18cf85903f6528b26301c8943b60ceaf339c2d66259f822", - "layout": { - "solcVersion": "0.8.27", - "storage": [ - { - "label": "hyperlane", - "offset": 0, - "slot": "0", - "type": "t_contract(IHyperlane)3238", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:23" - }, - { - "label": "_isValidDataSource", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_bool)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:24" - }, - { - "label": "spotMedianFeeds", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_bytes32,t_struct(SpotMedian)3385_storage)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:25" - }, - { - "label": "twapFeeds", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_struct(TWAP)3401_storage)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:26" - }, - { - "label": "rvFeeds", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_bytes32,t_struct(RealizedVolatility)3419_storage)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:27" - }, - { - "label": "optionsFeeds", - "offset": 0, - "slot": "5", - "type": "t_mapping(t_bytes32,t_struct(Options)3445_storage)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:28" - }, - { - "label": "perpFeeds", - "offset": 0, - "slot": "6", - "type": "t_mapping(t_bytes32,t_struct(Perp)3457_storage)", - "contract": "PragmaDecoder", - "src": "src/PragmaDecoder.sol:29" - }, - { - "label": "validTimePeriodSeconds", - "offset": 0, - "slot": "7", - "type": "t_uint256", - "contract": "Pragma", - "src": "src/Pragma.sol:21" - }, - { - "label": "singleUpdateFeeInWei", - "offset": 0, - "slot": "8", - "type": "t_uint256", - "contract": "Pragma", - "src": "src/Pragma.sol:22" - } - ], - "types": { - "t_address": { - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "label": "bool", - "numberOfBytes": "1" - }, - "t_struct(InitializableStorage)93_storage": { - "label": "struct Initializable.InitializableStorage", - "members": [ - { - "label": "_initialized", - "type": "t_uint64", - "offset": 0, - "slot": "0" - }, - { - "label": "_initializing", - "type": "t_bool", - "offset": 8, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_struct(OwnableStorage)14_storage": { - "label": "struct OwnableUpgradeable.OwnableStorage", - "members": [ - { - "label": "_owner", - "type": "t_address", - "offset": 0, - "slot": "0" - } - ], - "numberOfBytes": "32" - }, - "t_uint64": { - "label": "uint64", - "numberOfBytes": "8" - }, - "t_bytes32": { - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(IHyperlane)3238": { - "label": "contract IHyperlane", - "numberOfBytes": "20" - }, - "t_int256": { - "label": "int256", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_bool)": { - "label": "mapping(bytes32 => bool)", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(Options)3445_storage)": { - "label": "mapping(bytes32 => struct Options)", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(Perp)3457_storage)": { - "label": "mapping(bytes32 => struct Perp)", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(RealizedVolatility)3419_storage)": { - "label": "mapping(bytes32 => struct RealizedVolatility)", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(SpotMedian)3385_storage)": { - "label": "mapping(bytes32 => struct SpotMedian)", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(TWAP)3401_storage)": { - "label": "mapping(bytes32 => struct TWAP)", - "numberOfBytes": "32" - }, - "t_struct(Metadata)3377_storage": { - "label": "struct Metadata", - "members": [ - { - "label": "feedId", - "type": "t_bytes32", - "offset": 0, - "slot": "0" - }, - { - "label": "timestamp", - "type": "t_uint64", - "offset": 0, - "slot": "1" - }, - { - "label": "numberOfSources", - "type": "t_uint16", - "offset": 8, - "slot": "1" - }, - { - "label": "decimals", - "type": "t_uint8", - "offset": 10, - "slot": "1" - } - ], - "numberOfBytes": "64" - }, - "t_struct(Options)3445_storage": { - "label": "struct Options", - "members": [ - { - "label": "metadata", - "type": "t_struct(Metadata)3377_storage", - "offset": 0, - "slot": "0" - }, - { - "label": "strikePrice", - "type": "t_uint256", - "offset": 0, - "slot": "2" - }, - { - "label": "impliedVolatility", - "type": "t_uint256", - "offset": 0, - "slot": "3" - }, - { - "label": "timeToExpiry", - "type": "t_uint256", - "offset": 0, - "slot": "4" - }, - { - "label": "isCall", - "type": "t_bool", - "offset": 0, - "slot": "5" - }, - { - "label": "underlyingPrice", - "type": "t_uint256", - "offset": 0, - "slot": "6" - }, - { - "label": "optionPrice", - "type": "t_uint256", - "offset": 0, - "slot": "7" - }, - { - "label": "delta", - "type": "t_int256", - "offset": 0, - "slot": "8" - }, - { - "label": "gamma", - "type": "t_int256", - "offset": 0, - "slot": "9" - }, - { - "label": "vega", - "type": "t_int256", - "offset": 0, - "slot": "10" - }, - { - "label": "theta", - "type": "t_int256", - "offset": 0, - "slot": "11" - }, - { - "label": "rho", - "type": "t_int256", - "offset": 0, - "slot": "12" - } - ], - "numberOfBytes": "416" - }, - "t_struct(Perp)3457_storage": { - "label": "struct Perp", - "members": [ - { - "label": "metadata", - "type": "t_struct(Metadata)3377_storage", - "offset": 0, - "slot": "0" - }, - { - "label": "markPrice", - "type": "t_uint256", - "offset": 0, - "slot": "2" - }, - { - "label": "fundingRate", - "type": "t_uint256", - "offset": 0, - "slot": "3" - }, - { - "label": "openInterest", - "type": "t_uint256", - "offset": 0, - "slot": "4" - }, - { - "label": "volume", - "type": "t_uint256", - "offset": 0, - "slot": "5" - } - ], - "numberOfBytes": "192" - }, - "t_struct(RealizedVolatility)3419_storage": { - "label": "struct RealizedVolatility", - "members": [ - { - "label": "metadata", - "type": "t_struct(Metadata)3377_storage", - "offset": 0, - "slot": "0" - }, - { - "label": "volatility", - "type": "t_uint256", - "offset": 0, - "slot": "2" - }, - { - "label": "timePeriod", - "type": "t_uint256", - "offset": 0, - "slot": "3" - }, - { - "label": "startPrice", - "type": "t_uint256", - "offset": 0, - "slot": "4" - }, - { - "label": "endPrice", - "type": "t_uint256", - "offset": 0, - "slot": "5" - }, - { - "label": "highPrice", - "type": "t_uint256", - "offset": 0, - "slot": "6" - }, - { - "label": "lowPrice", - "type": "t_uint256", - "offset": 0, - "slot": "7" - }, - { - "label": "numberOfDataPoints", - "type": "t_uint256", - "offset": 0, - "slot": "8" - } - ], - "numberOfBytes": "288" - }, - "t_struct(SpotMedian)3385_storage": { - "label": "struct SpotMedian", - "members": [ - { - "label": "metadata", - "type": "t_struct(Metadata)3377_storage", - "offset": 0, - "slot": "0" - }, - { - "label": "price", - "type": "t_uint256", - "offset": 0, - "slot": "2" - }, - { - "label": "volume", - "type": "t_uint256", - "offset": 0, - "slot": "3" - } - ], - "numberOfBytes": "128" - }, - "t_struct(TWAP)3401_storage": { - "label": "struct TWAP", - "members": [ - { - "label": "metadata", - "type": "t_struct(Metadata)3377_storage", - "offset": 0, - "slot": "0" - }, - { - "label": "twapPrice", - "type": "t_uint256", - "offset": 0, - "slot": "2" - }, - { - "label": "timePeriod", - "type": "t_uint256", - "offset": 0, - "slot": "3" - }, - { - "label": "startPrice", - "type": "t_uint256", - "offset": 0, - "slot": "4" - }, - { - "label": "endPrice", - "type": "t_uint256", - "offset": 0, - "slot": "5" - }, - { - "label": "totalVolume", - "type": "t_uint256", - "offset": 0, - "slot": "6" - }, - { - "label": "numberOfDataPoints", - "type": "t_uint256", - "offset": 0, - "slot": "7" - } - ], - "numberOfBytes": "256" - }, - "t_uint16": { - "label": "uint16", - "numberOfBytes": "2" - }, - "t_uint256": { - "label": "uint256", - "numberOfBytes": "32" - }, - "t_uint8": { - "label": "uint8", - "numberOfBytes": "1" - } - }, - "namespaces": { - "erc7201:openzeppelin.storage.Ownable": [ - { - "contract": "OwnableUpgradeable", - "label": "_owner", - "type": "t_address", - "src": "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:24", - "offset": 0, - "slot": "0" - } - ], - "erc7201:openzeppelin.storage.Initializable": [ - { - "contract": "Initializable", - "label": "_initialized", - "type": "t_uint64", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69", - "offset": 0, - "slot": "0" - }, - { - "contract": "Initializable", - "label": "_initializing", - "type": "t_bool", - "src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73", - "offset": 8, - "slot": "0" - } - ] - } - } - } - } -} diff --git a/typescript/pragma-deployer/README.md b/typescript/pragma-deployer/README.md index 34de8c33..c7a63d3e 100644 --- a/typescript/pragma-deployer/README.md +++ b/typescript/pragma-deployer/README.md @@ -46,6 +46,17 @@ bun run deployer pragma --config ./config/config.example.yaml --chain hardhat npm run deployer pragma -- --config ./config/config.example.yaml --chain hardhat ``` +The etherscan verification should be automatic after a deployment. + +If you'd like to verify a pre-deployed contract, you can also run: + +```bash +bun run verifier pragma --config ./config/config.example.yaml --chain sepolia +``` + +It will look up the `deployments` folder for any deployments on `sepolia`. If any, it will +attempt a verification for the `Hyperlane` & `Pragma` contracts. + # Available chains ## Starknet diff --git a/typescript/pragma-deployer/hardhat.config.ts b/typescript/pragma-deployer/hardhat.config.ts index 06804fa2..2f68195a 100644 --- a/typescript/pragma-deployer/hardhat.config.ts +++ b/typescript/pragma-deployer/hardhat.config.ts @@ -85,10 +85,7 @@ const config: HardhatUserConfig = { "sepolia", `https://sepolia.infura.io/v3/${INFURA_PROJECT_ID}`, ), - holesky: getChainConfig( - "holesky", - `https://holesky.infura.io/v3/${INFURA_PROJECT_ID}`, - ), + holesky: getChainConfig("holesky", `https://holesky.gateway.tenderly.co`), bsc: getChainConfig("bsc", "https://bsc-dataseed1.defibit.io/"), bscTestnet: getChainConfig( "bsctestnet", diff --git a/typescript/pragma-deployer/package.json b/typescript/pragma-deployer/package.json index 66980d75..2a8ac124 100644 --- a/typescript/pragma-deployer/package.json +++ b/typescript/pragma-deployer/package.json @@ -40,6 +40,7 @@ "typescript": "^5.0.0" }, "scripts": { - "deployer": "bun run src/index.ts" + "deployer": "bun run src/index.ts deploy", + "verifier": "bun run src/index.ts verify" } } diff --git a/typescript/pragma-deployer/src/deployers/dispatcher.ts b/typescript/pragma-deployer/src/deployers/dispatcher.ts index 4c37bb5a..b75b8a1a 100644 --- a/typescript/pragma-deployer/src/deployers/dispatcher.ts +++ b/typescript/pragma-deployer/src/deployers/dispatcher.ts @@ -232,4 +232,13 @@ export class DispatcherDeployer implements ContractDeployer { await deployer.waitForTransaction(tx.transaction_hash); return feedRouter.address; } + + async verify( + _config: DeploymentConfig, + _chain?: StarknetChain, + ): Promise { + console.error( + "Contract verification not implemented yet for StarkNet chains.", + ); + } } diff --git a/typescript/pragma-deployer/src/deployers/interface.ts b/typescript/pragma-deployer/src/deployers/interface.ts index 2b16a886..4ab83389 100644 --- a/typescript/pragma-deployer/src/deployers/interface.ts +++ b/typescript/pragma-deployer/src/deployers/interface.ts @@ -10,4 +10,6 @@ export interface ContractDeployer { deterministic: boolean, chain?: string, ): Promise; + + verify?(config: DeploymentConfig, chain?: string): Promise; } diff --git a/typescript/pragma-deployer/src/deployers/oracle.ts b/typescript/pragma-deployer/src/deployers/oracle.ts index c4d71401..bbdc46f9 100644 --- a/typescript/pragma-deployer/src/deployers/oracle.ts +++ b/typescript/pragma-deployer/src/deployers/oracle.ts @@ -170,4 +170,13 @@ export class OracleDeployer implements ContractDeployer { console.log("✅ Pragma Summary Stats deployment complete!\n"); return summaryStats; } + + async verify( + _config: DeploymentConfig, + _chain?: StarknetChain, + ): Promise { + console.error( + "Contract verification not implemented yet for StarkNet chains.", + ); + } } diff --git a/typescript/pragma-deployer/src/deployers/pragma.ts b/typescript/pragma-deployer/src/deployers/pragma.ts index 7fc47b6a..124f0381 100644 --- a/typescript/pragma-deployer/src/deployers/pragma.ts +++ b/typescript/pragma-deployer/src/deployers/pragma.ts @@ -1,12 +1,11 @@ import fs from "fs"; import path from "path"; - import hre, { ethers, upgrades } from "hardhat"; import { Contract, parseEther, zeroPadValue } from "ethers"; import { EVM_CHAINS, type Chain, type EvmChain } from "pragma-utils"; - import { type ContractDeployer } from "./interface"; import type { DeploymentConfig } from "../config"; +import { verifyContract } from "../utils"; export class PragmaDeployer implements ContractDeployer { readonly allowedChains: Chain[] = EVM_CHAINS; @@ -14,7 +13,6 @@ export class PragmaDeployer implements ContractDeployer { async deploy( config: DeploymentConfig, - // TODO: Handle deterministic deployments, not mandatory yet. _deterministic: boolean, chain?: EvmChain, ): Promise { @@ -58,6 +56,9 @@ export class PragmaDeployer implements ContractDeployer { fs.writeFileSync(filePath, jsonContent); console.log(`Deployment info saved to ${filePath}`); console.log("Deployment complete!"); + + // Verify contracts + await this.verify(config, chain); } catch (error) { console.error("Deployment failed:", error); throw error; @@ -119,4 +120,75 @@ export class PragmaDeployer implements ContractDeployer { await pragma.waitForDeployment(); return pragma; } + + async verify(config: DeploymentConfig, chain?: EvmChain): Promise { + if (!chain) chain = this.defaultChain; + if (!this.allowedChains.includes(chain)) { + throw new Error(`⛔ Verification on ${chain} is not supported.`); + } + await hre.switchNetwork(chain); + + const apiKey = process.env.ETHERSCAN_API_KEY; + if (!apiKey) { + console.warn( + "ETHERSCAN_API_KEY is not set. Skipping contract verification.", + ); + return; + } + + const chainId = hre.network.config.chainId; + + if (!chainId) { + console.error("Chain ID not found in network config."); + return; + } + + // Load deployment info + const deploymentPath = path.join("..", "..", "deployments", chain); + const filePath = path.join(deploymentPath, "pragma.json"); + if (!fs.existsSync(filePath)) { + console.error(`Deployment info not found at ${filePath}`); + return; + } + const deploymentInfo = JSON.parse(fs.readFileSync(filePath, "utf-8")); + const hyperlaneAddress = deploymentInfo.Hyperlane; + const pragmaAddress = deploymentInfo.Pragma; + + try { + console.log("⏳ Verifying contracts on Etherscan..."); + + // Hyperlane verification + const hyperlane = await ethers.getContractAt( + "src/Hyperlane.sol:Hyperlane", + hyperlaneAddress, + ); + await verifyContract( + hyperlane, + "src/Hyperlane.sol:Hyperlane", + apiKey, + chainId, + [config.pragma.hyperlane.validators], + ); + + // Pragma verification + const pragmaImplAddress = + await upgrades.erc1967.getImplementationAddress(pragmaAddress); + + const pragmaImpl = await ethers.getContractAt( + "src/Pragma.sol:Pragma", + pragmaImplAddress, + ); + await verifyContract( + pragmaImpl, + "src/Pragma.sol:Pragma", + apiKey, + chainId, + [], + ); + + console.log("✅ Contracts verified successfully."); + } catch (error) { + console.error("Contract verification failed:", error); + } + } } diff --git a/typescript/pragma-deployer/src/index.ts b/typescript/pragma-deployer/src/index.ts index db192676..e0132f97 100644 --- a/typescript/pragma-deployer/src/index.ts +++ b/typescript/pragma-deployer/src/index.ts @@ -1,22 +1,29 @@ import { Command } from "commander"; -import deploymentManager from "./manager.ts"; -import { loadConfig, type DeploymentConfig } from "./config/index.ts"; +import deploymentManager from "./manager"; +import { loadConfig, type DeploymentConfig } from "./config/index"; const program = new Command(); program - .description("CLI to deploy Pragma contracts") - .arguments("") + .name("pragma-cli") + .description("CLI to deploy and verify Pragma contracts") + .version("1.0.0"); + +program + .command("deploy ") + .description("Deploy a contract") .requiredOption("--config ", "Path to the YAML config file") .option("--chain ", "Chain where the contract will be deployed") - .option("--deterministic", "Deterministic deployments addresses") + .option("--deterministic", "Deterministic deployment addresses") .action(async (contract: string, options) => { - contract = contract.toLocaleLowerCase(); + contract = contract.toLowerCase(); const supportedDeployments = deploymentManager.supportedDeployments(); if (!supportedDeployments.includes(contract)) { throw new Error( - `"${contract}" is not supported for deployments. Supported names: ${supportedDeployments}`, + `"${contract}" is not supported for deployment. Supported contracts: ${supportedDeployments.join( + ", ", + )}`, ); } @@ -34,4 +41,30 @@ program } }); +program + .command("verify ") + .description("Verify a deployed contract") + .requiredOption("--config ", "Path to the YAML config file") + .option("--chain ", "Chain where the contract is deployed") + .action(async (contract: string, options) => { + contract = contract.toLowerCase(); + + const supportedDeployments = deploymentManager.supportedDeployments(); + if (!supportedDeployments.includes(contract)) { + throw new Error( + `"${contract}" is not supported for verification. Supported contracts: ${supportedDeployments.join( + ", ", + )}`, + ); + } + + const config = loadConfig(options.config); + try { + await deploymentManager.verify(contract, config, options.chain); + } catch (error) { + console.error("Verification failed:", (error as Error).message); + process.exit(1); + } + }); + program.parse(process.argv); diff --git a/typescript/pragma-deployer/src/manager.ts b/typescript/pragma-deployer/src/manager.ts index cac429a9..f53536ed 100644 --- a/typescript/pragma-deployer/src/manager.ts +++ b/typescript/pragma-deployer/src/manager.ts @@ -30,6 +30,24 @@ class DeploymentManager { await deployer.deploy(config, deterministic, chain); } + + async verify( + contract: string, + config: DeploymentConfig, + chain?: string, + ): Promise { + const deployer = this.deployers.get(contract); + if ( + deployer?.verify !== undefined && + typeof deployer.verify === "function" + ) { + await deployer.verify(config, chain); + } else { + console.error( + `Contract verification not implemented yet for ${contract} on chain ${chain}.`, + ); + } + } } const deploymentManager = new DeploymentManager(); diff --git a/typescript/pragma-deployer/src/utils/evm_verify.ts b/typescript/pragma-deployer/src/utils/evm_verify.ts new file mode 100644 index 00000000..76e485cc --- /dev/null +++ b/typescript/pragma-deployer/src/utils/evm_verify.ts @@ -0,0 +1,87 @@ +import axios from "axios"; +import qs from "qs"; +import hre from "hardhat"; +import { AbiCoder, Contract } from "ethers"; + +/* + * NOTE: We use the v2 API of Etherscan. + * It is fairly new so it's possible that one recent chain is not supported by it. + */ +export const ETHERSCAN_VERIFIER_URL = "https://api.etherscan.io/v2/api"; + +/// Verifies a single contract using Etherscan API +export async function verifyContract( + contract: Contract, + contractFullyQualifiedName: string, + apiKey: string, + chainId: number, + constructorArguments: any[] = [], +): Promise { + const contractAddress = await contract.getAddress(); + + const artifact = await hre.artifacts.readArtifact(contractFullyQualifiedName); + + const buildInfo = await hre.artifacts.getBuildInfo( + `${artifact.sourceName}:${artifact.contractName}`, + ); + if (!buildInfo) { + console.error(`Build info not found for contract ${artifact.contractName}`); + return; + } + + const compilerVersion = `v${buildInfo.solcLongVersion}`; + const inputJSON = buildInfo.input; + let constructorArgumentsEncoded = ""; + if (constructorArguments.length > 0) { + const constructorAbi = artifact.abi.find( + (item) => item.type === "constructor", + ); + if (constructorAbi) { + const abiCoder = new AbiCoder(); + constructorArgumentsEncoded = abiCoder + .encode(constructorAbi.inputs || [], constructorArguments) + .replace(/^0x/, ""); + } + } + + const queryParams = { + apikey: apiKey, + chainid: chainId.toString(), + module: "contract", + action: "verifysourcecode", + }; + + const bodyData = { + codeformat: "solidity-standard-json-input", + sourceCode: JSON.stringify(inputJSON), + contractaddress: contractAddress, + contractname: `${artifact.sourceName}:${artifact.contractName}`, + compilerversion: compilerVersion, + // NOTE: There's a mistake in the etherscan api... "Arguements". + // TODO: To fix, one day, when they fix it. + constructorArguements: constructorArgumentsEncoded, + }; + const url = `${ETHERSCAN_VERIFIER_URL}?${qs.stringify(queryParams)}`; + try { + const response = await axios.post(url, qs.stringify(bodyData), { + headers: { + "Content-Type": "application/x-www-form-urlencoded", + }, + }); + + if (response.data.status === "1") { + console.log( + `✅ Contract ${artifact.contractName} verified successfully.`, + ); + } else { + console.error( + `❌ Verification failed for contract ${artifact.contractName}: ${response.data.result}`, + ); + } + } catch (error: any) { + console.error( + `❌ Verification failed for contract ${artifact.contractName}:`, + error.response?.data || error.message, + ); + } +} diff --git a/typescript/pragma-deployer/src/utils/index.ts b/typescript/pragma-deployer/src/utils/index.ts new file mode 100644 index 00000000..302bad63 --- /dev/null +++ b/typescript/pragma-deployer/src/utils/index.ts @@ -0,0 +1 @@ +export { ETHERSCAN_VERIFIER_URL, verifyContract } from "./evm_verify"; From 732af6cc4fb44a036e1ffb7d757d0425dc6ecf83 Mon Sep 17 00:00:00 2001 From: adel Date: Mon, 4 Nov 2024 00:41:47 +0100 Subject: [PATCH 2/5] feat: Theoros v1.0 (#86) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * dev(better_theoros): init * dev(better_theoros): pt1 * dev(better_theoros): * dev(better_theoros): * dev(better_theoros): Hyperlane service * dev(better_theoros): * dev(better_theoros): * dev(better_theoros): * dev(better_theoros): comms * dev(better_theoros): better * dev(better_theoros): logs * dev(better_theoros): added todo * dev(better_theoros): * dev(better_theoros): updated README * dev(better_theoros): Removed default active chain in websocket * dev(better_theoros): better comment * dev(better_theoros): last nitpick 💀 * dev(better_theoros): Simpler struct * dev(better_theoros): used same terminology between structs * dev(better_theoros): Added TODO for calldata * dev(better_theoros): smol perf update * dev(better_theoros): reading improvements * fix: strum EnumString * dev(better_theoros): Fixed EnumString deserialisation * dev(better_theoros): Works with N signatures * dev(better_theoros): * dev(better_theoros): better opti * dev(better_theoros): last commit - assert that the checkpoint is the same * dev(better_theoros): Removed unused dependencies * dev(better_theoros): * dev(better_theoros): 🔨 optimizations * dev(better_theoros): 🔨 nitpicking optis * dev(better_theoros): supports N datafeeds + returns N calldata ! * dev(better_theoros): Updated openapi specs * dev(better_theoros): Send error to ws client * dev(better_theoros): ✅ Websocket finished * dev(better_theoros): Fixed loop * dev(better_theoros): Fixed js script to update EVM feeds * dev(better_theoros): Theoros SDK * dev(better_theoros): updated README for SDk * dev(better_theoros): * dev(better_theoros): Better example + README * dev(better_theoros): ✅ theoros SDK * dev(better_theoros): Updated SDK Readme * dev(better_theoros): 🔨 Fixed & Tested SDK * dev(better_theoros): Fixed example * dev(better_theoros): Prevent overflows in indexer * fix: nit picks * Update tsconfig.json * dev(better_theoros): Fixes from review " r * dev(better_theoros): Lint * dev(better_theoros): docs * dev(better_theoros): Use DashMap / DashSet where applicable * fix: remove box * dev(better_theoros): Removed useless Result --------- Co-authored-by: 0xevolve --- README.md | 46 +- monorepo.code-workspace | 4 - rust/Cargo.lock | 749 +- rust/Cargo.toml | 33 +- rust/pragma-cli/.private.seed.example | 1 - rust/pragma-cli/Cargo.toml | 37 - rust/pragma-cli/src/cli/list.rs | 17 - rust/pragma-cli/src/cli/mod.rs | 5 - rust/pragma-cli/src/cli/schedule.rs | 24 - rust/pragma-cli/src/cli/types.rs | 47 - rust/pragma-cli/src/lib.rs | 3 - rust/pragma-cli/src/main.rs | 58 - rust/pragma-cli/src/runtimes/README.md | 21 - .../src/runtimes/artifacts/madara_metadata.rs | 8131 ----------------- .../runtimes/artifacts/madara_metadata.scale | Bin 40937 -> 0 bytes rust/pragma-cli/src/runtimes/mod.rs | 1 - rust/pragma-cli/src/runtimes/support.rs | 33 - rust/pragma-cli/src/utils/constants.rs | 2 - rust/pragma-cli/src/utils/mod.rs | 1 - rust/pragma-feeds/Cargo.toml | 10 +- rust/pragma-utils/Cargo.toml | 6 +- rust/rust-toolchain.toml | 2 +- rust/theoros/Cargo.toml | 10 +- rust/theoros/openapi.json | 155 +- rust/theoros/src/cli.rs | 5 - rust/theoros/src/configs/evm_config.rs | 76 +- rust/theoros/src/constants.rs | 5 +- rust/theoros/src/errors/calldata_error.rs | 3 + .../theoros/src/handlers/rest/get_calldata.rs | 87 +- .../src/handlers/rest/get_data_feeds.rs | 4 +- .../websocket/subscribe_to_calldata.rs | 240 +- rust/theoros/src/main.rs | 47 +- rust/theoros/src/rpc/evm/hyperlane.rs | 9 +- rust/theoros/src/rpc/evm/mod.rs | 18 +- rust/theoros/src/rpc/starknet/mod.rs | 7 +- rust/theoros/src/services/api/router.rs | 4 +- rust/theoros/src/services/hyperlane/mod.rs | 160 +- rust/theoros/src/services/indexer/mod.rs | 92 +- rust/theoros/src/storage/checkpoints.rs | 78 + rust/theoros/src/storage/event.rs | 137 - rust/theoros/src/storage/feed_id.rs | 67 +- rust/theoros/src/storage/mod.rs | 64 +- rust/theoros/src/storage/updates.rs | 22 + rust/theoros/src/storage/validator.rs | 104 +- rust/theoros/src/types/calldata.rs | 107 +- .../theoros/src/types/hyperlane/checkpoint.rs | 13 +- .../hyperlane/checkpoint_fetchers/gcs.rs | 8 - .../hyperlane/checkpoint_fetchers/local.rs | 13 - .../hyperlane/checkpoint_fetchers/mod.rs | 13 +- .../types/hyperlane/checkpoint_fetchers/s3.rs | 19 - .../types/hyperlane/events/dispatch_event.rs | 88 +- rust/theoros/src/types/mod.rs | 2 +- rust/theoros/src/types/rpc.rs | 13 - rust/theoros/src/types/state.rs | 29 + solidity/package-lock.json | 4 +- solidity/test/PragmaDecoder.t.sol | 2 +- typescript/pragma-scripts/bun.lockb | Bin 29212 -> 31495 bytes typescript/pragma-scripts/package-lock.json | 109 +- typescript/pragma-scripts/package.json | 5 +- .../pragma-scripts/src/pragma/update_feed.ts | 76 +- typescript/theoros-sdk/README.md | 221 +- typescript/theoros-sdk/examples/index.ts | 51 + typescript/theoros-sdk/package-lock.json | 4 +- typescript/theoros-sdk/package.json | 2 +- typescript/theoros-sdk/src/index.ts | 217 +- typescript/theoros-sdk/tsconfig.json | 5 +- 66 files changed, 1406 insertions(+), 10220 deletions(-) delete mode 100644 rust/pragma-cli/.private.seed.example delete mode 100644 rust/pragma-cli/Cargo.toml delete mode 100644 rust/pragma-cli/src/cli/list.rs delete mode 100644 rust/pragma-cli/src/cli/mod.rs delete mode 100644 rust/pragma-cli/src/cli/schedule.rs delete mode 100644 rust/pragma-cli/src/cli/types.rs delete mode 100644 rust/pragma-cli/src/lib.rs delete mode 100644 rust/pragma-cli/src/main.rs delete mode 100644 rust/pragma-cli/src/runtimes/README.md delete mode 100644 rust/pragma-cli/src/runtimes/artifacts/madara_metadata.rs delete mode 100644 rust/pragma-cli/src/runtimes/artifacts/madara_metadata.scale delete mode 100644 rust/pragma-cli/src/runtimes/mod.rs delete mode 100644 rust/pragma-cli/src/runtimes/support.rs delete mode 100644 rust/pragma-cli/src/utils/constants.rs delete mode 100644 rust/pragma-cli/src/utils/mod.rs create mode 100644 rust/theoros/src/storage/checkpoints.rs delete mode 100644 rust/theoros/src/storage/event.rs create mode 100644 rust/theoros/src/storage/updates.rs delete mode 100644 rust/theoros/src/types/rpc.rs create mode 100644 rust/theoros/src/types/state.rs create mode 100644 typescript/theoros-sdk/examples/index.ts diff --git a/README.md b/README.md index e7ab2e8d..106f0a70 100644 --- a/README.md +++ b/README.md @@ -1,25 +1,17 @@ -# Pragma +# Pragma V2 -[![GitHub Actions][gha-badge]][gha] [![codecov](https://codecov.io/gh/astraly-labs/pragma-monorepo/branch/main/graph/badge.svg?)](https://codecov.io/gh/astraly-labs/pragma-monorepo) [![Foundry][foundry-badge]][foundry] [![License: MIT][license-badge]][license] +[![GitHub Actions][gha-badge]][gha] [![Foundry][foundry-badge]][foundry] [![License: MIT][license-badge]][license] [gha]: https://github.com/astraly-labs/pragma-monorepo/actions [gha-badge]: https://github.com/PaulRBerg/prb-math/actions/workflows/ci.yml/badge.svg [codecov-badge]: https://img.shields.io/codecov/c/github/astraly-labs/pragma-monorepo [foundry]: https://getfoundry.sh/ [foundry-badge]: https://img.shields.io/badge/Built%20with-Foundry-FFDB1C.svg -[license]: https://www.apache.org/licenses/LICENSE-2.0 -[license-badge]: https://img.shields.io/badge/License-Apache-blue.svg +[license]: https://opensource.org/license/mit +[license-badge]: https://img.shields.io/badge/License-MIT-blue.svg ## Rust -Pragma CLI - -CLI used to interact with the Pragma protocol. - -- Register yourself as a data provider -- Schedule new data feeds -- Connect pragma to your protocol - Theoros Request the API to construct the calldata necessary for cross-chain updates. @@ -28,6 +20,16 @@ Request the API to construct the calldata necessary for cross-chain updates. - Retrieves the signatures of the Hyperlane Validators - Constructs the calldata for data feeds requested through HTTP/WebSocket +## Cairo + +Pragma Oracle + +Core Contacts of the Pragma Oracle. + +Pragma Dispatcher + +Wrapper around the Pragma Oracle that allows us to dispatch feed updates through Hyperlane. + ## Solidity Solidity SDK @@ -37,22 +39,18 @@ Solidity contracts & libraries. - Set of contracts used to store data relayed from Pragma chain using Hyperlane. - SDK that can be used by EVM protocols looking to integrate Pragma. -## Local Development +## Typescript -### Foundry +Theoros SDK -First ensure you have Foundry installed on your machine. +A SDK used to query data from Theoros in a simple way. -Run the following to install `foundryup`: +- Fetch the latest calldata using either REST or Websocket endpoints. -```bash -curl -L https://foundry.paradigm.xyz | bash -``` +Pragma Deployer -Then run `foundryup` to install `forge`, `cast`, `anvil` and `chisel`. +The main scripts used to deploy all our contracts (Cairo, Solidity, ...) are located there. -```bash -foundryup -``` +Pragma Scripts -Check out the [Foundry Book](https://book.getfoundry.sh/getting-started/installation) for more information. +Utils scripts that we use to make some actions on-chain. diff --git a/monorepo.code-workspace b/monorepo.code-workspace index 0fc0556d..e2216143 100644 --- a/monorepo.code-workspace +++ b/monorepo.code-workspace @@ -12,10 +12,6 @@ "name": "theoros", "path": "rust/theoros", }, - { - "name": "pragma-cli", - "path": "rust/pragma-cli", - }, { "name": "pragma-utils", "path": "rust/pragma-utils", diff --git a/rust/Cargo.lock b/rust/Cargo.lock index 97d324b7..196c2c5b 100644 --- a/rust/Cargo.lock +++ b/rust/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ "alloy-serde", "auto_impl", "c-kzg", - "derive_more 1.0.0", + "derive_more", "serde", ] @@ -199,7 +199,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "c-kzg", - "derive_more 1.0.0", + "derive_more", "once_cell", "serde", "sha2 0.10.8", @@ -286,7 +286,7 @@ dependencies = [ "bytes", "cfg-if", "const-hex", - "derive_more 1.0.0", + "derive_more", "hashbrown 0.14.5", "hex-literal", "indexmap 2.6.0", @@ -326,7 +326,7 @@ dependencies = [ "async-stream", "async-trait", "auto_impl", - "dashmap 6.0.1", + "dashmap", "futures", "futures-utils-wasm", "lru", @@ -434,7 +434,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-serde", - "derive_more 1.0.0", + "derive_more", "serde", "strum", ] @@ -452,7 +452,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "alloy-sol-types", - "derive_more 1.0.0", + "derive_more", "itertools 0.13.0", "serde", "serde_json", @@ -939,12 +939,6 @@ dependencies = [ "rustc_version 0.4.0", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "auto_impl" version = "1.2.0" @@ -1135,19 +1129,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bigdecimal" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" -dependencies = [ - "autocfg", - "libm", - "num-bigint", - "num-integer", - "num-traits", -] - [[package]] name = "bimap" version = "0.6.3" @@ -1223,50 +1204,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "bollard" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d41711ad46fda47cd701f6908e59d1bd6b9a2b7464c0d0aeab95c6d37096ff8a" -dependencies = [ - "base64 0.22.1", - "bollard-stubs", - "bytes", - "futures-core", - "futures-util", - "hex", - "http 1.1.0", - "http-body-util", - "hyper 1.4.1", - "hyper-named-pipe", - "hyper-util", - "hyperlocal", - "log", - "pin-project-lite", - "serde", - "serde_derive", - "serde_json", - "serde_repr", - "serde_urlencoded", - "thiserror", - "tokio", - "tokio-util", - "tower-service", - "url", - "winapi", -] - -[[package]] -name = "bollard-stubs" -version = "1.45.0-rc.26.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7c5415e3a6bc6d3e99eff6268e488fd4ee25e7b28c10f08fa6760bd9de16e4" -dependencies = [ - "serde", - "serde_repr", - "serde_with 3.9.0", -] - [[package]] name = "bumpalo" version = "3.16.0" @@ -1314,8 +1251,6 @@ version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "50d2eb3cd3d1bf4529e31c215ee6f93ec5a3d536d9f578f93d9d33ee19562932" dependencies = [ - "jobserver", - "libc", "shlex", ] @@ -1464,31 +1399,6 @@ version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio 0.8.11", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - -[[package]] -name = "crossterm_winapi" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b" -dependencies = [ - "winapi", -] - [[package]] name = "crunchy" version = "0.2.2" @@ -1573,22 +1483,9 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.5.3" +version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "lock_api", - "once_cell", - "parking_lot_core", -] - -[[package]] -name = "dashmap" -version = "6.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804c8821570c3f8b70230c2ba75ffa5c0f9a4189b9a432b6656c536712acae28" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ "cfg-if", "crossbeam-utils", @@ -1646,17 +1543,6 @@ dependencies = [ "syn 2.0.75", ] -[[package]] -name = "derive_more" -version = "0.99.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "derive_more" version = "1.0.0" @@ -1699,15 +1585,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -1718,18 +1595,6 @@ dependencies = [ "dirs-sys-next", ] -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "dirs-sys-next" version = "0.1.2" @@ -1758,30 +1623,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" -[[package]] -name = "dotenvy" -version = "0.15.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" - -[[package]] -name = "dtoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbb2bf8e87535c23f7a8a321e364ce21462d0ff10cb6407820e8e96dfff6653" - [[package]] name = "dunce" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" -[[package]] -name = "dyn-clone" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" - [[package]] name = "ecdsa" version = "0.16.9" @@ -1830,38 +1677,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_filter" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab" -dependencies = [ - "log", - "regex", -] - -[[package]] -name = "env_logger" -version = "0.11.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" -dependencies = [ - "anstream", - "anstyle", - "env_filter", - "humantime", - "log", -] - -[[package]] -name = "envy" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" -dependencies = [ - "serde", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -1937,16 +1752,6 @@ dependencies = [ "uint", ] -[[package]] -name = "eyre" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" -dependencies = [ - "indenter", - "once_cell", -] - [[package]] name = "fastrand" version = "2.1.0" @@ -2032,16 +1837,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "forwarded-header-value" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835f84f38484cc86f110a805655697908257fb9a7af005234060891557198e9" -dependencies = [ - "nonempty", - "thiserror", -] - [[package]] name = "funty" version = "2.0.0" @@ -2119,12 +1914,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" -[[package]] -name = "futures-timer" -version = "3.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" - [[package]] name = "futures-util" version = "0.3.30" @@ -2149,24 +1938,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" -[[package]] -name = "fuzzy-matcher" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54614a3312934d066701a80f20f15fa3b56d67ac7722b39eea5b4c9dd1d66c94" -dependencies = [ - "thread_local", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - [[package]] name = "generic-array" version = "0.14.7" @@ -2197,47 +1968,12 @@ version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" -[[package]] -name = "git2" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" -dependencies = [ - "bitflags 2.6.0", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - [[package]] name = "glob" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "governor" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a7f542ee6b35af73b06abc0dad1c1bae89964e4e253bc4b587b91c9637867b" -dependencies = [ - "cfg-if", - "dashmap 5.5.3", - "futures", - "futures-timer", - "no-std-compat", - "nonzero_ext", - "parking_lot", - "portable-atomic", - "quanta", - "rand", - "smallvec", - "spinning_top", -] - [[package]] name = "group" version = "0.13.0" @@ -2268,25 +2004,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" -dependencies = [ - "atomic-waker", - "bytes", - "fnv", - "futures-core", - "futures-sink", - "http 1.1.0", - "indexmap 2.6.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -2477,7 +2194,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "httparse", @@ -2500,7 +2217,6 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "httparse", @@ -2512,21 +2228,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-named-pipe" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b7d8abf35697b81a825e386fc151e0d503e8cb5fcb93cc8669c376dfd6f278" -dependencies = [ - "hex", - "hyper 1.4.1", - "hyper-util", - "pin-project-lite", - "tokio", - "tower-service", - "winapi", -] - [[package]] name = "hyper-rustls" version = "0.24.2" @@ -2622,21 +2323,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "hyperlocal" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "986c5ce3b994526b3cd75578e62554abd09f0899d6206de48b3e96ab34ccc8c7" -dependencies = [ - "hex", - "http-body-util", - "hyper 1.4.1", - "hyper-util", - "pin-project-lite", - "tokio", - "tower-service", -] - [[package]] name = "iana-time-zone" version = "0.1.60" @@ -2714,12 +2400,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - [[package]] name = "indexmap" version = "1.9.3" @@ -2751,23 +2431,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "inquire" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a" -dependencies = [ - "bitflags 2.6.0", - "crossterm", - "dyn-clone", - "fuzzy-matcher", - "fxhash", - "newline-converter", - "once_cell", - "unicode-segmentation", - "unicode-width", -] - [[package]] name = "interprocess" version = "2.2.1" @@ -2828,15 +2491,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.70" @@ -2912,20 +2566,6 @@ version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" -[[package]] -name = "libgit2-sys" -version = "0.17.0+1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - [[package]] name = "libm" version = "0.2.8" @@ -2942,32 +2582,6 @@ dependencies = [ "libc", ] -[[package]] -name = "libssh2-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc53a7799a7496ebc9fd29f31f7df80e83c9bda5299768af5f9e59eeea74647" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -3065,18 +2679,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mio" version = "1.0.2" @@ -3112,33 +2714,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "newline-converter" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47b6b097ecb1cbfed438542d16e84fd7ad9b0c76c8a65b7f9039212a3d14dc7f" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - -[[package]] -name = "nonempty" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e591e719385e6ebaeb5ce5d3887f7d5676fceca6411d1925ccc95745f3d6f7" - -[[package]] -name = "nonzero_ext" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38bf9645c8b145698bb0b18a4637dcacbc421ea49bef2317e4fd8065a387cf21" - [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -3398,12 +2973,6 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "ordered-float" version = "4.2.2" @@ -3605,12 +3174,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "portable-atomic" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" - [[package]] name = "powerfmt" version = "0.2.0" @@ -3626,71 +3189,27 @@ dependencies = [ "zerocopy", ] -[[package]] -name = "pragma-cli" -version = "0.1.0" -dependencies = [ - "alloy", - "anyhow", - "bollard", - "clap", - "dirs", - "env_logger", - "eyre", - "futures-util", - "git2", - "hex", - "inquire", - "parity-scale-codec", - "pragma-utils", - "rand", - "reqwest 0.12.7", - "scale-info", - "serde", - "serde_json", - "starknet 0.11.0", - "strum", - "strum_macros", - "thiserror", - "tokio", - "toml", - "tracing", - "url", -] - [[package]] name = "pragma-feeds" -version = "0.1.0" +version = "1.0.0" dependencies = [ "anyhow", - "apibara-core", - "async-trait", "hex", - "rusoto_core", "serde", - "starknet 0.11.0", "strum", "strum_macros", - "tokio", - "tracing", - "tracing-axiom", - "tracing-subscriber", ] [[package]] name = "pragma-utils" -version = "0.1.0" +version = "1.0.0" dependencies = [ "alloy", "anyhow", "apibara-core", "async-trait", - "hex", "rusoto_core", - "serde", "starknet 0.11.0", - "strum", - "strum_macros", "tokio", "tracing", "tracing-axiom", @@ -3726,7 +3245,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.21.1", + "toml_edit", ] [[package]] @@ -3799,29 +3318,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "prometheus-client" -version = "0.21.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c99afa9a01501019ac3a14d71d9f94050346f55ca471ce90c799a15c58f61e2" -dependencies = [ - "dtoa", - "itoa", - "parking_lot", - "prometheus-client-derive-encode", -] - -[[package]] -name = "prometheus-client-derive-encode" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "proptest" version = "1.5.0" @@ -3925,21 +3421,6 @@ version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" -[[package]] -name = "quanta" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5167a477619228a0b284fac2674e3c388cba90631d7b7de620e6f1fcd08da5" -dependencies = [ - "crossbeam-utils", - "libc", - "once_cell", - "raw-cpuid", - "wasi", - "web-sys", - "winapi", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -4049,15 +3530,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "raw-cpuid" -version = "11.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab240315c661615f2ee9f0f2cd32d5a7343a84d5ebcccb99d46e6637565e7b0" -dependencies = [ - "bitflags 2.6.0", -] - [[package]] name = "recvmsg" version = "1.0.0" @@ -4139,7 +3611,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -4157,7 +3629,7 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 0.1.2", - "system-configuration 0.5.1", + "system-configuration", "tokio", "tokio-rustls 0.24.1", "tower-service", @@ -4177,11 +3649,9 @@ checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", - "encoding_rs", "futures-channel", "futures-core", "futures-util", - "h2 0.4.6", "http 1.1.0", "http-body 1.0.1", "http-body-util", @@ -4205,7 +3675,6 @@ dependencies = [ "serde_json", "serde_urlencoded", "sync_wrapper 1.0.1", - "system-configuration 0.6.1", "tokio", "tokio-native-tls", "tokio-rustls 0.26.0", @@ -4588,18 +4057,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "scale-info" -version = "2.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" -dependencies = [ - "bitvec", - "cfg-if", - "derive_more 0.99.18", - "parity-scale-codec", -] - [[package]] name = "schannel" version = "0.1.23" @@ -4774,26 +4231,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_repr" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.75", -] - -[[package]] -name = "serde_spanned" -version = "0.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" -dependencies = [ - "serde", -] - [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4822,23 +4259,6 @@ dependencies = [ "time", ] -[[package]] -name = "serde_with" -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" -dependencies = [ - "base64 0.22.1", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.6.0", - "serde", - "serde_derive", - "serde_json", - "time", -] - [[package]] name = "serde_with_macros" version = "2.3.3" @@ -4934,27 +4354,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" -[[package]] -name = "signal-hook" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" -dependencies = [ - "libc", - "signal-hook-registry", -] - -[[package]] -name = "signal-hook-mio" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" -dependencies = [ - "libc", - "mio 0.8.11", - "signal-hook", -] - [[package]] name = "signal-hook-registry" version = "1.4.2" @@ -5005,15 +4404,6 @@ version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" -[[package]] -name = "spinning_top" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96d2d1d716fb500937168cc09353ffdc7a012be8475ac7308e1bdf0e3923300" -dependencies = [ - "lock_api", -] - [[package]] name = "spki" version = "0.7.3" @@ -5089,7 +4479,7 @@ source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=7153d0e42#7153d0e4 dependencies = [ "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-accounts 0.9.0", "starknet-core 0.10.0", "starknet-providers 0.10.0", @@ -5104,7 +4494,7 @@ checksum = "a5f91344f1e0b81873b6dc235c50ae4d084c6ea4dd4a1e3e27ad895803adb610" dependencies = [ "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-accounts 0.10.0", "starknet-core 0.11.1", "starknet-providers 0.11.0", @@ -5122,7 +4512,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with 2.3.3", + "serde_with", "sha3", "starknet-crypto 0.6.2", "starknet-ff", @@ -5141,7 +4531,7 @@ dependencies = [ "serde", "serde_json", "serde_json_pythonic", - "serde_with 2.3.3", + "serde_with", "sha3", "starknet-crypto 0.7.1", "starknet-types-core", @@ -5230,7 +4620,7 @@ version = "0.3.7" source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=7153d0e42#7153d0e42112f8c1348029557aa6cf2b881a5c84" dependencies = [ "ark-ff 0.4.2", - "bigdecimal 0.3.1", + "bigdecimal", "crypto-bigint", "getrandom", "hex", @@ -5270,7 +4660,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-core 0.10.0", "thiserror", "url", @@ -5291,7 +4681,7 @@ dependencies = [ "reqwest 0.11.27", "serde", "serde_json", - "serde_with 2.3.3", + "serde_with", "starknet-core 0.11.1", "thiserror", "url", @@ -5440,18 +4830,7 @@ checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" dependencies = [ "bitflags 1.3.2", "core-foundation", - "system-configuration-sys 0.5.0", -] - -[[package]] -name = "system-configuration" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" -dependencies = [ - "bitflags 2.6.0", - "core-foundation", - "system-configuration-sys 0.6.0", + "system-configuration-sys", ] [[package]] @@ -5464,16 +4843,6 @@ dependencies = [ "libc", ] -[[package]] -name = "system-configuration-sys" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tame-gcs" version = "0.10.0" @@ -5522,32 +4891,28 @@ dependencies = [ "async-trait", "axum 0.7.5", "axum-macros", - "bigdecimal 0.4.5", "chrono", "clap", - "dotenvy", - "envy", + "dashmap", "futures", "futures-util", "hyper 0.14.30", "lazy_static", - "num-bigint", - "num-traits", "opentelemetry 0.24.0", "pragma-feeds", "pragma-utils", "prometheus", - "prometheus-client", "rusoto_core", "rusoto_s3", "serde", "serde_json", "serde_yaml", "starknet 0.11.0", + "strum", + "strum_macros", "thiserror", "tokio", "tower-http", - "tower_governor", "tracing", "url", "utoipa", @@ -5661,7 +5026,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.2", + "mio", "parking_lot", "pin-project-lite", "signal-hook-registry", @@ -5775,26 +5140,11 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" -dependencies = [ - "serde", - "serde_spanned", - "toml_datetime", - "toml_edit 0.22.20", -] - [[package]] name = "toml_datetime" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" -dependencies = [ - "serde", -] [[package]] name = "toml_edit" @@ -5807,19 +5157,6 @@ dependencies = [ "winnow 0.5.40", ] -[[package]] -name = "toml_edit" -version = "0.22.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" -dependencies = [ - "indexmap 2.6.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow 0.6.18", -] - [[package]] name = "tonic" version = "0.9.2" @@ -5833,7 +5170,7 @@ dependencies = [ "bytes", "futures-core", "futures-util", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -5863,7 +5200,7 @@ dependencies = [ "axum 0.6.20", "base64 0.21.7", "bytes", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -5894,7 +5231,7 @@ dependencies = [ "axum 0.6.20", "base64 0.21.7", "bytes", - "h2 0.3.26", + "h2", "http 0.2.12", "http-body 0.4.6", "hyper 0.14.30", @@ -5994,22 +5331,6 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" -[[package]] -name = "tower_governor" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aea939ea6cfa7c4880f3e7422616624f97a567c16df67b53b11f0d03917a8e46" -dependencies = [ - "axum 0.7.5", - "forwarded-header-value", - "governor", - "http 1.1.0", - "pin-project", - "thiserror", - "tower 0.5.1", - "tracing", -] - [[package]] name = "tracing" version = "0.1.40" @@ -6224,18 +5545,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" - -[[package]] -name = "unicode-width" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" - [[package]] name = "unicode-xid" version = "0.2.6" diff --git a/rust/Cargo.toml b/rust/Cargo.toml index 8c556bab..38ef2f02 100644 --- a/rust/Cargo.toml +++ b/rust/Cargo.toml @@ -1,6 +1,6 @@ [workspace] resolver = "2" -members = ["pragma-cli", "theoros", "pragma-utils", "pragma-feeds"] +members = ["theoros", "pragma-utils", "pragma-feeds"] [workspace.package] version = "0.1.0" @@ -15,35 +15,16 @@ publish = false [workspace.dependencies] anyhow = "1.0.86" async-trait = "0.1.81" -bollard = "0.17.1" clap = { version = "4.5.16", features = ["derive", "env"] } chrono = { version = "0.4.38", features = ["serde"] } -derive_more = { version = "1", features = ["deref", "deref_mut"] } -dirs = "5.0.1" -dotenvy = "0.15.7" -envy = "0.4.2" -bigdecimal = "0.4.5" -deadpool-diesel = { version = "0.6.1", features = ["postgres"] } -diesel_migrations = "2.2.0" -diesel = { version = "2.2.3", features = [ - "postgres", - "extras", - "postgres_backend", - "serde_json", -] } -env_logger = "0.11.5" +dashmap = { version = "6.1.0" } alloy = { version = "0.5.2", features = ["full"] } -eyre = "0.6.12" futures = { version = "0.3.30", features = ["std"] } futures-util = "0.3.30" -git2 = "0.19.0" hex = "0.4.3" -inquire = "0.7.5" tracing = "0.1.4" tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } tracing-axiom = "0.7" -rand = "0.8.5" -reqwest = { version = "0.12.7", features = ["json", "blocking"] } serde = { version = "1.0.208", features = ["derive"] } serde_json = "1.0.125" serde_yaml = "0.9.34" @@ -51,7 +32,6 @@ strum = { version = "0.26.3", features = ["derive"] } strum_macros = { version = "0.26.4", features = [] } thiserror = "1.0.63" prometheus = "0.13.4" -prometheus-client = { version = "0.21.2" } hyper = { version = "0.14", features = ["server"] } tokio = { version = "1.39.3", features = [ "rt", @@ -59,9 +39,6 @@ tokio = { version = "1.39.3", features = [ "macros", "signal", ] } -toml = "0.8.19" -tower_governor = { version = "0.4.3", features = ["axum", "tracing"] } -scale-info = "2.11.3" scale = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive", ] } @@ -78,8 +55,6 @@ ya-gcp = { version = "0.11.3", features = ["storage"] } rusoto_s3 = "0.48.0" rusoto_core = "0.48.0" lazy_static = "1.5.0" -num-bigint = "0.4" -num-traits = "0.2" # Apibara DNA (indexing) apibara-core = { git = "https://github.com/apibara/dna", rev = "9caa385" } @@ -88,12 +63,8 @@ apibara-sdk = { git = "https://github.com/apibara/dna", rev = "9caa385" } # Pragma packages pragma-utils = { path = "pragma-utils" } pragma-feeds = { path = "pragma-feeds" } -pragma-cli = { path = "pragma-cli" } theoros = { path = "theoros" } -# Tests dependencies -tracing-test = "0.2.5" - [profile.release] overflow-checks = true lto = "fat" diff --git a/rust/pragma-cli/.private.seed.example b/rust/pragma-cli/.private.seed.example deleted file mode 100644 index b184776c..00000000 --- a/rust/pragma-cli/.private.seed.example +++ /dev/null @@ -1 +0,0 @@ -write your private seed here to sign the transactions \ No newline at end of file diff --git a/rust/pragma-cli/Cargo.toml b/rust/pragma-cli/Cargo.toml deleted file mode 100644 index 0609d3be..00000000 --- a/rust/pragma-cli/Cargo.toml +++ /dev/null @@ -1,37 +0,0 @@ -[package] -name = "pragma-cli" -version = "0.1.0" -edition = "2021" - -[[bin]] -name = "pragma" -path = "src/main.rs" - -[dependencies] -alloy = { workspace = true } -anyhow = { workspace = true } -bollard = { workspace = true } -clap = { workspace = true } -dirs = { workspace = true } -env_logger = { workspace = true } -eyre = { workspace = true } -futures-util = { workspace = true } -git2 = { workspace = true } -hex = { workspace = true } -inquire = { workspace = true } -rand = { workspace = true } -reqwest = { workspace = true } -scale = { workspace = true } -scale-info = { workspace = true } -serde = { workspace = true } -serde_json = { workspace = true } -starknet = { workspace = true } -strum = { workspace = true } -strum_macros = { workspace = true } -thiserror = { workspace = true } -tokio = { workspace = true } -toml = { workspace = true } -tracing = { workspace = true } -url = { workspace = true } - -pragma-utils = { path = "../pragma-utils" } diff --git a/rust/pragma-cli/src/cli/list.rs b/rust/pragma-cli/src/cli/list.rs deleted file mode 100644 index 3140e16d..00000000 --- a/rust/pragma-cli/src/cli/list.rs +++ /dev/null @@ -1,17 +0,0 @@ -use crate::utils::constants::DATA_FEEDS; - -pub fn list() { - match get_data_feed_list() { - Ok(feeds) => { - tracing::info!("Data Feeds available: {:?}", feeds); - } - Err(err) => { - panic!("Failed to list: {}", err); - } - } -} - -fn get_data_feed_list() -> Result, Box> { - let data_feeds = DATA_FEEDS.iter().map(|x| x.to_string()).collect(); - Ok(data_feeds) -} diff --git a/rust/pragma-cli/src/cli/mod.rs b/rust/pragma-cli/src/cli/mod.rs deleted file mode 100644 index c0cbaa16..00000000 --- a/rust/pragma-cli/src/cli/mod.rs +++ /dev/null @@ -1,5 +0,0 @@ -pub mod list; - -pub mod schedule; - -pub mod types; diff --git a/rust/pragma-cli/src/cli/schedule.rs b/rust/pragma-cli/src/cli/schedule.rs deleted file mode 100644 index d225536d..00000000 --- a/rust/pragma-cli/src/cli/schedule.rs +++ /dev/null @@ -1,24 +0,0 @@ -use super::types::DataFeed; - -pub async fn schedule(rpc_url: &Option, frequency: &Option, data_feed: &DataFeed) { - let rpc_url = rpc_url.as_deref().unwrap_or("ws://127.0.0.1:9944"); - let frequency = frequency.unwrap_or(10); - - match schedule_data_feed(rpc_url, &frequency, data_feed).await { - Ok(_) => { - tracing::info!("Data Feed successfully scheduled!"); - } - Err(err) => { - tracing::error!("Failed to schedule the given data feed: {}", err); - } - } -} - -async fn schedule_data_feed( - _rpc_url: &str, - frequency: &u128, - data_feed: &DataFeed, -) -> Result<(), Box> { - tracing::info!("Scheduling data feed with frequency: {}, data feed: {:?}", frequency, data_feed); - Ok(()) -} diff --git a/rust/pragma-cli/src/cli/types.rs b/rust/pragma-cli/src/cli/types.rs deleted file mode 100644 index 6687881c..00000000 --- a/rust/pragma-cli/src/cli/types.rs +++ /dev/null @@ -1,47 +0,0 @@ -use serde::{Deserialize, Serialize}; -use starknet::core::{types::Felt, utils::cairo_short_string_to_felt}; - -#[derive(Debug, Clone, Serialize, Deserialize)] -pub struct DataFeed { - pub assets: Vec, - pub contract_address: String, - pub selector: String, - pub calldata: Vec, -} - -impl DataFeed { - pub fn new(assets: Vec, contract_address: String, selector: String) -> Self { - let calldata = assets.iter().map(|a| cairo_short_string_to_felt(a).unwrap()).collect(); - Self { assets, contract_address, selector, calldata } - } -} - -pub trait HasSelector { - fn to_selector(&self) -> String; -} - -pub enum AggregationMode { - Median, - Mean, -} - -pub enum StateUpdate { - Checkpoint, -} - -impl HasSelector for AggregationMode { - fn to_selector(&self) -> String { - match self { - AggregationMode::Median => "0x00".to_string(), - AggregationMode::Mean => "0x01".to_string(), - } - } -} - -impl HasSelector for StateUpdate { - fn to_selector(&self) -> String { - match self { - StateUpdate::Checkpoint => "0x0270c07fa4205f06222fb499351ee48b50054a57b9599b4a462ea03b8e2b84d5".to_string(), - } - } -} diff --git a/rust/pragma-cli/src/lib.rs b/rust/pragma-cli/src/lib.rs deleted file mode 100644 index 88a2fcae..00000000 --- a/rust/pragma-cli/src/lib.rs +++ /dev/null @@ -1,3 +0,0 @@ -pub mod cli; -pub mod runtimes; -pub mod utils; diff --git a/rust/pragma-cli/src/main.rs b/rust/pragma-cli/src/main.rs deleted file mode 100644 index fe084389..00000000 --- a/rust/pragma-cli/src/main.rs +++ /dev/null @@ -1,58 +0,0 @@ -use anyhow::Result; -use clap::{Parser, Subcommand}; -use pragma_utils::tracing::init_tracing; -use tracing::Level; - -use pragma_cli::{ - cli::{ - self, - types::{DataFeed, HasSelector, StateUpdate}, - }, - utils::constants::ORACLE_ADDRESS, -}; - -#[derive(Parser)] -#[command(author, version, about, long_about = None)] -struct Cli { - #[command(subcommand)] - command: Option, -} - -#[derive(Subcommand)] -enum Commands { - /// Lists all the existing data feeds - List, - /// Schedule a new data feed automation - Schedule { - /// RPC Url for the Madara node - #[clap(short, long = "rpc-url")] - rpc_url: Option, - /// Frequency of updates in blocks - #[clap(short)] - frequency: Option, - /// Assets to be included in the data feed - #[clap(short)] - assets: Vec, - /// Data feed name - #[clap(short, long = "data-feed-name")] - data_feed_name: String, - }, -} - -#[tokio::main] -async fn main() -> Result<()> { - init_tracing("pragma-cli", Level::INFO)?; - - let cli = Cli::parse(); - match &cli.command { - Some(Commands::List) => cli::list::list(), - Some(Commands::Schedule { rpc_url, frequency, assets, data_feed_name: _ }) => { - let data_feed = - DataFeed::new(assets.to_vec(), ORACLE_ADDRESS.to_string(), StateUpdate::Checkpoint.to_selector()); - cli::schedule::schedule(rpc_url, frequency, &data_feed).await - } - None => tracing::info!("Use --help to see the complete list of available commands"), - } - - Ok(()) -} diff --git a/rust/pragma-cli/src/runtimes/README.md b/rust/pragma-cli/src/runtimes/README.md deleted file mode 100644 index 67f8fbe6..00000000 --- a/rust/pragma-cli/src/runtimes/README.md +++ /dev/null @@ -1,21 +0,0 @@ -# Supported Runtimes - -- Sharingan - -TODO: Improve the runtimes implementation without the need of replicating -the same functions for each runtime. Note that _RuntimeApi_ is runtime -specific. It gives access to api functions specific for each runtime. - -## Generated files from subxt-cli - -Download metadata from a substrate node, for use with `subxt` codegen. - -```bash -subxt metadata --url ws://127.0.0.1:9944 -f bytes > madara_metadata.scale -``` - -Generate runtime API client code from metadata. - -```bash -subxt codegen --url ws://127.0.0.1:9944 | rustfmt --edition=2018 --emit=stdout > madara_metadata.rs -``` diff --git a/rust/pragma-cli/src/runtimes/artifacts/madara_metadata.rs b/rust/pragma-cli/src/runtimes/artifacts/madara_metadata.rs deleted file mode 100644 index 7a6a8f15..00000000 --- a/rust/pragma-cli/src/runtimes/artifacts/madara_metadata.rs +++ /dev/null @@ -1,8131 +0,0 @@ -#[allow(dead_code, unused_imports, non_camel_case_types)] -#[allow(clippy::all)] -#[allow(rustdoc::broken_intra_doc_links)] -pub mod api { - #[allow(unused_imports)] - mod root_mod { - pub use super::*; - } - pub static PALLETS: [&str; 6usize] = ["System", "Timestamp", "Aura", "Grandpa", "Starknet", "Autonomous"]; - pub static RUNTIME_APIS: [&str; 11usize] = [ - "Core", - "Metadata", - "BlockBuilder", - "TaggedTransactionQueue", - "OffchainWorkerApi", - "AuraApi", - "SessionKeys", - "GrandpaApi", - "AccountNonceApi", - "StarknetRuntimeApi", - "ConvertTransactionRuntimeApi", - ]; - #[doc = r" The error type returned when there is a runtime issue."] - pub type DispatchError = runtime_types::sp_runtime::DispatchError; - #[doc = r" The outer event enum."] - pub type Event = runtime_types::madara_runtime::RuntimeEvent; - #[doc = r" The outer extrinsic enum."] - pub type Call = runtime_types::madara_runtime::RuntimeCall; - #[doc = r" The outer error enum representing the DispatchError's Module variant."] - pub type Error = runtime_types::madara_runtime::RuntimeError; - pub fn constants() -> ConstantsApi { - ConstantsApi - } - pub fn storage() -> StorageApi { - StorageApi - } - pub fn tx() -> TransactionApi { - TransactionApi - } - pub fn apis() -> runtime_apis::RuntimeApi { - runtime_apis::RuntimeApi - } - pub mod runtime_apis { - use super::root_mod; - use super::runtime_types; - use ::subxt::ext::codec::Encode; - pub struct RuntimeApi; - impl RuntimeApi { - pub fn core(&self) -> core::Core { - core::Core - } - pub fn metadata(&self) -> metadata::Metadata { - metadata::Metadata - } - pub fn block_builder(&self) -> block_builder::BlockBuilder { - block_builder::BlockBuilder - } - pub fn tagged_transaction_queue(&self) -> tagged_transaction_queue::TaggedTransactionQueue { - tagged_transaction_queue::TaggedTransactionQueue - } - pub fn offchain_worker_api(&self) -> offchain_worker_api::OffchainWorkerApi { - offchain_worker_api::OffchainWorkerApi - } - pub fn aura_api(&self) -> aura_api::AuraApi { - aura_api::AuraApi - } - pub fn session_keys(&self) -> session_keys::SessionKeys { - session_keys::SessionKeys - } - pub fn grandpa_api(&self) -> grandpa_api::GrandpaApi { - grandpa_api::GrandpaApi - } - pub fn account_nonce_api(&self) -> account_nonce_api::AccountNonceApi { - account_nonce_api::AccountNonceApi - } - pub fn starknet_runtime_api(&self) -> starknet_runtime_api::StarknetRuntimeApi { - starknet_runtime_api::StarknetRuntimeApi - } - pub fn convert_transaction_runtime_api( - &self, - ) -> convert_transaction_runtime_api::ConvertTransactionRuntimeApi { - convert_transaction_runtime_api::ConvertTransactionRuntimeApi - } - } - pub mod core { - use super::root_mod; - use super::runtime_types; - #[doc = " The `Core` runtime api that every Substrate runtime needs to implement."] - pub struct Core; - impl Core { - #[doc = " Returns the version of the runtime."] - pub fn version(&self) -> ::subxt::runtime_api::Payload { - ::subxt::runtime_api::Payload::new_static( - "Core", - "version", - types::Version {}, - [ - 76u8, 202u8, 17u8, 117u8, 189u8, 237u8, 239u8, 237u8, 151u8, 17u8, 125u8, 159u8, 218u8, - 92u8, 57u8, 238u8, 64u8, 147u8, 40u8, 72u8, 157u8, 116u8, 37u8, 195u8, 156u8, 27u8, 123u8, - 173u8, 178u8, 102u8, 136u8, 6u8, - ], - ) - } - #[doc = " Execute the given block."] - pub fn execute_block( - &self, - block: types::execute_block::Block, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "Core", - "execute_block", - types::ExecuteBlock { block }, - [ - 133u8, 135u8, 228u8, 65u8, 106u8, 27u8, 85u8, 158u8, 112u8, 254u8, 93u8, 26u8, 102u8, - 201u8, 118u8, 216u8, 249u8, 247u8, 91u8, 74u8, 56u8, 208u8, 231u8, 115u8, 131u8, 29u8, - 209u8, 6u8, 65u8, 57u8, 214u8, 125u8, - ], - ) - } - #[doc = " Initialize a block with the given header."] - pub fn initialize_block( - &self, - header: types::initialize_block::Header, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "Core", - "initialize_block", - types::InitializeBlock { header }, - [ - 146u8, 138u8, 72u8, 240u8, 63u8, 96u8, 110u8, 189u8, 77u8, 92u8, 96u8, 232u8, 41u8, 217u8, - 105u8, 148u8, 83u8, 190u8, 152u8, 219u8, 19u8, 87u8, 163u8, 1u8, 232u8, 25u8, 221u8, 74u8, - 224u8, 67u8, 223u8, 34u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod version { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::sp_version::RuntimeVersion; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Version {} - pub mod execute_block { - use super::runtime_types; - pub type Block = runtime_types::sp_runtime::generic::block::Block< - runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>, - ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >, - >; - pub mod output { - use super::runtime_types; - pub type Output = (); - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ExecuteBlock { - pub block: execute_block::Block, - } - pub mod initialize_block { - use super::runtime_types; - pub type Header = runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; - pub mod output { - use super::runtime_types; - pub type Output = (); - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct InitializeBlock { - pub header: initialize_block::Header, - } - } - } - pub mod metadata { - use super::root_mod; - use super::runtime_types; - #[doc = " The `Metadata` api trait that returns metadata for the runtime."] - pub struct Metadata; - impl Metadata { - #[doc = " Returns the metadata of a runtime."] - pub fn metadata( - &self, - ) -> ::subxt::runtime_api::Payload { - ::subxt::runtime_api::Payload::new_static( - "Metadata", - "metadata", - types::Metadata {}, - [ - 231u8, 24u8, 67u8, 152u8, 23u8, 26u8, 188u8, 82u8, 229u8, 6u8, 185u8, 27u8, 175u8, 68u8, - 83u8, 122u8, 69u8, 89u8, 185u8, 74u8, 248u8, 87u8, 217u8, 124u8, 193u8, 252u8, 199u8, - 186u8, 196u8, 179u8, 179u8, 96u8, - ], - ) - } - #[doc = " Returns the metadata at a given version."] - #[doc = ""] - #[doc = " If the given `version` isn't supported, this will return `None`."] - #[doc = " Use [`Self::metadata_versions`] to find out about supported metadata version of the runtime."] - pub fn metadata_at_version( - &self, - version: types::metadata_at_version::Version, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "Metadata", - "metadata_at_version", - types::MetadataAtVersion { version }, - [ - 131u8, 53u8, 212u8, 234u8, 16u8, 25u8, 120u8, 252u8, 153u8, 153u8, 216u8, 28u8, 54u8, - 113u8, 52u8, 236u8, 146u8, 68u8, 142u8, 8u8, 10u8, 169u8, 131u8, 142u8, 204u8, 38u8, 48u8, - 108u8, 134u8, 86u8, 226u8, 61u8, - ], - ) - } - #[doc = " Returns the supported metadata versions."] - #[doc = ""] - #[doc = " This can be used to call `metadata_at_version`."] - pub fn metadata_versions( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "Metadata", - "metadata_versions", - types::MetadataVersions {}, - [ - 23u8, 144u8, 137u8, 91u8, 188u8, 39u8, 231u8, 208u8, 252u8, 218u8, 224u8, 176u8, 77u8, - 32u8, 130u8, 212u8, 223u8, 76u8, 100u8, 190u8, 82u8, 94u8, 190u8, 8u8, 82u8, 244u8, 225u8, - 179u8, 85u8, 176u8, 56u8, 16u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod metadata { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::sp_core::OpaqueMetadata; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Metadata {} - pub mod metadata_at_version { - use super::runtime_types; - pub type Version = ::core::primitive::u32; - pub mod output { - use super::runtime_types; - pub type Output = ::core::option::Option; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MetadataAtVersion { - pub version: metadata_at_version::Version, - } - pub mod metadata_versions { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec<::core::primitive::u32>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MetadataVersions {} - } - } - pub mod block_builder { - use super::root_mod; - use super::runtime_types; - #[doc = " The `BlockBuilder` api trait that provides the required functionality for building a block."] - pub struct BlockBuilder; - impl BlockBuilder { - #[doc = " Apply the given extrinsic."] - #[doc = ""] - #[doc = " Returns an inclusion outcome which specifies if this extrinsic is included in"] - #[doc = " this block or not."] - pub fn apply_extrinsic( - &self, - extrinsic: types::apply_extrinsic::Extrinsic, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "BlockBuilder", - "apply_extrinsic", - types::ApplyExtrinsic { extrinsic }, - [ - 72u8, 54u8, 139u8, 3u8, 118u8, 136u8, 65u8, 47u8, 6u8, 105u8, 125u8, 223u8, 160u8, 29u8, - 103u8, 74u8, 79u8, 149u8, 48u8, 90u8, 237u8, 2u8, 97u8, 201u8, 123u8, 34u8, 167u8, 37u8, - 187u8, 35u8, 176u8, 97u8, - ], - ) - } - #[doc = " Finish the current block."] - pub fn finalize_block( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "BlockBuilder", - "finalize_block", - types::FinalizeBlock {}, - [ - 244u8, 207u8, 24u8, 33u8, 13u8, 69u8, 9u8, 249u8, 145u8, 143u8, 122u8, 96u8, 197u8, 55u8, - 64u8, 111u8, 238u8, 224u8, 34u8, 201u8, 27u8, 146u8, 232u8, 99u8, 191u8, 30u8, 114u8, 16u8, - 32u8, 220u8, 58u8, 62u8, - ], - ) - } - #[doc = " Generate inherent extrinsics. The inherent data will vary from chain to chain."] - pub fn inherent_extrinsics( - &self, - inherent: types::inherent_extrinsics::Inherent, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "BlockBuilder", - "inherent_extrinsics", - types::InherentExtrinsics { inherent }, - [ - 254u8, 110u8, 245u8, 201u8, 250u8, 192u8, 27u8, 228u8, 151u8, 213u8, 166u8, 89u8, 94u8, - 81u8, 189u8, 234u8, 64u8, 18u8, 245u8, 80u8, 29u8, 18u8, 140u8, 129u8, 113u8, 236u8, 135u8, - 55u8, 79u8, 159u8, 175u8, 183u8, - ], - ) - } - #[doc = " Check that the inherents are valid. The inherent data will vary from chain to chain."] - pub fn check_inherents( - &self, - block: types::check_inherents::Block, - data: types::check_inherents::Data, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "BlockBuilder", - "check_inherents", - types::CheckInherents { block, data }, - [ - 153u8, 134u8, 1u8, 215u8, 139u8, 11u8, 53u8, 51u8, 210u8, 175u8, 197u8, 28u8, 38u8, 209u8, - 175u8, 247u8, 142u8, 157u8, 50u8, 151u8, 164u8, 191u8, 181u8, 118u8, 80u8, 97u8, 160u8, - 248u8, 110u8, 217u8, 181u8, 234u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod apply_extrinsic { - use super::runtime_types; - pub type Extrinsic = ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::core::result::Result<(), runtime_types::sp_runtime::DispatchError>, - runtime_types::sp_runtime::transaction_validity::TransactionValidityError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ApplyExtrinsic { - pub extrinsic: apply_extrinsic::Extrinsic, - } - pub mod finalize_block { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FinalizeBlock {} - pub mod inherent_extrinsics { - use super::runtime_types; - pub type Inherent = runtime_types::sp_inherents::InherentData; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec< - ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct InherentExtrinsics { - pub inherent: inherent_extrinsics::Inherent, - } - pub mod check_inherents { - use super::runtime_types; - pub type Block = runtime_types::sp_runtime::generic::block::Block< - runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>, - ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >, - >; - pub type Data = runtime_types::sp_inherents::InherentData; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::sp_inherents::CheckInherentsResult; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckInherents { - pub block: check_inherents::Block, - pub data: check_inherents::Data, - } - } - } - pub mod tagged_transaction_queue { - use super::root_mod; - use super::runtime_types; - #[doc = " The `TaggedTransactionQueue` api trait for interfering with the transaction queue."] - pub struct TaggedTransactionQueue; - impl TaggedTransactionQueue { - #[doc = " Validate the transaction."] - #[doc = ""] - #[doc = " This method is invoked by the transaction pool to learn details about given transaction."] - #[doc = " The implementation should make sure to verify the correctness of the transaction"] - #[doc = " against current state. The given `block_hash` corresponds to the hash of the block"] - #[doc = " that is used as current state."] - #[doc = ""] - #[doc = " Note that this call may be performed by the pool multiple times and transactions"] - #[doc = " might be verified in any possible order."] - pub fn validate_transaction( - &self, - source: types::validate_transaction::Source, - tx: types::validate_transaction::Tx, - block_hash: types::validate_transaction::BlockHash, - ) -> ::subxt::runtime_api::Payload< - types::ValidateTransaction, - types::validate_transaction::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "TaggedTransactionQueue", - "validate_transaction", - types::ValidateTransaction { source, tx, block_hash }, - [ - 196u8, 50u8, 90u8, 49u8, 109u8, 251u8, 200u8, 35u8, 23u8, 150u8, 140u8, 143u8, 232u8, - 164u8, 133u8, 89u8, 32u8, 240u8, 115u8, 39u8, 95u8, 70u8, 162u8, 76u8, 122u8, 73u8, 151u8, - 144u8, 234u8, 120u8, 100u8, 29u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod validate_transaction { - use super::runtime_types; - pub type Source = runtime_types::sp_runtime::transaction_validity::TransactionSource; - pub type Tx = ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >; - pub type BlockHash = ::subxt::utils::H256; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - runtime_types::sp_runtime::transaction_validity::ValidTransaction, - runtime_types::sp_runtime::transaction_validity::TransactionValidityError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ValidateTransaction { - pub source: validate_transaction::Source, - pub tx: validate_transaction::Tx, - pub block_hash: validate_transaction::BlockHash, - } - } - } - pub mod offchain_worker_api { - use super::root_mod; - use super::runtime_types; - #[doc = " The offchain worker api."] - pub struct OffchainWorkerApi; - impl OffchainWorkerApi { - #[doc = " Starts the off-chain task for given block header."] - pub fn offchain_worker( - &self, - header: types::offchain_worker::Header, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "OffchainWorkerApi", - "offchain_worker", - types::OffchainWorker { header }, - [ - 10u8, 135u8, 19u8, 153u8, 33u8, 216u8, 18u8, 242u8, 33u8, 140u8, 4u8, 223u8, 200u8, 130u8, - 103u8, 118u8, 137u8, 24u8, 19u8, 127u8, 161u8, 29u8, 184u8, 111u8, 222u8, 111u8, 253u8, - 73u8, 45u8, 31u8, 79u8, 60u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod offchain_worker { - use super::runtime_types; - pub type Header = runtime_types::sp_runtime::generic::header::Header<::core::primitive::u32>; - pub mod output { - use super::runtime_types; - pub type Output = (); - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct OffchainWorker { - pub header: offchain_worker::Header, - } - } - } - pub mod aura_api { - use super::root_mod; - use super::runtime_types; - #[doc = " API necessary for block authorship with aura."] - pub struct AuraApi; - impl AuraApi { - #[doc = " Returns the slot duration for Aura."] - #[doc = ""] - #[doc = " Currently, only the value provided by this type at genesis will be used."] - pub fn slot_duration( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "AuraApi", - "slot_duration", - types::SlotDuration {}, - [ - 233u8, 210u8, 132u8, 172u8, 100u8, 125u8, 239u8, 92u8, 114u8, 82u8, 7u8, 110u8, 179u8, - 196u8, 10u8, 19u8, 211u8, 15u8, 174u8, 2u8, 91u8, 73u8, 133u8, 100u8, 205u8, 201u8, 191u8, - 60u8, 163u8, 122u8, 215u8, 10u8, - ], - ) - } - #[doc = " Return the current set of authorities."] - pub fn authorities( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "AuraApi", - "authorities", - types::Authorities {}, - [ - 96u8, 136u8, 226u8, 244u8, 105u8, 189u8, 8u8, 250u8, 71u8, 230u8, 37u8, 123u8, 218u8, 47u8, - 179u8, 16u8, 170u8, 181u8, 165u8, 77u8, 102u8, 51u8, 43u8, 51u8, 186u8, 84u8, 49u8, 15u8, - 208u8, 226u8, 129u8, 230u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod slot_duration { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::sp_consensus_slots::SlotDuration; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SlotDuration {} - pub mod authorities { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = - ::std::vec::Vec; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Authorities {} - } - } - pub mod session_keys { - use super::root_mod; - use super::runtime_types; - #[doc = " Session keys runtime api."] - pub struct SessionKeys; - impl SessionKeys { - #[doc = " Generate a set of session keys with optionally using the given seed."] - #[doc = " The keys should be stored within the keystore exposed via runtime"] - #[doc = " externalities."] - #[doc = ""] - #[doc = " The seed needs to be a valid `utf8` string."] - #[doc = ""] - #[doc = " Returns the concatenated SCALE encoded public keys."] - pub fn generate_session_keys( - &self, - seed: types::generate_session_keys::Seed, - ) -> ::subxt::runtime_api::Payload< - types::GenerateSessionKeys, - types::generate_session_keys::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "SessionKeys", - "generate_session_keys", - types::GenerateSessionKeys { seed }, - [ - 96u8, 171u8, 164u8, 166u8, 175u8, 102u8, 101u8, 47u8, 133u8, 95u8, 102u8, 202u8, 83u8, - 26u8, 238u8, 47u8, 126u8, 132u8, 22u8, 11u8, 33u8, 190u8, 175u8, 94u8, 58u8, 245u8, 46u8, - 80u8, 195u8, 184u8, 107u8, 65u8, - ], - ) - } - #[doc = " Decode the given public session keys."] - #[doc = ""] - #[doc = " Returns the list of public raw public keys + key type."] - pub fn decode_session_keys( - &self, - encoded: types::decode_session_keys::Encoded, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "SessionKeys", - "decode_session_keys", - types::DecodeSessionKeys { encoded }, - [ - 57u8, 242u8, 18u8, 51u8, 132u8, 110u8, 238u8, 255u8, 39u8, 194u8, 8u8, 54u8, 198u8, 178u8, - 75u8, 151u8, 148u8, 176u8, 144u8, 197u8, 87u8, 29u8, 179u8, 235u8, 176u8, 78u8, 252u8, - 103u8, 72u8, 203u8, 151u8, 248u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod generate_session_keys { - use super::runtime_types; - pub type Seed = ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec<::core::primitive::u8>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GenerateSessionKeys { - pub seed: generate_session_keys::Seed, - } - pub mod decode_session_keys { - use super::runtime_types; - pub type Encoded = ::std::vec::Vec<::core::primitive::u8>; - pub mod output { - use super::runtime_types; - pub type Output = ::core::option::Option< - ::std::vec::Vec<( - ::std::vec::Vec<::core::primitive::u8>, - runtime_types::sp_core::crypto::KeyTypeId, - )>, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DecodeSessionKeys { - pub encoded: decode_session_keys::Encoded, - } - } - } - pub mod grandpa_api { - use super::root_mod; - use super::runtime_types; - #[doc = " APIs for integrating the GRANDPA finality gadget into runtimes."] - #[doc = " This should be implemented on the runtime side."] - #[doc = ""] - #[doc = " This is primarily used for negotiating authority-set changes for the"] - #[doc = " gadget. GRANDPA uses a signaling model of changing authority sets:"] - #[doc = " changes should be signaled with a delay of N blocks, and then automatically"] - #[doc = " applied in the runtime after those N blocks have passed."] - #[doc = ""] - #[doc = " The consensus protocol will coordinate the handoff externally."] - pub struct GrandpaApi; - impl GrandpaApi { - #[doc = " Get the current GRANDPA authorities and weights. This should not change except"] - #[doc = " for when changes are scheduled and the corresponding delay has passed."] - #[doc = ""] - #[doc = " When called at block B, it will return the set of authorities that should be"] - #[doc = " used to finalize descendants of this block (B+1, B+2, ...). The block B itself"] - #[doc = " is finalized by the authorities from block B-1."] - pub fn grandpa_authorities( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "GrandpaApi", - "grandpa_authorities", - types::GrandpaAuthorities {}, - [ - 166u8, 76u8, 160u8, 101u8, 242u8, 145u8, 213u8, 10u8, 16u8, 130u8, 230u8, 196u8, 125u8, - 152u8, 92u8, 143u8, 119u8, 223u8, 140u8, 189u8, 203u8, 95u8, 52u8, 105u8, 147u8, 107u8, - 135u8, 228u8, 62u8, 178u8, 128u8, 33u8, - ], - ) - } - #[doc = " Submits an unsigned extrinsic to report an equivocation. The caller"] - #[doc = " must provide the equivocation proof and a key ownership proof"] - #[doc = " (should be obtained using `generate_key_ownership_proof`). The"] - #[doc = " extrinsic will be unsigned and should only be accepted for local"] - #[doc = " authorship (not to be broadcast to the network). This method returns"] - #[doc = " `None` when creation of the extrinsic fails, e.g. if equivocation"] - #[doc = " reporting is disabled for the given runtime (i.e. this method is"] - #[doc = " hardcoded to return `None`). Only useful in an offchain context."] - pub fn submit_report_equivocation_unsigned_extrinsic( - &self, - equivocation_proof: types::submit_report_equivocation_unsigned_extrinsic::EquivocationProof, - key_owner_proof: types::submit_report_equivocation_unsigned_extrinsic::KeyOwnerProof, - ) -> ::subxt::runtime_api::Payload< - types::SubmitReportEquivocationUnsignedExtrinsic, - types::submit_report_equivocation_unsigned_extrinsic::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "GrandpaApi", - "submit_report_equivocation_unsigned_extrinsic", - types::SubmitReportEquivocationUnsignedExtrinsic { equivocation_proof, key_owner_proof }, - [ - 112u8, 94u8, 150u8, 250u8, 132u8, 127u8, 185u8, 24u8, 113u8, 62u8, 28u8, 171u8, 83u8, 9u8, - 41u8, 228u8, 92u8, 137u8, 29u8, 190u8, 214u8, 232u8, 100u8, 66u8, 100u8, 168u8, 149u8, - 122u8, 93u8, 17u8, 236u8, 104u8, - ], - ) - } - #[doc = " Generates a proof of key ownership for the given authority in the"] - #[doc = " given set. An example usage of this module is coupled with the"] - #[doc = " session historical module to prove that a given authority key is"] - #[doc = " tied to a given staking identity during a specific session. Proofs"] - #[doc = " of key ownership are necessary for submitting equivocation reports."] - #[doc = " NOTE: even though the API takes a `set_id` as parameter the current"] - #[doc = " implementations ignore this parameter and instead rely on this"] - #[doc = " method being called at the correct block height, i.e. any point at"] - #[doc = " which the given set id is live on-chain. Future implementations will"] - #[doc = " instead use indexed data through an offchain worker, not requiring"] - #[doc = " older states to be available."] - pub fn generate_key_ownership_proof( - &self, - set_id: types::generate_key_ownership_proof::SetId, - authority_id: types::generate_key_ownership_proof::AuthorityId, - ) -> ::subxt::runtime_api::Payload< - types::GenerateKeyOwnershipProof, - types::generate_key_ownership_proof::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "GrandpaApi", - "generate_key_ownership_proof", - types::GenerateKeyOwnershipProof { set_id, authority_id }, - [ - 40u8, 126u8, 113u8, 27u8, 245u8, 45u8, 123u8, 138u8, 12u8, 3u8, 125u8, 186u8, 151u8, 53u8, - 186u8, 93u8, 13u8, 150u8, 163u8, 176u8, 206u8, 89u8, 244u8, 127u8, 182u8, 85u8, 203u8, - 41u8, 101u8, 183u8, 209u8, 179u8, - ], - ) - } - #[doc = " Get current GRANDPA authority set id."] - pub fn current_set_id( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "GrandpaApi", - "current_set_id", - types::CurrentSetId {}, - [ - 42u8, 230u8, 120u8, 211u8, 156u8, 245u8, 109u8, 86u8, 100u8, 146u8, 234u8, 205u8, 41u8, - 183u8, 109u8, 42u8, 17u8, 33u8, 156u8, 25u8, 139u8, 84u8, 101u8, 75u8, 232u8, 198u8, 87u8, - 136u8, 218u8, 233u8, 103u8, 156u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod grandpa_authorities { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = - ::std::vec::Vec<(runtime_types::sp_consensus_grandpa::app::Public, ::core::primitive::u64)>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GrandpaAuthorities {} - pub mod submit_report_equivocation_unsigned_extrinsic { - use super::runtime_types; - pub type EquivocationProof = runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::utils::H256, - ::core::primitive::u32, - >; - pub type KeyOwnerProof = runtime_types::sp_consensus_grandpa::OpaqueKeyOwnershipProof; - pub mod output { - use super::runtime_types; - pub type Output = ::core::option::Option<()>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SubmitReportEquivocationUnsignedExtrinsic { - pub equivocation_proof: submit_report_equivocation_unsigned_extrinsic::EquivocationProof, - pub key_owner_proof: submit_report_equivocation_unsigned_extrinsic::KeyOwnerProof, - } - pub mod generate_key_ownership_proof { - use super::runtime_types; - pub type SetId = ::core::primitive::u64; - pub type AuthorityId = runtime_types::sp_consensus_grandpa::app::Public; - pub mod output { - use super::runtime_types; - pub type Output = - ::core::option::Option; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GenerateKeyOwnershipProof { - pub set_id: generate_key_ownership_proof::SetId, - pub authority_id: generate_key_ownership_proof::AuthorityId, - } - pub mod current_set_id { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = ::core::primitive::u64; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CurrentSetId {} - } - } - pub mod account_nonce_api { - use super::root_mod; - use super::runtime_types; - #[doc = " The API to query account nonce."] - pub struct AccountNonceApi; - impl AccountNonceApi { - #[doc = " Get current account nonce of given `AccountId`."] - pub fn account_nonce( - &self, - account: types::account_nonce::Account, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "AccountNonceApi", - "account_nonce", - types::AccountNonce { account }, - [ - 231u8, 82u8, 7u8, 227u8, 131u8, 2u8, 215u8, 252u8, 173u8, 82u8, 11u8, 103u8, 200u8, 25u8, - 114u8, 116u8, 79u8, 229u8, 152u8, 150u8, 236u8, 37u8, 101u8, 26u8, 220u8, 146u8, 182u8, - 101u8, 73u8, 55u8, 191u8, 171u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod account_nonce { - use super::runtime_types; - pub type Account = ::subxt::utils::AccountId32; - pub mod output { - use super::runtime_types; - pub type Output = ::core::primitive::u32; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AccountNonce { - pub account: account_nonce::Account, - } - } - } - pub mod starknet_runtime_api { - use super::root_mod; - use super::runtime_types; - pub struct StarknetRuntimeApi; - impl StarknetRuntimeApi { - #[doc = " Returns the nonce associated with the given address in the given block"] - pub fn nonce( - &self, - contract_address: types::nonce::ContractAddress, - ) -> ::subxt::runtime_api::Payload { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "nonce", - types::Nonce { contract_address }, - [ - 223u8, 78u8, 98u8, 162u8, 110u8, 80u8, 134u8, 64u8, 16u8, 48u8, 174u8, 206u8, 222u8, 135u8, - 239u8, 38u8, 46u8, 199u8, 130u8, 229u8, 239u8, 236u8, 210u8, 57u8, 184u8, 219u8, 75u8, 1u8, - 161u8, 76u8, 171u8, 90u8, - ], - ) - } - #[doc = " Returns a storage slot value"] - pub fn get_storage_at( - &self, - address: types::get_storage_at::Address, - key: types::get_storage_at::Key, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_storage_at", - types::GetStorageAt { address, key }, - [ - 218u8, 70u8, 23u8, 117u8, 134u8, 149u8, 149u8, 52u8, 107u8, 184u8, 92u8, 60u8, 234u8, 81u8, - 62u8, 254u8, 176u8, 3u8, 72u8, 252u8, 234u8, 226u8, 113u8, 3u8, 238u8, 139u8, 216u8, 182u8, - 56u8, 200u8, 225u8, 44u8, - ], - ) - } - #[doc = " Returns a `Call` response."] - pub fn call( - &self, - address: types::call::Address, - function_selector: types::call::FunctionSelector, - calldata: types::call::Calldata, - ) -> ::subxt::runtime_api::Payload { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "call", - types::Call { address, function_selector, calldata }, - [ - 243u8, 171u8, 64u8, 174u8, 161u8, 137u8, 230u8, 19u8, 218u8, 58u8, 240u8, 15u8, 226u8, - 41u8, 176u8, 172u8, 67u8, 234u8, 184u8, 21u8, 84u8, 198u8, 196u8, 55u8, 240u8, 128u8, - 163u8, 75u8, 84u8, 235u8, 250u8, 249u8, - ], - ) - } - #[doc = " Returns the contract class hash at the given address."] - pub fn contract_class_hash_by_address( - &self, - address: types::contract_class_hash_by_address::Address, - ) -> ::subxt::runtime_api::Payload< - types::ContractClassHashByAddress, - types::contract_class_hash_by_address::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "contract_class_hash_by_address", - types::ContractClassHashByAddress { address }, - [ - 10u8, 25u8, 149u8, 78u8, 109u8, 81u8, 246u8, 45u8, 195u8, 195u8, 151u8, 125u8, 46u8, 227u8, - 76u8, 43u8, 162u8, 103u8, 196u8, 137u8, 68u8, 10u8, 21u8, 70u8, 150u8, 244u8, 56u8, 61u8, - 195u8, 204u8, 14u8, 20u8, - ], - ) - } - #[doc = " Returns the contract class for the given class hash."] - pub fn contract_class_by_class_hash( - &self, - class_hash: types::contract_class_by_class_hash::ClassHash, - ) -> ::subxt::runtime_api::Payload< - types::ContractClassByClassHash, - types::contract_class_by_class_hash::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "contract_class_by_class_hash", - types::ContractClassByClassHash { class_hash }, - [ - 101u8, 25u8, 72u8, 124u8, 184u8, 103u8, 59u8, 96u8, 180u8, 149u8, 213u8, 146u8, 67u8, - 254u8, 43u8, 202u8, 71u8, 159u8, 249u8, 32u8, 59u8, 251u8, 35u8, 190u8, 128u8, 234u8, 61u8, - 248u8, 181u8, 29u8, 126u8, 251u8, - ], - ) - } - #[doc = " Returns the chain id."] - pub fn chain_id( - &self, - ) -> ::subxt::runtime_api::Payload { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "chain_id", - types::ChainId {}, - [ - 40u8, 205u8, 232u8, 235u8, 194u8, 248u8, 230u8, 70u8, 133u8, 162u8, 103u8, 163u8, 134u8, - 9u8, 208u8, 149u8, 122u8, 242u8, 92u8, 98u8, 67u8, 7u8, 67u8, 223u8, 132u8, 110u8, 186u8, - 220u8, 40u8, 179u8, 48u8, 91u8, - ], - ) - } - #[doc = " Returns the Starknet OS Cairo program hash."] - pub fn program_hash( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "program_hash", - types::ProgramHash {}, - [ - 172u8, 109u8, 196u8, 182u8, 116u8, 64u8, 49u8, 225u8, 138u8, 12u8, 135u8, 200u8, 217u8, - 136u8, 64u8, 130u8, 0u8, 209u8, 221u8, 190u8, 9u8, 2u8, 143u8, 54u8, 84u8, 210u8, 195u8, - 255u8, 110u8, 218u8, 216u8, 164u8, - ], - ) - } - #[doc = " Returns the Starknet config hash."] - pub fn config_hash( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "config_hash", - types::ConfigHash {}, - [ - 106u8, 73u8, 154u8, 190u8, 90u8, 106u8, 65u8, 70u8, 120u8, 248u8, 104u8, 75u8, 148u8, - 184u8, 129u8, 205u8, 252u8, 31u8, 150u8, 31u8, 73u8, 164u8, 12u8, 251u8, 38u8, 116u8, - 153u8, 79u8, 147u8, 193u8, 149u8, 0u8, - ], - ) - } - #[doc = " Returns the fee token address."] - pub fn fee_token_address( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "fee_token_address", - types::FeeTokenAddress {}, - [ - 31u8, 130u8, 101u8, 106u8, 209u8, 212u8, 137u8, 207u8, 58u8, 18u8, 142u8, 195u8, 120u8, - 208u8, 132u8, 228u8, 147u8, 115u8, 234u8, 25u8, 202u8, 254u8, 96u8, 39u8, 197u8, 144u8, - 42u8, 92u8, 172u8, 82u8, 201u8, 204u8, - ], - ) - } - #[doc = " Returns fee estimate"] - pub fn estimate_fee( - &self, - transactions: types::estimate_fee::Transactions, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "estimate_fee", - types::EstimateFee { transactions }, - [ - 184u8, 182u8, 60u8, 242u8, 255u8, 251u8, 46u8, 30u8, 204u8, 104u8, 57u8, 131u8, 38u8, 50u8, - 84u8, 156u8, 164u8, 26u8, 206u8, 149u8, 40u8, 170u8, 255u8, 7u8, 45u8, 93u8, 195u8, 64u8, - 17u8, 8u8, 222u8, 14u8, - ], - ) - } - #[doc = " Returns message fee estimate"] - pub fn estimate_message_fee( - &self, - message: types::estimate_message_fee::Message, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "estimate_message_fee", - types::EstimateMessageFee { message }, - [ - 109u8, 56u8, 101u8, 23u8, 94u8, 130u8, 118u8, 178u8, 136u8, 17u8, 122u8, 98u8, 86u8, 171u8, - 19u8, 88u8, 130u8, 255u8, 208u8, 116u8, 99u8, 35u8, 201u8, 33u8, 226u8, 0u8, 66u8, 130u8, - 74u8, 197u8, 253u8, 17u8, - ], - ) - } - #[doc = " Simulates single L1 Message and returns its trace"] - pub fn simulate_message( - &self, - message: types::simulate_message::Message, - simulation_flags: types::simulate_message::SimulationFlags, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "simulate_message", - types::SimulateMessage { message, simulation_flags }, - [ - 229u8, 57u8, 24u8, 201u8, 169u8, 96u8, 194u8, 117u8, 191u8, 75u8, 255u8, 98u8, 206u8, - 115u8, 39u8, 119u8, 25u8, 230u8, 146u8, 3u8, 93u8, 78u8, 38u8, 166u8, 255u8, 72u8, 163u8, - 33u8, 175u8, 71u8, 109u8, 116u8, - ], - ) - } - #[doc = " Simulates transactions and returns their trace"] - pub fn simulate_transactions( - &self, - transactions: types::simulate_transactions::Transactions, - simulation_flags: types::simulate_transactions::SimulationFlags, - ) -> ::subxt::runtime_api::Payload< - types::SimulateTransactions, - types::simulate_transactions::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "simulate_transactions", - types::SimulateTransactions { transactions, simulation_flags }, - [ - 188u8, 223u8, 156u8, 234u8, 56u8, 98u8, 85u8, 252u8, 78u8, 252u8, 164u8, 181u8, 16u8, 73u8, - 49u8, 103u8, 174u8, 45u8, 168u8, 68u8, 172u8, 38u8, 216u8, 167u8, 239u8, 201u8, 18u8, - 105u8, 242u8, 122u8, 227u8, 190u8, - ], - ) - } - #[doc = " Filters extrinsic transactions to return only Starknet transactions"] - #[doc = ""] - #[doc = " To support runtime upgrades, the client must be unaware of the specific extrinsic"] - #[doc = " details. To achieve this, the client uses an OpaqueExtrinsic type to represent and"] - #[doc = " manipulate extrinsics. However, the client cannot decode and filter extrinsics due to"] - #[doc = " this limitation. The solution is to offload decoding and filtering to the RuntimeApi in"] - #[doc = " the runtime itself, accomplished through the extrinsic_filter method. This enables the"] - #[doc = " client to operate seamlessly while abstracting the extrinsic complexity."] - pub fn extrinsic_filter( - &self, - xts: types::extrinsic_filter::Xts, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "extrinsic_filter", - types::ExtrinsicFilter { xts }, - [ - 174u8, 71u8, 247u8, 222u8, 153u8, 41u8, 101u8, 40u8, 89u8, 39u8, 48u8, 240u8, 136u8, 23u8, - 195u8, 201u8, 117u8, 235u8, 71u8, 30u8, 231u8, 151u8, 74u8, 224u8, 180u8, 205u8, 115u8, - 110u8, 203u8, 95u8, 138u8, 157u8, - ], - ) - } - #[doc = " Re-execute a block and return the TransactionExecutionInfos of every transaction in it, in the same order"] - pub fn re_execute_transactions( - &self, - transactions: types::re_execute_transactions::Transactions, - ) -> ::subxt::runtime_api::Payload< - types::ReExecuteTransactions, - types::re_execute_transactions::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "re_execute_transactions", - types::ReExecuteTransactions { transactions }, - [ - 162u8, 224u8, 209u8, 166u8, 12u8, 75u8, 210u8, 149u8, 129u8, 76u8, 32u8, 42u8, 152u8, 97u8, - 215u8, 135u8, 68u8, 92u8, 224u8, 141u8, 124u8, 175u8, 69u8, 116u8, 193u8, 49u8, 207u8, - 216u8, 168u8, 235u8, 17u8, 252u8, - ], - ) - } - pub fn get_index_and_tx_for_tx_hash( - &self, - xts: types::get_index_and_tx_for_tx_hash::Xts, - chain_id: types::get_index_and_tx_for_tx_hash::ChainId, - tx_hash: types::get_index_and_tx_for_tx_hash::TxHash, - ) -> ::subxt::runtime_api::Payload< - types::GetIndexAndTxForTxHash, - types::get_index_and_tx_for_tx_hash::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_index_and_tx_for_tx_hash", - types::GetIndexAndTxForTxHash { xts, chain_id, tx_hash }, - [ - 230u8, 69u8, 155u8, 160u8, 153u8, 166u8, 187u8, 237u8, 45u8, 101u8, 245u8, 24u8, 182u8, - 192u8, 118u8, 68u8, 46u8, 103u8, 243u8, 155u8, 243u8, 252u8, 168u8, 34u8, 245u8, 242u8, - 89u8, 4u8, 223u8, 150u8, 157u8, 155u8, - ], - ) - } - pub fn get_events_for_tx_by_hash( - &self, - tx_hash: types::get_events_for_tx_by_hash::TxHash, - ) -> ::subxt::runtime_api::Payload< - types::GetEventsForTxByHash, - types::get_events_for_tx_by_hash::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_events_for_tx_by_hash", - types::GetEventsForTxByHash { tx_hash }, - [ - 9u8, 218u8, 79u8, 180u8, 233u8, 108u8, 107u8, 4u8, 15u8, 241u8, 8u8, 29u8, 187u8, 119u8, - 92u8, 216u8, 95u8, 87u8, 115u8, 119u8, 234u8, 62u8, 227u8, 244u8, 20u8, 111u8, 17u8, 87u8, - 125u8, 152u8, 80u8, 232u8, - ], - ) - } - #[doc = " Return the outcome of the tx execution"] - pub fn get_tx_execution_outcome( - &self, - tx_hash: types::get_tx_execution_outcome::TxHash, - ) -> ::subxt::runtime_api::Payload< - types::GetTxExecutionOutcome, - types::get_tx_execution_outcome::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_tx_execution_outcome", - types::GetTxExecutionOutcome { tx_hash }, - [ - 177u8, 94u8, 132u8, 75u8, 36u8, 225u8, 133u8, 68u8, 20u8, 144u8, 67u8, 79u8, 105u8, 190u8, - 8u8, 234u8, 206u8, 112u8, 196u8, 133u8, 99u8, 175u8, 132u8, 113u8, 121u8, 7u8, 75u8, 9u8, - 60u8, 96u8, 104u8, 64u8, - ], - ) - } - #[doc = " Return the block context"] - pub fn get_block_context( - &self, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_block_context", - types::GetBlockContext {}, - [ - 93u8, 141u8, 157u8, 168u8, 2u8, 15u8, 159u8, 49u8, 184u8, 176u8, 84u8, 196u8, 14u8, 245u8, - 235u8, 121u8, 161u8, 89u8, 190u8, 195u8, 159u8, 128u8, 252u8, 231u8, 247u8, 142u8, 76u8, - 182u8, 185u8, 130u8, 164u8, 115u8, - ], - ) - } - #[doc = " Return is fee disabled in state"] - pub fn is_transaction_fee_disabled( - &self, - ) -> ::subxt::runtime_api::Payload< - types::IsTransactionFeeDisabled, - types::is_transaction_fee_disabled::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "is_transaction_fee_disabled", - types::IsTransactionFeeDisabled {}, - [ - 248u8, 144u8, 121u8, 219u8, 115u8, 71u8, 41u8, 92u8, 164u8, 48u8, 110u8, 95u8, 31u8, 84u8, - 38u8, 154u8, 47u8, 181u8, 115u8, 76u8, 138u8, 127u8, 209u8, 87u8, 70u8, 45u8, 237u8, 212u8, - 250u8, 118u8, 164u8, 60u8, - ], - ) - } - #[doc = " Return messages sent to L1 during tx execution"] - pub fn get_tx_messages_to_l1( - &self, - tx_hash: types::get_tx_messages_to_l1::TxHash, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "get_tx_messages_to_l1", - types::GetTxMessagesToL1 { tx_hash }, - [ - 117u8, 201u8, 150u8, 193u8, 49u8, 219u8, 210u8, 46u8, 10u8, 186u8, 195u8, 124u8, 137u8, - 73u8, 127u8, 83u8, 120u8, 28u8, 61u8, 149u8, 195u8, 209u8, 193u8, 183u8, 63u8, 61u8, 104u8, - 135u8, 236u8, 99u8, 104u8, 190u8, - ], - ) - } - #[doc = " Check if L1 Message Nonce has not been used"] - pub fn l1_nonce_unused( - &self, - nonce: types::l1_nonce_unused::Nonce, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "StarknetRuntimeApi", - "l1_nonce_unused", - types::L1NonceUnused { nonce }, - [ - 210u8, 236u8, 76u8, 166u8, 82u8, 158u8, 90u8, 74u8, 152u8, 155u8, 167u8, 49u8, 230u8, 42u8, - 155u8, 111u8, 168u8, 113u8, 135u8, 163u8, 139u8, 93u8, 179u8, 212u8, 169u8, 175u8, 53u8, - 65u8, 142u8, 138u8, 146u8, 232u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod nonce { - use super::runtime_types; - pub type ContractAddress = runtime_types::starknet_api::api_core::ContractAddress; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::starknet_api::api_core::Nonce; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Nonce { - pub contract_address: nonce::ContractAddress, - } - pub mod get_storage_at { - use super::runtime_types; - pub type Address = runtime_types::starknet_api::api_core::ContractAddress; - pub type Key = runtime_types::starknet_api::state::StorageKey; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - runtime_types::starknet_api::hash::StarkFelt, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetStorageAt { - pub address: get_storage_at::Address, - pub key: get_storage_at::Key, - } - pub mod call { - use super::runtime_types; - pub type Address = runtime_types::starknet_api::api_core::ContractAddress; - pub type FunctionSelector = runtime_types::starknet_api::api_core::EntryPointSelector; - pub type Calldata = runtime_types::starknet_api::transaction::Calldata; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::std::vec::Vec, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Call { - pub address: call::Address, - pub function_selector: call::FunctionSelector, - pub calldata: call::Calldata, - } - pub mod contract_class_hash_by_address { - use super::runtime_types; - pub type Address = runtime_types::starknet_api::api_core::ContractAddress; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::starknet_api::api_core::ClassHash; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassHashByAddress { - pub address: contract_class_hash_by_address::Address, - } - pub mod contract_class_by_class_hash { - use super::runtime_types; - pub type ClassHash = runtime_types::starknet_api::api_core::ClassHash; - pub mod output { - use super::runtime_types; - pub type Output = - ::core::option::Option; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassByClassHash { - pub class_hash: contract_class_by_class_hash::ClassHash, - } - pub mod chain_id { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::mp_felt::Felt252Wrapper; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ChainId {} - pub mod program_hash { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::mp_felt::Felt252Wrapper; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ProgramHash {} - pub mod config_hash { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::starknet_api::hash::StarkFelt; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ConfigHash {} - pub mod fee_token_address { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::starknet_api::api_core::ContractAddress; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FeeTokenAddress {} - pub mod estimate_fee { - use super::runtime_types; - pub type Transactions = ::std::vec::Vec; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::std::vec::Vec<(::core::primitive::u64, ::core::primitive::u64)>, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EstimateFee { - pub transactions: estimate_fee::Transactions, - } - pub mod estimate_message_fee { - use super::runtime_types; - pub type Message = runtime_types::mp_transactions::HandleL1MessageTransaction; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - (::core::primitive::u128, ::core::primitive::u64, ::core::primitive::u64), - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EstimateMessageFee { - pub message: estimate_message_fee::Message, - } - pub mod simulate_message { - use super::runtime_types; - pub type Message = runtime_types::mp_transactions::HandleL1MessageTransaction; - pub type SimulationFlags = runtime_types::mp_simulations::SimulationFlags; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::core::result::Result< - runtime_types::blockifier::transaction::objects::TransactionExecutionInfo, - runtime_types::mp_simulations::PlaceHolderErrorTypeForFailedStarknetExecution, - >, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SimulateMessage { - pub message: simulate_message::Message, - pub simulation_flags: simulate_message::SimulationFlags, - } - pub mod simulate_transactions { - use super::runtime_types; - pub type Transactions = ::std::vec::Vec; - pub type SimulationFlags = runtime_types::mp_simulations::SimulationFlags; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::std::vec::Vec<( - runtime_types::blockifier::state::cached_state::CommitmentStateDiff, - ::core::result::Result< - runtime_types::blockifier::transaction::objects::TransactionExecutionInfo, - runtime_types::mp_simulations::PlaceHolderErrorTypeForFailedStarknetExecution, - >, - )>, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SimulateTransactions { - pub transactions: simulate_transactions::Transactions, - pub simulation_flags: simulate_transactions::SimulationFlags, - } - pub mod extrinsic_filter { - use super::runtime_types; - pub type Xts = ::std::vec::Vec< - ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >, - >; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ExtrinsicFilter { - pub xts: extrinsic_filter::Xts, - } - pub mod re_execute_transactions { - use super::runtime_types; - pub type Transactions = ::std::vec::Vec; - pub mod output { - use super::runtime_types; - pub type Output = ::core::result::Result< - ::core::result::Result< - ::std::vec::Vec<( - runtime_types::blockifier::transaction::objects::TransactionExecutionInfo, - runtime_types::blockifier::state::cached_state::CommitmentStateDiff, - )>, - runtime_types::mp_simulations::PlaceHolderErrorTypeForFailedStarknetExecution, - >, - runtime_types::sp_runtime::DispatchError, - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ReExecuteTransactions { - pub transactions: re_execute_transactions::Transactions, - } - pub mod get_index_and_tx_for_tx_hash { - use super::runtime_types; - pub type Xts = ::std::vec::Vec< - ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >, - >; - pub type ChainId = runtime_types::mp_felt::Felt252Wrapper; - pub type TxHash = runtime_types::mp_felt::Felt252Wrapper; - pub mod output { - use super::runtime_types; - pub type Output = ::core::option::Option<( - ::core::primitive::u32, - runtime_types::mp_transactions::Transaction, - )>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetIndexAndTxForTxHash { - pub xts: get_index_and_tx_for_tx_hash::Xts, - pub chain_id: get_index_and_tx_for_tx_hash::ChainId, - pub tx_hash: get_index_and_tx_for_tx_hash::TxHash, - } - pub mod get_events_for_tx_by_hash { - use super::runtime_types; - pub type TxHash = runtime_types::starknet_api::transaction::TransactionHash; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetEventsForTxByHash { - pub tx_hash: get_events_for_tx_by_hash::TxHash, - } - pub mod get_tx_execution_outcome { - use super::runtime_types; - pub type TxHash = runtime_types::starknet_api::transaction::TransactionHash; - pub mod output { - use super::runtime_types; - pub type Output = ::core::option::Option<::std::vec::Vec<::core::primitive::u8>>; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetTxExecutionOutcome { - pub tx_hash: get_tx_execution_outcome::TxHash, - } - pub mod get_block_context { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::pallet_starknet_runtime_api::BlockContext; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetBlockContext {} - pub mod is_transaction_fee_disabled { - use super::runtime_types; - pub mod output { - use super::runtime_types; - pub type Output = ::core::primitive::bool; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct IsTransactionFeeDisabled {} - pub mod get_tx_messages_to_l1 { - use super::runtime_types; - pub type TxHash = runtime_types::starknet_api::transaction::TransactionHash; - pub mod output { - use super::runtime_types; - pub type Output = ::std::vec::Vec; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct GetTxMessagesToL1 { - pub tx_hash: get_tx_messages_to_l1::TxHash, - } - pub mod l1_nonce_unused { - use super::runtime_types; - pub type Nonce = runtime_types::starknet_api::api_core::Nonce; - pub mod output { - use super::runtime_types; - pub type Output = ::core::primitive::bool; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct L1NonceUnused { - pub nonce: l1_nonce_unused::Nonce, - } - } - } - pub mod convert_transaction_runtime_api { - use super::root_mod; - use super::runtime_types; - pub struct ConvertTransactionRuntimeApi; - impl ConvertTransactionRuntimeApi { - #[doc = " Converts the transaction to an UncheckedExtrinsic for submission to the pool."] - pub fn convert_transaction( - &self, - transaction: types::convert_transaction::Transaction, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "ConvertTransactionRuntimeApi", - "convert_transaction", - types::ConvertTransaction { transaction }, - [ - 2u8, 28u8, 195u8, 173u8, 73u8, 16u8, 65u8, 48u8, 228u8, 175u8, 103u8, 175u8, 208u8, 146u8, - 110u8, 70u8, 70u8, 124u8, 194u8, 14u8, 172u8, 153u8, 223u8, 148u8, 224u8, 104u8, 185u8, - 128u8, 129u8, 12u8, 21u8, 136u8, - ], - ) - } - #[doc = " Converts the L1 Message transaction to an UncheckedExtrinsic for submission to the pool."] - pub fn convert_l1_transaction( - &self, - transaction: types::convert_l1_transaction::Transaction, - fee: types::convert_l1_transaction::Fee, - ) -> ::subxt::runtime_api::Payload< - types::ConvertL1Transaction, - types::convert_l1_transaction::output::Output, - > { - ::subxt::runtime_api::Payload::new_static( - "ConvertTransactionRuntimeApi", - "convert_l1_transaction", - types::ConvertL1Transaction { transaction, fee }, - [ - 144u8, 54u8, 178u8, 219u8, 51u8, 230u8, 156u8, 233u8, 63u8, 216u8, 248u8, 105u8, 227u8, - 232u8, 201u8, 53u8, 243u8, 182u8, 84u8, 171u8, 249u8, 140u8, 79u8, 70u8, 95u8, 25u8, 196u8, - 10u8, 127u8, 75u8, 83u8, 65u8, - ], - ) - } - #[doc = " Converts the DispatchError to an understandable error for the client"] - pub fn convert_error( - &self, - error: types::convert_error::Error, - ) -> ::subxt::runtime_api::Payload - { - ::subxt::runtime_api::Payload::new_static( - "ConvertTransactionRuntimeApi", - "convert_error", - types::ConvertError { error }, - [ - 99u8, 109u8, 225u8, 103u8, 141u8, 72u8, 147u8, 132u8, 251u8, 176u8, 127u8, 246u8, 28u8, - 171u8, 244u8, 204u8, 159u8, 42u8, 215u8, 195u8, 88u8, 246u8, 173u8, 193u8, 46u8, 170u8, - 188u8, 147u8, 113u8, 158u8, 243u8, 203u8, - ], - ) - } - } - pub mod types { - use super::runtime_types; - pub mod convert_transaction { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::UserTransaction; - pub mod output { - use super::runtime_types; - pub type Output = ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ConvertTransaction { - pub transaction: convert_transaction::Transaction, - } - pub mod convert_l1_transaction { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::HandleL1MessageTransaction; - pub type Fee = runtime_types::starknet_api::transaction::Fee; - pub mod output { - use super::runtime_types; - pub type Output = ::subxt::utils::UncheckedExtrinsic< - ::subxt::utils::MultiAddress<::subxt::utils::AccountId32, ()>, - runtime_types::madara_runtime::RuntimeCall, - runtime_types::sp_runtime::MultiSignature, - ( - runtime_types::frame_system::extensions::check_non_zero_sender::CheckNonZeroSender, - runtime_types::frame_system::extensions::check_spec_version::CheckSpecVersion, - runtime_types::frame_system::extensions::check_tx_version::CheckTxVersion, - runtime_types::frame_system::extensions::check_genesis::CheckGenesis, - runtime_types::frame_system::extensions::check_mortality::CheckMortality, - runtime_types::frame_system::extensions::check_nonce::CheckNonce, - runtime_types::frame_system::extensions::check_weight::CheckWeight, - ), - >; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ConvertL1Transaction { - pub transaction: convert_l1_transaction::Transaction, - pub fee: convert_l1_transaction::Fee, - } - pub mod convert_error { - use super::runtime_types; - pub type Error = runtime_types::sp_runtime::DispatchError; - pub mod output { - use super::runtime_types; - pub type Output = runtime_types::pallet_starknet_runtime_api::StarknetTransactionExecutionError; - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ConvertError { - pub error: convert_error::Error, - } - } - } - } - pub fn custom() -> CustomValuesApi { - CustomValuesApi - } - pub struct CustomValuesApi; - impl CustomValuesApi {} - pub struct ConstantsApi; - impl ConstantsApi { - pub fn system(&self) -> system::constants::ConstantsApi { - system::constants::ConstantsApi - } - pub fn timestamp(&self) -> timestamp::constants::ConstantsApi { - timestamp::constants::ConstantsApi - } - pub fn grandpa(&self) -> grandpa::constants::ConstantsApi { - grandpa::constants::ConstantsApi - } - pub fn starknet(&self) -> starknet::constants::ConstantsApi { - starknet::constants::ConstantsApi - } - pub fn autonomous(&self) -> autonomous::constants::ConstantsApi { - autonomous::constants::ConstantsApi - } - } - pub struct StorageApi; - impl StorageApi { - pub fn system(&self) -> system::storage::StorageApi { - system::storage::StorageApi - } - pub fn timestamp(&self) -> timestamp::storage::StorageApi { - timestamp::storage::StorageApi - } - pub fn aura(&self) -> aura::storage::StorageApi { - aura::storage::StorageApi - } - pub fn grandpa(&self) -> grandpa::storage::StorageApi { - grandpa::storage::StorageApi - } - pub fn starknet(&self) -> starknet::storage::StorageApi { - starknet::storage::StorageApi - } - pub fn autonomous(&self) -> autonomous::storage::StorageApi { - autonomous::storage::StorageApi - } - } - pub struct TransactionApi; - impl TransactionApi { - pub fn system(&self) -> system::calls::TransactionApi { - system::calls::TransactionApi - } - pub fn timestamp(&self) -> timestamp::calls::TransactionApi { - timestamp::calls::TransactionApi - } - pub fn grandpa(&self) -> grandpa::calls::TransactionApi { - grandpa::calls::TransactionApi - } - pub fn starknet(&self) -> starknet::calls::TransactionApi { - starknet::calls::TransactionApi - } - pub fn autonomous(&self) -> autonomous::calls::TransactionApi { - autonomous::calls::TransactionApi - } - } - #[doc = r" check whether the metadata provided is aligned with this statically generated code."] - pub fn is_codegen_valid_for(metadata: &::subxt::Metadata) -> bool { - let runtime_metadata_hash = - metadata.hasher().only_these_pallets(&PALLETS).only_these_runtime_apis(&RUNTIME_APIS).hash(); - runtime_metadata_hash - == [ - 117u8, 185u8, 174u8, 237u8, 196u8, 139u8, 66u8, 59u8, 25u8, 86u8, 75u8, 39u8, 46u8, 226u8, 30u8, 205u8, - 54u8, 201u8, 140u8, 156u8, 175u8, 241u8, 134u8, 233u8, 233u8, 215u8, 159u8, 145u8, 119u8, 176u8, 38u8, - 59u8, - ] - } - pub mod system { - use super::root_mod; - use super::runtime_types; - #[doc = "Error for the System pallet"] - pub type Error = runtime_types::frame_system::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::frame_system::pallet::Call; - pub mod calls { - use super::root_mod; - use super::runtime_types; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::remark`]."] - pub struct Remark { - pub remark: remark::Remark, - } - pub mod remark { - use super::runtime_types; - pub type Remark = ::std::vec::Vec<::core::primitive::u8>; - } - impl ::subxt::blocks::StaticExtrinsic for Remark { - const PALLET: &'static str = "System"; - const CALL: &'static str = "remark"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set_heap_pages`]."] - pub struct SetHeapPages { - pub pages: set_heap_pages::Pages, - } - pub mod set_heap_pages { - use super::runtime_types; - pub type Pages = ::core::primitive::u64; - } - impl ::subxt::blocks::StaticExtrinsic for SetHeapPages { - const PALLET: &'static str = "System"; - const CALL: &'static str = "set_heap_pages"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set_code`]."] - pub struct SetCode { - pub code: set_code::Code, - } - pub mod set_code { - use super::runtime_types; - pub type Code = ::std::vec::Vec<::core::primitive::u8>; - } - impl ::subxt::blocks::StaticExtrinsic for SetCode { - const PALLET: &'static str = "System"; - const CALL: &'static str = "set_code"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set_code_without_checks`]."] - pub struct SetCodeWithoutChecks { - pub code: set_code_without_checks::Code, - } - pub mod set_code_without_checks { - use super::runtime_types; - pub type Code = ::std::vec::Vec<::core::primitive::u8>; - } - impl ::subxt::blocks::StaticExtrinsic for SetCodeWithoutChecks { - const PALLET: &'static str = "System"; - const CALL: &'static str = "set_code_without_checks"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set_storage`]."] - pub struct SetStorage { - pub items: set_storage::Items, - } - pub mod set_storage { - use super::runtime_types; - pub type Items = ::std::vec::Vec<( - ::std::vec::Vec<::core::primitive::u8>, - ::std::vec::Vec<::core::primitive::u8>, - )>; - } - impl ::subxt::blocks::StaticExtrinsic for SetStorage { - const PALLET: &'static str = "System"; - const CALL: &'static str = "set_storage"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::kill_storage`]."] - pub struct KillStorage { - pub keys: kill_storage::Keys, - } - pub mod kill_storage { - use super::runtime_types; - pub type Keys = ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>; - } - impl ::subxt::blocks::StaticExtrinsic for KillStorage { - const PALLET: &'static str = "System"; - const CALL: &'static str = "kill_storage"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::kill_prefix`]."] - pub struct KillPrefix { - pub prefix: kill_prefix::Prefix, - pub subkeys: kill_prefix::Subkeys, - } - pub mod kill_prefix { - use super::runtime_types; - pub type Prefix = ::std::vec::Vec<::core::primitive::u8>; - pub type Subkeys = ::core::primitive::u32; - } - impl ::subxt::blocks::StaticExtrinsic for KillPrefix { - const PALLET: &'static str = "System"; - const CALL: &'static str = "kill_prefix"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::remark_with_event`]."] - pub struct RemarkWithEvent { - pub remark: remark_with_event::Remark, - } - pub mod remark_with_event { - use super::runtime_types; - pub type Remark = ::std::vec::Vec<::core::primitive::u8>; - } - impl ::subxt::blocks::StaticExtrinsic for RemarkWithEvent { - const PALLET: &'static str = "System"; - const CALL: &'static str = "remark_with_event"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::remark`]."] - pub fn remark(&self, remark: types::remark::Remark) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "remark", - types::Remark { remark }, - [ - 43u8, 126u8, 180u8, 174u8, 141u8, 48u8, 52u8, 125u8, 166u8, 212u8, 216u8, 98u8, 100u8, - 24u8, 132u8, 71u8, 101u8, 64u8, 246u8, 169u8, 33u8, 250u8, 147u8, 208u8, 2u8, 40u8, 129u8, - 209u8, 232u8, 207u8, 207u8, 13u8, - ], - ) - } - #[doc = "See [`Pallet::set_heap_pages`]."] - pub fn set_heap_pages( - &self, - pages: types::set_heap_pages::Pages, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "set_heap_pages", - types::SetHeapPages { pages }, - [ - 188u8, 191u8, 99u8, 216u8, 219u8, 109u8, 141u8, 50u8, 78u8, 235u8, 215u8, 242u8, 195u8, - 24u8, 111u8, 76u8, 229u8, 64u8, 99u8, 225u8, 134u8, 121u8, 81u8, 209u8, 127u8, 223u8, 98u8, - 215u8, 150u8, 70u8, 57u8, 147u8, - ], - ) - } - #[doc = "See [`Pallet::set_code`]."] - pub fn set_code(&self, code: types::set_code::Code) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "set_code", - types::SetCode { code }, - [ - 233u8, 248u8, 88u8, 245u8, 28u8, 65u8, 25u8, 169u8, 35u8, 237u8, 19u8, 203u8, 136u8, 160u8, - 18u8, 3u8, 20u8, 197u8, 81u8, 169u8, 244u8, 188u8, 27u8, 147u8, 147u8, 236u8, 65u8, 25u8, - 3u8, 143u8, 182u8, 22u8, - ], - ) - } - #[doc = "See [`Pallet::set_code_without_checks`]."] - pub fn set_code_without_checks( - &self, - code: types::set_code_without_checks::Code, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "set_code_without_checks", - types::SetCodeWithoutChecks { code }, - [ - 82u8, 212u8, 157u8, 44u8, 70u8, 0u8, 143u8, 15u8, 109u8, 109u8, 107u8, 157u8, 141u8, 42u8, - 169u8, 11u8, 15u8, 186u8, 252u8, 138u8, 10u8, 147u8, 15u8, 178u8, 247u8, 229u8, 213u8, - 98u8, 207u8, 231u8, 119u8, 115u8, - ], - ) - } - #[doc = "See [`Pallet::set_storage`]."] - pub fn set_storage(&self, items: types::set_storage::Items) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "set_storage", - types::SetStorage { items }, - [ - 141u8, 216u8, 52u8, 222u8, 223u8, 136u8, 123u8, 181u8, 19u8, 75u8, 163u8, 102u8, 229u8, - 189u8, 158u8, 142u8, 95u8, 235u8, 240u8, 49u8, 150u8, 76u8, 78u8, 137u8, 126u8, 88u8, - 183u8, 88u8, 231u8, 146u8, 234u8, 43u8, - ], - ) - } - #[doc = "See [`Pallet::kill_storage`]."] - pub fn kill_storage( - &self, - keys: types::kill_storage::Keys, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "kill_storage", - types::KillStorage { keys }, - [ - 73u8, 63u8, 196u8, 36u8, 144u8, 114u8, 34u8, 213u8, 108u8, 93u8, 209u8, 234u8, 153u8, - 185u8, 33u8, 91u8, 187u8, 195u8, 223u8, 130u8, 58u8, 156u8, 63u8, 47u8, 228u8, 249u8, - 216u8, 139u8, 143u8, 177u8, 41u8, 35u8, - ], - ) - } - #[doc = "See [`Pallet::kill_prefix`]."] - pub fn kill_prefix( - &self, - prefix: types::kill_prefix::Prefix, - subkeys: types::kill_prefix::Subkeys, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "kill_prefix", - types::KillPrefix { prefix, subkeys }, - [ - 184u8, 57u8, 139u8, 24u8, 208u8, 87u8, 108u8, 215u8, 198u8, 189u8, 175u8, 242u8, 167u8, - 215u8, 97u8, 63u8, 110u8, 166u8, 238u8, 98u8, 67u8, 236u8, 111u8, 110u8, 234u8, 81u8, - 102u8, 5u8, 182u8, 5u8, 214u8, 85u8, - ], - ) - } - #[doc = "See [`Pallet::remark_with_event`]."] - pub fn remark_with_event( - &self, - remark: types::remark_with_event::Remark, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "System", - "remark_with_event", - types::RemarkWithEvent { remark }, - [ - 120u8, 120u8, 153u8, 92u8, 184u8, 85u8, 34u8, 2u8, 174u8, 206u8, 105u8, 228u8, 233u8, - 130u8, 80u8, 246u8, 228u8, 59u8, 234u8, 240u8, 4u8, 49u8, 147u8, 170u8, 115u8, 91u8, 149u8, - 200u8, 228u8, 181u8, 8u8, 154u8, - ], - ) - } - } - } - #[doc = "Event for the System pallet."] - pub type Event = runtime_types::frame_system::pallet::Event; - pub mod events { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "An extrinsic completed successfully."] - pub struct ExtrinsicSuccess { - pub dispatch_info: extrinsic_success::DispatchInfo, - } - pub mod extrinsic_success { - use super::runtime_types; - pub type DispatchInfo = runtime_types::frame_support::dispatch::DispatchInfo; - } - impl ::subxt::events::StaticEvent for ExtrinsicSuccess { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "ExtrinsicSuccess"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "An extrinsic failed."] - pub struct ExtrinsicFailed { - pub dispatch_error: extrinsic_failed::DispatchError, - pub dispatch_info: extrinsic_failed::DispatchInfo, - } - pub mod extrinsic_failed { - use super::runtime_types; - pub type DispatchError = runtime_types::sp_runtime::DispatchError; - pub type DispatchInfo = runtime_types::frame_support::dispatch::DispatchInfo; - } - impl ::subxt::events::StaticEvent for ExtrinsicFailed { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "ExtrinsicFailed"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "`:code` was updated."] - pub struct CodeUpdated; - impl ::subxt::events::StaticEvent for CodeUpdated { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "CodeUpdated"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "A new account was created."] - pub struct NewAccount { - pub account: new_account::Account, - } - pub mod new_account { - use super::runtime_types; - pub type Account = ::subxt::utils::AccountId32; - } - impl ::subxt::events::StaticEvent for NewAccount { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "NewAccount"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "An account was reaped."] - pub struct KilledAccount { - pub account: killed_account::Account, - } - pub mod killed_account { - use super::runtime_types; - pub type Account = ::subxt::utils::AccountId32; - } - impl ::subxt::events::StaticEvent for KilledAccount { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "KilledAccount"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "On on-chain remark happened."] - pub struct Remarked { - pub sender: remarked::Sender, - pub hash: remarked::Hash, - } - pub mod remarked { - use super::runtime_types; - pub type Sender = ::subxt::utils::AccountId32; - pub type Hash = ::subxt::utils::H256; - } - impl ::subxt::events::StaticEvent for Remarked { - const PALLET: &'static str = "System"; - const EVENT: &'static str = "Remarked"; - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod account { - use super::runtime_types; - pub type Account = runtime_types::frame_system::AccountInfo<::core::primitive::u32, ()>; - pub type Param0 = ::subxt::utils::AccountId32; - } - pub mod extrinsic_count { - use super::runtime_types; - pub type ExtrinsicCount = ::core::primitive::u32; - } - pub mod block_weight { - use super::runtime_types; - pub type BlockWeight = runtime_types::frame_support::dispatch::PerDispatchClass< - runtime_types::sp_weights::weight_v2::Weight, - >; - } - pub mod all_extrinsics_len { - use super::runtime_types; - pub type AllExtrinsicsLen = ::core::primitive::u32; - } - pub mod block_hash { - use super::runtime_types; - pub type BlockHash = ::subxt::utils::H256; - pub type Param0 = ::core::primitive::u32; - } - pub mod extrinsic_data { - use super::runtime_types; - pub type ExtrinsicData = ::std::vec::Vec<::core::primitive::u8>; - pub type Param0 = ::core::primitive::u32; - } - pub mod number { - use super::runtime_types; - pub type Number = ::core::primitive::u32; - } - pub mod parent_hash { - use super::runtime_types; - pub type ParentHash = ::subxt::utils::H256; - } - pub mod digest { - use super::runtime_types; - pub type Digest = runtime_types::sp_runtime::generic::digest::Digest; - } - pub mod events { - use super::runtime_types; - pub type Events = ::std::vec::Vec< - runtime_types::frame_system::EventRecord< - runtime_types::madara_runtime::RuntimeEvent, - ::subxt::utils::H256, - >, - >; - } - pub mod event_count { - use super::runtime_types; - pub type EventCount = ::core::primitive::u32; - } - pub mod event_topics { - use super::runtime_types; - pub type EventTopics = ::std::vec::Vec<(::core::primitive::u32, ::core::primitive::u32)>; - pub type Param0 = ::subxt::utils::H256; - } - pub mod last_runtime_upgrade { - use super::runtime_types; - pub type LastRuntimeUpgrade = runtime_types::frame_system::LastRuntimeUpgradeInfo; - } - pub mod upgraded_to_u32_ref_count { - use super::runtime_types; - pub type UpgradedToU32RefCount = ::core::primitive::bool; - } - pub mod upgraded_to_triple_ref_count { - use super::runtime_types; - pub type UpgradedToTripleRefCount = ::core::primitive::bool; - } - pub mod execution_phase { - use super::runtime_types; - pub type ExecutionPhase = runtime_types::frame_system::Phase; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The full account information for a particular account ID."] - pub fn account_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::account::Account, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "System", - "Account", - (), - [ - 207u8, 128u8, 217u8, 6u8, 244u8, 231u8, 113u8, 230u8, 246u8, 220u8, 226u8, 62u8, 206u8, - 203u8, 104u8, 119u8, 181u8, 97u8, 211u8, 3u8, 157u8, 102u8, 196u8, 131u8, 51u8, 221u8, - 41u8, 183u8, 108u8, 28u8, 247u8, 73u8, - ], - ) - } - #[doc = " The full account information for a particular account ID."] - pub fn account( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::account::Account, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "Account", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 207u8, 128u8, 217u8, 6u8, 244u8, 231u8, 113u8, 230u8, 246u8, 220u8, 226u8, 62u8, 206u8, - 203u8, 104u8, 119u8, 181u8, 97u8, 211u8, 3u8, 157u8, 102u8, 196u8, 131u8, 51u8, 221u8, - 41u8, 183u8, 108u8, 28u8, 247u8, 73u8, - ], - ) - } - #[doc = " Total extrinsics count for the current block."] - pub fn extrinsic_count( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::extrinsic_count::ExtrinsicCount, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "ExtrinsicCount", - (), - [ - 102u8, 76u8, 236u8, 42u8, 40u8, 231u8, 33u8, 222u8, 123u8, 147u8, 153u8, 148u8, 234u8, - 203u8, 181u8, 119u8, 6u8, 187u8, 177u8, 199u8, 120u8, 47u8, 137u8, 254u8, 96u8, 100u8, - 165u8, 182u8, 249u8, 230u8, 159u8, 79u8, - ], - ) - } - #[doc = " The current weight for the block."] - pub fn block_weight( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::block_weight::BlockWeight, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "BlockWeight", - (), - [ - 158u8, 46u8, 228u8, 89u8, 210u8, 214u8, 84u8, 154u8, 50u8, 68u8, 63u8, 62u8, 43u8, 42u8, - 99u8, 27u8, 54u8, 42u8, 146u8, 44u8, 241u8, 216u8, 229u8, 30u8, 216u8, 255u8, 165u8, 238u8, - 181u8, 130u8, 36u8, 102u8, - ], - ) - } - #[doc = " Total length (in bytes) for all extrinsics put together, for the current block."] - pub fn all_extrinsics_len( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::all_extrinsics_len::AllExtrinsicsLen, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "AllExtrinsicsLen", - (), - [ - 117u8, 86u8, 61u8, 243u8, 41u8, 51u8, 102u8, 214u8, 137u8, 100u8, 243u8, 185u8, 122u8, - 174u8, 187u8, 117u8, 86u8, 189u8, 63u8, 135u8, 101u8, 218u8, 203u8, 201u8, 237u8, 254u8, - 128u8, 183u8, 169u8, 221u8, 242u8, 65u8, - ], - ) - } - #[doc = " Map of block numbers to block hashes."] - pub fn block_hash_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::block_hash::BlockHash, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "System", - "BlockHash", - (), - [ - 217u8, 32u8, 215u8, 253u8, 24u8, 182u8, 207u8, 178u8, 157u8, 24u8, 103u8, 100u8, 195u8, - 165u8, 69u8, 152u8, 112u8, 181u8, 56u8, 192u8, 164u8, 16u8, 20u8, 222u8, 28u8, 214u8, - 144u8, 142u8, 146u8, 69u8, 202u8, 118u8, - ], - ) - } - #[doc = " Map of block numbers to block hashes."] - pub fn block_hash( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::block_hash::BlockHash, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "BlockHash", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 217u8, 32u8, 215u8, 253u8, 24u8, 182u8, 207u8, 178u8, 157u8, 24u8, 103u8, 100u8, 195u8, - 165u8, 69u8, 152u8, 112u8, 181u8, 56u8, 192u8, 164u8, 16u8, 20u8, 222u8, 28u8, 214u8, - 144u8, 142u8, 146u8, 69u8, 202u8, 118u8, - ], - ) - } - #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] - pub fn extrinsic_data_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::extrinsic_data::ExtrinsicData, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "System", - "ExtrinsicData", - (), - [ - 160u8, 180u8, 122u8, 18u8, 196u8, 26u8, 2u8, 37u8, 115u8, 232u8, 133u8, 220u8, 106u8, - 245u8, 4u8, 129u8, 42u8, 84u8, 241u8, 45u8, 199u8, 179u8, 128u8, 61u8, 170u8, 137u8, 231u8, - 156u8, 247u8, 57u8, 47u8, 38u8, - ], - ) - } - #[doc = " Extrinsics data for the current block (maps an extrinsic's index to its data)."] - pub fn extrinsic_data( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::extrinsic_data::ExtrinsicData, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "ExtrinsicData", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 160u8, 180u8, 122u8, 18u8, 196u8, 26u8, 2u8, 37u8, 115u8, 232u8, 133u8, 220u8, 106u8, - 245u8, 4u8, 129u8, 42u8, 84u8, 241u8, 45u8, 199u8, 179u8, 128u8, 61u8, 170u8, 137u8, 231u8, - 156u8, 247u8, 57u8, 47u8, 38u8, - ], - ) - } - #[doc = " The current block number being processed. Set by `execute_block`."] - pub fn number( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::number::Number, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "Number", - (), - [ - 30u8, 194u8, 177u8, 90u8, 194u8, 232u8, 46u8, 180u8, 85u8, 129u8, 14u8, 9u8, 8u8, 8u8, - 23u8, 95u8, 230u8, 5u8, 13u8, 105u8, 125u8, 2u8, 22u8, 200u8, 78u8, 93u8, 115u8, 28u8, - 150u8, 113u8, 48u8, 53u8, - ], - ) - } - #[doc = " Hash of the previous block."] - pub fn parent_hash( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::parent_hash::ParentHash, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "ParentHash", - (), - [ - 26u8, 130u8, 11u8, 216u8, 155u8, 71u8, 128u8, 170u8, 30u8, 153u8, 21u8, 192u8, 62u8, 93u8, - 137u8, 80u8, 120u8, 81u8, 202u8, 94u8, 248u8, 125u8, 71u8, 82u8, 141u8, 229u8, 32u8, 56u8, - 73u8, 50u8, 101u8, 78u8, - ], - ) - } - #[doc = " Digest of the current block, also part of the block header."] - pub fn digest( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::digest::Digest, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "Digest", - (), - [ - 61u8, 64u8, 237u8, 91u8, 145u8, 232u8, 17u8, 254u8, 181u8, 16u8, 234u8, 91u8, 51u8, 140u8, - 254u8, 131u8, 98u8, 135u8, 21u8, 37u8, 251u8, 20u8, 58u8, 92u8, 123u8, 141u8, 14u8, 227u8, - 146u8, 46u8, 222u8, 117u8, - ], - ) - } - #[doc = " Events deposited for the current block."] - #[doc = ""] - #[doc = " NOTE: The item is unbound and should therefore never be read on chain."] - #[doc = " It could otherwise inflate the PoV size of a block."] - #[doc = ""] - #[doc = " Events have a large in-memory size. Box the events to not go out-of-memory"] - #[doc = " just in case someone still reads them from within the runtime."] - pub fn events( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::events::Events, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "Events", - (), - [ - 255u8, 169u8, 249u8, 70u8, 39u8, 153u8, 238u8, 39u8, 195u8, 196u8, 92u8, 84u8, 82u8, 162u8, - 155u8, 174u8, 44u8, 174u8, 242u8, 82u8, 193u8, 130u8, 148u8, 194u8, 182u8, 64u8, 126u8, - 65u8, 148u8, 199u8, 233u8, 124u8, - ], - ) - } - #[doc = " The number of events in the `Events` list."] - pub fn event_count( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::event_count::EventCount, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "EventCount", - (), - [ - 175u8, 24u8, 252u8, 184u8, 210u8, 167u8, 146u8, 143u8, 164u8, 80u8, 151u8, 205u8, 189u8, - 189u8, 55u8, 220u8, 47u8, 101u8, 181u8, 33u8, 254u8, 131u8, 13u8, 143u8, 3u8, 244u8, 245u8, - 45u8, 2u8, 210u8, 79u8, 133u8, - ], - ) - } - #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] - #[doc = " of events in the `>` list."] - #[doc = ""] - #[doc = " All topic vectors have deterministic storage locations depending on the topic. This"] - #[doc = " allows light-clients to leverage the changes trie storage tracking mechanism and"] - #[doc = " in case of changes fetch the list of events of interest."] - #[doc = ""] - #[doc = " The value has the type `(BlockNumberFor, EventIndex)` because if we used only just"] - #[doc = " the `EventIndex` then in case if the topic has the same contents on the next block"] - #[doc = " no notification will be triggered thus the event might be lost."] - pub fn event_topics_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::event_topics::EventTopics, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "System", - "EventTopics", - (), - [ - 40u8, 225u8, 14u8, 75u8, 44u8, 176u8, 76u8, 34u8, 143u8, 107u8, 69u8, 133u8, 114u8, 13u8, - 172u8, 250u8, 141u8, 73u8, 12u8, 65u8, 217u8, 63u8, 120u8, 241u8, 48u8, 106u8, 143u8, - 161u8, 128u8, 100u8, 166u8, 59u8, - ], - ) - } - #[doc = " Mapping between a topic (represented by T::Hash) and a vector of indexes"] - #[doc = " of events in the `>` list."] - #[doc = ""] - #[doc = " All topic vectors have deterministic storage locations depending on the topic. This"] - #[doc = " allows light-clients to leverage the changes trie storage tracking mechanism and"] - #[doc = " in case of changes fetch the list of events of interest."] - #[doc = ""] - #[doc = " The value has the type `(BlockNumberFor, EventIndex)` because if we used only just"] - #[doc = " the `EventIndex` then in case if the topic has the same contents on the next block"] - #[doc = " no notification will be triggered thus the event might be lost."] - pub fn event_topics( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::event_topics::EventTopics, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "EventTopics", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 40u8, 225u8, 14u8, 75u8, 44u8, 176u8, 76u8, 34u8, 143u8, 107u8, 69u8, 133u8, 114u8, 13u8, - 172u8, 250u8, 141u8, 73u8, 12u8, 65u8, 217u8, 63u8, 120u8, 241u8, 48u8, 106u8, 143u8, - 161u8, 128u8, 100u8, 166u8, 59u8, - ], - ) - } - #[doc = " Stores the `spec_version` and `spec_name` of when the last runtime upgrade happened."] - pub fn last_runtime_upgrade( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::last_runtime_upgrade::LastRuntimeUpgrade, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "LastRuntimeUpgrade", - (), - [ - 137u8, 29u8, 175u8, 75u8, 197u8, 208u8, 91u8, 207u8, 156u8, 87u8, 148u8, 68u8, 91u8, 140u8, - 22u8, 233u8, 1u8, 229u8, 56u8, 34u8, 40u8, 194u8, 253u8, 30u8, 163u8, 39u8, 54u8, 209u8, - 13u8, 27u8, 139u8, 184u8, - ], - ) - } - #[doc = " True if we have upgraded so that `type RefCount` is `u32`. False (default) if not."] - pub fn upgraded_to_u32_ref_count( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::upgraded_to_u32_ref_count::UpgradedToU32RefCount, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "UpgradedToU32RefCount", - (), - [ - 229u8, 73u8, 9u8, 132u8, 186u8, 116u8, 151u8, 171u8, 145u8, 29u8, 34u8, 130u8, 52u8, 146u8, - 124u8, 175u8, 79u8, 189u8, 147u8, 230u8, 234u8, 107u8, 124u8, 31u8, 2u8, 22u8, 86u8, 190u8, - 4u8, 147u8, 50u8, 245u8, - ], - ) - } - #[doc = " True if we have upgraded so that AccountInfo contains three types of `RefCount`. False"] - #[doc = " (default) if not."] - pub fn upgraded_to_triple_ref_count( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::upgraded_to_triple_ref_count::UpgradedToTripleRefCount, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "UpgradedToTripleRefCount", - (), - [ - 97u8, 66u8, 124u8, 243u8, 27u8, 167u8, 147u8, 81u8, 254u8, 201u8, 101u8, 24u8, 40u8, 231u8, - 14u8, 179u8, 154u8, 163u8, 71u8, 81u8, 185u8, 167u8, 82u8, 254u8, 189u8, 3u8, 101u8, 207u8, - 206u8, 194u8, 155u8, 151u8, - ], - ) - } - #[doc = " The execution phase of the block."] - pub fn execution_phase( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::execution_phase::ExecutionPhase, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "System", - "ExecutionPhase", - (), - [ - 191u8, 129u8, 100u8, 134u8, 126u8, 116u8, 154u8, 203u8, 220u8, 200u8, 0u8, 26u8, 161u8, - 250u8, 133u8, 205u8, 146u8, 24u8, 5u8, 156u8, 158u8, 35u8, 36u8, 253u8, 52u8, 235u8, 86u8, - 167u8, 35u8, 100u8, 119u8, 27u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " Block & extrinsics weights: base values and limits."] - pub fn block_weights( - &self, - ) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "System", - "BlockWeights", - [ - 176u8, 124u8, 225u8, 136u8, 25u8, 73u8, 247u8, 33u8, 82u8, 206u8, 85u8, 190u8, 127u8, - 102u8, 71u8, 11u8, 185u8, 8u8, 58u8, 0u8, 94u8, 55u8, 163u8, 177u8, 104u8, 59u8, 60u8, - 136u8, 246u8, 116u8, 0u8, 239u8, - ], - ) - } - #[doc = " The maximum length of a block (in bytes)."] - pub fn block_length( - &self, - ) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "System", - "BlockLength", - [ - 23u8, 242u8, 225u8, 39u8, 225u8, 67u8, 152u8, 41u8, 155u8, 104u8, 68u8, 229u8, 185u8, - 133u8, 10u8, 143u8, 184u8, 152u8, 234u8, 44u8, 140u8, 96u8, 166u8, 235u8, 162u8, 160u8, - 72u8, 7u8, 35u8, 194u8, 3u8, 37u8, - ], - ) - } - #[doc = " Maximum number of block number to block hash mappings to keep (oldest pruned first)."] - pub fn block_hash_count(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "System", - "BlockHashCount", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - #[doc = " The weight of runtime database operations the runtime can invoke."] - pub fn db_weight(&self) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "System", - "DbWeight", - [ - 42u8, 43u8, 178u8, 142u8, 243u8, 203u8, 60u8, 173u8, 118u8, 111u8, 200u8, 170u8, 102u8, - 70u8, 237u8, 187u8, 198u8, 120u8, 153u8, 232u8, 183u8, 76u8, 74u8, 10u8, 70u8, 243u8, 14u8, - 218u8, 213u8, 126u8, 29u8, 177u8, - ], - ) - } - #[doc = " Get the chain's current version."] - pub fn version(&self) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "System", - "Version", - [ - 219u8, 45u8, 162u8, 245u8, 177u8, 246u8, 48u8, 126u8, 191u8, 157u8, 228u8, 83u8, 111u8, - 133u8, 183u8, 13u8, 148u8, 108u8, 92u8, 102u8, 72u8, 205u8, 74u8, 242u8, 233u8, 79u8, 20u8, - 170u8, 72u8, 202u8, 158u8, 165u8, - ], - ) - } - #[doc = " The designated SS58 prefix of this chain."] - #[doc = ""] - #[doc = " This replaces the \"ss58Format\" property declared in the chain spec. Reason is"] - #[doc = " that the runtime should know about the prefix in order to make use of it as"] - #[doc = " an identifier of the chain."] - pub fn ss58_prefix(&self) -> ::subxt::constants::Address<::core::primitive::u16> { - ::subxt::constants::Address::new_static( - "System", - "SS58Prefix", - [ - 116u8, 33u8, 2u8, 170u8, 181u8, 147u8, 171u8, 169u8, 167u8, 227u8, 41u8, 144u8, 11u8, - 236u8, 82u8, 100u8, 74u8, 60u8, 184u8, 72u8, 169u8, 90u8, 208u8, 135u8, 15u8, 117u8, 10u8, - 123u8, 128u8, 193u8, 29u8, 70u8, - ], - ) - } - } - } - } - pub mod timestamp { - use super::root_mod; - use super::runtime_types; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_timestamp::pallet::Call; - pub mod calls { - use super::root_mod; - use super::runtime_types; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set`]."] - pub struct Set { - #[codec(compact)] - pub now: set::Now, - } - pub mod set { - use super::runtime_types; - pub type Now = ::core::primitive::u64; - } - impl ::subxt::blocks::StaticExtrinsic for Set { - const PALLET: &'static str = "Timestamp"; - const CALL: &'static str = "set"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::set`]."] - pub fn set(&self, now: types::set::Now) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Timestamp", - "set", - types::Set { now }, - [ - 37u8, 95u8, 49u8, 218u8, 24u8, 22u8, 0u8, 95u8, 72u8, 35u8, 155u8, 199u8, 213u8, 54u8, - 207u8, 22u8, 185u8, 193u8, 221u8, 70u8, 18u8, 200u8, 4u8, 231u8, 195u8, 173u8, 6u8, 122u8, - 11u8, 203u8, 231u8, 227u8, - ], - ) - } - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod now { - use super::runtime_types; - pub type Now = ::core::primitive::u64; - } - pub mod did_update { - use super::runtime_types; - pub type DidUpdate = ::core::primitive::bool; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The current time for the current block."] - pub fn now( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::now::Now, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Timestamp", - "Now", - (), - [ - 44u8, 50u8, 80u8, 30u8, 195u8, 146u8, 123u8, 238u8, 8u8, 163u8, 187u8, 92u8, 61u8, 39u8, - 51u8, 29u8, 173u8, 169u8, 217u8, 158u8, 85u8, 187u8, 141u8, 26u8, 12u8, 115u8, 51u8, 11u8, - 200u8, 244u8, 138u8, 152u8, - ], - ) - } - #[doc = " Whether the timestamp has been updated in this block."] - #[doc = ""] - #[doc = " This value is updated to `true` upon successful submission of a timestamp by a node."] - #[doc = " It is then checked at the end of each block execution in the `on_finalize` hook."] - pub fn did_update( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::did_update::DidUpdate, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Timestamp", - "DidUpdate", - (), - [ - 229u8, 175u8, 246u8, 102u8, 237u8, 158u8, 212u8, 229u8, 238u8, 214u8, 205u8, 160u8, 164u8, - 252u8, 195u8, 75u8, 139u8, 110u8, 22u8, 34u8, 248u8, 204u8, 107u8, 46u8, 20u8, 200u8, - 238u8, 167u8, 71u8, 41u8, 214u8, 140u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " The minimum period between blocks."] - #[doc = ""] - #[doc = " Be aware that this is different to the *expected* period that the block production"] - #[doc = " apparatus provides. Your chosen consensus system will generally work with this to"] - #[doc = " determine a sensible block time. For example, in the Aura pallet it will be double this"] - #[doc = " period on default settings."] - pub fn minimum_period(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Timestamp", - "MinimumPeriod", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - } - } - } - pub mod aura { - use super::root_mod; - use super::runtime_types; - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod authorities { - use super::runtime_types; - pub type Authorities = runtime_types::bounded_collections::bounded_vec::BoundedVec< - runtime_types::sp_consensus_aura::sr25519::app_sr25519::Public, - >; - } - pub mod current_slot { - use super::runtime_types; - pub type CurrentSlot = runtime_types::sp_consensus_slots::Slot; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The current authority set."] - pub fn authorities( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::authorities::Authorities, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Aura", - "Authorities", - (), - [ - 232u8, 129u8, 167u8, 104u8, 47u8, 188u8, 238u8, 164u8, 6u8, 29u8, 129u8, 45u8, 64u8, 182u8, - 194u8, 47u8, 0u8, 73u8, 63u8, 102u8, 204u8, 94u8, 111u8, 96u8, 137u8, 7u8, 141u8, 110u8, - 180u8, 80u8, 228u8, 16u8, - ], - ) - } - #[doc = " The current slot of this block."] - #[doc = ""] - #[doc = " This will be set in `on_initialize`."] - pub fn current_slot( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::current_slot::CurrentSlot, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Aura", - "CurrentSlot", - (), - [ - 112u8, 199u8, 115u8, 248u8, 217u8, 242u8, 45u8, 231u8, 178u8, 53u8, 236u8, 167u8, 219u8, - 238u8, 81u8, 243u8, 39u8, 140u8, 68u8, 19u8, 201u8, 169u8, 211u8, 133u8, 135u8, 213u8, - 150u8, 105u8, 60u8, 252u8, 43u8, 57u8, - ], - ) - } - } - } - } - pub mod grandpa { - use super::root_mod; - use super::runtime_types; - #[doc = "The `Error` enum of this pallet."] - pub type Error = runtime_types::pallet_grandpa::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_grandpa::pallet::Call; - pub mod calls { - use super::root_mod; - use super::runtime_types; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::report_equivocation`]."] - pub struct ReportEquivocation { - pub equivocation_proof: ::std::boxed::Box, - pub key_owner_proof: report_equivocation::KeyOwnerProof, - } - pub mod report_equivocation { - use super::runtime_types; - pub type EquivocationProof = runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::utils::H256, - ::core::primitive::u32, - >; - pub type KeyOwnerProof = runtime_types::sp_core::Void; - } - impl ::subxt::blocks::StaticExtrinsic for ReportEquivocation { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "report_equivocation"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::report_equivocation_unsigned`]."] - pub struct ReportEquivocationUnsigned { - pub equivocation_proof: ::std::boxed::Box, - pub key_owner_proof: report_equivocation_unsigned::KeyOwnerProof, - } - pub mod report_equivocation_unsigned { - use super::runtime_types; - pub type EquivocationProof = runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::utils::H256, - ::core::primitive::u32, - >; - pub type KeyOwnerProof = runtime_types::sp_core::Void; - } - impl ::subxt::blocks::StaticExtrinsic for ReportEquivocationUnsigned { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "report_equivocation_unsigned"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::note_stalled`]."] - pub struct NoteStalled { - pub delay: note_stalled::Delay, - pub best_finalized_block_number: note_stalled::BestFinalizedBlockNumber, - } - pub mod note_stalled { - use super::runtime_types; - pub type Delay = ::core::primitive::u32; - pub type BestFinalizedBlockNumber = ::core::primitive::u32; - } - impl ::subxt::blocks::StaticExtrinsic for NoteStalled { - const PALLET: &'static str = "Grandpa"; - const CALL: &'static str = "note_stalled"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::report_equivocation`]."] - pub fn report_equivocation( - &self, - equivocation_proof: types::report_equivocation::EquivocationProof, - key_owner_proof: types::report_equivocation::KeyOwnerProof, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Grandpa", - "report_equivocation", - types::ReportEquivocation { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }, - [ - 158u8, 70u8, 189u8, 51u8, 231u8, 191u8, 199u8, 33u8, 64u8, 156u8, 71u8, 243u8, 122u8, - 199u8, 216u8, 10u8, 45u8, 73u8, 198u8, 141u8, 31u8, 209u8, 58u8, 164u8, 219u8, 124u8, - 242u8, 26u8, 114u8, 52u8, 65u8, 106u8, - ], - ) - } - #[doc = "See [`Pallet::report_equivocation_unsigned`]."] - pub fn report_equivocation_unsigned( - &self, - equivocation_proof: types::report_equivocation_unsigned::EquivocationProof, - key_owner_proof: types::report_equivocation_unsigned::KeyOwnerProof, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Grandpa", - "report_equivocation_unsigned", - types::ReportEquivocationUnsigned { - equivocation_proof: ::std::boxed::Box::new(equivocation_proof), - key_owner_proof, - }, - [ - 53u8, 23u8, 255u8, 215u8, 105u8, 11u8, 67u8, 177u8, 234u8, 248u8, 183u8, 57u8, 230u8, - 239u8, 54u8, 238u8, 115u8, 170u8, 153u8, 18u8, 55u8, 195u8, 85u8, 98u8, 109u8, 194u8, 57u8, - 225u8, 139u8, 237u8, 171u8, 152u8, - ], - ) - } - #[doc = "See [`Pallet::note_stalled`]."] - pub fn note_stalled( - &self, - delay: types::note_stalled::Delay, - best_finalized_block_number: types::note_stalled::BestFinalizedBlockNumber, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Grandpa", - "note_stalled", - types::NoteStalled { delay, best_finalized_block_number }, - [ - 158u8, 25u8, 64u8, 114u8, 131u8, 139u8, 227u8, 132u8, 42u8, 107u8, 40u8, 249u8, 18u8, 93u8, - 254u8, 86u8, 37u8, 67u8, 250u8, 35u8, 241u8, 194u8, 209u8, 20u8, 39u8, 75u8, 186u8, 21u8, - 48u8, 124u8, 151u8, 31u8, - ], - ) - } - } - } - #[doc = "The `Event` enum of this pallet"] - pub type Event = runtime_types::pallet_grandpa::pallet::Event; - pub mod events { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "New authority set has been applied."] - pub struct NewAuthorities { - pub authority_set: new_authorities::AuthoritySet, - } - pub mod new_authorities { - use super::runtime_types; - pub type AuthoritySet = - ::std::vec::Vec<(runtime_types::sp_consensus_grandpa::app::Public, ::core::primitive::u64)>; - } - impl ::subxt::events::StaticEvent for NewAuthorities { - const PALLET: &'static str = "Grandpa"; - const EVENT: &'static str = "NewAuthorities"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Current authority set has been paused."] - pub struct Paused; - impl ::subxt::events::StaticEvent for Paused { - const PALLET: &'static str = "Grandpa"; - const EVENT: &'static str = "Paused"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Current authority set has been resumed."] - pub struct Resumed; - impl ::subxt::events::StaticEvent for Resumed { - const PALLET: &'static str = "Grandpa"; - const EVENT: &'static str = "Resumed"; - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod state { - use super::runtime_types; - pub type State = runtime_types::pallet_grandpa::StoredState<::core::primitive::u32>; - } - pub mod pending_change { - use super::runtime_types; - pub type PendingChange = runtime_types::pallet_grandpa::StoredPendingChange<::core::primitive::u32>; - } - pub mod next_forced { - use super::runtime_types; - pub type NextForced = ::core::primitive::u32; - } - pub mod stalled { - use super::runtime_types; - pub type Stalled = (::core::primitive::u32, ::core::primitive::u32); - } - pub mod current_set_id { - use super::runtime_types; - pub type CurrentSetId = ::core::primitive::u64; - } - pub mod set_id_session { - use super::runtime_types; - pub type SetIdSession = ::core::primitive::u32; - pub type Param0 = ::core::primitive::u64; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " State of the current authority set."] - pub fn state( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::state::State, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "State", - (), - [ - 73u8, 71u8, 112u8, 83u8, 238u8, 75u8, 44u8, 9u8, 180u8, 33u8, 30u8, 121u8, 98u8, 96u8, - 61u8, 133u8, 16u8, 70u8, 30u8, 249u8, 34u8, 148u8, 15u8, 239u8, 164u8, 157u8, 52u8, 27u8, - 144u8, 52u8, 223u8, 109u8, - ], - ) - } - #[doc = " Pending change: (signaled at, scheduled change)."] - pub fn pending_change( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::pending_change::PendingChange, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "PendingChange", - (), - [ - 150u8, 194u8, 185u8, 248u8, 239u8, 43u8, 141u8, 253u8, 61u8, 106u8, 74u8, 164u8, 209u8, - 204u8, 206u8, 200u8, 32u8, 38u8, 11u8, 78u8, 84u8, 243u8, 181u8, 142u8, 179u8, 151u8, 81u8, - 204u8, 244u8, 150u8, 137u8, 250u8, - ], - ) - } - #[doc = " next block number where we can force a change."] - pub fn next_forced( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::next_forced::NextForced, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "NextForced", - (), - [ - 3u8, 231u8, 56u8, 18u8, 87u8, 112u8, 227u8, 126u8, 180u8, 131u8, 255u8, 141u8, 82u8, 34u8, - 61u8, 47u8, 234u8, 37u8, 95u8, 62u8, 33u8, 235u8, 231u8, 122u8, 125u8, 8u8, 223u8, 95u8, - 255u8, 204u8, 40u8, 97u8, - ], - ) - } - #[doc = " `true` if we are currently stalled."] - pub fn stalled( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::stalled::Stalled, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "Stalled", - (), - [ - 6u8, 81u8, 205u8, 142u8, 195u8, 48u8, 0u8, 247u8, 108u8, 170u8, 10u8, 249u8, 72u8, 206u8, - 32u8, 103u8, 109u8, 57u8, 51u8, 21u8, 144u8, 204u8, 79u8, 8u8, 191u8, 185u8, 38u8, 34u8, - 118u8, 223u8, 75u8, 241u8, - ], - ) - } - #[doc = " The number of changes (both in terms of keys and underlying economic responsibilities)"] - #[doc = " in the \"set\" of Grandpa validators from genesis."] - pub fn current_set_id( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::current_set_id::CurrentSetId, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "CurrentSetId", - (), - [ - 234u8, 215u8, 218u8, 42u8, 30u8, 76u8, 129u8, 40u8, 125u8, 137u8, 207u8, 47u8, 46u8, 213u8, - 159u8, 50u8, 175u8, 81u8, 155u8, 123u8, 246u8, 175u8, 156u8, 68u8, 22u8, 113u8, 135u8, - 137u8, 163u8, 18u8, 115u8, 73u8, - ], - ) - } - #[doc = " A mapping from grandpa set ID to the index of the *most recent* session for which its"] - #[doc = " members were responsible."] - #[doc = ""] - #[doc = " This is only used for validating equivocation proofs. An equivocation proof must"] - #[doc = " contains a key-ownership proof for a given session, therefore we need a way to tie"] - #[doc = " together sessions and GRANDPA set ids, i.e. we need to validate that a validator"] - #[doc = " was the owner of a given key on a given session, and what the active set ID was"] - #[doc = " during that session."] - #[doc = ""] - #[doc = " TWOX-NOTE: `SetId` is not under user control."] - pub fn set_id_session_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::set_id_session::SetIdSession, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "SetIdSession", - (), - [ - 47u8, 0u8, 239u8, 121u8, 187u8, 213u8, 254u8, 50u8, 238u8, 10u8, 162u8, 65u8, 189u8, 166u8, - 37u8, 74u8, 82u8, 81u8, 160u8, 20u8, 180u8, 253u8, 238u8, 18u8, 209u8, 203u8, 38u8, 148u8, - 16u8, 105u8, 72u8, 169u8, - ], - ) - } - #[doc = " A mapping from grandpa set ID to the index of the *most recent* session for which its"] - #[doc = " members were responsible."] - #[doc = ""] - #[doc = " This is only used for validating equivocation proofs. An equivocation proof must"] - #[doc = " contains a key-ownership proof for a given session, therefore we need a way to tie"] - #[doc = " together sessions and GRANDPA set ids, i.e. we need to validate that a validator"] - #[doc = " was the owner of a given key on a given session, and what the active set ID was"] - #[doc = " during that session."] - #[doc = ""] - #[doc = " TWOX-NOTE: `SetId` is not under user control."] - pub fn set_id_session( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::set_id_session::SetIdSession, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Grandpa", - "SetIdSession", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 47u8, 0u8, 239u8, 121u8, 187u8, 213u8, 254u8, 50u8, 238u8, 10u8, 162u8, 65u8, 189u8, 166u8, - 37u8, 74u8, 82u8, 81u8, 160u8, 20u8, 180u8, 253u8, 238u8, 18u8, 209u8, 203u8, 38u8, 148u8, - 16u8, 105u8, 72u8, 169u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " Max Authorities in use"] - pub fn max_authorities(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "Grandpa", - "MaxAuthorities", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - #[doc = " The maximum number of nominators for each validator."] - pub fn max_nominators(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "Grandpa", - "MaxNominators", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - #[doc = " The maximum number of entries to keep in the set id to session index mapping."] - #[doc = ""] - #[doc = " Since the `SetIdSession` map is only used for validating equivocations this"] - #[doc = " value should relate to the bonding duration of whatever staking system is"] - #[doc = " being used (if any). If equivocation handling is not enabled then this value"] - #[doc = " can be zero."] - pub fn max_set_id_session_entries(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Grandpa", - "MaxSetIdSessionEntries", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - } - } - } - pub mod starknet { - use super::root_mod; - use super::runtime_types; - #[doc = "The Starknet pallet custom errors."] - #[doc = "ERRORS"] - pub type Error = runtime_types::pallet_starknet::pallet::Error; - #[doc = "The Starknet pallet external functions."] - #[doc = "Dispatchable functions allows users to interact with the pallet and invoke state changes."] - #[doc = "These functions materialize as \"extrinsics\", which are often compared to transactions."] - #[doc = "Dispatchable functions must be annotated with a weight and must return a DispatchResult."] - pub type Call = runtime_types::pallet_starknet::pallet::Call; - pub mod calls { - use super::root_mod; - use super::runtime_types; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::set_sequencer_address`]."] - pub struct SetSequencerAddress { - pub addr: set_sequencer_address::Addr, - } - pub mod set_sequencer_address { - use super::runtime_types; - pub type Addr = [::core::primitive::u8; 32usize]; - } - impl ::subxt::blocks::StaticExtrinsic for SetSequencerAddress { - const PALLET: &'static str = "Starknet"; - const CALL: &'static str = "set_sequencer_address"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::invoke`]."] - pub struct Invoke { - pub transaction: invoke::Transaction, - } - pub mod invoke { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::InvokeTransaction; - } - impl ::subxt::blocks::StaticExtrinsic for Invoke { - const PALLET: &'static str = "Starknet"; - const CALL: &'static str = "invoke"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::declare`]."] - pub struct Declare { - pub transaction: declare::Transaction, - pub contract_class: declare::ContractClass, - } - pub mod declare { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::DeclareTransaction; - pub type ContractClass = runtime_types::blockifier::execution::contract_class::ContractClass; - } - impl ::subxt::blocks::StaticExtrinsic for Declare { - const PALLET: &'static str = "Starknet"; - const CALL: &'static str = "declare"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::deploy_account`]."] - pub struct DeployAccount { - pub transaction: deploy_account::Transaction, - } - pub mod deploy_account { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::DeployAccountTransaction; - } - impl ::subxt::blocks::StaticExtrinsic for DeployAccount { - const PALLET: &'static str = "Starknet"; - const CALL: &'static str = "deploy_account"; - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::consume_l1_message`]."] - pub struct ConsumeL1Message { - pub transaction: consume_l1_message::Transaction, - pub paid_fee_on_l1: consume_l1_message::PaidFeeOnL1, - } - pub mod consume_l1_message { - use super::runtime_types; - pub type Transaction = runtime_types::mp_transactions::HandleL1MessageTransaction; - pub type PaidFeeOnL1 = runtime_types::starknet_api::transaction::Fee; - } - impl ::subxt::blocks::StaticExtrinsic for ConsumeL1Message { - const PALLET: &'static str = "Starknet"; - const CALL: &'static str = "consume_l1_message"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::set_sequencer_address`]."] - pub fn set_sequencer_address( - &self, - addr: types::set_sequencer_address::Addr, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Starknet", - "set_sequencer_address", - types::SetSequencerAddress { addr }, - [ - 169u8, 26u8, 33u8, 250u8, 166u8, 134u8, 232u8, 133u8, 55u8, 175u8, 66u8, 239u8, 41u8, - 169u8, 98u8, 174u8, 140u8, 37u8, 219u8, 244u8, 241u8, 223u8, 217u8, 81u8, 149u8, 123u8, - 195u8, 228u8, 103u8, 201u8, 113u8, 94u8, - ], - ) - } - #[doc = "See [`Pallet::invoke`]."] - pub fn invoke(&self, transaction: types::invoke::Transaction) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Starknet", - "invoke", - types::Invoke { transaction }, - [ - 85u8, 17u8, 2u8, 235u8, 36u8, 132u8, 208u8, 46u8, 163u8, 207u8, 213u8, 244u8, 110u8, 92u8, - 166u8, 212u8, 59u8, 93u8, 234u8, 176u8, 75u8, 134u8, 172u8, 162u8, 64u8, 253u8, 136u8, - 29u8, 107u8, 128u8, 57u8, 153u8, - ], - ) - } - #[doc = "See [`Pallet::declare`]."] - pub fn declare( - &self, - transaction: types::declare::Transaction, - contract_class: types::declare::ContractClass, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Starknet", - "declare", - types::Declare { transaction, contract_class }, - [ - 51u8, 168u8, 26u8, 92u8, 124u8, 211u8, 249u8, 222u8, 97u8, 183u8, 74u8, 98u8, 198u8, 228u8, - 105u8, 222u8, 18u8, 138u8, 61u8, 48u8, 47u8, 228u8, 152u8, 205u8, 226u8, 55u8, 212u8, - 206u8, 122u8, 51u8, 201u8, 110u8, - ], - ) - } - #[doc = "See [`Pallet::deploy_account`]."] - pub fn deploy_account( - &self, - transaction: types::deploy_account::Transaction, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Starknet", - "deploy_account", - types::DeployAccount { transaction }, - [ - 83u8, 35u8, 190u8, 103u8, 87u8, 56u8, 43u8, 218u8, 33u8, 76u8, 114u8, 250u8, 228u8, 8u8, - 220u8, 189u8, 165u8, 197u8, 106u8, 131u8, 232u8, 15u8, 215u8, 178u8, 174u8, 235u8, 239u8, - 201u8, 162u8, 43u8, 175u8, 99u8, - ], - ) - } - #[doc = "See [`Pallet::consume_l1_message`]."] - pub fn consume_l1_message( - &self, - transaction: types::consume_l1_message::Transaction, - paid_fee_on_l1: types::consume_l1_message::PaidFeeOnL1, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Starknet", - "consume_l1_message", - types::ConsumeL1Message { transaction, paid_fee_on_l1 }, - [ - 163u8, 125u8, 67u8, 173u8, 100u8, 72u8, 223u8, 26u8, 56u8, 92u8, 169u8, 125u8, 58u8, 205u8, - 189u8, 68u8, 24u8, 158u8, 149u8, 26u8, 42u8, 81u8, 79u8, 16u8, 177u8, 200u8, 189u8, 224u8, - 44u8, 118u8, 0u8, 233u8, - ], - ) - } - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod pending { - use super::runtime_types; - pub type Pending = ::std::vec::Vec; - } - pub mod pending_hashes { - use super::runtime_types; - pub type PendingHashes = ::std::vec::Vec; - } - pub mod tx_events { - use super::runtime_types; - pub type TxEvents = ::std::vec::Vec; - pub type Param0 = runtime_types::starknet_api::transaction::TransactionHash; - } - pub mod tx_messages { - use super::runtime_types; - pub type TxMessages = ::std::vec::Vec; - pub type Param0 = runtime_types::starknet_api::transaction::TransactionHash; - } - pub mod tx_revert_error { - use super::runtime_types; - pub type TxRevertError = ::std::string::String; - pub type Param0 = runtime_types::starknet_api::transaction::TransactionHash; - } - pub mod contracts_state_roots { - use super::runtime_types; - pub type ContractsStateRoots = runtime_types::mp_felt::Felt252Wrapper; - pub type Param0 = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod pending_storage_changes { - use super::runtime_types; - pub type PendingStorageChanges = ::std::vec::Vec<( - runtime_types::starknet_api::state::StorageKey, - runtime_types::mp_felt::Felt252Wrapper, - )>; - pub type Param0 = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod block_hash { - use super::runtime_types; - pub type BlockHash = runtime_types::mp_felt::Felt252Wrapper; - pub type Param0 = ::core::primitive::u64; - } - pub mod contract_class_hashes { - use super::runtime_types; - pub type ContractClassHashes = runtime_types::starknet_api::api_core::ClassHash; - pub type Param0 = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod contract_classes { - use super::runtime_types; - pub type ContractClasses = runtime_types::blockifier::execution::contract_class::ContractClass; - pub type Param0 = runtime_types::starknet_api::api_core::ClassHash; - } - pub mod compiled_class_hashes { - use super::runtime_types; - pub type CompiledClassHashes = runtime_types::starknet_api::api_core::CompiledClassHash; - pub type Param0 = runtime_types::starknet_api::api_core::ClassHash; - } - pub mod nonces { - use super::runtime_types; - pub type Nonces = runtime_types::starknet_api::api_core::Nonce; - pub type Param0 = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod storage_view { - use super::runtime_types; - pub type StorageView = runtime_types::starknet_api::hash::StarkFelt; - pub type Param0 = runtime_types::starknet_api::api_core::ContractAddress; - pub type Param1 = runtime_types::starknet_api::state::StorageKey; - } - pub mod last_known_eth_block { - use super::runtime_types; - pub type LastKnownEthBlock = ::core::primitive::u64; - } - pub mod fee_token_address { - use super::runtime_types; - pub type FeeTokenAddress = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod sequencer_address { - use super::runtime_types; - pub type SequencerAddress = runtime_types::starknet_api::api_core::ContractAddress; - } - pub mod seq_addr_update { - use super::runtime_types; - pub type SeqAddrUpdate = ::core::primitive::bool; - } - pub mod l1_messages { - use super::runtime_types; - pub type L1Messages = ::std::vec::Vec; - } - } - pub struct StorageApi; - impl StorageApi { - #[doc = " The Starknet pallet storage items."] - #[doc = " STORAGE"] - #[doc = " Current building block's transactions."] - pub fn pending( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::pending::Pending, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "Pending", - (), - [ - 84u8, 54u8, 119u8, 230u8, 72u8, 65u8, 155u8, 131u8, 53u8, 149u8, 140u8, 155u8, 24u8, 140u8, - 246u8, 87u8, 214u8, 136u8, 158u8, 39u8, 221u8, 39u8, 245u8, 53u8, 3u8, 36u8, 9u8, 178u8, - 17u8, 50u8, 126u8, 60u8, - ], - ) - } - pub fn pending_hashes( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::pending_hashes::PendingHashes, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "PendingHashes", - (), - [ - 66u8, 137u8, 130u8, 57u8, 29u8, 64u8, 57u8, 214u8, 150u8, 219u8, 146u8, 144u8, 151u8, - 215u8, 0u8, 55u8, 199u8, 44u8, 55u8, 64u8, 31u8, 113u8, 27u8, 86u8, 210u8, 4u8, 188u8, - 184u8, 217u8, 161u8, 76u8, 123u8, - ], - ) - } - pub fn tx_events_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::tx_events::TxEvents, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxEvents", - (), - [ - 121u8, 221u8, 127u8, 211u8, 86u8, 203u8, 128u8, 198u8, 221u8, 89u8, 110u8, 99u8, 184u8, - 167u8, 140u8, 177u8, 171u8, 25u8, 236u8, 201u8, 94u8, 6u8, 73u8, 35u8, 221u8, 204u8, 221u8, - 187u8, 247u8, 251u8, 173u8, 14u8, - ], - ) - } - pub fn tx_events( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::tx_events::TxEvents, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxEvents", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 121u8, 221u8, 127u8, 211u8, 86u8, 203u8, 128u8, 198u8, 221u8, 89u8, 110u8, 99u8, 184u8, - 167u8, 140u8, 177u8, 171u8, 25u8, 236u8, 201u8, 94u8, 6u8, 73u8, 35u8, 221u8, 204u8, 221u8, - 187u8, 247u8, 251u8, 173u8, 14u8, - ], - ) - } - pub fn tx_messages_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::tx_messages::TxMessages, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxMessages", - (), - [ - 167u8, 160u8, 91u8, 132u8, 79u8, 241u8, 107u8, 41u8, 163u8, 195u8, 225u8, 232u8, 145u8, - 217u8, 48u8, 98u8, 150u8, 247u8, 235u8, 102u8, 151u8, 238u8, 11u8, 107u8, 241u8, 54u8, - 137u8, 234u8, 168u8, 14u8, 73u8, 227u8, - ], - ) - } - pub fn tx_messages( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::tx_messages::TxMessages, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxMessages", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 167u8, 160u8, 91u8, 132u8, 79u8, 241u8, 107u8, 41u8, 163u8, 195u8, 225u8, 232u8, 145u8, - 217u8, 48u8, 98u8, 150u8, 247u8, 235u8, 102u8, 151u8, 238u8, 11u8, 107u8, 241u8, 54u8, - 137u8, 234u8, 168u8, 14u8, 73u8, 227u8, - ], - ) - } - pub fn tx_revert_error_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::tx_revert_error::TxRevertError, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxRevertError", - (), - [ - 135u8, 202u8, 162u8, 217u8, 245u8, 163u8, 157u8, 219u8, 170u8, 92u8, 64u8, 59u8, 204u8, - 168u8, 146u8, 93u8, 221u8, 30u8, 79u8, 181u8, 70u8, 49u8, 136u8, 164u8, 1u8, 234u8, 28u8, - 13u8, 222u8, 32u8, 237u8, 60u8, - ], - ) - } - pub fn tx_revert_error( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::tx_revert_error::TxRevertError, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "TxRevertError", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 135u8, 202u8, 162u8, 217u8, 245u8, 163u8, 157u8, 219u8, 170u8, 92u8, 64u8, 59u8, 204u8, - 168u8, 146u8, 93u8, 221u8, 30u8, 79u8, 181u8, 70u8, 49u8, 136u8, 164u8, 1u8, 234u8, 28u8, - 13u8, 222u8, 32u8, 237u8, 60u8, - ], - ) - } - #[doc = " The Starknet pallet storage items."] - #[doc = " STORAGE"] - #[doc = " Mapping of contract address to state root."] - pub fn contracts_state_roots_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::contracts_state_roots::ContractsStateRoots, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractsStateRoots", - (), - [ - 229u8, 249u8, 42u8, 22u8, 180u8, 204u8, 109u8, 58u8, 8u8, 151u8, 244u8, 138u8, 112u8, - 214u8, 87u8, 191u8, 95u8, 114u8, 61u8, 127u8, 210u8, 88u8, 229u8, 154u8, 33u8, 62u8, 108u8, - 153u8, 150u8, 109u8, 103u8, 59u8, - ], - ) - } - #[doc = " The Starknet pallet storage items."] - #[doc = " STORAGE"] - #[doc = " Mapping of contract address to state root."] - pub fn contracts_state_roots( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::contracts_state_roots::ContractsStateRoots, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractsStateRoots", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 229u8, 249u8, 42u8, 22u8, 180u8, 204u8, 109u8, 58u8, 8u8, 151u8, 244u8, 138u8, 112u8, - 214u8, 87u8, 191u8, 95u8, 114u8, 61u8, 127u8, 210u8, 88u8, 229u8, 154u8, 33u8, 62u8, 108u8, - 153u8, 150u8, 109u8, 103u8, 59u8, - ], - ) - } - #[doc = " Pending storage slot updates"] - #[doc = " STORAGE"] - #[doc = " Mapping storage key to storage value."] - pub fn pending_storage_changes_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::pending_storage_changes::PendingStorageChanges, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "PendingStorageChanges", - (), - [ - 164u8, 119u8, 210u8, 206u8, 60u8, 14u8, 39u8, 11u8, 109u8, 110u8, 175u8, 105u8, 56u8, - 188u8, 73u8, 130u8, 180u8, 56u8, 78u8, 81u8, 108u8, 255u8, 109u8, 246u8, 244u8, 20u8, - 157u8, 59u8, 134u8, 213u8, 167u8, 84u8, - ], - ) - } - #[doc = " Pending storage slot updates"] - #[doc = " STORAGE"] - #[doc = " Mapping storage key to storage value."] - pub fn pending_storage_changes( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::pending_storage_changes::PendingStorageChanges, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "PendingStorageChanges", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 164u8, 119u8, 210u8, 206u8, 60u8, 14u8, 39u8, 11u8, 109u8, 110u8, 175u8, 105u8, 56u8, - 188u8, 73u8, 130u8, 180u8, 56u8, 78u8, 81u8, 108u8, 255u8, 109u8, 246u8, 244u8, 20u8, - 157u8, 59u8, 134u8, 213u8, 167u8, 84u8, - ], - ) - } - #[doc = " Mapping for block number and hashes."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn block_hash_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::block_hash::BlockHash, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "BlockHash", - (), - [ - 136u8, 185u8, 29u8, 194u8, 72u8, 62u8, 93u8, 202u8, 59u8, 231u8, 199u8, 32u8, 71u8, 128u8, - 203u8, 237u8, 92u8, 50u8, 122u8, 167u8, 75u8, 26u8, 233u8, 203u8, 104u8, 139u8, 215u8, - 149u8, 55u8, 218u8, 50u8, 113u8, - ], - ) - } - #[doc = " Mapping for block number and hashes."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn block_hash( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::block_hash::BlockHash, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "BlockHash", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 136u8, 185u8, 29u8, 194u8, 72u8, 62u8, 93u8, 202u8, 59u8, 231u8, 199u8, 32u8, 71u8, 128u8, - 203u8, 237u8, 92u8, 50u8, 122u8, 167u8, 75u8, 26u8, 233u8, 203u8, 104u8, 139u8, 215u8, - 149u8, 55u8, 218u8, 50u8, 113u8, - ], - ) - } - #[doc = " Mapping from Starknet contract address to the contract's class hash."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn contract_class_hashes_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::contract_class_hashes::ContractClassHashes, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractClassHashes", - (), - [ - 134u8, 45u8, 113u8, 42u8, 146u8, 136u8, 240u8, 221u8, 0u8, 154u8, 218u8, 167u8, 114u8, - 119u8, 133u8, 137u8, 235u8, 201u8, 135u8, 204u8, 174u8, 33u8, 130u8, 230u8, 244u8, 87u8, - 47u8, 164u8, 221u8, 71u8, 71u8, 138u8, - ], - ) - } - #[doc = " Mapping from Starknet contract address to the contract's class hash."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn contract_class_hashes( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::contract_class_hashes::ContractClassHashes, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractClassHashes", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 134u8, 45u8, 113u8, 42u8, 146u8, 136u8, 240u8, 221u8, 0u8, 154u8, 218u8, 167u8, 114u8, - 119u8, 133u8, 137u8, 235u8, 201u8, 135u8, 204u8, 174u8, 33u8, 130u8, 230u8, 244u8, 87u8, - 47u8, 164u8, 221u8, 71u8, 71u8, 138u8, - ], - ) - } - #[doc = " Mapping from Starknet class hash to contract class."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn contract_classes_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::contract_classes::ContractClasses, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractClasses", - (), - [ - 249u8, 24u8, 108u8, 51u8, 136u8, 97u8, 170u8, 65u8, 255u8, 44u8, 91u8, 209u8, 79u8, 189u8, - 207u8, 200u8, 79u8, 5u8, 41u8, 9u8, 221u8, 220u8, 214u8, 145u8, 244u8, 158u8, 28u8, 182u8, - 223u8, 7u8, 244u8, 102u8, - ], - ) - } - #[doc = " Mapping from Starknet class hash to contract class."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn contract_classes( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::contract_classes::ContractClasses, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "ContractClasses", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 249u8, 24u8, 108u8, 51u8, 136u8, 97u8, 170u8, 65u8, 255u8, 44u8, 91u8, 209u8, 79u8, 189u8, - 207u8, 200u8, 79u8, 5u8, 41u8, 9u8, 221u8, 220u8, 214u8, 145u8, 244u8, 158u8, 28u8, 182u8, - 223u8, 7u8, 244u8, 102u8, - ], - ) - } - #[doc = " Mapping from Starknet Sierra class hash to Casm compiled contract class."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn compiled_class_hashes_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::compiled_class_hashes::CompiledClassHashes, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "CompiledClassHashes", - (), - [ - 16u8, 255u8, 109u8, 187u8, 48u8, 225u8, 113u8, 26u8, 67u8, 134u8, 61u8, 248u8, 246u8, - 231u8, 191u8, 29u8, 140u8, 141u8, 55u8, 147u8, 127u8, 133u8, 130u8, 137u8, 189u8, 33u8, - 187u8, 109u8, 45u8, 67u8, 101u8, 73u8, - ], - ) - } - #[doc = " Mapping from Starknet Sierra class hash to Casm compiled contract class."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn compiled_class_hashes( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::compiled_class_hashes::CompiledClassHashes, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "CompiledClassHashes", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 16u8, 255u8, 109u8, 187u8, 48u8, 225u8, 113u8, 26u8, 67u8, 134u8, 61u8, 248u8, 246u8, - 231u8, 191u8, 29u8, 140u8, 141u8, 55u8, 147u8, 127u8, 133u8, 130u8, 137u8, 189u8, 33u8, - 187u8, 109u8, 45u8, 67u8, 101u8, 73u8, - ], - ) - } - #[doc = " Mapping from Starknet contract address to its nonce."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn nonces_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::nonces::Nonces, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "Nonces", - (), - [ - 235u8, 122u8, 110u8, 231u8, 171u8, 151u8, 159u8, 224u8, 190u8, 13u8, 0u8, 106u8, 250u8, - 25u8, 89u8, 242u8, 164u8, 98u8, 63u8, 56u8, 181u8, 34u8, 0u8, 155u8, 112u8, 144u8, 75u8, - 239u8, 21u8, 137u8, 225u8, 232u8, - ], - ) - } - #[doc = " Mapping from Starknet contract address to its nonce."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn nonces( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::nonces::Nonces, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "Nonces", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 235u8, 122u8, 110u8, 231u8, 171u8, 151u8, 159u8, 224u8, 190u8, 13u8, 0u8, 106u8, 250u8, - 25u8, 89u8, 242u8, 164u8, 98u8, 63u8, 56u8, 181u8, 34u8, 0u8, 155u8, 112u8, 144u8, 75u8, - 239u8, 21u8, 137u8, 225u8, 232u8, - ], - ) - } - #[doc = " Mapping from Starknet contract storage key to its value."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn storage_view_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::storage_view::StorageView, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "StorageView", - (), - [ - 167u8, 146u8, 218u8, 79u8, 41u8, 243u8, 153u8, 185u8, 246u8, 39u8, 34u8, 194u8, 2u8, 36u8, - 122u8, 249u8, 16u8, 241u8, 86u8, 76u8, 190u8, 193u8, 234u8, 31u8, 219u8, 20u8, 109u8, - 159u8, 24u8, 24u8, 236u8, 150u8, - ], - ) - } - #[doc = " Mapping from Starknet contract storage key to its value."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn storage_view_iter1( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::storage_view::StorageView, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "StorageView", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 167u8, 146u8, 218u8, 79u8, 41u8, 243u8, 153u8, 185u8, 246u8, 39u8, 34u8, 194u8, 2u8, 36u8, - 122u8, 249u8, 16u8, 241u8, 86u8, 76u8, 190u8, 193u8, 234u8, 31u8, 219u8, 20u8, 109u8, - 159u8, 24u8, 24u8, 236u8, 150u8, - ], - ) - } - #[doc = " Mapping from Starknet contract storage key to its value."] - #[doc = " Safe to use `Identity` as the key is already a hash."] - pub fn storage_view( - &self, - _0: impl ::std::borrow::Borrow, - _1: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ( - ::subxt::storage::address::StaticStorageKey, - ::subxt::storage::address::StaticStorageKey, - ), - types::storage_view::StorageView, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "StorageView", - ( - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - ::subxt::storage::address::StaticStorageKey::new(_1.borrow()), - ), - [ - 167u8, 146u8, 218u8, 79u8, 41u8, 243u8, 153u8, 185u8, 246u8, 39u8, 34u8, 194u8, 2u8, 36u8, - 122u8, 249u8, 16u8, 241u8, 86u8, 76u8, 190u8, 193u8, 234u8, 31u8, 219u8, 20u8, 109u8, - 159u8, 24u8, 24u8, 236u8, 150u8, - ], - ) - } - #[doc = " The last processed Ethereum block number for L1 messages consumption."] - #[doc = " This is used to avoid re-processing the same Ethereum block multiple times."] - #[doc = " This is used by the offchain worker."] - #[doc = " # TODO"] - #[doc = " * Find a more relevant name for this."] - pub fn last_known_eth_block( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::last_known_eth_block::LastKnownEthBlock, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "LastKnownEthBlock", - (), - [ - 166u8, 178u8, 57u8, 216u8, 0u8, 63u8, 226u8, 197u8, 145u8, 98u8, 38u8, 69u8, 113u8, 73u8, - 223u8, 181u8, 230u8, 158u8, 206u8, 68u8, 147u8, 217u8, 203u8, 228u8, 171u8, 114u8, 237u8, - 137u8, 100u8, 114u8, 94u8, 6u8, - ], - ) - } - #[doc = " The address of the fee token ERC20 contract."] - pub fn fee_token_address( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::fee_token_address::FeeTokenAddress, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "FeeTokenAddress", - (), - [ - 189u8, 33u8, 185u8, 103u8, 164u8, 79u8, 96u8, 107u8, 253u8, 109u8, 193u8, 77u8, 130u8, - 217u8, 61u8, 5u8, 155u8, 190u8, 216u8, 132u8, 55u8, 253u8, 98u8, 247u8, 211u8, 18u8, 93u8, - 165u8, 218u8, 121u8, 79u8, 18u8, - ], - ) - } - #[doc = " Current sequencer address."] - pub fn sequencer_address( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::sequencer_address::SequencerAddress, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "SequencerAddress", - (), - [ - 247u8, 120u8, 203u8, 213u8, 64u8, 34u8, 196u8, 214u8, 252u8, 242u8, 84u8, 7u8, 188u8, 8u8, - 97u8, 163u8, 191u8, 219u8, 78u8, 238u8, 10u8, 201u8, 226u8, 95u8, 21u8, 35u8, 218u8, 107u8, - 117u8, 32u8, 166u8, 2u8, - ], - ) - } - #[doc = " Ensure the sequencer address was updated for this block."] - pub fn seq_addr_update( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::seq_addr_update::SeqAddrUpdate, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "SeqAddrUpdate", - (), - [ - 86u8, 255u8, 158u8, 112u8, 88u8, 3u8, 203u8, 93u8, 42u8, 28u8, 71u8, 231u8, 161u8, 207u8, - 222u8, 62u8, 118u8, 196u8, 132u8, 133u8, 33u8, 226u8, 237u8, 95u8, 251u8, 75u8, 142u8, - 159u8, 110u8, 186u8, 84u8, 189u8, - ], - ) - } - #[doc = " Information about processed L1 Messages"] - #[doc = " Based on Nonce value."] - pub fn l1_messages( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::l1_messages::L1Messages, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Starknet", - "L1Messages", - (), - [ - 134u8, 94u8, 210u8, 225u8, 209u8, 59u8, 193u8, 228u8, 58u8, 14u8, 7u8, 117u8, 204u8, 238u8, - 47u8, 6u8, 101u8, 247u8, 209u8, 127u8, 126u8, 224u8, 8u8, 190u8, 20u8, 126u8, 19u8, 87u8, - 154u8, 11u8, 152u8, 220u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " The gas price"] - pub fn l1_gas_price(&self) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "Starknet", - "L1GasPrice", - [ - 144u8, 104u8, 160u8, 190u8, 161u8, 137u8, 14u8, 77u8, 96u8, 91u8, 140u8, 151u8, 150u8, - 217u8, 205u8, 36u8, 70u8, 81u8, 50u8, 2u8, 79u8, 140u8, 61u8, 37u8, 153u8, 86u8, 60u8, - 74u8, 56u8, 162u8, 239u8, 139u8, - ], - ) - } - #[doc = " A configuration for base priority of unsigned transactions."] - #[doc = ""] - #[doc = " This is exposed so that it can be tuned for particular runtime, when"] - #[doc = " multiple pallets send unsigned transactions."] - pub fn unsigned_priority(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Starknet", - "UnsignedPriority", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - #[doc = " A configuration for longevity of transactions."] - #[doc = ""] - #[doc = " This is exposed so that it can be tuned for particular runtime to"] - #[doc = " set how long transactions are kept in the mempool."] - pub fn transaction_longevity(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Starknet", - "TransactionLongevity", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - #[doc = " A bool to disable transaction fees and make all transactions free"] - pub fn disable_transaction_fee(&self) -> ::subxt::constants::Address<::core::primitive::bool> { - ::subxt::constants::Address::new_static( - "Starknet", - "DisableTransactionFee", - [ - 165u8, 28u8, 112u8, 190u8, 18u8, 129u8, 182u8, 206u8, 237u8, 1u8, 68u8, 252u8, 125u8, - 234u8, 185u8, 50u8, 149u8, 164u8, 47u8, 126u8, 134u8, 100u8, 14u8, 86u8, 209u8, 39u8, 20u8, - 4u8, 233u8, 115u8, 102u8, 131u8, - ], - ) - } - pub fn invoke_tx_max_n_steps(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "Starknet", - "InvokeTxMaxNSteps", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - pub fn validate_max_n_steps(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "Starknet", - "ValidateMaxNSteps", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - pub fn protocol_version(&self) -> ::subxt::constants::Address<::core::primitive::u8> { - ::subxt::constants::Address::new_static( - "Starknet", - "ProtocolVersion", - [ - 141u8, 130u8, 11u8, 35u8, 226u8, 114u8, 92u8, 179u8, 168u8, 110u8, 28u8, 91u8, 221u8, 64u8, - 4u8, 148u8, 201u8, 193u8, 185u8, 66u8, 226u8, 114u8, 97u8, 79u8, 62u8, 212u8, 202u8, 114u8, - 237u8, 228u8, 183u8, 165u8, - ], - ) - } - pub fn chain_id(&self) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "Starknet", - "ChainId", - [ - 115u8, 233u8, 13u8, 223u8, 88u8, 20u8, 202u8, 139u8, 153u8, 28u8, 155u8, 157u8, 224u8, - 66u8, 3u8, 250u8, 23u8, 53u8, 88u8, 168u8, 211u8, 204u8, 122u8, 166u8, 248u8, 23u8, 174u8, - 225u8, 99u8, 108u8, 89u8, 135u8, - ], - ) - } - pub fn max_recursion_depth(&self) -> ::subxt::constants::Address<::core::primitive::u32> { - ::subxt::constants::Address::new_static( - "Starknet", - "MaxRecursionDepth", - [ - 98u8, 252u8, 116u8, 72u8, 26u8, 180u8, 225u8, 83u8, 200u8, 157u8, 125u8, 151u8, 53u8, 76u8, - 168u8, 26u8, 10u8, 9u8, 98u8, 68u8, 9u8, 178u8, 197u8, 113u8, 31u8, 79u8, 200u8, 90u8, - 203u8, 100u8, 41u8, 145u8, - ], - ) - } - pub fn program_hash(&self) -> ::subxt::constants::Address { - ::subxt::constants::Address::new_static( - "Starknet", - "ProgramHash", - [ - 115u8, 233u8, 13u8, 223u8, 88u8, 20u8, 202u8, 139u8, 153u8, 28u8, 155u8, 157u8, 224u8, - 66u8, 3u8, 250u8, 23u8, 53u8, 88u8, 168u8, 211u8, 204u8, 122u8, 166u8, 248u8, 23u8, 174u8, - 225u8, 99u8, 108u8, 89u8, 135u8, - ], - ) - } - } - } - } - pub mod autonomous { - use super::root_mod; - use super::runtime_types; - #[doc = "The pallet custom errors."] - #[doc = "ERRORS"] - pub type Error = runtime_types::pallet_autonomous::pallet::Error; - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub type Call = runtime_types::pallet_autonomous::pallet::Call; - pub mod calls { - use super::root_mod; - use super::runtime_types; - type DispatchError = runtime_types::sp_runtime::DispatchError; - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "See [`Pallet::register_job`]."] - pub struct RegisterJob { - pub user_job: register_job::UserJob, - } - pub mod register_job { - use super::runtime_types; - pub type UserJob = runtime_types::pallet_autonomous::types::UserJob; - } - impl ::subxt::blocks::StaticExtrinsic for RegisterJob { - const PALLET: &'static str = "Autonomous"; - const CALL: &'static str = "register_job"; - } - } - pub struct TransactionApi; - impl TransactionApi { - #[doc = "See [`Pallet::register_job`]."] - pub fn register_job( - &self, - user_job: types::register_job::UserJob, - ) -> ::subxt::tx::Payload { - ::subxt::tx::Payload::new_static( - "Autonomous", - "register_job", - types::RegisterJob { user_job }, - [ - 235u8, 87u8, 42u8, 245u8, 46u8, 177u8, 213u8, 219u8, 227u8, 178u8, 24u8, 223u8, 152u8, - 17u8, 214u8, 8u8, 194u8, 208u8, 94u8, 33u8, 67u8, 146u8, 166u8, 185u8, 210u8, 210u8, 215u8, - 150u8, 3u8, 83u8, 60u8, 104u8, - ], - ) - } - } - } - pub mod storage { - use super::runtime_types; - pub mod types { - use super::runtime_types; - pub mod jobs { - use super::runtime_types; - pub type Jobs = - ::std::vec::Vec<(::core::primitive::u128, runtime_types::pallet_autonomous::types::Job)>; - } - pub mod job_index { - use super::runtime_types; - pub type JobIndex = ::core::primitive::u64; - pub type Param0 = ::core::primitive::u64; - } - pub mod job_executed { - use super::runtime_types; - pub type JobExecuted = ::core::primitive::bool; - pub type Param0 = ::core::primitive::u128; - } - } - pub struct StorageApi; - impl StorageApi { - pub fn jobs( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::jobs::Jobs, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Autonomous", - "Jobs", - (), - [ - 35u8, 29u8, 5u8, 140u8, 69u8, 158u8, 192u8, 208u8, 136u8, 99u8, 8u8, 10u8, 134u8, 89u8, - 94u8, 69u8, 121u8, 204u8, 151u8, 115u8, 41u8, 252u8, 7u8, 214u8, 203u8, 168u8, 229u8, 18u8, - 4u8, 85u8, 175u8, 174u8, - ], - ) - } - pub fn job_index_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::job_index::JobIndex, - (), - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Autonomous", - "JobIndex", - (), - [ - 155u8, 145u8, 200u8, 155u8, 31u8, 32u8, 208u8, 242u8, 124u8, 193u8, 30u8, 200u8, 148u8, - 188u8, 101u8, 78u8, 155u8, 57u8, 120u8, 95u8, 136u8, 94u8, 13u8, 182u8, 98u8, 137u8, 176u8, - 242u8, 17u8, 57u8, 67u8, 220u8, - ], - ) - } - pub fn job_index( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::job_index::JobIndex, - ::subxt::storage::address::Yes, - ::subxt::storage::address::Yes, - (), - > { - ::subxt::storage::address::Address::new_static( - "Autonomous", - "JobIndex", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 155u8, 145u8, 200u8, 155u8, 31u8, 32u8, 208u8, 242u8, 124u8, 193u8, 30u8, 200u8, 148u8, - 188u8, 101u8, 78u8, 155u8, 57u8, 120u8, 95u8, 136u8, 94u8, 13u8, 182u8, 98u8, 137u8, 176u8, - 242u8, 17u8, 57u8, 67u8, 220u8, - ], - ) - } - pub fn job_executed_iter( - &self, - ) -> ::subxt::storage::address::Address< - (), - types::job_executed::JobExecuted, - (), - (), - ::subxt::storage::address::Yes, - > { - ::subxt::storage::address::Address::new_static( - "Autonomous", - "JobExecuted", - (), - [ - 155u8, 52u8, 157u8, 111u8, 102u8, 208u8, 219u8, 177u8, 103u8, 43u8, 3u8, 122u8, 255u8, - 139u8, 17u8, 99u8, 187u8, 148u8, 181u8, 244u8, 132u8, 234u8, 176u8, 156u8, 195u8, 246u8, - 248u8, 157u8, 215u8, 212u8, 194u8, 155u8, - ], - ) - } - pub fn job_executed( - &self, - _0: impl ::std::borrow::Borrow, - ) -> ::subxt::storage::address::Address< - ::subxt::storage::address::StaticStorageKey, - types::job_executed::JobExecuted, - ::subxt::storage::address::Yes, - (), - (), - > { - ::subxt::storage::address::Address::new_static( - "Autonomous", - "JobExecuted", - ::subxt::storage::address::StaticStorageKey::new(_0.borrow()), - [ - 155u8, 52u8, 157u8, 111u8, 102u8, 208u8, 219u8, 177u8, 103u8, 43u8, 3u8, 122u8, 255u8, - 139u8, 17u8, 99u8, 187u8, 148u8, 181u8, 244u8, 132u8, 234u8, 176u8, 156u8, 195u8, 246u8, - 248u8, 157u8, 215u8, 212u8, 194u8, 155u8, - ], - ) - } - } - } - pub mod constants { - use super::runtime_types; - pub struct ConstantsApi; - impl ConstantsApi { - #[doc = " Maximum gas allowed for a job."] - pub fn max_gas(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Autonomous", - "MaxGas", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - #[doc = " Maximum offset allowed for a job. (in blocks)"] - pub fn validity_max_offset(&self) -> ::subxt::constants::Address<::core::primitive::u64> { - ::subxt::constants::Address::new_static( - "Autonomous", - "ValidityMaxOffset", - [ - 128u8, 214u8, 205u8, 242u8, 181u8, 142u8, 124u8, 231u8, 190u8, 146u8, 59u8, 226u8, 157u8, - 101u8, 103u8, 117u8, 249u8, 65u8, 18u8, 191u8, 103u8, 119u8, 53u8, 85u8, 81u8, 96u8, 220u8, - 42u8, 184u8, 239u8, 42u8, 246u8, - ], - ) - } - } - } - } - pub mod runtime_types { - use super::runtime_types; - pub mod blockifier { - use super::runtime_types; - pub mod execution { - use super::runtime_types; - pub mod contract_class { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum ContractClass { - #[codec(index = 0)] - V0(runtime_types::blockifier::execution::contract_class::ContractClassV0), - #[codec(index = 1)] - V1(runtime_types::blockifier::execution::contract_class::ContractClassV1), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassV0( - pub runtime_types::blockifier::execution::contract_class::ContractClassV0Inner, - ); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassV0Inner(pub ::std::vec::Vec<::core::primitive::u8>); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassV1( - pub runtime_types::blockifier::execution::contract_class::ContractClassV1Inner, - ); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractClassV1Inner(pub ::std::vec::Vec<::core::primitive::u8>); - } - } - pub mod state { - use super::runtime_types; - pub mod cached_state { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CommitmentStateDiff(pub ::std::vec::Vec<::core::primitive::u8>); - } - } - pub mod transaction { - use super::runtime_types; - pub mod objects { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct TransactionExecutionInfo(pub ::std::vec::Vec<::core::primitive::u8>); - } - } - } - pub mod bounded_collections { - use super::runtime_types; - pub mod bounded_vec { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BoundedVec<_0>(pub ::std::vec::Vec<_0>); - } - pub mod weak_bounded_vec { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WeakBoundedVec<_0>(pub ::std::vec::Vec<_0>); - } - } - pub mod finality_grandpa { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Equivocation<_0, _1, _2> { - pub round_number: ::core::primitive::u64, - pub identity: _0, - pub first: (_1, _2), - pub second: (_1, _2), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Precommit<_0, _1> { - pub target_hash: _0, - pub target_number: _1, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Prevote<_0, _1> { - pub target_hash: _0, - pub target_number: _1, - } - } - pub mod frame_support { - use super::runtime_types; - pub mod dispatch { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum DispatchClass { - #[codec(index = 0)] - Normal, - #[codec(index = 1)] - Operational, - #[codec(index = 2)] - Mandatory, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DispatchInfo { - pub weight: runtime_types::sp_weights::weight_v2::Weight, - pub class: runtime_types::frame_support::dispatch::DispatchClass, - pub pays_fee: runtime_types::frame_support::dispatch::Pays, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Pays { - #[codec(index = 0)] - Yes, - #[codec(index = 1)] - No, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct PerDispatchClass<_0> { - pub normal: _0, - pub operational: _0, - pub mandatory: _0, - } - } - } - pub mod frame_system { - use super::runtime_types; - pub mod extensions { - use super::runtime_types; - pub mod check_genesis { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckGenesis; - } - pub mod check_mortality { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckMortality(pub runtime_types::sp_runtime::generic::era::Era); - } - pub mod check_non_zero_sender { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckNonZeroSender; - } - pub mod check_nonce { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckNonce(#[codec(compact)] pub ::core::primitive::u32); - } - pub mod check_spec_version { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckSpecVersion; - } - pub mod check_tx_version { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckTxVersion; - } - pub mod check_weight { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckWeight; - } - } - pub mod limits { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BlockLength { - pub max: runtime_types::frame_support::dispatch::PerDispatchClass<::core::primitive::u32>, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BlockWeights { - pub base_block: runtime_types::sp_weights::weight_v2::Weight, - pub max_block: runtime_types::sp_weights::weight_v2::Weight, - pub per_class: runtime_types::frame_support::dispatch::PerDispatchClass< - runtime_types::frame_system::limits::WeightsPerClass, - >, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct WeightsPerClass { - pub base_extrinsic: runtime_types::sp_weights::weight_v2::Weight, - pub max_extrinsic: ::core::option::Option, - pub max_total: ::core::option::Option, - pub reserved: ::core::option::Option, - } - } - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::remark`]."] - remark { remark: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 1)] - #[doc = "See [`Pallet::set_heap_pages`]."] - set_heap_pages { pages: ::core::primitive::u64 }, - #[codec(index = 2)] - #[doc = "See [`Pallet::set_code`]."] - set_code { code: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 3)] - #[doc = "See [`Pallet::set_code_without_checks`]."] - set_code_without_checks { code: ::std::vec::Vec<::core::primitive::u8> }, - #[codec(index = 4)] - #[doc = "See [`Pallet::set_storage`]."] - set_storage { - items: ::std::vec::Vec<( - ::std::vec::Vec<::core::primitive::u8>, - ::std::vec::Vec<::core::primitive::u8>, - )>, - }, - #[codec(index = 5)] - #[doc = "See [`Pallet::kill_storage`]."] - kill_storage { keys: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>> }, - #[codec(index = 6)] - #[doc = "See [`Pallet::kill_prefix`]."] - kill_prefix { prefix: ::std::vec::Vec<::core::primitive::u8>, subkeys: ::core::primitive::u32 }, - #[codec(index = 7)] - #[doc = "See [`Pallet::remark_with_event`]."] - remark_with_event { remark: ::std::vec::Vec<::core::primitive::u8> }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Error for the System pallet"] - pub enum Error { - #[codec(index = 0)] - #[doc = "The name of specification does not match between the current runtime"] - #[doc = "and the new runtime."] - InvalidSpecName, - #[codec(index = 1)] - #[doc = "The specification version is not allowed to decrease between the current runtime"] - #[doc = "and the new runtime."] - SpecVersionNeedsToIncrease, - #[codec(index = 2)] - #[doc = "Failed to extract the runtime version from the new runtime."] - #[doc = ""] - #[doc = "Either calling `Core_version` or decoding `RuntimeVersion` failed."] - FailedToExtractRuntimeVersion, - #[codec(index = 3)] - #[doc = "Suicide called when the account has non-default composite data."] - NonDefaultComposite, - #[codec(index = 4)] - #[doc = "There is a non-zero reference count preventing the account from being purged."] - NonZeroRefCount, - #[codec(index = 5)] - #[doc = "The origin filter prevent the call to be dispatched."] - CallFiltered, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Event for the System pallet."] - pub enum Event { - #[codec(index = 0)] - #[doc = "An extrinsic completed successfully."] - ExtrinsicSuccess { dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo }, - #[codec(index = 1)] - #[doc = "An extrinsic failed."] - ExtrinsicFailed { - dispatch_error: runtime_types::sp_runtime::DispatchError, - dispatch_info: runtime_types::frame_support::dispatch::DispatchInfo, - }, - #[codec(index = 2)] - #[doc = "`:code` was updated."] - CodeUpdated, - #[codec(index = 3)] - #[doc = "A new account was created."] - NewAccount { account: ::subxt::utils::AccountId32 }, - #[codec(index = 4)] - #[doc = "An account was reaped."] - KilledAccount { account: ::subxt::utils::AccountId32 }, - #[codec(index = 5)] - #[doc = "On on-chain remark happened."] - Remarked { sender: ::subxt::utils::AccountId32, hash: ::subxt::utils::H256 }, - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct AccountInfo<_0, _1> { - pub nonce: _0, - pub consumers: ::core::primitive::u32, - pub providers: ::core::primitive::u32, - pub sufficients: ::core::primitive::u32, - pub data: _1, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EventRecord<_0, _1> { - pub phase: runtime_types::frame_system::Phase, - pub event: _0, - pub topics: ::std::vec::Vec<_1>, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct LastRuntimeUpgradeInfo { - #[codec(compact)] - pub spec_version: ::core::primitive::u32, - pub spec_name: ::std::string::String, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Phase { - #[codec(index = 0)] - ApplyExtrinsic(::core::primitive::u32), - #[codec(index = 1)] - Finalization, - #[codec(index = 2)] - Initialization, - } - } - pub mod madara_runtime { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Runtime; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeCall { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Call), - #[codec(index = 1)] - Timestamp(runtime_types::pallet_timestamp::pallet::Call), - #[codec(index = 3)] - Grandpa(runtime_types::pallet_grandpa::pallet::Call), - #[codec(index = 4)] - Starknet(runtime_types::pallet_starknet::pallet::Call), - #[codec(index = 5)] - Autonomous(runtime_types::pallet_autonomous::pallet::Call), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeError { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Error), - #[codec(index = 3)] - Grandpa(runtime_types::pallet_grandpa::pallet::Error), - #[codec(index = 4)] - Starknet(runtime_types::pallet_starknet::pallet::Error), - #[codec(index = 5)] - Autonomous(runtime_types::pallet_autonomous::pallet::Error), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum RuntimeEvent { - #[codec(index = 0)] - System(runtime_types::frame_system::pallet::Event), - #[codec(index = 3)] - Grandpa(runtime_types::pallet_grandpa::pallet::Event), - } - } - pub mod mp_fee { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ResourcePrice { - pub price_in_strk: ::core::option::Option<::core::primitive::u64>, - pub price_in_wei: ::core::primitive::u128, - } - } - pub mod mp_felt { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Felt252Wrapper(pub [::core::primitive::u8; 32usize]); - } - pub mod mp_simulations { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct PlaceHolderErrorTypeForFailedStarknetExecution; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SimulationFlags { - pub skip_validate: ::core::primitive::bool, - pub skip_fee_charge: ::core::primitive::bool, - } - } - pub mod mp_transactions { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum DeclareTransaction { - #[codec(index = 0)] - V0(runtime_types::mp_transactions::DeclareTransactionV0), - #[codec(index = 1)] - V1(runtime_types::mp_transactions::DeclareTransactionV1), - #[codec(index = 2)] - V2(runtime_types::mp_transactions::DeclareTransactionV2), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DeclareTransactionV0 { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub nonce: runtime_types::mp_felt::Felt252Wrapper, - pub class_hash: runtime_types::mp_felt::Felt252Wrapper, - pub sender_address: runtime_types::mp_felt::Felt252Wrapper, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DeclareTransactionV1 { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub nonce: runtime_types::mp_felt::Felt252Wrapper, - pub class_hash: runtime_types::mp_felt::Felt252Wrapper, - pub sender_address: runtime_types::mp_felt::Felt252Wrapper, - pub offset_version: ::core::primitive::bool, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DeclareTransactionV2 { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub nonce: runtime_types::mp_felt::Felt252Wrapper, - pub class_hash: runtime_types::mp_felt::Felt252Wrapper, - pub sender_address: runtime_types::mp_felt::Felt252Wrapper, - pub compiled_class_hash: runtime_types::mp_felt::Felt252Wrapper, - pub offset_version: ::core::primitive::bool, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct DeployAccountTransaction { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub nonce: runtime_types::mp_felt::Felt252Wrapper, - pub contract_address_salt: runtime_types::mp_felt::Felt252Wrapper, - pub constructor_calldata: ::std::vec::Vec, - pub class_hash: runtime_types::mp_felt::Felt252Wrapper, - pub offset_version: ::core::primitive::bool, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct HandleL1MessageTransaction { - pub nonce: ::core::primitive::u64, - pub contract_address: runtime_types::mp_felt::Felt252Wrapper, - pub entry_point_selector: runtime_types::mp_felt::Felt252Wrapper, - pub calldata: ::std::vec::Vec, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum InvokeTransaction { - #[codec(index = 0)] - V0(runtime_types::mp_transactions::InvokeTransactionV0), - #[codec(index = 1)] - V1(runtime_types::mp_transactions::InvokeTransactionV1), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct InvokeTransactionV0 { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub contract_address: runtime_types::mp_felt::Felt252Wrapper, - pub entry_point_selector: runtime_types::mp_felt::Felt252Wrapper, - pub calldata: ::std::vec::Vec, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct InvokeTransactionV1 { - pub max_fee: ::core::primitive::u128, - pub signature: ::std::vec::Vec, - pub nonce: runtime_types::mp_felt::Felt252Wrapper, - pub sender_address: runtime_types::mp_felt::Felt252Wrapper, - pub calldata: ::std::vec::Vec, - pub offset_version: ::core::primitive::bool, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Transaction { - #[codec(index = 0)] - Declare( - runtime_types::mp_transactions::DeclareTransaction, - runtime_types::blockifier::execution::contract_class::ContractClass, - ), - #[codec(index = 1)] - DeployAccount(runtime_types::mp_transactions::DeployAccountTransaction), - #[codec(index = 2)] - Invoke(runtime_types::mp_transactions::InvokeTransaction), - #[codec(index = 3)] - L1Handler(runtime_types::mp_transactions::HandleL1MessageTransaction), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum UserOrL1HandlerTransaction { - #[codec(index = 0)] - User(runtime_types::mp_transactions::UserTransaction), - #[codec(index = 1)] - L1Handler( - runtime_types::mp_transactions::HandleL1MessageTransaction, - runtime_types::starknet_api::transaction::Fee, - ), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum UserTransaction { - #[codec(index = 0)] - Declare( - runtime_types::mp_transactions::DeclareTransaction, - runtime_types::blockifier::execution::contract_class::ContractClass, - ), - #[codec(index = 1)] - DeployAccount(runtime_types::mp_transactions::DeployAccountTransaction), - #[codec(index = 2)] - Invoke(runtime_types::mp_transactions::InvokeTransaction), - } - } - pub mod pallet_autonomous { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::register_job`]."] - register_job { user_job: runtime_types::pallet_autonomous::types::UserJob }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The pallet custom errors."] - #[doc = "ERRORS"] - pub enum Error { - #[codec(index = 0)] - JobAlreadyExecuted, - #[codec(index = 1)] - InvalidJob, - #[codec(index = 2)] - InvalidJobFrequency, - #[codec(index = 3)] - JobsLimitReached, - #[codec(index = 4)] - JobAlreadyRegistered, - #[codec(index = 5)] - JobGasLimitExceeded, - } - } - pub mod types { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Job { - pub emission_block_number: ::core::primitive::u64, - pub index: ::core::primitive::u64, - pub max_gas: ::core::primitive::u64, - pub actual_gas: ::core::primitive::u64, - pub calls: ::std::vec::Vec, - pub policy: runtime_types::pallet_autonomous::types::Policy, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Policy { - pub validity_start: ::core::primitive::u64, - pub validity_end: ::core::primitive::u64, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct UserJob { - pub calls: ::std::vec::Vec<::std::vec::Vec>, - pub policy: runtime_types::pallet_autonomous::types::UserPolicy, - } - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct UserPolicy { - pub frequency: ::core::primitive::u64, - } - } - } - pub mod pallet_grandpa { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::report_equivocation`]."] - report_equivocation { - equivocation_proof: ::std::boxed::Box< - runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::utils::H256, - ::core::primitive::u32, - >, - >, - key_owner_proof: runtime_types::sp_core::Void, - }, - #[codec(index = 1)] - #[doc = "See [`Pallet::report_equivocation_unsigned`]."] - report_equivocation_unsigned { - equivocation_proof: ::std::boxed::Box< - runtime_types::sp_consensus_grandpa::EquivocationProof< - ::subxt::utils::H256, - ::core::primitive::u32, - >, - >, - key_owner_proof: runtime_types::sp_core::Void, - }, - #[codec(index = 2)] - #[doc = "See [`Pallet::note_stalled`]."] - note_stalled { delay: ::core::primitive::u32, best_finalized_block_number: ::core::primitive::u32 }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Error` enum of this pallet."] - pub enum Error { - #[codec(index = 0)] - #[doc = "Attempt to signal GRANDPA pause when the authority set isn't live"] - #[doc = "(either paused or already pending pause)."] - PauseFailed, - #[codec(index = 1)] - #[doc = "Attempt to signal GRANDPA resume when the authority set isn't paused"] - #[doc = "(either live or already pending resume)."] - ResumeFailed, - #[codec(index = 2)] - #[doc = "Attempt to signal GRANDPA change with one already pending."] - ChangePending, - #[codec(index = 3)] - #[doc = "Cannot signal forced change so soon after last."] - TooSoon, - #[codec(index = 4)] - #[doc = "A key ownership proof provided as part of an equivocation report is invalid."] - InvalidKeyOwnershipProof, - #[codec(index = 5)] - #[doc = "An equivocation proof provided as part of an equivocation report is invalid."] - InvalidEquivocationProof, - #[codec(index = 6)] - #[doc = "A given equivocation report is valid but already previously reported."] - DuplicateOffenceReport, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The `Event` enum of this pallet"] - pub enum Event { - #[codec(index = 0)] - #[doc = "New authority set has been applied."] - NewAuthorities { - authority_set: - ::std::vec::Vec<(runtime_types::sp_consensus_grandpa::app::Public, ::core::primitive::u64)>, - }, - #[codec(index = 1)] - #[doc = "Current authority set has been paused."] - Paused, - #[codec(index = 2)] - #[doc = "Current authority set has been resumed."] - Resumed, - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StoredPendingChange<_0> { - pub scheduled_at: _0, - pub delay: _0, - pub next_authorities: runtime_types::bounded_collections::weak_bounded_vec::WeakBoundedVec<( - runtime_types::sp_consensus_grandpa::app::Public, - ::core::primitive::u64, - )>, - pub forced: ::core::option::Option<_0>, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum StoredState<_0> { - #[codec(index = 0)] - Live, - #[codec(index = 1)] - PendingPause { scheduled_at: _0, delay: _0 }, - #[codec(index = 2)] - Paused, - #[codec(index = 3)] - PendingResume { scheduled_at: _0, delay: _0 }, - } - } - pub mod pallet_starknet { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The Starknet pallet external functions."] - #[doc = "Dispatchable functions allows users to interact with the pallet and invoke state changes."] - #[doc = "These functions materialize as \"extrinsics\", which are often compared to transactions."] - #[doc = "Dispatchable functions must be annotated with a weight and must return a DispatchResult."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::set_sequencer_address`]."] - set_sequencer_address { addr: [::core::primitive::u8; 32usize] }, - #[codec(index = 1)] - #[doc = "See [`Pallet::invoke`]."] - invoke { transaction: runtime_types::mp_transactions::InvokeTransaction }, - #[codec(index = 2)] - #[doc = "See [`Pallet::declare`]."] - declare { - transaction: runtime_types::mp_transactions::DeclareTransaction, - contract_class: runtime_types::blockifier::execution::contract_class::ContractClass, - }, - #[codec(index = 3)] - #[doc = "See [`Pallet::deploy_account`]."] - deploy_account { transaction: runtime_types::mp_transactions::DeployAccountTransaction }, - #[codec(index = 4)] - #[doc = "See [`Pallet::consume_l1_message`]."] - consume_l1_message { - transaction: runtime_types::mp_transactions::HandleL1MessageTransaction, - paid_fee_on_l1: runtime_types::starknet_api::transaction::Fee, - }, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "The Starknet pallet custom errors."] - #[doc = "ERRORS"] - pub enum Error { - #[codec(index = 0)] - AccountNotDeployed, - #[codec(index = 1)] - TransactionExecutionFailed, - #[codec(index = 2)] - ClassHashAlreadyDeclared, - #[codec(index = 3)] - ContractClassHashUnknown, - #[codec(index = 4)] - ContractClassAlreadyAssociated, - #[codec(index = 5)] - ContractClassMustBeSpecified, - #[codec(index = 6)] - AccountAlreadyDeployed, - #[codec(index = 7)] - ContractAddressAlreadyAssociated, - #[codec(index = 8)] - InvalidContractClass, - #[codec(index = 9)] - TooManyEmittedStarknetEvents, - #[codec(index = 10)] - StateReaderError, - #[codec(index = 11)] - EmitEventError, - #[codec(index = 12)] - StateDiffError, - #[codec(index = 13)] - ContractNotFound, - #[codec(index = 14)] - TransactionConversionError, - #[codec(index = 15)] - SequencerAddressNotValid, - #[codec(index = 16)] - InvalidContractClassForThisDeclareVersion, - #[codec(index = 17)] - Unimplemented, - #[codec(index = 18)] - MissingRevertReason, - #[codec(index = 19)] - MissingCallInfo, - #[codec(index = 20)] - FailedToCreateATransactionalStorageExecution, - #[codec(index = 21)] - L1MessageAlreadyExecuted, - #[codec(index = 22)] - MissingL1GasUsage, - } - } - } - pub mod pallet_starknet_runtime_api { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct BlockContext { - pub chain_id: ::std::string::String, - pub block_number: ::core::primitive::u64, - pub block_timestamp: ::core::primitive::u64, - pub sequencer_address: runtime_types::starknet_api::api_core::ContractAddress, - pub fee_token_address: runtime_types::starknet_api::api_core::ContractAddress, - pub vm_resource_fee_cost: - ::std::vec::Vec<(::std::string::String, runtime_types::sp_arithmetic::fixed_point::FixedU128)>, - pub gas_price: ::core::primitive::u128, - pub invoke_tx_max_n_steps: ::core::primitive::u32, - pub validate_max_n_steps: ::core::primitive::u32, - pub max_recursion_depth: ::core::primitive::u32, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum StarknetTransactionExecutionError { - #[codec(index = 0)] - ContractNotFound, - #[codec(index = 1)] - ClassAlreadyDeclared, - #[codec(index = 2)] - ClassHashNotFound, - #[codec(index = 3)] - InvalidContractClass, - #[codec(index = 4)] - ContractError, - } - } - pub mod pallet_timestamp { - use super::runtime_types; - pub mod pallet { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - #[doc = "Contains a variant per dispatchable extrinsic that this pallet has."] - pub enum Call { - #[codec(index = 0)] - #[doc = "See [`Pallet::set`]."] - set { - #[codec(compact)] - now: ::core::primitive::u64, - }, - } - } - } - pub mod sp_arithmetic { - use super::runtime_types; - pub mod fixed_point { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct FixedU128(pub ::core::primitive::u128); - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum ArithmeticError { - #[codec(index = 0)] - Underflow, - #[codec(index = 1)] - Overflow, - #[codec(index = 2)] - DivisionByZero, - } - } - pub mod sp_consensus_aura { - use super::runtime_types; - pub mod sr25519 { - use super::runtime_types; - pub mod app_sr25519 { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Public(pub runtime_types::sp_core::sr25519::Public); - } - } - } - pub mod sp_consensus_grandpa { - use super::runtime_types; - pub mod app { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Public(pub runtime_types::sp_core::ed25519::Public); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Signature(pub runtime_types::sp_core::ed25519::Signature); - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Equivocation<_0, _1> { - #[codec(index = 0)] - Prevote( - runtime_types::finality_grandpa::Equivocation< - runtime_types::sp_consensus_grandpa::app::Public, - runtime_types::finality_grandpa::Prevote<_0, _1>, - runtime_types::sp_consensus_grandpa::app::Signature, - >, - ), - #[codec(index = 1)] - Precommit( - runtime_types::finality_grandpa::Equivocation< - runtime_types::sp_consensus_grandpa::app::Public, - runtime_types::finality_grandpa::Precommit<_0, _1>, - runtime_types::sp_consensus_grandpa::app::Signature, - >, - ), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EquivocationProof<_0, _1> { - pub set_id: ::core::primitive::u64, - pub equivocation: runtime_types::sp_consensus_grandpa::Equivocation<_0, _1>, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct OpaqueKeyOwnershipProof(pub ::std::vec::Vec<::core::primitive::u8>); - } - pub mod sp_consensus_slots { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Slot(pub ::core::primitive::u64); - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct SlotDuration(pub ::core::primitive::u64); - } - pub mod sp_core { - use super::runtime_types; - pub mod crypto { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct KeyTypeId(pub [::core::primitive::u8; 4usize]); - } - pub mod ecdsa { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Signature(pub [::core::primitive::u8; 65usize]); - } - pub mod ed25519 { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Public(pub [::core::primitive::u8; 32usize]); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Signature(pub [::core::primitive::u8; 64usize]); - } - pub mod sr25519 { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Public(pub [::core::primitive::u8; 32usize]); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Signature(pub [::core::primitive::u8; 64usize]); - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct OpaqueMetadata(pub ::std::vec::Vec<::core::primitive::u8>); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Void {} - } - pub mod sp_inherents { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CheckInherentsResult { - pub okay: ::core::primitive::bool, - pub fatal_error: ::core::primitive::bool, - pub errors: runtime_types::sp_inherents::InherentData, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct InherentData { - pub data: - ::subxt::utils::KeyedVec<[::core::primitive::u8; 8usize], ::std::vec::Vec<::core::primitive::u8>>, - } - } - pub mod sp_runtime { - use super::runtime_types; - pub mod generic { - use super::runtime_types; - pub mod block { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Block<_0, _1> { - pub header: _0, - pub extrinsics: ::std::vec::Vec<_1>, - } - } - pub mod digest { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Digest { - pub logs: ::std::vec::Vec, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum DigestItem { - #[codec(index = 6)] - PreRuntime([::core::primitive::u8; 4usize], ::std::vec::Vec<::core::primitive::u8>), - #[codec(index = 4)] - Consensus([::core::primitive::u8; 4usize], ::std::vec::Vec<::core::primitive::u8>), - #[codec(index = 5)] - Seal([::core::primitive::u8; 4usize], ::std::vec::Vec<::core::primitive::u8>), - #[codec(index = 0)] - Other(::std::vec::Vec<::core::primitive::u8>), - #[codec(index = 8)] - RuntimeEnvironmentUpdated, - } - } - pub mod era { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum Era { - #[codec(index = 0)] - Immortal, - #[codec(index = 1)] - Mortal1(::core::primitive::u8), - #[codec(index = 2)] - Mortal2(::core::primitive::u8), - #[codec(index = 3)] - Mortal3(::core::primitive::u8), - #[codec(index = 4)] - Mortal4(::core::primitive::u8), - #[codec(index = 5)] - Mortal5(::core::primitive::u8), - #[codec(index = 6)] - Mortal6(::core::primitive::u8), - #[codec(index = 7)] - Mortal7(::core::primitive::u8), - #[codec(index = 8)] - Mortal8(::core::primitive::u8), - #[codec(index = 9)] - Mortal9(::core::primitive::u8), - #[codec(index = 10)] - Mortal10(::core::primitive::u8), - #[codec(index = 11)] - Mortal11(::core::primitive::u8), - #[codec(index = 12)] - Mortal12(::core::primitive::u8), - #[codec(index = 13)] - Mortal13(::core::primitive::u8), - #[codec(index = 14)] - Mortal14(::core::primitive::u8), - #[codec(index = 15)] - Mortal15(::core::primitive::u8), - #[codec(index = 16)] - Mortal16(::core::primitive::u8), - #[codec(index = 17)] - Mortal17(::core::primitive::u8), - #[codec(index = 18)] - Mortal18(::core::primitive::u8), - #[codec(index = 19)] - Mortal19(::core::primitive::u8), - #[codec(index = 20)] - Mortal20(::core::primitive::u8), - #[codec(index = 21)] - Mortal21(::core::primitive::u8), - #[codec(index = 22)] - Mortal22(::core::primitive::u8), - #[codec(index = 23)] - Mortal23(::core::primitive::u8), - #[codec(index = 24)] - Mortal24(::core::primitive::u8), - #[codec(index = 25)] - Mortal25(::core::primitive::u8), - #[codec(index = 26)] - Mortal26(::core::primitive::u8), - #[codec(index = 27)] - Mortal27(::core::primitive::u8), - #[codec(index = 28)] - Mortal28(::core::primitive::u8), - #[codec(index = 29)] - Mortal29(::core::primitive::u8), - #[codec(index = 30)] - Mortal30(::core::primitive::u8), - #[codec(index = 31)] - Mortal31(::core::primitive::u8), - #[codec(index = 32)] - Mortal32(::core::primitive::u8), - #[codec(index = 33)] - Mortal33(::core::primitive::u8), - #[codec(index = 34)] - Mortal34(::core::primitive::u8), - #[codec(index = 35)] - Mortal35(::core::primitive::u8), - #[codec(index = 36)] - Mortal36(::core::primitive::u8), - #[codec(index = 37)] - Mortal37(::core::primitive::u8), - #[codec(index = 38)] - Mortal38(::core::primitive::u8), - #[codec(index = 39)] - Mortal39(::core::primitive::u8), - #[codec(index = 40)] - Mortal40(::core::primitive::u8), - #[codec(index = 41)] - Mortal41(::core::primitive::u8), - #[codec(index = 42)] - Mortal42(::core::primitive::u8), - #[codec(index = 43)] - Mortal43(::core::primitive::u8), - #[codec(index = 44)] - Mortal44(::core::primitive::u8), - #[codec(index = 45)] - Mortal45(::core::primitive::u8), - #[codec(index = 46)] - Mortal46(::core::primitive::u8), - #[codec(index = 47)] - Mortal47(::core::primitive::u8), - #[codec(index = 48)] - Mortal48(::core::primitive::u8), - #[codec(index = 49)] - Mortal49(::core::primitive::u8), - #[codec(index = 50)] - Mortal50(::core::primitive::u8), - #[codec(index = 51)] - Mortal51(::core::primitive::u8), - #[codec(index = 52)] - Mortal52(::core::primitive::u8), - #[codec(index = 53)] - Mortal53(::core::primitive::u8), - #[codec(index = 54)] - Mortal54(::core::primitive::u8), - #[codec(index = 55)] - Mortal55(::core::primitive::u8), - #[codec(index = 56)] - Mortal56(::core::primitive::u8), - #[codec(index = 57)] - Mortal57(::core::primitive::u8), - #[codec(index = 58)] - Mortal58(::core::primitive::u8), - #[codec(index = 59)] - Mortal59(::core::primitive::u8), - #[codec(index = 60)] - Mortal60(::core::primitive::u8), - #[codec(index = 61)] - Mortal61(::core::primitive::u8), - #[codec(index = 62)] - Mortal62(::core::primitive::u8), - #[codec(index = 63)] - Mortal63(::core::primitive::u8), - #[codec(index = 64)] - Mortal64(::core::primitive::u8), - #[codec(index = 65)] - Mortal65(::core::primitive::u8), - #[codec(index = 66)] - Mortal66(::core::primitive::u8), - #[codec(index = 67)] - Mortal67(::core::primitive::u8), - #[codec(index = 68)] - Mortal68(::core::primitive::u8), - #[codec(index = 69)] - Mortal69(::core::primitive::u8), - #[codec(index = 70)] - Mortal70(::core::primitive::u8), - #[codec(index = 71)] - Mortal71(::core::primitive::u8), - #[codec(index = 72)] - Mortal72(::core::primitive::u8), - #[codec(index = 73)] - Mortal73(::core::primitive::u8), - #[codec(index = 74)] - Mortal74(::core::primitive::u8), - #[codec(index = 75)] - Mortal75(::core::primitive::u8), - #[codec(index = 76)] - Mortal76(::core::primitive::u8), - #[codec(index = 77)] - Mortal77(::core::primitive::u8), - #[codec(index = 78)] - Mortal78(::core::primitive::u8), - #[codec(index = 79)] - Mortal79(::core::primitive::u8), - #[codec(index = 80)] - Mortal80(::core::primitive::u8), - #[codec(index = 81)] - Mortal81(::core::primitive::u8), - #[codec(index = 82)] - Mortal82(::core::primitive::u8), - #[codec(index = 83)] - Mortal83(::core::primitive::u8), - #[codec(index = 84)] - Mortal84(::core::primitive::u8), - #[codec(index = 85)] - Mortal85(::core::primitive::u8), - #[codec(index = 86)] - Mortal86(::core::primitive::u8), - #[codec(index = 87)] - Mortal87(::core::primitive::u8), - #[codec(index = 88)] - Mortal88(::core::primitive::u8), - #[codec(index = 89)] - Mortal89(::core::primitive::u8), - #[codec(index = 90)] - Mortal90(::core::primitive::u8), - #[codec(index = 91)] - Mortal91(::core::primitive::u8), - #[codec(index = 92)] - Mortal92(::core::primitive::u8), - #[codec(index = 93)] - Mortal93(::core::primitive::u8), - #[codec(index = 94)] - Mortal94(::core::primitive::u8), - #[codec(index = 95)] - Mortal95(::core::primitive::u8), - #[codec(index = 96)] - Mortal96(::core::primitive::u8), - #[codec(index = 97)] - Mortal97(::core::primitive::u8), - #[codec(index = 98)] - Mortal98(::core::primitive::u8), - #[codec(index = 99)] - Mortal99(::core::primitive::u8), - #[codec(index = 100)] - Mortal100(::core::primitive::u8), - #[codec(index = 101)] - Mortal101(::core::primitive::u8), - #[codec(index = 102)] - Mortal102(::core::primitive::u8), - #[codec(index = 103)] - Mortal103(::core::primitive::u8), - #[codec(index = 104)] - Mortal104(::core::primitive::u8), - #[codec(index = 105)] - Mortal105(::core::primitive::u8), - #[codec(index = 106)] - Mortal106(::core::primitive::u8), - #[codec(index = 107)] - Mortal107(::core::primitive::u8), - #[codec(index = 108)] - Mortal108(::core::primitive::u8), - #[codec(index = 109)] - Mortal109(::core::primitive::u8), - #[codec(index = 110)] - Mortal110(::core::primitive::u8), - #[codec(index = 111)] - Mortal111(::core::primitive::u8), - #[codec(index = 112)] - Mortal112(::core::primitive::u8), - #[codec(index = 113)] - Mortal113(::core::primitive::u8), - #[codec(index = 114)] - Mortal114(::core::primitive::u8), - #[codec(index = 115)] - Mortal115(::core::primitive::u8), - #[codec(index = 116)] - Mortal116(::core::primitive::u8), - #[codec(index = 117)] - Mortal117(::core::primitive::u8), - #[codec(index = 118)] - Mortal118(::core::primitive::u8), - #[codec(index = 119)] - Mortal119(::core::primitive::u8), - #[codec(index = 120)] - Mortal120(::core::primitive::u8), - #[codec(index = 121)] - Mortal121(::core::primitive::u8), - #[codec(index = 122)] - Mortal122(::core::primitive::u8), - #[codec(index = 123)] - Mortal123(::core::primitive::u8), - #[codec(index = 124)] - Mortal124(::core::primitive::u8), - #[codec(index = 125)] - Mortal125(::core::primitive::u8), - #[codec(index = 126)] - Mortal126(::core::primitive::u8), - #[codec(index = 127)] - Mortal127(::core::primitive::u8), - #[codec(index = 128)] - Mortal128(::core::primitive::u8), - #[codec(index = 129)] - Mortal129(::core::primitive::u8), - #[codec(index = 130)] - Mortal130(::core::primitive::u8), - #[codec(index = 131)] - Mortal131(::core::primitive::u8), - #[codec(index = 132)] - Mortal132(::core::primitive::u8), - #[codec(index = 133)] - Mortal133(::core::primitive::u8), - #[codec(index = 134)] - Mortal134(::core::primitive::u8), - #[codec(index = 135)] - Mortal135(::core::primitive::u8), - #[codec(index = 136)] - Mortal136(::core::primitive::u8), - #[codec(index = 137)] - Mortal137(::core::primitive::u8), - #[codec(index = 138)] - Mortal138(::core::primitive::u8), - #[codec(index = 139)] - Mortal139(::core::primitive::u8), - #[codec(index = 140)] - Mortal140(::core::primitive::u8), - #[codec(index = 141)] - Mortal141(::core::primitive::u8), - #[codec(index = 142)] - Mortal142(::core::primitive::u8), - #[codec(index = 143)] - Mortal143(::core::primitive::u8), - #[codec(index = 144)] - Mortal144(::core::primitive::u8), - #[codec(index = 145)] - Mortal145(::core::primitive::u8), - #[codec(index = 146)] - Mortal146(::core::primitive::u8), - #[codec(index = 147)] - Mortal147(::core::primitive::u8), - #[codec(index = 148)] - Mortal148(::core::primitive::u8), - #[codec(index = 149)] - Mortal149(::core::primitive::u8), - #[codec(index = 150)] - Mortal150(::core::primitive::u8), - #[codec(index = 151)] - Mortal151(::core::primitive::u8), - #[codec(index = 152)] - Mortal152(::core::primitive::u8), - #[codec(index = 153)] - Mortal153(::core::primitive::u8), - #[codec(index = 154)] - Mortal154(::core::primitive::u8), - #[codec(index = 155)] - Mortal155(::core::primitive::u8), - #[codec(index = 156)] - Mortal156(::core::primitive::u8), - #[codec(index = 157)] - Mortal157(::core::primitive::u8), - #[codec(index = 158)] - Mortal158(::core::primitive::u8), - #[codec(index = 159)] - Mortal159(::core::primitive::u8), - #[codec(index = 160)] - Mortal160(::core::primitive::u8), - #[codec(index = 161)] - Mortal161(::core::primitive::u8), - #[codec(index = 162)] - Mortal162(::core::primitive::u8), - #[codec(index = 163)] - Mortal163(::core::primitive::u8), - #[codec(index = 164)] - Mortal164(::core::primitive::u8), - #[codec(index = 165)] - Mortal165(::core::primitive::u8), - #[codec(index = 166)] - Mortal166(::core::primitive::u8), - #[codec(index = 167)] - Mortal167(::core::primitive::u8), - #[codec(index = 168)] - Mortal168(::core::primitive::u8), - #[codec(index = 169)] - Mortal169(::core::primitive::u8), - #[codec(index = 170)] - Mortal170(::core::primitive::u8), - #[codec(index = 171)] - Mortal171(::core::primitive::u8), - #[codec(index = 172)] - Mortal172(::core::primitive::u8), - #[codec(index = 173)] - Mortal173(::core::primitive::u8), - #[codec(index = 174)] - Mortal174(::core::primitive::u8), - #[codec(index = 175)] - Mortal175(::core::primitive::u8), - #[codec(index = 176)] - Mortal176(::core::primitive::u8), - #[codec(index = 177)] - Mortal177(::core::primitive::u8), - #[codec(index = 178)] - Mortal178(::core::primitive::u8), - #[codec(index = 179)] - Mortal179(::core::primitive::u8), - #[codec(index = 180)] - Mortal180(::core::primitive::u8), - #[codec(index = 181)] - Mortal181(::core::primitive::u8), - #[codec(index = 182)] - Mortal182(::core::primitive::u8), - #[codec(index = 183)] - Mortal183(::core::primitive::u8), - #[codec(index = 184)] - Mortal184(::core::primitive::u8), - #[codec(index = 185)] - Mortal185(::core::primitive::u8), - #[codec(index = 186)] - Mortal186(::core::primitive::u8), - #[codec(index = 187)] - Mortal187(::core::primitive::u8), - #[codec(index = 188)] - Mortal188(::core::primitive::u8), - #[codec(index = 189)] - Mortal189(::core::primitive::u8), - #[codec(index = 190)] - Mortal190(::core::primitive::u8), - #[codec(index = 191)] - Mortal191(::core::primitive::u8), - #[codec(index = 192)] - Mortal192(::core::primitive::u8), - #[codec(index = 193)] - Mortal193(::core::primitive::u8), - #[codec(index = 194)] - Mortal194(::core::primitive::u8), - #[codec(index = 195)] - Mortal195(::core::primitive::u8), - #[codec(index = 196)] - Mortal196(::core::primitive::u8), - #[codec(index = 197)] - Mortal197(::core::primitive::u8), - #[codec(index = 198)] - Mortal198(::core::primitive::u8), - #[codec(index = 199)] - Mortal199(::core::primitive::u8), - #[codec(index = 200)] - Mortal200(::core::primitive::u8), - #[codec(index = 201)] - Mortal201(::core::primitive::u8), - #[codec(index = 202)] - Mortal202(::core::primitive::u8), - #[codec(index = 203)] - Mortal203(::core::primitive::u8), - #[codec(index = 204)] - Mortal204(::core::primitive::u8), - #[codec(index = 205)] - Mortal205(::core::primitive::u8), - #[codec(index = 206)] - Mortal206(::core::primitive::u8), - #[codec(index = 207)] - Mortal207(::core::primitive::u8), - #[codec(index = 208)] - Mortal208(::core::primitive::u8), - #[codec(index = 209)] - Mortal209(::core::primitive::u8), - #[codec(index = 210)] - Mortal210(::core::primitive::u8), - #[codec(index = 211)] - Mortal211(::core::primitive::u8), - #[codec(index = 212)] - Mortal212(::core::primitive::u8), - #[codec(index = 213)] - Mortal213(::core::primitive::u8), - #[codec(index = 214)] - Mortal214(::core::primitive::u8), - #[codec(index = 215)] - Mortal215(::core::primitive::u8), - #[codec(index = 216)] - Mortal216(::core::primitive::u8), - #[codec(index = 217)] - Mortal217(::core::primitive::u8), - #[codec(index = 218)] - Mortal218(::core::primitive::u8), - #[codec(index = 219)] - Mortal219(::core::primitive::u8), - #[codec(index = 220)] - Mortal220(::core::primitive::u8), - #[codec(index = 221)] - Mortal221(::core::primitive::u8), - #[codec(index = 222)] - Mortal222(::core::primitive::u8), - #[codec(index = 223)] - Mortal223(::core::primitive::u8), - #[codec(index = 224)] - Mortal224(::core::primitive::u8), - #[codec(index = 225)] - Mortal225(::core::primitive::u8), - #[codec(index = 226)] - Mortal226(::core::primitive::u8), - #[codec(index = 227)] - Mortal227(::core::primitive::u8), - #[codec(index = 228)] - Mortal228(::core::primitive::u8), - #[codec(index = 229)] - Mortal229(::core::primitive::u8), - #[codec(index = 230)] - Mortal230(::core::primitive::u8), - #[codec(index = 231)] - Mortal231(::core::primitive::u8), - #[codec(index = 232)] - Mortal232(::core::primitive::u8), - #[codec(index = 233)] - Mortal233(::core::primitive::u8), - #[codec(index = 234)] - Mortal234(::core::primitive::u8), - #[codec(index = 235)] - Mortal235(::core::primitive::u8), - #[codec(index = 236)] - Mortal236(::core::primitive::u8), - #[codec(index = 237)] - Mortal237(::core::primitive::u8), - #[codec(index = 238)] - Mortal238(::core::primitive::u8), - #[codec(index = 239)] - Mortal239(::core::primitive::u8), - #[codec(index = 240)] - Mortal240(::core::primitive::u8), - #[codec(index = 241)] - Mortal241(::core::primitive::u8), - #[codec(index = 242)] - Mortal242(::core::primitive::u8), - #[codec(index = 243)] - Mortal243(::core::primitive::u8), - #[codec(index = 244)] - Mortal244(::core::primitive::u8), - #[codec(index = 245)] - Mortal245(::core::primitive::u8), - #[codec(index = 246)] - Mortal246(::core::primitive::u8), - #[codec(index = 247)] - Mortal247(::core::primitive::u8), - #[codec(index = 248)] - Mortal248(::core::primitive::u8), - #[codec(index = 249)] - Mortal249(::core::primitive::u8), - #[codec(index = 250)] - Mortal250(::core::primitive::u8), - #[codec(index = 251)] - Mortal251(::core::primitive::u8), - #[codec(index = 252)] - Mortal252(::core::primitive::u8), - #[codec(index = 253)] - Mortal253(::core::primitive::u8), - #[codec(index = 254)] - Mortal254(::core::primitive::u8), - #[codec(index = 255)] - Mortal255(::core::primitive::u8), - } - } - pub mod header { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Header<_0> { - pub parent_hash: ::subxt::utils::H256, - #[codec(compact)] - pub number: _0, - pub state_root: ::subxt::utils::H256, - pub extrinsics_root: ::subxt::utils::H256, - pub digest: runtime_types::sp_runtime::generic::digest::Digest, - } - } - } - pub mod transaction_validity { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum InvalidTransaction { - #[codec(index = 0)] - Call, - #[codec(index = 1)] - Payment, - #[codec(index = 2)] - Future, - #[codec(index = 3)] - Stale, - #[codec(index = 4)] - BadProof, - #[codec(index = 5)] - AncientBirthBlock, - #[codec(index = 6)] - ExhaustsResources, - #[codec(index = 7)] - Custom(::core::primitive::u8), - #[codec(index = 8)] - BadMandatory, - #[codec(index = 9)] - MandatoryValidation, - #[codec(index = 10)] - BadSigner, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum TransactionSource { - #[codec(index = 0)] - InBlock, - #[codec(index = 1)] - Local, - #[codec(index = 2)] - External, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum TransactionValidityError { - #[codec(index = 0)] - Invalid(runtime_types::sp_runtime::transaction_validity::InvalidTransaction), - #[codec(index = 1)] - Unknown(runtime_types::sp_runtime::transaction_validity::UnknownTransaction), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum UnknownTransaction { - #[codec(index = 0)] - CannotLookup, - #[codec(index = 1)] - NoUnsignedValidator, - #[codec(index = 2)] - Custom(::core::primitive::u8), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ValidTransaction { - pub priority: ::core::primitive::u64, - pub requires: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, - pub provides: ::std::vec::Vec<::std::vec::Vec<::core::primitive::u8>>, - pub longevity: ::core::primitive::u64, - pub propagate: ::core::primitive::bool, - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum DispatchError { - #[codec(index = 0)] - Other, - #[codec(index = 1)] - CannotLookup, - #[codec(index = 2)] - BadOrigin, - #[codec(index = 3)] - Module(runtime_types::sp_runtime::ModuleError), - #[codec(index = 4)] - ConsumerRemaining, - #[codec(index = 5)] - NoProviders, - #[codec(index = 6)] - TooManyConsumers, - #[codec(index = 7)] - Token(runtime_types::sp_runtime::TokenError), - #[codec(index = 8)] - Arithmetic(runtime_types::sp_arithmetic::ArithmeticError), - #[codec(index = 9)] - Transactional(runtime_types::sp_runtime::TransactionalError), - #[codec(index = 10)] - Exhausted, - #[codec(index = 11)] - Corruption, - #[codec(index = 12)] - Unavailable, - #[codec(index = 13)] - RootNotAllowed, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ModuleError { - pub index: ::core::primitive::u8, - pub error: [::core::primitive::u8; 4usize], - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum MultiSignature { - #[codec(index = 0)] - Ed25519(runtime_types::sp_core::ed25519::Signature), - #[codec(index = 1)] - Sr25519(runtime_types::sp_core::sr25519::Signature), - #[codec(index = 2)] - Ecdsa(runtime_types::sp_core::ecdsa::Signature), - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum TokenError { - #[codec(index = 0)] - FundsUnavailable, - #[codec(index = 1)] - OnlyProvider, - #[codec(index = 2)] - BelowMinimum, - #[codec(index = 3)] - CannotCreate, - #[codec(index = 4)] - UnknownAsset, - #[codec(index = 5)] - Frozen, - #[codec(index = 6)] - Unsupported, - #[codec(index = 7)] - CannotCreateHold, - #[codec(index = 8)] - NotExpendable, - #[codec(index = 9)] - Blocked, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub enum TransactionalError { - #[codec(index = 0)] - LimitReached, - #[codec(index = 1)] - NoLayer, - } - } - pub mod sp_version { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct RuntimeVersion { - pub spec_name: ::std::string::String, - pub impl_name: ::std::string::String, - pub authoring_version: ::core::primitive::u32, - pub spec_version: ::core::primitive::u32, - pub impl_version: ::core::primitive::u32, - pub apis: ::std::vec::Vec<([::core::primitive::u8; 8usize], ::core::primitive::u32)>, - pub transaction_version: ::core::primitive::u32, - pub state_version: ::core::primitive::u8, - } - } - pub mod sp_weights { - use super::runtime_types; - pub mod weight_v2 { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Weight { - #[codec(compact)] - pub ref_time: ::core::primitive::u64, - #[codec(compact)] - pub proof_size: ::core::primitive::u64, - } - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct RuntimeDbWeight { - pub read: ::core::primitive::u64, - pub write: ::core::primitive::u64, - } - } - pub mod starknet_api { - use super::runtime_types; - pub mod api_core { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ClassHash(pub runtime_types::starknet_api::hash::StarkFelt); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct CompiledClassHash(pub runtime_types::starknet_api::hash::StarkFelt); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct ContractAddress(pub runtime_types::starknet_api::api_core::PatriciaKey); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EntryPointSelector(pub runtime_types::starknet_api::hash::StarkFelt); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EthAddress(pub ::subxt::utils::H160); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Nonce(pub runtime_types::starknet_api::hash::StarkFelt); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct PatriciaKey(pub runtime_types::starknet_api::hash::StarkFelt); - } - pub mod hash { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StarkFelt(pub [::core::primitive::u8; 32usize]); - } - pub mod state { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct StorageKey(pub runtime_types::starknet_api::api_core::PatriciaKey); - } - pub mod transaction { - use super::runtime_types; - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Calldata(pub ::std::vec::Vec); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Event { - pub from_address: runtime_types::starknet_api::api_core::ContractAddress, - pub content: runtime_types::starknet_api::transaction::EventContent, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EventContent { - pub keys: ::std::vec::Vec, - pub data: runtime_types::starknet_api::transaction::EventData, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EventData(pub ::std::vec::Vec); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct EventKey(pub runtime_types::starknet_api::hash::StarkFelt); - #[derive( - :: subxt :: ext :: codec :: CompactAs, - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct Fee(pub ::core::primitive::u128); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct L2ToL1Payload(pub ::std::vec::Vec); - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct MessageToL1 { - pub from_address: runtime_types::starknet_api::api_core::ContractAddress, - pub to_address: runtime_types::starknet_api::api_core::EthAddress, - pub payload: runtime_types::starknet_api::transaction::L2ToL1Payload, - } - #[derive( - :: subxt :: ext :: codec :: Decode, - :: subxt :: ext :: codec :: Encode, - :: subxt :: ext :: scale_decode :: DecodeAsType, - :: subxt :: ext :: scale_encode :: EncodeAsType, - Debug, - )] - # [codec (crate = :: subxt :: ext :: codec)] - #[decode_as_type(crate_path = ":: subxt :: ext :: scale_decode")] - #[encode_as_type(crate_path = ":: subxt :: ext :: scale_encode")] - pub struct TransactionHash(pub runtime_types::starknet_api::hash::StarkFelt); - } - } - } -} diff --git a/rust/pragma-cli/src/runtimes/artifacts/madara_metadata.scale b/rust/pragma-cli/src/runtimes/artifacts/madara_metadata.scale deleted file mode 100644 index 083a4754b25c490e9c00a66922725a1d66d7b687..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40937 zcmd6Q4SZx*b>F?CxAqw1Fb;Aex1v0V9JDa|s$H}oE3zZ)O12cVyYfoAtb;eB(ae)H z>}X~@Z)SHz?bc3A3dJ;biW@ta#%@fC6Wp2<8r+%&QfMK8)}*F|1{!Eg0u4@ZiyKIs zr2liy{dn`CwIPsSmc={wzWZ_Rz2}~EHxH=6k)%;5)tm8fskzf=)$_BZ zQoUVkEtX$>K&e0lI($QW@<+l~A2>}(H4rMLviP6cgUZ?Qjb?E>E+jiiE8cc>Ya8|K z(9wFW6ziPLoGZ49dPoiFp&EV2X(^!eXsKRH+S_q6$?5QTym6SiM|PuGKU*nxXXlgl z#zv)7iEFLS^0_iP7}DwPl*$3jJ!*&{A0C`Az_uHWdb1UlD@mi+Ds9ay$IUtO`*5|G zBtfvMN7SGmuGO2{#p;L-R+Y}z8*#JPs?=*XXLP$*L#OrT4wq0PgJYP>b8%&JtCft( zzlF00hF{M)m^B?XG0|rN=PH`bHtCyvb%M%%L z(yE+|3$2|-oa7b`9DEH8r(<36N@cQYJV*UEF?;A?WHYYC%}QywT-l71*6bu81%!#uvnYQ&#>OaTgL%CGj2Ht(3^lfjNqoB=TBd(72Qigf z(80XY!>xLwQcB*UhiS;Gn9zmnaJj9ZwfmeSeb72Y?2TGEa5Mw*)9{-;fG zG^IwaYXaLE#XvRmYNJ@K#;wApWSP=xK&hp{jtx011&6pbU^Rf8nLpoZR%%J5w9+n> zVj#Poup6OJ!Ny(I<90JFA_IvKKJf+oh^s9sAj(#_|*(iUwUXJZTW`gClsS+~Q!gIwWY|HvaV@Kn2 zhKvPzq$mVU>G9R6DM#I~{9ChOEj|~T@7zME854#?6R)dahRe^{ND!O?km(lCKm!ec zkZl*6XJ{UVu_-{ty8G8TpwQNs9syJf_@(v)jbpX2UfWmNDpqPB71ThuRcth{lgm-i z;8hGa>dg@79t!G&vcl2wZp5u?F+tRXFpX$Sm-JAHh~BDSA0~oIqwSrfuo1_nbZ!|x zm0I1c7q_&g>frEECY?as{4q~Al~$uiEYVaMrB3bEpmeCSgEz$JS7ndZQCHoVO;I@4 zr$MJlAp&6LdCzw7zT^k=mnXR_k?)V24N<^DNM{q1F1CxE83g9^+rq-oIG`-aJ|`VH>i$!p~|1A z70+U86xXY<8dQ_V>-E;rdTX{?t)D~jOO;wnPg=*2!I6e4z|Henoo!DNHKUC=t?yut ze`NMl;mEPM6HD`j`Qyir9WTruJ$!6#ey*^x_~Y{s2FmGn(<9eoGuO6js@6-`j_MMnwz3o8lSQ{UJqx1;M^Dg} z-2i|gm&qKfU)7kMQV&cc+VrdH?fS4bxFBNx) zCMeYyoa`j$9YkB{!AYWK?bcQu09Rt7*F}@sDPU?^dcuC)S*j#05bQfpBXosA6apDZ z!u2=?t!gx?6_AtRWgrxQ(ZM~3+s!8U(QY*wTre6r9uvlwRVKLaIchYeWE9-I3PQEU zbZae)Ywhi@z5(J@NetNnu$lAfJV4IgJgROUTxMC+ND-F34Fcrh<@S2DQbIv>tDcU_ z2M!+Gf7R5K&Aru0u_NYNszQgPbbBYCw|snXau)Nl<9HaP4@hVv0ju$AE0FjqZ(`98 z3pTk}!#emJV8B~2j4^cw{(GmolLnK^sdsdCbZV)XvN?h*1k`dy_7dKW!hXJroO4vJ&+!A>OM%18FfGY ztJH&iMS|R6h!89hgu}vV0&RYzWHuGtxDvQQ0}eFO#XCqqpemr2hv(^qm8Y&bO!x* zw=xji-@lcvnt&xwjV6%eF#-&v0%gf_;{Kw$8V zAFUx&i&50%|-gKk|AI04P0@wAZOYgOe9^gOaL?rsiak zc$|fpB+Y(HdvWlVPJnu9p{d|f4Mx`jGfcu_cornH2s#0N?sO+2uPNcMwN-4TH#pIq z=snmN?^W-mjgil*N07>^_jh4sl?Y@q&Qx0TC9wTLJ+=-pyRc5QJ0-9{@jBm|39t$* z$$U`XzTBnJO`A56&k_nG>JRQFdh}HXAM@(qV?FAi#jDB?{Y?K^}#uhLRn+iY!NQS~5T__$u}nRBLG>f_(mJm>s8=X&N@a{N4VT78oF zuSm6tRhj12WyMMB&OxLoTgo(a4s0|wDfKwlHMDoq(9)Aaioy6h$nHcZsnw$uC_)7x z$=%=P4EL>VTEcGjZYQ;OncS2C!)E4+jY{%_9+|~Ipd(5zwY;?0-Rwltg5qLxMV?bn z1cQg`=V*aH3�btSBZVv zu)gvNSk_T6Bh4%b0mY1`cg7NM^g+4 z%g_oqpENR)7j02DW;Kq+aXDG7FV;v!Bh@=Q%N=)iXr?fPghAbcYmpQjw(22xDp&lr zfoO?7yILpV01UYcNiu_9lLFKU?Nk)uftW#r7Nm`4eYJmK;Nxf=BPK;H+~9267B@uWpjlpz9s41@ zxXM~mf4%r?gEL0BCYu=c$aces*Iob$2EqS9#h`3p!$TWC0tyK8j0%=JIV6gG*LdRB z2bb0{S>?D4DG1BMDqxbgd1vF&*dh6jt)ImX{zk9@h}5&*y7Z0QT!*+^Y&VM|Ns~q6 zJY?pA`JEDlzp1B9rk9<+>1F5M3LUcZvmhSdP+DgfI{Hnjb(msT@LvMZQr0~>+ojj! zS0G}=&3s&EPigu~iRkL~> zs@XKR2(CR0BTgwUU#9h_VdzI8kzA_#BE`(PxOk?J!i>q+Bcl^L&I@+5Ja$~B(+ob> z!{A{V2ZO&H>SbT;({GQ#rDja#@_!r{_}zq43u? zrj3a!AF||dw7tC^H?M`IVfC78FdNg5Z41!!A-{1u^IFfK21MUul*vs1weIZPjeVfP z?gZ`W0k+VFxpNaXw7-6+b@2Y@gxY}z@W;WmaGC;fj!mc*>*sprP3h`7=viSylvC^! z7Lp6lu`#zf-KR#TTLnq?^<5)uSLkeCEq<;CE3(0Y9;1y05e+udR-pnRZD=LN(Ua2S zY4m!D)(h$C(+l~KHq1+Q>1#Y)*ma|`Bg^1SnBYLYOzW$(H=m~vcG~UO#d1D$MNCcU zIsXDzXa$H>Y_*%v5S1E5DVWEh$pq>ut!Ka89;EJt`oNZbna0V9n^Yw>|{P%*$Xn2U^umM zDob72r*}K8Zlq_M04wp`hw&uio9{GwP<6*vdYjfHV7~zUZ} zv{((VJ3f1KZh01#JlGLa!lkuMve~hc)LzjFtKjkvj>RJAiaC)4+hUazvmMwInE6Xf zd!un-=B9HE1!MQl#nO1;-lfC)ZT|#Jzuu*(z0rh-07f2wweu^xcaM`ANDCp^qHu5n zQMYqM(FjfpR_d_R4+M{imD-K6rWLIjP0Mn@WUJB;P8bCH z^=t^988XkL4-k{VX6e6lVqOj**f)we;YMB&XLl*`24S7gz9GR^M3r+rrHQ8Ww1;}? zs{dE%>C{{s#%D+n@v)5!QW%aiFzTYA1uT|=6bEJ*V*aqMj@q9C;3&cUMrm&nTugfYQ|Z00<^~@(nZuw zT2GL9j8r~3_fl$NE^buoJNDpEy;i)D?gB}G5b?5oDyxavZS0^bfuXp)$ z%kyiv3odMdK;70C_*~R)7ZiVM?`-tpM+T+e4x-${tUOxZ)%P=__S<{A>EF_K z$Q5R~XSMHyLhWhp6dLtP4d;F_8Q)-->NE3fIla(qtGk}pc)k~;{<+zheopXrrS^CC z4(mda2Q*A!$5yrc>t2R?iBrEzt9R+aaTrgUXKG+!I6ldPI$Qsm>6EOrK>k*sJrBSD z2YY1mjAT5}Rh>PwqyPySRHMTn`flp>A*~+js+aCoeD5GpX?W(Bt{&jVQDLuLM^SAffbo4=Lw|!qK&euM`k;`}IW4YsXR)67 z_&`^^^tieJ#3>szlH^f{#3ZgU^ynLc8vEsb1QX49bD&*HJxUYzA+0`ifeu33M#nSNf}1Q4$>RR$OQ81?>uR-d4MKc&^DF3?)u3flE0?Bc=av4~@>x?SW? zYdtpK+OkWdN8nIbtryE*z$`5tSVfa?tD_91KHUX_TcUIWSliD)Mqb$e8p!CM!5-~# z4(2a``kXdKj|1Z{dVCJ!92jDw#}~S~Nv~)(Nc|`8OEhU;)(U@NKKZJSwfbsTqeIw& zt$2*=>QGS_1N$K5Q(d*(h(}qM+GUGAy<06f?}?0eq1w;vR@?ZZr%8ff+P8R^59_aL z_2)VW53M%i7$!a@Sv>)ZGp}QWcGi;Fyus-HujH^jCd#m*m^431@<} zPT)=R=xMUdDssV`3wDD2<_qb|1Kn;#oh_m51(KEErBntN9G46HDEw6!N7{&qC?@hNfxt>c1@1? zqF7s3X!f6RALPIqj?8e|NXXU(2?du9aH7m6COS=mt8Xg+b1@ ziL-ZH1R#es7^sr)<#b5R4&cel^RS#%a4-)u2W&-PJ$wd?6d#$VrY(tzyMeq7zf?Ms zWtUrYg@a}?hZRHd$UuHMn*YR;9MIHrzz26-YSpQzNyw6#hMk{479FaGF{=zMe0^t)9|j| z)-P7ePyxsn#1`dYz?Y<9T%_l54gxsrc3^g%!2fmzIW3s}-~!oXOC5ZgC#f)(kenB) zNiH>4+1QYrLHPNaxxnOJOXnGIZcfiEJ{zlr)c8IH5@g7%83t;?oey^K7pVvPL60-Z zRd}bG1vqK^fO2Z$1iX}S>wyeBn4ink(veD%;K2HLj4sKsH-VA&`_;6`Ccg%D?|iX( zMAmt=F8;~0DO4y{4U2R*ftyNe&bDXfTt1@L%hjA|erf-8#pDDLH}wN5`<8x0r-a3Z zze!B4J4rOm4%{nOfLUc;l2P~z-hEoXETdkQ8JsgL3kTTsT74TP)giuWH27onb+S>d z#@jSl(8Kf*qZReVf!wCpl($)QexPHZUF~AEkjfe&6*jptqnAl8I{`|UniA~N;YJ-c z;+=gNJ-p1nl)94O-kVW-Gd)JA?grp5{WrsKtM=_avuhj4W0+icl+9Cz6; zR+>z;zh8?z0!A?2j5py24%y<3^>qjo#7yYt!HgcE>E>naJ_}CQ0Vn(JIDQ`N2e2TQ zhXi*J7$dIA=uyH5+B+T%uFmK&0@|X&RfGyK%wD~F(;ejlJ-X2pDzIbcakgJwGmj}^ zKD>aL>fVG(jTyp0)2J0$FNmTbb*=3ObbAKrq{HcdKrQ>`j++(2uEyOjG|^| z__-l_kII&5UmJGccRSB#_`;!aG#lRrGp&#i3Atzd2qg^F%Z?g4k8@!)ZhzCg4~^TH zIQtF2;d~h|tf58v8mPsL?kJA|4<0X`3(`03a7JPJc{R=ifN$=)=z#lj0H+NdIthAQ z#7bT?q>f~|FUjSNn;Rhl?ELPI+=KdI4QtKD)D(_1N&nrdlyQO$c3-Nt%W(pI*x1SJ zb-Ssl&LUG&_Db3d;9rmCN&2FH$rnZLQ{_X`JD=yTTBoriS$p+AD^as9|-CH3c)qjBdQ;s7AAb$Eo-%AL5Unv;&D0O`% zeZ6Or_m%fQ0JoW!%P70MD5#MYamowSiHu%w4tS|n)X;pXoZxQf4H-QX)6c0X{}~(Q zM8>;0mBMc}FkRI! zPNgfHMa~BJQ`x<#1!;=BeC?Uk47ZbV4K}T8@7~Icw9-0n+nD4wR?iy|&$MvU?k!A6 z3v{VEsU+iE{W?jQ%I)1NPfO)(c+r7Zw05NTBR0tm;Oqvv=6th=Q<_Y_E7*fj1o^v$ z9b$1?8pGs`NIN*Mg)28mh9p6Xk<8fSt2sGflM|eTm%kJ~$jLo6`5I1MWRtJu70X@PIlr3Jn#U0UG#VV4&8USZP{ z0^gWR3w(QBTHt%7OACCja%q7t@6rO_K9?5wB9|8U{;o?4eB&-H@a?zhg96_HmlpV5 z?a~6@gi8y22VGj=dyPvAe6MwBfp5~K1-`3XTHu>A1-@%tTHw3Rr3JnPmlpUIU0UG# zF_#wjUgy#R-;zrUd`Dbb;5+Kl0^c#4o)q|&U0UF~-lYY;<1Q`mt+=$nx9ZXY-wBr% z_)faC!1sEW7WhuNw7_?ROe1<^!_k4yxdb7_ENN@2O0_orP83O4)@EHQ>tv*8_z0GA9_VSZH zLm>SrpCORm?lT0^H~S2M^rwA>K>81ThCuojpCORG)n^E#|Hx+uq;GQ>hSA*NGX&DN z`wW5fANve}^k;mAKzgUo5J>Ox83O6g`V4{epZE-c^c_A!AidjV7?$%-eTG2#b3Q{L zy~k$=r1$y^f%NBnhCupGpCORm=Q9M-cliu~^q=_*f%F$#hG9PU`wW5f0iPj|{&Sxp zkp8025J(^N83O6MeTG2#OFly&{TDt%AbpR|5J(?#8HNr0vd<7mf5m4Ar0?|^0_np( zLm>T^K0_e=S3W}^eZ*%7r0???0_m^%41x4ty9~pS-tRL6(hv9yf%M<_41x65e1<^! zL7yRzKI$_B(tqnS1k!)!GX&Dde1<^!A(vrT)4%r_0_m^&41x5+K0_e=h|ds6f5T@8 zr2oNZ2&5nN83O6Ye1<^!AAN>E`k!pZ0mGv{?lT0^PxuUh^f!HmK>AxgLm>U6&k#sI z`hCup1e1<^!J1)cUsL%Thf%FSLLm>U1K0_e=U7sP4e$i(Lq+jwG0_p$q z83O6=`3!;dNuME*e%WOh9`*Y^Lm>SFpCOQb#b*elU-cOR>Hqc_0_h+641x4(K0_dV z%4Z0qf8;X+(m!??hDUwfX9%QE`wW5f|M(1n^#A${f%F?bLm+*|X9%SK&u0jvf8sL) z(r@|;RX9%Q!snjjI+dlGQ`+zN|6pyjl z1QwtYE`Y-F6R3N1h?{<#qttD?w=yoR$dPiMo00qd#`yB)9xL*QvE!0`>8*VYDnopn zHFSuAOJs)^_&id-J%dAg4OE+`?iMG>d9M-Z2iTrLSaQbA$VyE;zk@6Gfa)8C6G z;jHrjwVYG$Mse{kpv%(_WrBJAFzRHFoe9)KC<0$DoDv7>VX1`zsp3N@eWNK%ep9CG zjoiV*9j7kK7?$-gEZ9T4wbY5`Nje>Z%}>sxag)Ft7{Mb7#$c03l}B$Q=8Qj3A3zb4 zNEg8{-}l^5^lMz_d3mT4xSsKS1&zpBZMtd!YvB;=@CYLY(?24n$sM3T&CS+0+~%Q5 zv$e&$1*cPUCL&p4oiGx34GbUVQ)gJ%IG)(Wi1Ae{`*?3z9Gl~mfg@(}v`9#$OE^9o znY$4X>jesfP9JOao#4KcGC1B5_Dw0oML?u5zWHmqqo{-3PyzuS&14aT2?t3O+yHS! z#}~~n@m7Ry7GdOvGWs3t|8=C;KpYGyyU2Ga=~_UZgZ&`VB`Cm$GR9R5MYF-{^cQg( zGY^FR2w@)mC-bq4!e5-ie=)B<(bfGj(>L1#%`gu0$oVi=KU3VXS2A>d13*;^e8lfE zhvmfoQ5@Xa24oPQdhS`BOX1iGd)Clt`eIGi97fY6-2TRqoC>j<*`*06qdwiSbw1Ov z(>_Dv?c8afd2Tpnc(qc%plbvpY*r`&8cuPSQlH@a!?}uLtKyy;4nH4}8$+o=tHn*6 zDBJ6CyA~L&)^VHfEcdaTs=j2i6$hn7peqnwJLBqenSSvQ#wi}c93nDsm_97MJ$(K` z2OZ1zkTFn4Z0|31l=^Znwfiz=7Uk%l%vUoCe}PN+r!wj(fAnJ_`i{Z_a}}{;amN>M zOzROo`k~vfPiOky)xJ?kG3xOJe1G+@izYwQ0p(E7SU@`g5H&r)4aEj&h!4 zKY*C3jtD=1W-J~F71jftPGin{bYY&H`xI_o>W=ZurUyTp8jj#JoA~8+v93pHrxDx&t*%r%D^tpsY-BK;bVY^WebZfQr$A-+dL} zRaeln3d#a3`Uf!_uh(jOAX_!wahPqnR$|<3$OA>f)sb6bd>#yX3^#5lbT0x~+^2_4 zL`FT%YDQP=g=xujL5U1^&~rVG;e9WP%+Wq;QPf#`)u3;&<+IxbFhpkMvNh{T>!tzy zI8ihB=TpeYJVJJ*Vxdk=ApjwyeZCwuHFYf|PT)@NUNF#6c<~`Z3tViS^Q>O2uX4!F`f-B59S6=6% zn%Tuqc0jr7qS6ywqHZIS(?4LiM9j`PXQ;3A1PtfUy(#A+=SST|5)+(+11C zh9rJF7lFDQ?jc=Rj}YUX?RR<V5)$%>M$&@1#e-fYz#XwOSlMRQgdduT6F*< zh?a;*Qs{pc77qrX%JCD!F~mAs-)Y6kUKtC<31VU#^bshHLT+rvEod8g*MaR#%@i|U%%hMJt6cG3J$>ygkoCY`v#J+g|^}(nsDHg3c-!%F@mc#$^RBY z5|sJ_7LIKf8weDa3LgIoiaG($LcZG2N;uBk-pHCl6vF1>PjCsQ2y5OkN&_S=8gTr$ zW}QOUBjQ7d%Q%?7a4lxPdJ`*jEgD;9V+zlTdLC2K2&pK|38osFg2a}P35tx71kRHf z{?~DTfnHRwWjnyk;|2$UdD!3^)Rvi2HX^|hnSTFt=u=6<>2hG{?;3<}y;?mv+c z0v&}%kFCy6@w`xcT8hBeu5nB-zF?6c7H*XTC?XgiF0&%AJsi{NS_TEnKx`7>Owr@v zVvFz{W$T1f=PC)J`PDWc@5Maw<@!m4D0vgdax9wRBlwPmbgOt4H$4!c1QH(V?c0vG z@%#nXh(g5v;x^DV#z<>iLkz~vdWbl^`|2B}@U!6?VI@FiTu(*k34-lW=#->|0J;n< zYHneK94?TqlAt8bqv5;J7*8SZXoNNrjKQWx3BhAp7XyK*DFLVxL>pT}C>q38$#WB{ z{9FUkov}MW&aTw7D;k7eHcn*`W5AOR;TYnOfRAESSRx>s31_yKryg-}`2sQZ%g7xk z@8|=AT!|zgEEI@A5`spUKBSQZ0dq0KWxTJ@+(u}0%t{GU!x!m7Y;zII31Q$rN1$S5 zX>u6O2(wU0=C!>=RHcVV_LUIs+bl;F^FmkhxQc|H!DKfpH2cy;3zv<~P`lePeXk_j zG{z_0YGI7F-bPFzJ*jh=)6|H09sob~NQ5{byflyl+A#+qXJ{cehihX@x5NwzDH=1A z7c^t%BvXkhWUFYQH_W$E?*P>} zp}}CWF{SES+MjWa(MYl=j4FbDV!$?7Cj|qtxQ_=ez`zmF(>)5YYGR3(SL-KUeZWTQ z)arh8i78rbV%BB)7_UryJl#>pI1s9Njc$5`w%!_%l{JLzU5mnNLCE58%)|!WORZpH zqBY;)YO{hXF}5!Ei903F-KTRv->CCiaCGU`7A{tXeD8#Yzh;}YkSz3q0`_j=aL8jU z>UIoT7_%?~k`Ef-WlYQn8JHAD`a!)k+!1N|{om4=H@x&TUQ-Bv?4eKV7yqUC^Bea+ z^b)0C_;}$Leksx~-jF}Pq+h7+`IBo-yJEi%mBE($gQs)9=t}-RN_IA=FII0k{>Ije z4OgDwYQ*v$4|y|$Kb&U%B32|*A%%xV^lfY*Vy9(nIH-Jykxe8H^G9(b`0HqC2Efed z;61$SAYjwu3ZW4-Ft3KBr=*T(l6xlZ$22vUTf-9xgs(?TZBJHt{w$fLK&&Kq(B|4g zfL|t^K<_$2Q^k#NjMQYHZUc0i7#qcw+Z%;8F7qd6X3pONSn=me&pUY;N7v~&`2KiR7Y5ZKq8|t@Srg~paek#Sg~C^ z!$h2btRRe6(f}@-7=&a$7vRlAMEWbRD!5A#2+M14Vq^!8*3W4*8e$IlPjElux}7&t zsdo{hM&~MJc{zxQRqnIl>$h04<`FwxoVf+Rm0{i!k~slsWPFbhWlN@2m>Nl9^6n6g zat(o6K*8G$OqhQk2|w4(B{~`=aygE`xFMXOIp$;L*ex{E4R%j8=>-w9 z?L3XMVh-HxZ8*@ia0`#$MEYwgm^dO&tROslrCuHlKlnnKx8Xa4M#xtR>W|M(^x>f< zkpdGr1c~n)aKo-WAjID?3{8AmLZc=Ger1gJR!WeNUTNEMxFU1{xK>6G8zA)}M3e?( zWCYGcpgIX!mqg(WFjQb4)FEgQW57RnODs%SPsF8SFk*hw4A$A5@LU~lBbiIlG-dUo zc2W~bs8qQ^Zxcx0G~eK9Q1RmPhyh)V^A^!(VWYRVtbmr5-4Rd}~Y)WKe2C^MA8>TqCg$wP^KqFr;b+c0xJk&k&ho$f1Wt*QB!ot+WnhWnkXD zwWAhASeEU9p&BH7hv1-v7tPU#)_?<8P)j^okyMyDTy6i-@yKz?TX&W`F!^uRD`5%^Nt9na$k4oN@~Ao zLO>db^F&s_*GQcOF4S-_5=G7xcX-g17;swCh#jP?kc~{rd!n3Rt4G-Uwh53cvj&Eu z(ZeQYO=dN}0!QSG0i=bqPyuSv7;Mr3Ndnn9%N23mnZk=w&sZG1Nw*r7+hk@H;%O>H z3JUA%kDb~lO8puyJqzEYFf)SjtzDk9X1y9|T>ry6QIN<|^d*-gdJ)`6f?Al$C)C55 zO(6RyuoK~lfo!?lR|Zh{38pLCJ(3-vu@q!HVK(DtB|3$s(&#ylBQ{{U=fT4)X~e)( z5jg#Z0t!-5S~3<34X=`=pCV?^KM)6cUdTz@w36)A zw8qedjI`23FnKa~2VTIVRp-OU4gGo|x-WOvaJa`Tc zlIufYwBO)mr9K~FEW^`gsMov)?9;D%QCA}L)4`Eyk@Wc8` z)N{*mFFSF}XhoV!-1M=vlG3qeGUNjo(Td_MY_$T`gHyR>;BB_|I zLsW$nE0|%Q2v>?5jI6-8a7{c;T01Zs5OT-FnP@u{O8k(9wLffbG(*y}fiZvH@&d>^U8HkjA76>Bv6u^{b!;pS=0K^lUAdqHJ zpLrgO`ot~}yXi{pBghD#T4?_}oIQT*1H0~IB|b-J_bvUv^MLTl=Yr5~IkN)^N~WUU zA(V4uu6rH5GKny4hsc@%tus(VSC9wB~BkM$jr^TDIxbciQVIsb~I z0Cs+oW%Df zy!1C7-2CI8UOaWt{=2UH!KZ%n*EVO9r+?>9qj#47>{CDa*bzKTd3mP84?w3Pb`0hy z1ddi$pa`ts^>sd^AyzO-Xl?%F@j=Y^(CG2)w8pe5y&sPE!+;XI$0JN|Gq{837qn$C znf$gJ?So?Y#`=0B69)H96g$RY%tynr=?Lfkwz5P(?o(f^;=~1@FwAE5s9-*GBy)YH zm>KC4yCTlOHH3WQQ;{eT$f7H<1O=twQYKi$O_{N-=nw78Sn6KHEt#S8^@iIrLvPN& zXBz~3aKxB|)#I?(9OqzqA^@6v-Y}qiX3ItsVj(m~;(=Uucxz@TDC7K|PELeS%Cig1 z(xMq}JCa~ufxG=MgfoRjXIa9G3lns438fjiD-i`R69$U#bxl}9t)U(+Q=rYTXp&~N z6Rxz^5vPw7FMOgZ&!;fL6;lQyalhMhYG=78&T8`9fMdJ#pe5q$aBcI5gYkOvJ-AFb3G- z+B!S|0salpW+{k~1J1ORtevKj!-5M-FTHcY#&p-N8@+o_&~RP5+;cq*;x5Es=MZ;q z4VKIg3w1Tzz{)G|_^yU)u5CY)Yf%7;lQqc zW4J@4mg3c_X;_7;JN~9gfKdA|AHc9yx-0YUOs*QvQi0SmxbJ+}VK)W%83%<--Y3ARYcs=%N| zxM6IMMygn^Khtv@uo#>OFh1B4KFu^Q5#k(W+ zK#~1`IQ%0rp=NBABx|=lUtxGO^N9={?J-4?B_gn0X=Z^Cs4H-+`F48_ZZg<#h$yI8 z(jJU}3`I}W2;njw`#2pmkx|hz&Z1bdv6c!$Xrfba;>VkjDIR=%J8s8;cQFLsSzE^7 zusA(_DwA!Uzbhk;H^{}RPiIEALd#is(Ngsyy!9cw00_T@;}Av(3a-n3A2e5~(jiF) zv}dbv5rIwNv{9^7!I*gC3Ykcirt=-1Q%l;!)?_SFEFXyQ3i~9^Vm1WLOLe@>UTPug z5L=Uv*ZLvKKbHP?9|*O4|+ce9z5cc z0xQX~hU&0ilU&6oi4nUspw+eh_>e|8!Xpl#i-RgsvmCEV^&H~LSv!vAATRI+dOa&q zvyDnHZ56A6C{}4!_;I#8kdG4}LAiZq7Z#H2Y8%0d2mNw zMDe4%J@o;JRL=(Y84k$ z?ehTz3omHZoGHMWrnND-hE50pBlUQPzyW=(gi*upj@m1SXP4$-B&LV%%kcYLM-Ws# zbc&X6Hjm8C$r&*v^Iysg-V-8VElThr$$(A$^dv><^BuiguPsxwSv;5SHGCD@6$w`& z@Hn$v43L$t716ECtM=nX z)K?wIhfx&a1Ys3@nEuf{g}VGOF(BKNBdBQr*!E~D?b{!{pB)WaaI4?_6;v;cWcxni z+Wj2s)0t;7;bl0BARh*d0@9UJ_`UE1HfUaJ!}s(-h>VM8xcNxM!@Q5h#pA3|b^w zfx%*U>9RY!k?H-kZjeZk594SvB8fFUTNsVZIN>&WF!l%UL@cDh>Q-ZX3d+if6K>E1 zE^C#A=I{z~h;{)DkRKy=OQ1B|?}Z%`vlCuNMq_{(H7+#oS^KW*xW(BWT#mWp^1mr38V-7g5NVt zS0+9^>SOelK!V(Wm7UG6s;9BQ;6M_g6**3Za!u1yZ*PiHLW~(O zks&Hv0}aCp@YxYL-~bbF#z|9bnESI{^)|l7@G~Q3$cW>s&>khZlf27eS>~g0DuM|y z*d>Rgp0aW$BF!2qw-uA`tT~<+Q4iu8s4zB}Xlqo*a&VaCSRR-6J8L3x!Ka7suJ=Gq z`Zr*)AOeT+8#fQIR(xXt{-!)ZAXW~gMb69fX|1Rx*jaF@Bi)qFfpJO0Z1&<=Y)dls zMU!UUz@2Ggae8nM5ZjC6-JFgce=w406v{JJ2IL($PEsnECoe9I+13)$50z-MSjHs~ zDhD##243N~AuA>ArIzgOPk@e5+71k>@piFUk^L<+qZV(%^;w{Bh`x`w zp5?M;KVo79pvXar2`2m!?;j#a*miN1@S5vVj%$(_X)?7RJ|WE29it~{jJz7%9xWP{ zjaH5d&VUpe-VWse(Shj}5TV%4laNO6wkQT}q&Pcpc~TYI0T^H#0nx+8wnD(O%y{Y8 zMjXzt?b*629HLZ*-a)<*B3{v{J`l!=}=lRsoR(j!9r7uKV%fIxKA25mOXzRe?BuRpUN) z%XJ0Rkdh%QF|3;8XypcdwK;1Bz-E$1+4KO5X0&7X4B)19HPznQVbq3gQCzR$=)4;( zAHA}|TUg(*W5+T`X!M8mQ#$ypYluc_Yo-rvAq)0QLe#J&%|nuC-gg$Hp5A*(IMvw%pYwru;3X3_)bk*z+#?<3EJ}pOR&elKX)-G#!#*qf zQ68hfL6TH{K*MJ~jS#M~l#(jF7fx}42ZMaNqCfsKGaZe?0UT5YiXFZM<0-Wp??2#< z`>Lx?b#38g`@_EA!?j1u0qflw*V{c_nOr((aShCv8|=7sO4=x%0P>aXH&_M>xb?J| z>>a=bb?EbQ(H%sLR7c1Q{)mq$j*;6)E+-REDPDD*q=%L58f2gDa3%b)RCnpx9X$d2 zDqzjj*Nl?~;oyr$BAdbB`Brjw=7=V_{94XRQlf1~n_jGAsn#uTx)2@($E`$b#CA-> zTo(b+QGS2`OM)=>*3=)}CW z_==r^p*NSWXnNofxs7{C4T?}e`k*ln!`o>Ar$MkCb-)T+Hc9BBK=bU%{G}>FJOfPR zKFkshU#(!tNA#AYUgf7=Nqz(@ApP`So3zMG4RVmQNhy?|x$vYI+~_p5>>05rc3@+; zrwU6TEXO218fk;p5o)dbGg5v^g58%X22qjOB%$WHK1W3;~-_o~=9By&lYAa&tiNx7YG*<~p zq_CYa_=eJm6;xF0{9+Vf^-azy@(JNz_awQ zlw+jtu)kvjkl%a5k+Dq8`jWUln{CO5`KN5J7-XvBY`WvS^&lqu66!wg>OM8djz?|GDv&fdJ}H$B^f62cd||mh4w)x?(3`U;r#jWEi+}x@9JLw diff --git a/rust/pragma-cli/src/runtimes/mod.rs b/rust/pragma-cli/src/runtimes/mod.rs deleted file mode 100644 index 05ed7c04..00000000 --- a/rust/pragma-cli/src/runtimes/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod support; diff --git a/rust/pragma-cli/src/runtimes/support.rs b/rust/pragma-cli/src/runtimes/support.rs deleted file mode 100644 index 6fc39236..00000000 --- a/rust/pragma-cli/src/runtimes/support.rs +++ /dev/null @@ -1,33 +0,0 @@ -pub type ChainPrefix = u16; -pub type ChainTokenSymbol = String; - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum SupportedRuntime { - Madara, -} - -impl From for SupportedRuntime { - fn from(v: ChainPrefix) -> Self { - match v { - 0 => Self::Madara, - _ => unimplemented!("Chain prefix not supported"), - } - } -} - -impl From for SupportedRuntime { - fn from(v: ChainTokenSymbol) -> Self { - match v.as_str() { - "ETH" => Self::Madara, - _ => unimplemented!("Chain unit not supported"), - } - } -} - -impl std::fmt::Display for SupportedRuntime { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::Madara => write!(f, "Madara"), - } - } -} diff --git a/rust/pragma-cli/src/utils/constants.rs b/rust/pragma-cli/src/utils/constants.rs deleted file mode 100644 index cd8b612c..00000000 --- a/rust/pragma-cli/src/utils/constants.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub const DATA_FEEDS: [&str; 2] = ["median", "average"]; -pub const ORACLE_ADDRESS: &str = "0x2a85bd616f912537c50a49a4076db02c00b29b2cdc8a197ce92ed1837fa875b"; diff --git a/rust/pragma-cli/src/utils/mod.rs b/rust/pragma-cli/src/utils/mod.rs deleted file mode 100644 index 0b6d2c4e..00000000 --- a/rust/pragma-cli/src/utils/mod.rs +++ /dev/null @@ -1 +0,0 @@ -pub mod constants; diff --git a/rust/pragma-feeds/Cargo.toml b/rust/pragma-feeds/Cargo.toml index ed6f2aac..db0c0799 100644 --- a/rust/pragma-feeds/Cargo.toml +++ b/rust/pragma-feeds/Cargo.toml @@ -1,19 +1,11 @@ [package] name = "pragma-feeds" -version = "0.1.0" +version = "1.0.0" edition = "2021" [dependencies] anyhow = { workspace = true } -apibara-core = { workspace = true } -async-trait = { workspace = true } hex = { workspace = true } -rusoto_core = { workspace = true } serde = { workspace = true, features = ["derive"] } -starknet = { workspace = true } strum = { workspace = true } strum_macros = { workspace = true } -tokio = { workspace = true, features = ["signal"] } -tracing = { workspace = true } -tracing-axiom = { workspace = true } -tracing-subscriber = { workspace = true } diff --git a/rust/pragma-utils/Cargo.toml b/rust/pragma-utils/Cargo.toml index a0c0e3d3..cd43d24a 100644 --- a/rust/pragma-utils/Cargo.toml +++ b/rust/pragma-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pragma-utils" -version = "0.1.0" +version = "1.0.0" edition = "2021" [dependencies] @@ -8,12 +8,8 @@ alloy = { workspace = true } anyhow = { workspace = true } apibara-core = { workspace = true } async-trait = { workspace = true } -hex = { workspace = true } rusoto_core = { workspace = true } -serde = { workspace = true, features = ["derive"] } starknet = { workspace = true } -strum = { workspace = true } -strum_macros = { workspace = true } tokio = { workspace = true, features = ["signal"] } tracing = { workspace = true } tracing-axiom = { workspace = true } diff --git a/rust/rust-toolchain.toml b/rust/rust-toolchain.toml index 8c9c3a25..7d857086 100644 --- a/rust/rust-toolchain.toml +++ b/rust/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.81.0" +channel = "1.82.0" components = ["rustfmt", "clippy", "rust-analyzer"] targets = ["wasm32-unknown-unknown"] profile = "minimal" diff --git a/rust/theoros/Cargo.toml b/rust/theoros/Cargo.toml index 192bb0ab..b9af05a3 100644 --- a/rust/theoros/Cargo.toml +++ b/rust/theoros/Cargo.toml @@ -11,32 +11,28 @@ apibara-sdk = { workspace = true } async-trait = { workspace = true } axum = { workspace = true, features = ["macros", "ws", "tokio"] } axum-macros = { workspace = true } -bigdecimal = { workspace = true } chrono = { workspace = true, features = ["serde"] } clap = { workspace = true, features = ["derive", "env"] } -dotenvy = { workspace = true } -envy = { workspace = true } +dashmap = { workspace = true } futures = { workspace = true, features = ["std"] } futures-util = { workspace = true } hyper = { workspace = true, features = ["server"] } lazy_static = { workspace = true } -num-bigint = { workspace = true } -num-traits = { workspace = true } opentelemetry = { workspace = true } pragma-feeds = { workspace = true } pragma-utils = { workspace = true } prometheus = { workspace = true } -prometheus-client = { workspace = true } rusoto_core = { workspace = true } rusoto_s3 = { workspace = true } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } serde_yaml = { workspace = true } +strum = { workspace = true, features = ["derive"] } +strum_macros = { workspace = true } starknet = { workspace = true } thiserror = { workspace = true } tokio = { workspace = true, features = ["sync", "macros", "rt-multi-thread"] } tower-http = { workspace = true, features = ["fs", "trace", "cors"] } -tower_governor = { workspace = true, features = ["axum", "tracing"] } tracing = { workspace = true } url = { workspace = true } utoipa = { workspace = true, features = ["axum_extras", "chrono", "uuid"] } diff --git a/rust/theoros/openapi.json b/rust/theoros/openapi.json index 42f5dde3..af969707 100644 --- a/rust/theoros/openapi.json +++ b/rust/theoros/openapi.json @@ -9,16 +9,34 @@ "version": "0.1.0" }, "paths": { - "/v1/calldata/{chain_name}/{feed_id}": { + "/v1/calldata": { "get": { - "tags": [ - "crate::handlers::get_calldata" - ], + "tags": ["crate::handlers::rest::get_calldata"], "operationId": "get_calldata", - "parameters": [], + "parameters": [ + { + "name": "chain", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "feed_ids", + "in": "query", + "required": true, + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], "responses": { "200": { - "description": "Constructs the calldata used to update the feed id specified", + "description": "Constructs the calldata used to update the specified feed IDs", "content": { "application/json": { "schema": { @@ -31,14 +49,11 @@ } }, "404": { - "description": "Unknown Feed Id", + "description": "Unknown Feed ID", "content": { "application/json": { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/GetCalldataError" - } + "$ref": "#/components/schemas/GetCalldataError" } } } @@ -48,9 +63,7 @@ }, "/v1/chains": { "get": { - "tags": [ - "crate::handlers::get_chains" - ], + "tags": ["crate::handlers::rest::get_chains"], "operationId": "get_chains", "responses": { "200": { @@ -71,9 +84,7 @@ }, "/v1/data_feeds": { "get": { - "tags": [ - "crate::handlers::get_data_feeds" - ], + "tags": ["crate::handlers::rest::get_data_feeds"], "operationId": "get_data_feeds", "responses": { "200": { @@ -95,37 +106,39 @@ }, "components": { "schemas": { + "CalldataResponse": { + "type": "object", + "required": ["feed_id", "encoded_calldata"], + "properties": { + "encoded_calldata": { + "type": "string" + }, + "feed_id": { + "type": "string" + } + } + }, "GetCalldataError": { "oneOf": [ { "type": "string", - "enum": [ - "InternalServerError" - ] + "enum": ["InternalServerError"] }, { "type": "string", - "enum": [ - "DatabaseConnection" - ] + "enum": ["DatabaseConnection"] }, { "type": "string", - "enum": [ - "InvalidFeedId" - ] + "enum": ["InvalidFeedId"] }, { "type": "string", - "enum": [ - "DispatchNotFound" - ] + "enum": ["DispatchNotFound"] }, { "type": "object", - "required": [ - "FeedNotFound" - ], + "required": ["FeedNotFound"], "properties": { "FeedNotFound": { "type": "string" @@ -134,54 +147,54 @@ }, { "type": "string", - "enum": [ - "FailedToCreateHyperlaneClient" - ] + "enum": ["FailedToCreateHyperlaneClient"] }, { "type": "string", - "enum": [ - "FailedToFetchOnchainValidators" - ] + "enum": ["FailedToFetchOnchainValidators"] }, { "type": "string", - "enum": [ - "ValidatorNotFound" - ] + "enum": ["ValidatorNotFound"] }, { "type": "object", - "required": [ - "ChainNotSupported" - ], + "required": ["ChainNotSupported"], "properties": { "ChainNotSupported": { "type": "string" } } + }, + { + "type": "object", + "required": ["CalldataError"], + "properties": { + "CalldataError": { + "type": "string" + } + } } ] }, "GetCalldataQuery": { - "type": "object" - }, - "GetCalldataResponse": { "type": "object", - "required": [ - "calldata" - ], + "required": ["chain", "feed_ids"], "properties": { - "calldata": { + "chain": { "type": "string" + }, + "feed_ids": { + "type": "array", + "items": { + "type": "string" + } } } }, "GetChainsError": { "type": "string", - "enum": [ - "InternalServerError" - ] + "enum": ["InternalServerError"] }, "GetChainsResponse": { "type": "array", @@ -193,9 +206,7 @@ "oneOf": [ { "type": "object", - "required": [ - "ParsingFeedId" - ], + "required": ["ParsingFeedId"], "properties": { "ParsingFeedId": { "type": "string" @@ -204,9 +215,7 @@ }, { "type": "string", - "enum": [ - "InternalServerError" - ] + "enum": ["InternalServerError"] } ] }, @@ -215,20 +224,34 @@ "items": { "$ref": "#/components/schemas/Feed" } + }, + "RpcDataFeed": { + "type": "object", + "required": ["feed_id", "encoded_calldata"], + "properties": { + "encoded_calldata": { + "type": "string", + "description": "The calldata binary represented as a hex string." + }, + "feed_id": { + "type": "string" + } + } } }, "responses": { - "GetCalldataResponse": { + "CalldataResponse": { "description": "", "content": { "application/json": { "schema": { "type": "object", - "required": [ - "calldata" - ], + "required": ["feed_id", "encoded_calldata"], "properties": { - "calldata": { + "encoded_calldata": { + "type": "string" + }, + "feed_id": { "type": "string" } } @@ -270,4 +293,4 @@ "description": "Theoros - The Pragma Consultant" } ] -} \ No newline at end of file +} diff --git a/rust/theoros/src/cli.rs b/rust/theoros/src/cli.rs index e4c563e7..b67f7347 100644 --- a/rust/theoros/src/cli.rs +++ b/rust/theoros/src/cli.rs @@ -50,9 +50,6 @@ pub struct TheorosCli { value_parser = parse_evm_config )] pub evm_config: evm_config::EvmConfig, - - #[clap(env = "INDEXER_STARTING_BLOCK", long, default_value = "0")] - pub indexer_starting_block: u64, } /// Parse a Felt. @@ -76,7 +73,5 @@ pub fn parse_evm_config(s: &str) -> anyhow::Result { if !std::path::Path::new(s).exists() { anyhow::bail!("EVM config file not found at path: {}", s); } - - // Load and parse the config evm_config::EvmConfig::from_file(s).with_context(|| format!("Failed to load EVM config from path: {}", s)) } diff --git a/rust/theoros/src/configs/evm_config.rs b/rust/theoros/src/configs/evm_config.rs index 8c6358c9..5448d519 100644 --- a/rust/theoros/src/configs/evm_config.rs +++ b/rust/theoros/src/configs/evm_config.rs @@ -1,9 +1,8 @@ +use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs; use std::path::Path; -use std::str::FromStr; - -use serde::{Deserialize, Serialize}; +use strum_macros::EnumString; use thiserror::Error; pub const DEFAULT_CONFIG_PATH: &str = "evm_config.yaml"; @@ -11,8 +10,10 @@ pub const DEFAULT_CONFIG_PATH: &str = "evm_config.yaml"; /// Supported Chain identifiers // Must reflect the EVM chains here: // https://github.com/astraly-labs/pragma-monorepo/blob/main/typescript/pragma-utils/src/chains.ts -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[derive(Debug, strum_macros::Display, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, EnumString)] +#[strum(serialize_all = "snake_case")] #[serde(rename_all = "snake_case")] +#[strum(ascii_case_insensitive)] pub enum EvmChainName { Mainnet, Sepolia, @@ -68,75 +69,8 @@ impl EvmConfig { Ok(config) } - /// Get configuration for a specific chain - pub fn chain_config(&self, chain_name: EvmChainName) -> Option<&EvmChainConfig> { - self.chains.get(&chain_name) - } - /// Get all configured chains pub fn chains(&self) -> &HashMap { &self.chains } - - /// Get all configured chains names - pub fn chain_names(&self) -> Vec { - self.chains.keys().cloned().collect() - } -} - -#[derive(Error, Debug)] -#[error("Unknown chain name: {0}")] -pub struct ParseChainError(String); - -impl FromStr for EvmChainName { - type Err = ParseChainError; - - fn from_str(s: &str) -> Result { - let chain_name = s.to_lowercase().replace('-', "_"); - match chain_name.as_str() { - "mainnet" => Ok(Self::Mainnet), - "sepolia" => Ok(Self::Sepolia), - "holesky" => Ok(Self::Holesky), - "bsc" => Ok(Self::Bsc), - "bsc_testnet" => Ok(Self::BscTestnet), - "polygon" => Ok(Self::Polygon), - "polygon_testnet" => Ok(Self::PolygonTestnet), - "polygon_zk_evm" => Ok(Self::PolygonZkEvm), - "avalanche" => Ok(Self::Avalanche), - "fantom" => Ok(Self::Fantom), - "arbitrum" => Ok(Self::Arbitrum), - "optimism" => Ok(Self::Optimism), - "base" => Ok(Self::Base), - "scroll" => Ok(Self::Scroll), - "scroll_testnet" => Ok(Self::ScrollTestnet), - "scroll_sepolia_testnet" => Ok(Self::ScrollSepoliaTestnet), - "zircuit_testnet" => Ok(Self::ZircuitTestnet), - "plume_testnet" => Ok(Self::PlumeTestnet), - "worldchain" => Ok(Self::Worldchain), - "worldchain_testnet" => Ok(Self::WorldchainTestnet), - "zksync" => Ok(Self::Zksync), - "zksync_testnet" => Ok(Self::ZksyncTestnet), - _ => Err(ParseChainError(s.to_string())), - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - const EXAMPLE_CONFIG: &str = r#" - zircuit_testnet: - rpc_url: "https://zircuit1-testnet.p2pify.com" - hyperlane_address: "0xb9aB8aDC69Ad3B96a8CdF5610e9bFEcc0415D662" - "#; - - #[test] - fn test_parse_config() { - let config: EvmConfig = serde_yaml::from_str(EXAMPLE_CONFIG).unwrap(); - - let zircuit_config = config.chain_config(EvmChainName::ZircuitTestnet).unwrap(); - assert_eq!(zircuit_config.rpc_url, "https://zircuit1-testnet.p2pify.com"); - assert_eq!(zircuit_config.hyperlane_address, "0xb9aB8aDC69Ad3B96a8CdF5610e9bFEcc0415D662"); - } } diff --git a/rust/theoros/src/constants.rs b/rust/theoros/src/constants.rs index 4e838ab8..0bafbb70 100644 --- a/rust/theoros/src/constants.rs +++ b/rust/theoros/src/constants.rs @@ -1,7 +1,5 @@ use std::time::Duration; -use crate::configs::evm_config::EvmChainName; - pub const HYPERLANE_VERSION: u8 = 3; pub const PRAGMA_MAJOR_VERSION: u8 = 1; @@ -10,10 +8,9 @@ pub const TRAILING_HEADER_SIZE: u8 = 0; pub const PING_INTERVAL_DURATION: Duration = Duration::from_secs(30); pub const MAX_CLIENT_MESSAGE_SIZE: usize = 100 * 1024; // 100 KiB +pub const FEED_UPDATED_CHANNEL_CAPACITY: usize = 1024; // TODO: add support for this /// The maximum number of bytes that can be sent per second per IP address. /// If the limit is exceeded, the connection is closed. pub const _BYTES_LIMIT_PER_IP_PER_SECOND: u32 = 256 * 1024; // 256 KiB - -pub const DEFAULT_ACTIVE_CHAIN: EvmChainName = EvmChainName::Mainnet; diff --git a/rust/theoros/src/errors/calldata_error.rs b/rust/theoros/src/errors/calldata_error.rs index 6c26557c..a849b990 100644 --- a/rust/theoros/src/errors/calldata_error.rs +++ b/rust/theoros/src/errors/calldata_error.rs @@ -23,6 +23,8 @@ pub enum GetCalldataError { ValidatorNotFound, #[error("The chain '{0}' is not supported")] ChainNotSupported(String), + #[error("Error while building the calldata: {0}")] + CalldataError(String), } impl IntoResponse for GetCalldataError { @@ -37,6 +39,7 @@ impl IntoResponse for GetCalldataError { Self::DispatchNotFound => { (StatusCode::NOT_FOUND, "Could not find any Dispatch event for the provided Feed ID".into()) } + Self::CalldataError(msg) => (StatusCode::INTERNAL_SERVER_ERROR, msg), _ => (StatusCode::INTERNAL_SERVER_ERROR, String::from("Internal server error")), }; (status, Json(json!({"resource":"Calldata", "message": err_msg, "happened_at" : chrono::Utc::now() }))) diff --git a/rust/theoros/src/handlers/rest/get_calldata.rs b/rust/theoros/src/handlers/rest/get_calldata.rs index ef3b049a..39c97ac5 100644 --- a/rust/theoros/src/handlers/rest/get_calldata.rs +++ b/rust/theoros/src/handlers/rest/get_calldata.rs @@ -1,64 +1,91 @@ use std::str::FromStr; use alloy::hex; -use axum::extract::{Query, State}; -use axum::Json; +use axum::{ + extract::{Query, State}, + Json, +}; use serde::{Deserialize, Serialize}; use utoipa::{IntoParams, ToResponse, ToSchema}; -use crate::configs::evm_config::EvmChainName; -use crate::errors::GetCalldataError; -use crate::extractors::PathExtractor; -use crate::types::calldata::{AsCalldata, Calldata}; -use crate::AppState; +use crate::{ + configs::evm_config::EvmChainName, + errors::GetCalldataError, + types::calldata::{AsCalldata, Calldata}, + AppState, +}; -#[derive(Default, Deserialize, IntoParams, ToSchema)] -pub struct GetCalldataQuery {} +#[derive(Deserialize, IntoParams, ToSchema)] +pub struct GetCalldataQuery { + pub chain: String, + #[serde(deserialize_with = "deserialize_feed_ids")] + pub feed_ids: Vec, +} #[derive(Debug, Serialize, Deserialize, ToResponse, ToSchema)] -pub struct GetCalldataResponse { - pub calldata: Calldata, +pub struct CalldataResponse { + pub feed_id: String, pub encoded_calldata: String, } +pub type GetCalldataResponse = Vec; + #[utoipa::path( get, - path = "/v1/calldata/{chain_name}/{feed_id}", + path = "/v1/calldata", + params( + GetCalldataQuery + ), responses( ( status = 200, - description = "Constructs the calldata used to update the feed id specified", + description = "Constructs the calldata used to update the specified feed IDs", body = [GetCalldataResponse] ), ( status = 404, - description = "Unknown Feed Id", - body = [GetCalldataError] + description = "Unknown Feed ID", + body = GetCalldataError ) ), - params( - GetCalldataQuery - ), )] pub async fn get_calldata( State(state): State, - PathExtractor(path_args): PathExtractor<(String, String)>, - Query(_params): Query, + Query(params): Query, ) -> Result, GetCalldataError> { let started_at = std::time::Instant::now(); - let (raw_chain_name, feed_id) = path_args; - let chain_name = EvmChainName::from_str(&raw_chain_name) - .map_err(|_| GetCalldataError::ChainNotSupported(raw_chain_name.clone()))?; + + let chain_name = + EvmChainName::from_str(¶ms.chain).map_err(|_| GetCalldataError::ChainNotSupported(params.chain.clone()))?; let stored_feed_ids = state.storage.feed_ids(); - if !stored_feed_ids.contains(&feed_id).await { - return Err(GetCalldataError::FeedNotFound(feed_id)); - }; - let calldata = Calldata::build_from(&state, chain_name, feed_id).await?; + // Check if all requested feed IDs are supported. + if let Some(missing_id) = stored_feed_ids.contains_vec(¶ms.feed_ids) { + return Err(GetCalldataError::FeedNotFound(missing_id)); + } + + // Build calldata for each feed ID. + let mut responses: GetCalldataResponse = Vec::with_capacity(params.feed_ids.len()); + for feed_id in ¶ms.feed_ids { + let calldata = Calldata::build_from(&state, chain_name, feed_id.clone()) + .await + .map_err(|e| GetCalldataError::CalldataError(e.to_string()))?; + + let response = + CalldataResponse { feed_id: feed_id.clone(), encoded_calldata: hex::encode(calldata.as_bytes()) }; + responses.push(response); + } - let response = - GetCalldataResponse { calldata: calldata.clone(), encoded_calldata: hex::encode(calldata.as_bytes()) }; tracing::info!("🌐 get_calldata - {:?}", started_at.elapsed()); - Ok(Json(response)) + Ok(Json(responses)) +} + +/// Deserialize a list of feed ids "A, B, C" into a Vec = [A, B, C]. +fn deserialize_feed_ids<'de, D>(deserializer: D) -> Result, D::Error> +where + D: serde::Deserializer<'de>, +{ + let s: String = String::deserialize(deserializer)?; + Ok(s.split(',').map(|s| s.trim().to_string()).collect()) } diff --git a/rust/theoros/src/handlers/rest/get_data_feeds.rs b/rust/theoros/src/handlers/rest/get_data_feeds.rs index 0af8769c..4e14e7d0 100644 --- a/rust/theoros/src/handlers/rest/get_data_feeds.rs +++ b/rust/theoros/src/handlers/rest/get_data_feeds.rs @@ -23,8 +23,8 @@ pub async fn get_data_feeds(State(state): State) -> Result, chain_name: EvmChainName }, + Subscribe { feed_ids: Vec, chain: EvmChainName }, #[serde(rename = "unsubscribe")] - Unsubscribe { ids: Vec }, + Unsubscribe { feed_ids: Vec }, +} + +#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] +pub struct RpcDataFeed { + pub feed_id: String, + /// The calldata binary represented as a hex string. + pub encoded_calldata: String, } #[derive(Serialize, Debug, Clone)] @@ -46,7 +56,7 @@ enum ServerMessage { #[serde(rename = "response")] Response(ServerResponseMessage), #[serde(rename = "data_feed_update")] - DataFeedUpdate { data_feed: RpcDataFeed }, + DataFeedUpdate { data_feeds: Vec }, } #[derive(Serialize, Debug, Clone)] @@ -58,6 +68,10 @@ enum ServerResponseMessage { Err { error: String }, } +/// WebSocket route handler. +/// +/// Upgrades the HTTP connection to a WebSocket connection and spawns a new +/// subscriber to handle incoming and outgoing messages. pub async fn ws_route_handler( ws: WebSocketUpgrade, AxumState(state): AxumState, @@ -66,18 +80,14 @@ pub async fn ws_route_handler( ws.max_message_size(MAX_CLIENT_MESSAGE_SIZE).on_upgrade(move |socket| websocket_handler(socket, state)) } +/// Handles the WebSocket connection for a single client. #[tracing::instrument(skip(stream, state))] async fn websocket_handler(stream: WebSocket, state: AppState) { let ws_state = state.ws.clone(); - // TODO: add new connection to metrics - let (sender, receiver) = stream.split(); - - let feeds_receiver = state.storage.feeds_channel.subscribe(); - + let feeds_receiver = state.storage.feeds_updated_tx().subscribe(); let id = ws_state.subscriber_counter.fetch_add(1, Ordering::SeqCst); - let mut subscriber = Subscriber::new(id, Arc::new(state), feeds_receiver, receiver, sender); subscriber.run().await; @@ -85,24 +95,29 @@ async fn websocket_handler(stream: WebSocket, state: AppState) { pub type SubscriberId = usize; +/// Represents a client connected via WebSocket. +/// +/// Manages subscriptions to data feeds, handles incoming client messages, +/// and sends updates to the client. pub struct Subscriber { id: SubscriberId, closed: bool, state: Arc, - feeds_receiver: Receiver, + feeds_receiver: Receiver, receiver: SplitStream, sender: SplitSink, data_feeds_with_config: HashMap, - active_chain: EvmChainName, + active_chain: Option, ping_interval: tokio::time::Interval, responded_to_ping: bool, } impl Subscriber { + /// Creates a new `Subscriber` instance. pub fn new( id: SubscriberId, state: Arc, - feeds_receiver: Receiver, + feeds_receiver: Receiver, receiver: SplitStream, sender: SplitSink, ) -> Self { @@ -114,47 +129,43 @@ impl Subscriber { receiver, sender, data_feeds_with_config: HashMap::new(), - active_chain: DEFAULT_ACTIVE_CHAIN, + active_chain: None, ping_interval: tokio::time::interval(PING_INTERVAL_DURATION), responded_to_ping: true, } } + /// Runs the subscriber event loop, handling messages and updates. #[tracing::instrument(skip(self))] pub async fn run(&mut self) { while !self.closed { - if let Err(e) = self.handle_next().await { - tracing::error!(subscriber = self.id, error = ?e, "Error Handling Subscriber Message."); + if self.handle_next().await.is_err() { break; } } } + /// Handles the next event, whether it's an incoming message, a data feed update, or a ping. async fn handle_next(&mut self) -> Result<()> { tokio::select! { - maybe_update_feeds_event = self.feeds_receiver.recv() => { - match maybe_update_feeds_event { - Ok(event) => self.handle_data_feeds_update(event).await, - Err(e) => Err(anyhow!("Failed to receive update from store: {:?}", e)), + maybe_update = self.feeds_receiver.recv() => { + match maybe_update { + Ok(_) => self.handle_data_feeds_update().await, + Err(e) => anyhow::bail!("Failed to receive update from store: {:?}", e), } }, - maybe_message_or_err = self.receiver.next() => { - self.handle_client_message( - maybe_message_or_err.ok_or(anyhow!("Client channel is closed"))?? - ).await - }, - _ = self.ping_interval.tick() => { - if !self.responded_to_ping { - // self.metrics - // .interactions - // .get_or_create(&Labels { - // interaction: Interaction::ClientHeartbeat, - // status: Status::Error, - // }) - // .inc(); - - return Err(anyhow!("Subscriber did not respond to ping. Closing connection.")); + maybe_message = self.receiver.next() => { + match maybe_message { + Some(Ok(message)) => self.handle_client_message(message).await, + Some(Err(e)) => anyhow::bail!("WebSocket error: {:?}", e), + None => { + self.closed = true; + Ok(()) + } } + }, + _ = self.ping_interval.tick() => { + anyhow::ensure!(self.responded_to_ping, "Subscriber did not respond to ping. Closing connection."); self.responded_to_ping = false; self.sender.send(Message::Ping(vec![])).await?; Ok(()) @@ -162,105 +173,118 @@ impl Subscriber { } } - async fn handle_data_feeds_update(&mut self, event: CheckpointMatchEvent) -> Result<()> { - tracing::debug!(subscriber = self.id, n = event.block_number(), "Handling Data Feeds Update."); - // Retrieve the updates for subscribed feed ids at the given slot - let feed_ids = self.data_feeds_with_config.keys().cloned().collect::>(); - // TODO: add support for multiple feeds - let feed_id = feed_ids.first().unwrap(); + /// Handles data feed updates by sending new data to the client for all subscribed feeds. + async fn handle_data_feeds_update(&mut self) -> Result<()> { + if self.active_chain.is_none() || self.data_feeds_with_config.is_empty() { + return Ok(()); + } + + tracing::debug!(subscriber = self.id, "Handling data feeds update."); + + // Retrieve the list of subscribed feed IDs. + let feed_ids: Vec = self.data_feeds_with_config.keys().cloned().collect(); - let calldata = Calldata::build_from(self.state.as_ref(), self.active_chain, feed_id.to_owned()).await?; + let mut data_feeds = Vec::with_capacity(feed_ids.len()); + // Build calldata for each subscribed feed and collect them. + for feed_id in feed_ids { + match Calldata::build_from(self.state.as_ref(), self.active_chain.unwrap(), feed_id.clone()).await { + Ok(calldata) => { + data_feeds.push(RpcDataFeed { + feed_id: feed_id.clone(), + encoded_calldata: hex::encode(calldata.as_bytes()), + }); + } + Err(e) => { + self.send_error_to_client(format!("Error building calldata for {}: {}", feed_id, e)).await?; + } + } + } + + // Send a single update containing all data feeds. + if !data_feeds.is_empty() { + let update = ServerMessage::DataFeedUpdate { data_feeds }; + let message = serde_json::to_string(&update)?; + self.sender.send(Message::Text(message)).await?; + } - let message = serde_json::to_string(&ServerMessage::DataFeedUpdate { - data_feed: RpcDataFeed { feed_id: feed_id.clone(), calldata: Some(hex::encode(calldata.as_bytes())) }, - })?; - self.sender.send(message.into()).await?; - // TODO: success metric Ok(()) } + /// Processes messages received from the client. #[tracing::instrument(skip(self, message))] async fn handle_client_message(&mut self, message: Message) -> Result<()> { - let maybe_client_message = match message { + match message { Message::Close(_) => { - // Closing the connection. We don't remove it from the subscribers - // list, instead when the Subscriber struct is dropped the channel - // to subscribers list will be closed and it will eventually get - // removed. tracing::trace!(id = self.id, "📨 [CLOSE]"); - - // Send the close message to gracefully shut down the connection - // Otherwise the client might get an abnormal Websocket closure - // error. self.sender.close().await?; self.closed = true; - return Ok(()); + Ok(()) } - Message::Text(text) => serde_json::from_str::(&text), - Message::Binary(data) => serde_json::from_slice::(&data), - Message::Ping(_) => { - // Axum will send Pong automatically - return Ok(()); + Message::Text(text) => self.process_client_message(&text).await, + Message::Binary(data) => { + let text = String::from_utf8(data)?; + self.process_client_message(&text).await } + Message::Ping(_) => Ok(()), // Axum handles PONG responses automatically. Message::Pong(_) => { self.responded_to_ping = true; - return Ok(()); + Ok(()) } - }; + } + } - match maybe_client_message { + /// Parses and processes a client message in text format. + async fn process_client_message(&mut self, text: &str) -> Result<()> { + let client_message: ClientMessage = match serde_json::from_str(text) { + Ok(msg) => msg, Err(e) => { - tracing::error!("😶‍🌫️ Client disconnected/error occurred. Closing the channel."); - self.sender - .send( - serde_json::to_string(&ServerMessage::Response(ServerResponseMessage::Err { - error: e.to_string(), - }))? - .into(), - ) - .await?; + self.send_error_to_client(e.to_string()).await?; return Ok(()); } + }; - Ok(ClientMessage::Subscribe { ids: feed_ids, chain_name }) => { + match client_message { + ClientMessage::Subscribe { feed_ids, chain } => { + // Check if the chain is supported + if !self.state.hyperlane_validators_mapping.is_supported_chain(&chain) { + self.send_error_to_client(format!( + "The chain {} is not supported. Call /v1/chains to know the chains supported by Theoros.", + chain, + )) + .await?; + return Ok(()); + } + // Check if all requested feed IDs are supported. let stored_feed_ids = self.state.storage.feed_ids(); + if let Some(missing_id) = stored_feed_ids.contains_vec(&feed_ids) { + self.send_error_to_client(format!("Can't subscribe: feed ID not supported {:}", missing_id)) + .await?; + return Ok(()); + } - // TODO: Assert that the chain is supported? - - // If there is a single feed id that is not found, we don't subscribe to any of the - // asked feed ids and return an error to be more explicit and clear. - match stored_feed_ids.contains_vec(&feed_ids).await { - Some(missing_id) => { - // TODO: return multiple missing ids - self.sender - .send( - serde_json::to_string(&ServerMessage::Response(ServerResponseMessage::Err { - error: format!("Can't subscribe: at least one of the requested feed ids is not supported ({:?})", missing_id), - }))? - .into(), - ) - .await?; - return Ok(()); - } - None => { - for feed_id in feed_ids { - self.data_feeds_with_config.insert(feed_id, DataFeedClientConfig {}); - self.active_chain = chain_name; - } - } + // Subscribe to the requested feed IDs. + self.active_chain = Some(chain); + for feed_id in feed_ids { + self.data_feeds_with_config.insert(feed_id, DataFeedClientConfig {}); } } - Ok(ClientMessage::Unsubscribe { ids: feed_ids }) => { + ClientMessage::Unsubscribe { feed_ids } => { for feed_id in feed_ids { self.data_feeds_with_config.remove(&feed_id); } } } + // Acknowledge the successful processing of the client message. self.sender - .send(serde_json::to_string(&ServerMessage::Response(ServerResponseMessage::Success))?.into()) + .send(Message::Text(serde_json::to_string(&ServerMessage::Response(ServerResponseMessage::Success))?)) .await?; + Ok(()) + } + async fn send_error_to_client(&mut self, msg: String) -> anyhow::Result<()> { + let message = ServerResponseMessage::Err { error: msg }; + self.sender.send(Message::Text(serde_json::to_string(&ServerMessage::Response(message))?)).await?; Ok(()) } } diff --git a/rust/theoros/src/main.rs b/rust/theoros/src/main.rs index 830187a9..248c4836 100644 --- a/rust/theoros/src/main.rs +++ b/rust/theoros/src/main.rs @@ -9,11 +9,10 @@ mod services; mod storage; mod types; -use std::sync::{atomic::AtomicUsize, Arc}; +use std::sync::Arc; use anyhow::Result; use clap::Parser; -use prometheus::Registry; use storage::TheorosStorage; use tracing::Level; @@ -25,29 +24,10 @@ use pragma_utils::{ use cli::TheorosCli; use rpc::{evm::HyperlaneValidatorsMapping, starknet::StarknetRpc}; use services::{ApiService, HyperlaneService, IndexerService, MetricsService}; +use types::state::{AppState, WsState}; const LOG_LEVEL: Level = Level::INFO; -#[derive(Clone)] -pub struct AppState { - pub starknet_rpc: Arc, - pub hyperlane_validators_mapping: Arc, - pub storage: Arc, - pub metrics_registry: Registry, // already wrapped into an Arc - pub ws: Arc, -} - -pub struct WsState { - pub subscriber_counter: AtomicUsize, -} - -#[allow(clippy::new_without_default)] -impl WsState { - pub fn new() -> Self { - Self { subscriber_counter: AtomicUsize::new(0) } - } -} - #[tokio::main] #[tracing::instrument] async fn main() -> Result<()> { @@ -56,15 +36,12 @@ async fn main() -> Result<()> { init_tracing(&config.app_name, LOG_LEVEL)?; let starknet_rpc = StarknetRpc::new(config.madara_rpc_url); - let hyperlane_rpcs = HyperlaneValidatorsMapping::from_config(&config.evm_config).await?; - - let (update_tx, _) = tokio::sync::broadcast::channel(1000); + let hyperlane_validators_mapping = HyperlaneValidatorsMapping::from_config(&config.evm_config).await?; let theoros_storage = TheorosStorage::from_rpc_state( &starknet_rpc, &config.pragma_feeds_registry_address, &config.hyperlane_validator_announce_address, - update_tx, ) .await?; @@ -72,7 +49,7 @@ async fn main() -> Result<()> { let state = AppState { starknet_rpc: Arc::new(starknet_rpc), - hyperlane_validators_mapping: Arc::new(hyperlane_rpcs), + hyperlane_validators_mapping: Arc::new(hyperlane_validators_mapping), storage: Arc::new(theoros_storage), metrics_registry: metrics_service.registry(), ws: Arc::new(WsState::new()), @@ -84,17 +61,21 @@ async fn main() -> Result<()> { config.hyperlane_mailbox_address, config.hyperlane_validator_announce_address, config.pragma_feeds_registry_address, - config.indexer_starting_block, + state.starknet_rpc.block_number().await?, )?; + let hyperlane_service = HyperlaneService::new(state.storage.clone()); let api_service = ApiService::new(state.clone(), &config.server_host, config.server_port); - let hyperlane_service = HyperlaneService::new(state.clone()); - let theoros = - ServiceGroup::default().with(metrics_service).with(indexer_service).with(api_service).with(hyperlane_service); - - theoros.start_and_drive_to_end().await?; + ServiceGroup::default() + .with(metrics_service) + .with(indexer_service) + .with(hyperlane_service) + .with(api_service) + .start_and_drive_to_end() + .await?; // Ensure that the tracing provider is shutdown correctly opentelemetry::global::shutdown_tracer_provider(); + Ok(()) } diff --git a/rust/theoros/src/rpc/evm/hyperlane.rs b/rust/theoros/src/rpc/evm/hyperlane.rs index 3e00db92..07dbb9e7 100644 --- a/rust/theoros/src/rpc/evm/hyperlane.rs +++ b/rust/theoros/src/rpc/evm/hyperlane.rs @@ -1,3 +1,5 @@ +use std::collections::HashMap; + use alloy::network::Ethereum; use alloy::primitives::Address; use alloy::providers::fillers::{ChainIdFiller, FillProvider, GasFiller, JoinFill, NonceFiller}; @@ -36,15 +38,16 @@ impl HyperlaneClient { Self(hyperlane_client) } - pub async fn get_validators(&self) -> Result> { - let mut validators = Vec::new(); + pub async fn get_validators_with_index(&self) -> Result> { + let mut validators = HashMap::new(); let mut index = 0; while let Ok(address) = self.0._validators(index.try_into()?).call().await { if address._0 == Address::ZERO { break; } - validators.push(Felt::from_bytes_be(&pad_left_to_32_bytes(&address._0.into_array()))); + let validator = Felt::from_bytes_be(&pad_left_to_32_bytes(&address._0.into_array())); + validators.insert(validator, index); index += 1; } diff --git a/rust/theoros/src/rpc/evm/mod.rs b/rust/theoros/src/rpc/evm/mod.rs index 32958de3..226620a8 100644 --- a/rust/theoros/src/rpc/evm/mod.rs +++ b/rust/theoros/src/rpc/evm/mod.rs @@ -12,7 +12,7 @@ use url::Url; use crate::configs::evm_config::{EvmChainName, EvmConfig}; #[derive(Debug, Default, Clone)] -pub struct HyperlaneValidatorsMapping(HashMap>); +pub struct HyperlaneValidatorsMapping(HashMap>); impl HyperlaneValidatorsMapping { pub async fn from_config(config: &EvmConfig) -> anyhow::Result { @@ -24,23 +24,25 @@ impl HyperlaneValidatorsMapping { .map_err(|e| anyhow::anyhow!("Invalid hyperlane address for {chain_name:?}: {e}"))?; let rpc_client = HyperlaneClient::new(rpc_url, address).await; - let validators = rpc_client.get_validators().await?; + let validators = rpc_client.get_validators_with_index().await?; contracts.insert(*chain_name, validators); } Ok(Self(contracts)) } - pub fn get_validators(&self, chain_name: EvmChainName) -> Option<&Vec> { - self.0.get(&chain_name) - } - - pub fn validators(&self) -> &HashMap> { - &self.0 + /// Get the available validators for a chain & their indexes + pub fn get_validators(&self, chain_name: &EvmChainName) -> Option<&HashMap> { + self.0.get(chain_name) } /// Get all configured chains names pub fn chain_names(&self) -> Vec { self.0.keys().cloned().collect() } + + /// Check if the provided chain is supported + pub fn is_supported_chain(&self, chain: &EvmChainName) -> bool { + self.0.contains_key(chain) + } } diff --git a/rust/theoros/src/rpc/starknet/mod.rs b/rust/theoros/src/rpc/starknet/mod.rs index 8641b8e6..917dff9d 100644 --- a/rust/theoros/src/rpc/starknet/mod.rs +++ b/rust/theoros/src/rpc/starknet/mod.rs @@ -4,7 +4,8 @@ pub mod pragma_feeds_registry; pub use hyperlane::*; pub use pragma_feeds_registry::*; -use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient}; +use anyhow::Context; +use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient, Provider}; use url::Url; pub struct StarknetRpc(JsonRpcClient); @@ -13,4 +14,8 @@ impl StarknetRpc { pub fn new(rpc_url: Url) -> Self { Self(JsonRpcClient::new(HttpTransport::new(rpc_url))) } + + pub async fn block_number(&self) -> anyhow::Result { + self.0.block_number().await.context("Fetching block number") + } } diff --git a/rust/theoros/src/services/api/router.rs b/rust/theoros/src/services/api/router.rs index 67e54182..9a5d9c90 100644 --- a/rust/theoros/src/services/api/router.rs +++ b/rust/theoros/src/services/api/router.rs @@ -37,11 +37,11 @@ async fn handler_404() -> impl IntoResponse { } fn ws_route(state: AppState) -> Router { - Router::new().route("/ws", get(ws_route_handler)).with_state(state) + Router::new().route("/ws/calldata", get(ws_route_handler)).with_state(state) } fn calldata_routes(state: AppState) -> Router { - Router::new().route("/calldata/:chain_name/:feed_id", get(get_calldata)).with_state(state) + Router::new().route("/calldata", get(get_calldata)).with_state(state) } fn data_feeds_routes(state: AppState) -> Router { diff --git a/rust/theoros/src/services/hyperlane/mod.rs b/rust/theoros/src/services/hyperlane/mod.rs index dd9013a7..9f31c398 100644 --- a/rust/theoros/src/services/hyperlane/mod.rs +++ b/rust/theoros/src/services/hyperlane/mod.rs @@ -1,19 +1,21 @@ use std::{sync::Arc, time::Duration}; -use pragma_utils::services::Service; use starknet::core::types::Felt; use tokio::task::JoinSet; -use crate::{ - types::hyperlane::{FetchFromStorage, SignedCheckpointWithMessageId}, - AppState, +use pragma_utils::{conversions::alloy::hex_str_to_u256, services::Service}; + +use crate::storage::TheorosStorage; +use crate::types::hyperlane::{ + DispatchUpdateInfos, FetchFromStorage, NewUpdatesAvailableEvent, SignedCheckpointWithMessageId, }; -const FETCH_INTERVAL: Duration = Duration::from_secs(2); +/// Every [FETCH_INTERVAL] seconds, we check the pending checkpoints for all validators. +const FETCH_INTERVAL: Duration = Duration::from_secs(1); #[derive(Clone)] pub struct HyperlaneService { - state: AppState, + storage: Arc, } #[async_trait::async_trait] @@ -30,12 +32,10 @@ impl Service for HyperlaneService { } impl HyperlaneService { - pub fn new(state: AppState) -> Self { - Self { state } + pub fn new(storage: Arc) -> Self { + Self { storage } } - /// Every [FETCH_INTERVAL] seconds, fetch the latest checkpoint signed for all - /// registered validators. pub async fn run_forever(&self) -> anyhow::Result<()> { loop { self.process_validator_checkpoints().await; @@ -43,46 +43,138 @@ impl HyperlaneService { } } + /// Processes validator checkpoints by fetching signed checkpoints from all validators for each unsigned nonce. + /// + /// This function performs the following steps: + /// + /// 1. **Retrieve Unsigned Nonces**: + /// - Fetches all the nonces currently stored in the `UnsignedCheckpointsStorage`. + /// + /// 2. **Retrieve Validators and Fetchers**: + /// - Gets all registered validators and their corresponding fetchers from the `ValidatorsFetchersStorage`. + /// + /// 3. **Fetch Signed Checkpoints**: + /// - Attempts to fetch the signed checkpoint all unsigned nonce from each validator's fetcher (in parallel), + /// + /// 4. **Process Completed Nonces**: + /// - After all fetches are completed, iterates over the unsigned nonces again. + /// - Checks if all validators have signed the nonce using the `all_validators_signed_nonce` method. + /// - **Note**: Currently, the function only proceeds if **all** validators have signed the nonce. + /// - There's a `TODO` to modify this behavior to use a quorum method (e.g., consider a nonce as valid if 66% of validators have signed it). + /// - If all validators have signed the nonce: + /// - Calls `store_event_updates(nonce)` to process and store the updates associated with that nonce. + /// - Removes the nonce from the `UnsignedCheckpointsStorage`, as it has been fully processed. + /// async fn process_validator_checkpoints(&self) { - let validators_locations = self.state.storage.validators_locations().all().await; - let futures = validators_locations - .into_iter() - .map(|(validator, fetcher)| self.process_single_validator(validator, fetcher)); + let unsigned_nonces = self.storage.unsigned_checkpoints().nonces().await; + if unsigned_nonces.is_empty() { + return; + } + let validators_fetchers = self.storage.validators_fetchers().all(); + let mut futures = Vec::with_capacity(unsigned_nonces.len()); + for &nonce in &unsigned_nonces { + for (validator, fetcher) in &validators_fetchers { + let fut = self.fetch_checkpoint_for_validator(*validator, fetcher.clone(), nonce); + futures.push(fut); + } + } futures::future::join_all(futures).await; + + // NOTE: At the moment, we only process updates when ALL validators have signed a message. + // TODO: We should instead use a quorum method - if 66% have signed, consider it ok. + let validator_addresses: Vec = validators_fetchers.keys().cloned().collect(); + for &nonce in &unsigned_nonces { + if !self.all_validators_signed_nonce(&validator_addresses, nonce) { + continue; + } + // TODO: If the nonce n+1 is fully signed, shall we ignore every nonces before..? Or raise an alert? + tracing::info!("🌉 [Hyperlane] ✅ Nonce #{} is fully signed by all validators! Storing updates...", nonce); + if let Err(e) = self.store_dispatch_updates(nonce).await { + tracing::error!("😱 Failed to store event updates for nonce {}: {:?}", nonce, e); + } + self.send_websocket_notification().await; + self.storage.unsigned_checkpoints().remove(nonce).await; + } + } + + /// Checks if all validators have signed a given nonce. + fn all_validators_signed_nonce(&self, validators_addresses: &[Felt], nonce: u32) -> bool { + self.storage.signed_checkpoints().all_validators_signed_nonce(validators_addresses, nonce) } - async fn process_single_validator(&self, validator: Felt, fetcher: Arc>) { - match fetcher.fetch_latest().await { - Ok(Some(checkpoint)) => self.handle_checkpoint(validator, checkpoint).await, + /// Given a validator & a nonce, query the fetcher to try to get the signed checkpoint. + /// If it exists, it will get stored in the Signed Checkpoints storage. + async fn fetch_checkpoint_for_validator( + &self, + validator: Felt, + fetcher: Arc, + nonce: u32, + ) { + // If the validator already signed this nonce, ignore + if self.storage.signed_checkpoints().validator_signed_nonce(validator, nonce) { + return; + } + + match fetcher.fetch(nonce).await { + Ok(Some(checkpoint)) => { + self.store_signed_checkpoint(validator, checkpoint); + } Ok(None) => { - tracing::debug!("🌉 [Hyperlane] No new checkpoint for validator {:#x}", validator) + tracing::debug!("🌉 [Hyperlane] Validator {:#x} has not yet signed nonce {}", validator, nonce); } Err(e) => { - tracing::error!("🌉 [Hyperlane] Failed to fetch checkpoint for validator {:#x}: {:?}", validator, e) + tracing::error!( + "🌉 [Hyperlane] Failed to fetch checkpoint for validator {:#x} and nonce {}: {:?}", + validator, + nonce, + e + ); } } } - async fn handle_checkpoint(&self, validator: Felt, checkpoint: SignedCheckpointWithMessageId) { - let message_id = checkpoint.value.message_id; + /// Store the signed checkpoint for the (validator;nonce) couple. + fn store_signed_checkpoint(&self, validator: Felt, checkpoint: SignedCheckpointWithMessageId) { + let nonce = checkpoint.value.checkpoint.index; - if self.state.storage.validators_checkpoints().exists(validator, message_id).await { - tracing::debug!( - "🌉 [Hyperlane] Skipping duplicate checkpoint for validator {:#x}: {:#x}", - validator, - message_id - ); + if self.storage.signed_checkpoints().validator_signed_nonce(validator, nonce) { + tracing::debug!("🌉 [Hyperlane] Skipping duplicate checkpoint for validator {:#x}: #{}", validator, nonce); return; } - tracing::info!( - "🌉 [Hyperlane] Validator {:#x} retrieved latest checkpoint for message {:#x}", - validator, - message_id - ); - if let Err(e) = self.state.storage.validators_checkpoints().add(validator, message_id, checkpoint).await { - tracing::error!("🌉 [Hyperlane] Failed to store checkpoint for validator {:#x}: {:?}", validator, e); + self.storage.signed_checkpoints().add(validator, nonce, checkpoint); + tracing::info!("🌉 [Hyperlane] Validator {:#x} signed checkpoint #{}", validator, nonce); + } + + /// Stores the updates once it has been signed. + /// Also sends an update to the websocket channel that an update has been stored. + async fn store_dispatch_updates(&self, nonce: u32) -> anyhow::Result<()> { + let event = match self.storage.unsigned_checkpoints().get(nonce).await { + Some(e) => e, + None => unreachable!(), + }; + + for update in event.message.body.updates.iter() { + let dispatch_update_infos = DispatchUpdateInfos::new(&event, update); + + let feed_id = hex_str_to_u256(&update.feed_id())?; + self.storage.latest_update_per_feed().add(feed_id, dispatch_update_infos); + } + Ok(()) + } + + /// Sends a websocket notification to any client that *might* be listening. + /// Allows them to retrieve the latest update instantly after it is stored. + async fn send_websocket_notification(&self) { + match self.storage.feeds_updated_tx().send(NewUpdatesAvailableEvent::New) { + Ok(_) => { + tracing::debug!("🕸️ [Websocket] 🔔 Successfully sent websocket notification"); + } + Err(e) => { + // Only log as debug since this is expected when there are no subscribers + tracing::debug!("🕸️ [Websocket] 📪 No active websocket subscribers to receive notification: {}", e); + } } } } diff --git a/rust/theoros/src/services/indexer/mod.rs b/rust/theoros/src/services/indexer/mod.rs index 774245ca..c2f72768 100644 --- a/rust/theoros/src/services/indexer/mod.rs +++ b/rust/theoros/src/services/indexer/mod.rs @@ -1,3 +1,5 @@ +use std::cmp::max; + use anyhow::{anyhow, bail, Context, Result}; use apibara_core::{ node::v1alpha2::DataFinality, @@ -14,14 +16,13 @@ use pragma_utils::{ services::Service, }; -use crate::{ - storage::DispatchUpdateInfos, - types::hyperlane::{CheckpointMatchEvent, DispatchEvent, FromStarknetEventData, ValidatorAnnouncementEvent}, - AppState, -}; +use crate::types::hyperlane::{DispatchEvent, FromStarknetEventData, ValidatorAnnouncementEvent}; +use crate::types::state::AppState; const INDEXING_STREAM_CHUNK_SIZE: usize = 1; +const START_INDEXER_DELTA: u64 = 5; + lazy_static::lazy_static! { // Pragma Dispatcher pub static ref DISPATCH_EVENT_SELECTOR: FieldElement = felt_as_apibara_field(&get_selector_from_name("Dispatch").unwrap()); @@ -37,7 +38,6 @@ pub struct IndexerService { state: AppState, uri: Uri, stream_config: Configuration, - reached_pending_block: bool, } #[async_trait::async_trait] @@ -60,10 +60,10 @@ impl IndexerService { hyperlane_mailbox_address: Felt, hyperlane_validator_announce_address: Felt, pragma_feeds_registry_address: Felt, - starting_block: u64, + current_block: u64, ) -> Result { let stream_config = Configuration::::default() - .with_starting_block(starting_block) + .with_starting_block(max(0, current_block.saturating_sub(START_INDEXER_DELTA))) .with_filter(|mut filter| { filter .with_header(HeaderFilter::weak()) @@ -86,7 +86,7 @@ impl IndexerService { }) .with_finality(DataFinality::DataStatusPending); - let indexer_service = Self { state, uri: apibara_uri, stream_config, reached_pending_block: false }; + let indexer_service = Self { state, uri: apibara_uri, stream_config }; Ok(indexer_service) } @@ -108,15 +108,6 @@ impl IndexerService { match stream.try_next().await { Ok(Some(response)) => { self.process_batch(response).await?; - // This should be done in Hyperlane service? Currently poisoning the thread. - self.state - .storage - .cached_events() - .process_cached_events( - self.state.storage.validators_checkpoints(), - self.state.storage.dispatch_events(), - ) - .await?; } Ok(None) => continue, Err(e) => bail!("Error while streaming indexed batch: {}", e), @@ -127,11 +118,7 @@ impl IndexerService { /// Process a batch of blocks indexed by Apibara DNA async fn process_batch(&mut self, batch: DataMessage) -> Result<()> { match batch { - DataMessage::Data { cursor: _, end_cursor: _, finality, batch } => { - if matches!(finality, DataFinality::DataStatusPending) && !self.reached_pending_block { - tracing::info!("[🔍 Indexer] 🥳🎉 Reached pending block!"); - self.reached_pending_block = true; - } + DataMessage::Data { cursor: _, end_cursor: _, finality: _, batch } => { for block in batch { for event in block.clone().events.into_iter().filter_map(|e| e.event) { if event.from_address.is_none() { @@ -142,7 +129,7 @@ impl IndexerService { } } DataMessage::Invalidate { cursor } => match cursor { - Some(c) => bail!("Received an invalidate request data at {}", &c.order_key), + Some(c) => bail!("Indexed an invalidate request data at {}", &c.order_key), None => bail!("Invalidate request without cursor provided"), }, DataMessage::Heartbeat => {} @@ -162,10 +149,10 @@ impl IndexerService { self.decode_validator_announce_event(event_data).await?; } selector if selector == &*NEW_FEED_ID_EVENT_SELECTOR => { - self.decode_new_feed_id_event(event_data).await?; + self.decode_new_feed_id_event(event_data); } selector if selector == &*REMOVED_FEED_ID_EVENT_SELECTOR => { - self.decode_removed_feed_id_event(event_data).await?; + self.decode_removed_feed_id_event(event_data); } _ => unreachable!(), } @@ -174,70 +161,45 @@ impl IndexerService { /// Decodes a DispatchEvent from the Starknet event data. async fn decode_dispatch_event(&self, event_data: Vec, block: &Block) -> anyhow::Result<()> { - // TODO: If we index from a toooooo far block, just ignore? - // What's the point of fetching storing etc for old events? Since they get - // overriten anyway? (we only store the latest update for a given feed) - let dispatch_event = DispatchEvent::from_starknet_event_data(event_data).context("Failed to parse Dispatch")?; - let message_id = dispatch_event.id(); - + let dispatch_event = DispatchEvent::from_starknet_event_data(event_data).context("Parsing DispatchEvent")?; + let nonce = dispatch_event.message.header.nonce; match &block.header { Some(h) => { tracing::info!( - "📨 [Indexer] Received a Dispatch event at block #{}, message_id={:#x}", + "📨 [Indexer] [Block {}] Indexed a Dispatch event with nonce #{}", h.block_number, - message_id + nonce, ); } None => { - tracing::info!("📨 [Indexer] Received a Dispatch event, message_id={:#x}", message_id); + tracing::info!("📨 [Indexer] Indexed a Dispatch event with nonce #{}", nonce); } }; - - for update in dispatch_event.message.body.updates.iter() { - let feed_id = update.feed_id(); - // Check if there's a corresponding signed checkpoints among validators - if self.state.storage.validators_checkpoints().contains_message_id(message_id).await { - tracing::debug!("Found corresponding checkpoint for message ID: {:?}", message_id); - let dispatch_update_infos = DispatchUpdateInfos::new(message_id, &dispatch_event, update); - self.state.storage.dispatch_events().add(feed_id, dispatch_update_infos).await?; - let _ = self - .state - .storage - .feeds_channel - .send(CheckpointMatchEvent::New { block_number: block.clone().header.unwrap().block_number }); - // If not, store the event and check later in `process_cached_events` - } else { - tracing::debug!("No checkpoint found, caching dispatch event"); - // If no checkpoint found, add to cache - self.state.storage.cached_events().add(message_id, &dispatch_event).await; - } - } + self.state.storage.unsigned_checkpoints().add(nonce, &dispatch_event).await; Ok(()) } /// Decodes a ValidatorAnnouncementEvent from the Starknet event data. async fn decode_validator_announce_event(&self, event_data: Vec) -> anyhow::Result<()> { - tracing::info!("📨 [Indexer] Received a ValidatorAnnouncement event"); + tracing::info!("📨 [Indexer] Indexed a ValidatorAnnouncement event"); let validator_announcement_event = ValidatorAnnouncementEvent::from_starknet_event_data(event_data) .context("Failed to parse ValidatorAnnouncement")?; - let validators = &mut self.state.storage.validators_locations(); + let validators = &mut self.state.storage.validators_fetchers(); validators.add_from_announcement_event(validator_announcement_event).await?; Ok(()) } /// Decodes a NewFeedId event from the Starknet event data. - async fn decode_new_feed_id_event(&self, event_data: Vec) -> anyhow::Result<()> { + fn decode_new_feed_id_event(&self, event_data: Vec) { let feed_id = event_data[1].to_hex_string(); - tracing::info!("📨 [Indexer] Received a NewFeedId event for: {}", feed_id); - self.state.storage.feed_ids().add(feed_id).await; - Ok(()) + tracing::info!("📨 [Indexer] Indexed a NewFeedId event for: {}", feed_id); + self.state.storage.feed_ids().add(feed_id); } /// Decodes a RemovedFeedId event from the Starknet event data. - async fn decode_removed_feed_id_event(&self, event_data: Vec) -> anyhow::Result<()> { + fn decode_removed_feed_id_event(&self, event_data: Vec) { let feed_id = event_data[1].to_hex_string(); - tracing::info!("📨 [Indexer] Received a RemovedFeedId event for: {}", feed_id); - self.state.storage.feed_ids().remove(&feed_id).await; - Ok(()) + tracing::info!("📨 [Indexer] Indexed a RemovedFeedId event for: {}", feed_id); + self.state.storage.feed_ids().remove(&feed_id); } } diff --git a/rust/theoros/src/storage/checkpoints.rs b/rust/theoros/src/storage/checkpoints.rs new file mode 100644 index 00000000..7739b962 --- /dev/null +++ b/rust/theoros/src/storage/checkpoints.rs @@ -0,0 +1,78 @@ +use std::collections::BTreeMap; +use std::sync::Arc; + +use dashmap::DashMap; +use starknet::core::types::Felt; +use tokio::sync::RwLock; + +use crate::types::hyperlane::{DispatchEvent, SignedCheckpointWithMessageId}; + +/// Mapping between messages nonces and their corresponding Event. +#[derive(Clone, Default)] +pub struct UnsignedCheckpointsStorage(Arc>>); + +impl UnsignedCheckpointsStorage { + /// Insert a new mapping between a nonce & an Event. + pub async fn add(&self, nonce: u32, event: &DispatchEvent) { + let mut lock = self.0.write().await; + lock.insert(nonce, event.clone()); + } + + /// Retrieve all nonces currently stored, in ascending order. + pub async fn nonces(&self) -> Vec { + let lock = self.0.read().await; + lock.keys().cloned().collect() + } + + /// Remove a nonce from the storage. + pub async fn remove(&self, nonce: u32) { + let mut lock = self.0.write().await; + lock.remove(&nonce); + } + + /// Get the event associated with a nonce. + pub async fn get(&self, nonce: u32) -> Option { + let lock = self.0.read().await; + lock.get(&nonce).cloned() + } +} + +/// Mapping between the validators and their signed checkpoint for a given nonce. +#[derive(Debug, Default)] +pub struct SignedCheckpointsStorage(Arc>); + +impl SignedCheckpointsStorage { + pub fn len(&self) -> usize { + self.0.len() + } + + /// Adds or updates the [SignedCheckpointWithMessageId] for the given validator + pub fn add(&self, validator: Felt, nonce: u32, checkpoint: SignedCheckpointWithMessageId) { + self.0.insert((validator, nonce), checkpoint); + } + + // For the provided list of validators, returns all their signed checkpoints for the + // provided message_id. + pub fn get(&self, validators: &[Felt], searched_nonce: u32) -> Vec<(Felt, SignedCheckpointWithMessageId)> { + let mut checkpoints = Vec::with_capacity(self.len()); + // Iterate over the map with tuple key (validator, message_id) + for validator_signatures_map in self.0.iter() { + let (validator, nonce) = validator_signatures_map.key(); + if nonce == &searched_nonce && validators.contains(validator) { + checkpoints.push((*validator, validator_signatures_map.value().clone())); + } + } + + checkpoints + } + + // Check if the given validator has a checkpoint for the given nonce. + pub fn validator_signed_nonce(&self, validator: Felt, nonce: u32) -> bool { + self.0.contains_key(&(validator, nonce)) + } + + /// Checks if all validators have signed a nonce. + pub fn all_validators_signed_nonce(&self, validators: &[Felt], nonce: u32) -> bool { + validators.iter().all(|validator| self.0.contains_key(&(*validator, nonce))) + } +} diff --git a/rust/theoros/src/storage/event.rs b/rust/theoros/src/storage/event.rs deleted file mode 100644 index c6776cef..00000000 --- a/rust/theoros/src/storage/event.rs +++ /dev/null @@ -1,137 +0,0 @@ -use std::collections::HashMap; -use std::sync::Arc; - -use alloy::primitives::U256; -use anyhow::Result; -use pragma_utils::conversions::alloy::hex_str_to_u256; -use tokio::sync::RwLock; - -use crate::types::hyperlane::DispatchUpdate; -use crate::{storage::ValidatorsCheckpointsStorage, types::hyperlane::DispatchEvent}; - -#[derive(Debug, Clone)] -pub struct DispatchUpdateInfos { - pub update: DispatchUpdate, - pub emitter_chain_id: u32, - pub emitter_address: String, - pub nonce: u32, - pub message_id: U256, -} - -impl DispatchUpdateInfos { - pub fn new(message_id: U256, event: &DispatchEvent, update: &DispatchUpdate) -> Self { - DispatchUpdateInfos { - update: update.clone(), - emitter_address: event.message.header.sender.to_string(), - emitter_chain_id: event.message.header.origin, - nonce: event.message.header.nonce, - message_id, - } - } -} - -/// Contains a mapping between a feed_id and the latest dispatch update. -#[derive(Debug, Default)] -pub struct EventStorage { - events: RwLock>, -} - -impl EventStorage { - /// Insert the latest dispatch update for a feed_id. - pub async fn add(&self, feed_id: String, event: DispatchUpdateInfos) -> Result<()> { - let mut events = self.events.write().await; - let feed_id = hex_str_to_u256(&feed_id)?; - events.insert(feed_id, event); - Ok(()) - } - - /// Retrieves the latest dispatch update for a feed_id; - pub async fn get(&self, feed_id: &str) -> Result> { - let events = self.events.read().await; - let feed_id = hex_str_to_u256(feed_id)?; - Ok(events.get(&feed_id).cloned()) - } - - /// Returns the current mapping as a Vec. - pub async fn as_vec(&self) -> Result> { - let events = self.events.read().await; - Ok(events.iter().map(|(k, v)| (*k, v.clone())).collect()) - } - - /// TODO, explain + re-assert the existence of this. - /// Retrieves multiple events by their feed IDs. - /// Returns a tuple of (found_events, first_missing_feed_id). - /// If all feed IDs are found, first_missing_feed_id will be None. - pub async fn get_vec(&self, feed_ids: &[String]) -> Result<(Vec, Option)> { - let events = self.events.read().await; - let mut result = Vec::with_capacity(feed_ids.len()); - let mut missing_feed_id = None; - - for feed_id in feed_ids { - let u256_feed_id = hex_str_to_u256(feed_id)?; - match events.get(&u256_feed_id) { - Some(event) => result.push(event.clone()), - None => { - missing_feed_id = Some(feed_id.clone()); - break; - } - } - } - - Ok((result, missing_feed_id)) - } -} - -/// Contains a Mapping between message ids and the corresponding Event. -#[derive(Clone, Default)] -pub struct EventCache { - cache: Arc>>, -} - -impl EventCache { - /// Insert a new mapping between a message_id & an Event. - pub async fn add(&self, message_id: U256, event: &DispatchEvent) { - let mut cache = self.cache.write().await; - cache.insert(message_id, event.clone()); - } - - /// Returns the number of mappings stored. - pub async fn len(&self) -> usize { - self.cache.read().await.len() - } - - /// Returns the mappings as a Vec. - /// Will contain a tuple, first element being the message_id and second the Event. - pub async fn as_vec(&self) -> Vec<(U256, DispatchEvent)> { - let cache = self.cache.read().await; - cache.iter().map(|(k, v)| (*k, v.clone())).collect() - } - - /// TODO, explain + re-assert the existence of this. - /// Should probably be used in the context of the Hyperlane service: - /// * each validators try to query the signatures for the cached events - /// * store signature for each successful queries - /// * if at least one signature is retrieved, remove from the cache - /// (hyperlane service query the latest events only, they should) - pub async fn process_cached_events( - &self, - checkpoint_storage: &ValidatorsCheckpointsStorage, - event_storage: &EventStorage, - ) -> Result<()> { - let mut cache_write = self.cache.write().await; - - for (message_id, dispatch_event) in cache_write.clone().into_iter() { - if checkpoint_storage.contains_message_id(message_id).await { - for update in dispatch_event.message.body.updates.iter() { - let feed_id = update.feed_id(); - let dispatch_update_infos = DispatchUpdateInfos::new(message_id, &dispatch_event, update); - event_storage.add(feed_id, dispatch_update_infos).await?; - // TODO: Emit the websocket notification - } - cache_write.remove(&message_id); - tracing::debug!("Processed cached event with message ID: {:x}", message_id); - } - } - Ok(()) - } -} diff --git a/rust/theoros/src/storage/feed_id.rs b/rust/theoros/src/storage/feed_id.rs index 2e928118..72a05090 100644 --- a/rust/theoros/src/storage/feed_id.rs +++ b/rust/theoros/src/storage/feed_id.rs @@ -1,73 +1,40 @@ -use std::collections::HashSet; +use dashmap::DashSet; use std::sync::Arc; -use tokio::sync::RwLock; /// Contains the registered feed ids. #[derive(Debug, Default, Clone)] -pub struct FeedIdsStorage(Arc>>); +pub struct FeedIdsStorage(Arc>); impl FeedIdsStorage { - pub fn new() -> Self { - Self(Arc::new(RwLock::new(HashSet::new()))) - } - pub fn from_rpc_response(feed_ids: Vec) -> Self { - Self(Arc::new(RwLock::new(feed_ids.into_iter().collect()))) + let set = DashSet::new(); + for id in feed_ids { + set.insert(id); + } + Self(Arc::new(set)) } - pub async fn add(&self, feed_id: String) { - let mut feed_ids = self.0.write().await; - feed_ids.insert(feed_id); + pub fn add(&self, feed_id: String) { + self.0.insert(feed_id); } - pub async fn remove(&self, feed_id: &str) { - let mut feed_ids = self.0.write().await; - feed_ids.remove(feed_id); - } - - /// Checks if the storage contains the given feed ID. - pub async fn contains(&self, feed_id: &str) -> bool { - let feed_ids = self.0.read().await; - feed_ids.contains(feed_id) + pub fn remove(&self, feed_id: &str) { + self.0.remove(feed_id); } /// Checks if all feed IDs in the given vector are present in the storage. /// Returns None if all IDs are present, or Some(id) with the first missing ID. - pub async fn contains_vec(&self, feed_ids: &[String]) -> Option { - let stored_feed_ids = self.0.read().await; - feed_ids.iter().find(|id| !stored_feed_ids.contains(*id)).cloned() + pub fn contains_vec(&self, feed_ids: &[String]) -> Option { + feed_ids.iter().find(|id| !self.0.contains(*id)).cloned() } /// Returns the number of feed IDs in the storage. - pub async fn len(&self) -> usize { - let feed_ids = self.0.read().await; - feed_ids.len() - } - - /// Returns true if the storage is empty. - pub async fn is_empty(&self) -> bool { - let feed_ids = self.0.read().await; - feed_ids.is_empty() - } - - /// Returns a clone of the inner HashSet. - pub async fn clone_inner(&self) -> HashSet { - let feed_ids = self.0.read().await; - feed_ids.clone() - } - - /// Performs an operation on the inner HashSet while holding the write lock. - pub async fn with_inner(&self, f: F) -> R - where - F: FnOnce(&mut HashSet) -> R, - { - let mut feed_ids = self.0.write().await; - f(&mut feed_ids) + pub fn len(&self) -> usize { + self.0.len() } /// Returns an iterator over the feed IDs. - pub async fn iter(&self) -> impl Iterator { - let feed_ids = self.0.read().await; - feed_ids.iter().cloned().collect::>().into_iter() + pub fn iter(&self) -> impl Iterator { + self.0.iter().map(|ref_multi| ref_multi.key().clone()).collect::>().into_iter() } } diff --git a/rust/theoros/src/storage/mod.rs b/rust/theoros/src/storage/mod.rs index 7ae978e4..c3819fdf 100644 --- a/rust/theoros/src/storage/mod.rs +++ b/rust/theoros/src/storage/mod.rs @@ -1,33 +1,30 @@ -pub mod event; +pub mod checkpoints; pub mod feed_id; +pub mod updates; pub mod validator; -pub use event::*; +pub use checkpoints::*; pub use feed_id::*; -use tokio::sync::broadcast::Sender; +pub use updates::*; pub use validator::*; use starknet::core::types::Felt; +use tokio::sync::broadcast::Sender; use crate::{ + constants::FEED_UPDATED_CHANNEL_CAPACITY, rpc::starknet::{HyperlaneCalls, PragmaFeedsRegistryCalls, StarknetRpc}, - types::hyperlane::CheckpointMatchEvent, + types::hyperlane::NewUpdatesAvailableEvent, }; -/// Theoros storage that contains: -/// * a set of all available feed ids, -/// * a mapping of all the validators and their fetchers. -/// * a mapping of all the validators and their latest fetched checkpoints. -/// * an event cache, -/// * an events storage containing the most recents [DispatchEvent] events indexed. -/// * a channel to dispatch updates to the clients. pub struct TheorosStorage { feed_ids: FeedIdsStorage, - validators: ValidatorsLocationStorage, - checkpoints: ValidatorsCheckpointsStorage, - cached_events: EventCache, - dispatch_events: EventStorage, - pub feeds_channel: Sender, + validators_fetchers: ValidatorsFetchersStorage, + signed_checkpoints: SignedCheckpointsStorage, + unsigned_checkpoints: UnsignedCheckpointsStorage, + latest_update_per_feed: LatestUpdatePerFeedStorage, + // websocket notifications + feeds_updated_tx: Sender, } impl TheorosStorage { @@ -35,26 +32,25 @@ impl TheorosStorage { rpc_client: &StarknetRpc, pragma_feeds_registry_address: &Felt, hyperlane_validator_announce_address: &Felt, - update_tx: Sender, ) -> anyhow::Result { let initial_validators = rpc_client.get_announced_validators(hyperlane_validator_announce_address).await?; let initial_locations = rpc_client .get_announced_storage_locations(hyperlane_validator_announce_address, &initial_validators) .await?; - let mut validators = ValidatorsLocationStorage::default(); - validators.fill_with_initial_state(initial_validators, initial_locations).await?; + let mut validators_fetchers = ValidatorsFetchersStorage::default(); + validators_fetchers.fill_with_initial_state(initial_validators, initial_locations).await?; let supported_feed_ids = rpc_client.get_feed_ids(pragma_feeds_registry_address).await?; let feed_ids = FeedIdsStorage::from_rpc_response(supported_feed_ids); Ok(Self { feed_ids, - validators, - checkpoints: ValidatorsCheckpointsStorage::default(), - cached_events: EventCache::default(), - dispatch_events: EventStorage::default(), - feeds_channel: update_tx, + validators_fetchers, + signed_checkpoints: SignedCheckpointsStorage::default(), + unsigned_checkpoints: UnsignedCheckpointsStorage::default(), + latest_update_per_feed: LatestUpdatePerFeedStorage::default(), + feeds_updated_tx: tokio::sync::broadcast::channel(FEED_UPDATED_CHANNEL_CAPACITY).0, }) } @@ -62,19 +58,23 @@ impl TheorosStorage { &self.feed_ids } - pub fn validators_locations(&self) -> &ValidatorsLocationStorage { - &self.validators + pub fn validators_fetchers(&self) -> &ValidatorsFetchersStorage { + &self.validators_fetchers + } + + pub fn signed_checkpoints(&self) -> &SignedCheckpointsStorage { + &self.signed_checkpoints } - pub fn validators_checkpoints(&self) -> &ValidatorsCheckpointsStorage { - &self.checkpoints + pub fn latest_update_per_feed(&self) -> &LatestUpdatePerFeedStorage { + &self.latest_update_per_feed } - pub fn dispatch_events(&self) -> &EventStorage { - &self.dispatch_events + pub fn unsigned_checkpoints(&self) -> &UnsignedCheckpointsStorage { + &self.unsigned_checkpoints } - pub fn cached_events(&self) -> &EventCache { - &self.cached_events + pub fn feeds_updated_tx(&self) -> &Sender { + &self.feeds_updated_tx } } diff --git a/rust/theoros/src/storage/updates.rs b/rust/theoros/src/storage/updates.rs new file mode 100644 index 00000000..495b83d2 --- /dev/null +++ b/rust/theoros/src/storage/updates.rs @@ -0,0 +1,22 @@ +use std::sync::Arc; + +use alloy::primitives::U256; +use dashmap::DashMap; + +use crate::types::hyperlane::DispatchUpdateInfos; + +/// Contains a mapping between feed ids and their latest dispatch update. +#[derive(Debug, Default)] +pub struct LatestUpdatePerFeedStorage(Arc>); + +impl LatestUpdatePerFeedStorage { + /// Insert the latest [`DispatchUpdateInfos`] for a feed id. + pub fn add(&self, feed_id: U256, event: DispatchUpdateInfos) { + self.0.insert(feed_id, event); + } + + /// Retrieves the latest [`DispatchUpdateInfos`] for a feed id. + pub fn get(&self, feed_id: &U256) -> Option { + self.0.get(feed_id).map(|r| r.value().clone()) + } +} diff --git a/rust/theoros/src/storage/validator.rs b/rust/theoros/src/storage/validator.rs index 4bc57e5d..d09539a2 100644 --- a/rust/theoros/src/storage/validator.rs +++ b/rust/theoros/src/storage/validator.rs @@ -1,26 +1,19 @@ use std::str::FromStr; use std::{collections::HashMap, sync::Arc}; -use alloy::primitives::U256; use anyhow::bail; +use dashmap::DashMap; use starknet::core::types::Felt; -use tokio::sync::RwLock; -use crate::types::hyperlane::{ - CheckpointStorage, FetchFromStorage, SignedCheckpointWithMessageId, ValidatorAnnouncementEvent, -}; +use crate::types::hyperlane::{CheckpointStorage, FetchFromStorage, ValidatorAnnouncementEvent}; -// TODO: Rename this. It should be clear that it is a Validator => StorageLocation mapping. -// TODO: The ValidatorsLocationStorage should contain the builded Location, not the CheckpointStorage. -// Currently, we are building it everytime in the Hyperlane service using: checkpoint.build() - -/// Contains a mapping between the validators and their storages used to -/// retrieve checkpoints. +/// Mapping between the validators and their fetcher used to +/// retrieve signed checkpoints. #[derive(Debug, Default)] -pub struct ValidatorsLocationStorage(RwLock>>>); +pub struct ValidatorsFetchersStorage(Arc>>); -impl ValidatorsLocationStorage { - /// Fills the [HashMap] with the initial state fetched from the RPC. +impl ValidatorsFetchersStorage { + /// Fills the [DashMap] with the initial state fetched from the RPC. pub async fn fill_with_initial_state( &mut self, validators: Vec, @@ -30,7 +23,6 @@ impl ValidatorsLocationStorage { bail!("⛔ Validators and locations vectors must have the same length"); } - let mut all_storages = self.0.write().await; for (validator, location) in validators.into_iter().zip(locations.into_iter()) { // TODO: This should be a feature. We sometime want to have a local storage. if location[location.len() - 1].starts_with("file") { @@ -38,100 +30,34 @@ impl ValidatorsLocationStorage { } let storage = CheckpointStorage::from_str(&location[location.len() - 1])?; let storage_fetcher = storage.build().await?; - all_storages.insert(validator, Arc::new(storage_fetcher)); + self.0.insert(validator, storage_fetcher); } Ok(()) } /// Adds or updates the [CheckpointStorage] for the given validator - pub async fn add(&self, validator: Felt, storage: CheckpointStorage) -> anyhow::Result<()> { + pub async fn build_and_add(&self, validator: Felt, storage: CheckpointStorage) -> anyhow::Result<()> { let storage_fetcher = storage.build().await?; - let mut all_storages = self.0.write().await; - all_storages.insert(validator, Arc::new(storage_fetcher)); + self.0.insert(validator, storage_fetcher); Ok(()) } /// Adds or updates the [CheckpointStorage] for the given validator from a [ValidatorAnnouncementEvent] + /// NOTE: This won't work with local storage. + /// TODO: This should be a feature. We sometime want to have a local storage. pub async fn add_from_announcement_event(&self, event: ValidatorAnnouncementEvent) -> anyhow::Result<()> { let validator: Felt = event.validator.into(); - // TODO: This should be a feature. We sometime want to have a local storage. if event.storage_location.starts_with("file") { return Ok(()); } let storage = CheckpointStorage::from_str(&event.storage_location)?; - self.add(validator, storage).await?; + self.build_and_add(validator, storage).await?; Ok(()) } /// Returns all registered mappings between validators & their location storage. - pub async fn all(&self) -> HashMap>> { - self.0.read().await.clone() - } -} - -/// Contains a mapping between the validators and their latest fetched checkpoint. -#[derive(Debug, Default)] -pub struct ValidatorsCheckpointsStorage(pub RwLock>); - -impl ValidatorsCheckpointsStorage { - /// Adds or updates the [SignedCheckpointWithMessageId] for the given validator - pub async fn add( - &self, - validator: Felt, - message_id: U256, - checkpoint: SignedCheckpointWithMessageId, - ) -> anyhow::Result<()> { - let mut all_checkpoints = self.0.write().await; - all_checkpoints.insert((validator, message_id), checkpoint); - Ok(()) - } - - /// Returns all the checkpoints for each validator - pub async fn all(&self) -> HashMap<(Felt, U256), SignedCheckpointWithMessageId> { - self.0.read().await.clone() - } - - /// Returns the checkpoint for the given validator and message Id - pub async fn get(&self, validator: &Felt, message_id: U256) -> Option { - self.0.read().await.get(&(*validator, message_id)).cloned() - } - - // Check if any of the validators has a checkpoint signed for the provided message id. - pub async fn contains_message_id(&self, message_id: U256) -> bool { - let all_checkpoints = self.0.read().await; - - for checkpoint in all_checkpoints.values() { - if checkpoint.value.message_id == message_id { - return true; - } - } - false - } - - // Check if the given validator has a checkpoint for the given message_id. - pub async fn exists(&self, validator: Felt, message_id: U256) -> bool { - self.0.read().await.contains_key(&(validator, message_id)) - } - - // For the provided list of validators, returns all their signed checkpoints for the - // provided message_id. - pub async fn get_validators_signed_checkpoints( - &self, - validators: &[Felt], - searched_message_id: U256, - ) -> anyhow::Result> { - let checkpoints = self.0.read().await; - - let mut signatures = Vec::new(); - // Iterate over the map with tuple key (validator, message_id) - for ((validator, message_id), checkpoint) in checkpoints.iter() { - // Only include if validator is in the provided list and message_id matches - if message_id == &searched_message_id && validators.contains(validator) { - signatures.push(checkpoint.clone()); - } - } - - Ok(signatures) + pub fn all(&self) -> HashMap> { + self.0.iter().map(|entry| (*entry.key(), entry.value().clone())).collect() } } diff --git a/rust/theoros/src/types/calldata.rs b/rust/theoros/src/types/calldata.rs index f6a5a09f..7f2dfd92 100644 --- a/rust/theoros/src/types/calldata.rs +++ b/rust/theoros/src/types/calldata.rs @@ -1,21 +1,18 @@ -// TODO: -// Create tests for this module. It should produces the same than abi.encodePack +use std::str::FromStr; + use alloy::{primitives::U256, signers::Signature}; +use anyhow::Context; +use pragma_utils::conversions::alloy::hex_str_to_u256; use serde::{Deserialize, Serialize}; use starknet::core::types::Felt; -use std::str::FromStr; use crate::{ configs::evm_config::EvmChainName, constants::{HYPERLANE_VERSION, PRAGMA_MAJOR_VERSION, PRAGMA_MINOR_VERSION, TRAILING_HEADER_SIZE}, - errors::GetCalldataError, - storage::DispatchUpdateInfos, - types::hyperlane::CheckpointWithMessageId, - AppState, + types::hyperlane::{CheckpointWithMessageId, DispatchUpdate}, + types::state::AppState, }; -use super::hyperlane::DispatchUpdate; - pub trait AsCalldata { fn as_bytes(&self) -> Vec; } @@ -35,72 +32,69 @@ pub struct Calldata { } impl Calldata { - pub async fn build_from( - state: &AppState, - chain_name: EvmChainName, - feed_id: String, - ) -> Result { - let event: DispatchUpdateInfos = state - .storage - .dispatch_events() - .get(&feed_id) - .await - .map_err(|_| GetCalldataError::DispatchNotFound)? - .ok_or(GetCalldataError::DispatchNotFound)?; - - let validators = state - .hyperlane_validators_mapping - .get_validators(chain_name) - .ok_or(GetCalldataError::ChainNotSupported(format!("{:?}", chain_name)))?; - - let checkpoints = state - .storage - .validators_checkpoints() - .get_validators_signed_checkpoints(validators, event.message_id) - .await - .map_err(|_| GetCalldataError::ValidatorNotFound)?; - - // TODO: We only have one validator for now - let checkpoint_infos = checkpoints.last().unwrap(); - - let update = match event.update { - DispatchUpdate::SpotMedian { update, feed_id: _ } => update, + pub async fn build_from(state: &AppState, chain_name: EvmChainName, feed_id: String) -> anyhow::Result { + let feed_id = hex_str_to_u256(&feed_id)?; + let update_info = state.storage.latest_update_per_feed().get(&feed_id).context("No update found")?; + + let validator_index_map = + state.hyperlane_validators_mapping.get_validators(&chain_name).context("No validators found")?; + + let validators: Vec = validator_index_map.keys().copied().collect(); + let checkpoints = state.storage.signed_checkpoints().get(&validators, update_info.nonce); + anyhow::ensure!(!checkpoints.is_empty(), "No signatures found"); + + // Ensure all nonce have the same checkpoint + let nonce_checkpoint = &checkpoints[0].1.value; + anyhow::ensure!( + checkpoints.iter().all(|(_, checkpoint)| &(checkpoint.value) == nonce_checkpoint), + "Inconsistent checkpoint values found" + ); + + let signatures: Vec = checkpoints + .iter() + .filter_map(|(validator, signed_checkpoint)| { + validator_index_map + .get(validator) + .map(|&idx| ValidatorSignature { validator_index: idx, signature: signed_checkpoint.signature }) + }) + .collect(); + + let update = match update_info.update { + DispatchUpdate::SpotMedian { update, .. } => update, }; let payload = Payload { - checkpoint: checkpoint_infos.value.clone(), + checkpoint: nonce_checkpoint.clone(), num_updates: 1, - update_data_len: 1, + // TODO: proof should be deleted proof_len: 0, proof: vec![], + update_data_len: update.to_bytes().len() as u16, update_data: update.to_bytes(), - // TODO: Store directly a U256. - feed_id: U256::from_str(&feed_id).unwrap(), + feed_id, + // TODO: publish_time is a duplicated of update timestamp - remove? publish_time: update.metadata.timestamp, }; let hyperlane_message = HyperlaneMessage { hyperlane_version: HYPERLANE_VERSION, - // TODO: signers_len & signatures should work for multiple validators - signers_len: 1_u8, - signatures: vec![ValidatorSignature { validator_index: 0, signature: checkpoint_infos.signature }], - nonce: event.nonce, + emitter_chain_id: update_info.emitter_chain_id, + emitter_address: update_info.emitter_address, + nonce: update_info.nonce, + signers_len: signatures.len() as u8, + signatures, + // TODO: timestamp is a duplicated of update timestamp - remove? timestamp: update.metadata.timestamp, - emitter_chain_id: event.emitter_chain_id, - // TODO: Store directly a Felt. - emitter_address: Felt::from_dec_str(&event.emitter_address).unwrap(), payload, }; - let calldata = Calldata { + Ok(Calldata { major_version: PRAGMA_MAJOR_VERSION, minor_version: PRAGMA_MINOR_VERSION, trailing_header_size: TRAILING_HEADER_SIZE, - hyperlane_msg_size: hyperlane_message.as_bytes().len().try_into().unwrap(), + hyperlane_msg_size: hyperlane_message.as_bytes().len().try_into()?, hyperlane_msg: hyperlane_message, - }; - - Ok(calldata) + }) } } @@ -166,13 +160,14 @@ pub struct Payload { pub checkpoint: CheckpointWithMessageId, /// Number of updates pub num_updates: u8, - pub update_data_len: u16, /// Length of the proof #[serde(skip)] pub proof_len: u16, #[serde(skip)] pub proof: Vec, #[serde(skip)] + pub update_data_len: u16, + #[serde(skip)] pub update_data: Vec, /// The id associated to the feed to be updated pub feed_id: U256, diff --git a/rust/theoros/src/types/hyperlane/checkpoint.rs b/rust/theoros/src/types/hyperlane/checkpoint.rs index 5f09bf94..98c7e215 100644 --- a/rust/theoros/src/types/hyperlane/checkpoint.rs +++ b/rust/theoros/src/types/hyperlane/checkpoint.rs @@ -31,15 +31,6 @@ pub struct CheckpointWithMessageId { /// An event that is emitted when we find a match between a checkpoint and a message #[derive(Clone, PartialEq, Debug)] -pub enum CheckpointMatchEvent { - New { block_number: u64 }, -} - -impl CheckpointMatchEvent { - /// Returns the block number of the event - pub fn block_number(&self) -> u64 { - match self { - CheckpointMatchEvent::New { block_number } => *block_number, - } - } +pub enum NewUpdatesAvailableEvent { + New, } diff --git a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/gcs.rs b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/gcs.rs index d019074e..5c247674 100644 --- a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/gcs.rs +++ b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/gcs.rs @@ -68,14 +68,6 @@ impl FetchFromStorage for GcsStorageClient { Ok(Some(serde_json::from_slice(res.as_ref())?)) } - async fn fetch_latest(&self) -> Result> { - let res = self.inner.get_object(&self.bucket, GcsStorageClient::get_latest_checkpoint_key()).await?; - let latest_index = serde_json::from_slice(&res)?; - - let res = self.inner.get_object(&self.bucket, GcsStorageClient::get_checkpoint_key(latest_index)).await?; - Ok(Some(serde_json::from_slice(res.as_ref())?)) - } - fn announcement_location(&self) -> String { format!("gs://{}/{}", &self.bucket, ANNOUNCEMENT_KEY) } diff --git a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/local.rs b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/local.rs index aea23bcd..dd182b29 100644 --- a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/local.rs +++ b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/local.rs @@ -26,10 +26,6 @@ impl LocalStorage { fn checkpoint_file_path(&self, index: u32) -> PathBuf { self.path.join(format!("{}_with_id.json", index)) } - - fn latest_checkpoint_file_path(&self) -> PathBuf { - self.path.join("index.json") - } } #[async_trait] @@ -42,15 +38,6 @@ impl FetchFromStorage for LocalStorage { Ok(Some(checkpoint)) } - async fn fetch_latest(&self) -> Result> { - let latest_index = serde_json::from_slice(&tokio::fs::read(self.latest_checkpoint_file_path()).await?)?; - let Ok(data) = tokio::fs::read(self.checkpoint_file_path(latest_index)).await else { - return Ok(None); - }; - let checkpoint = serde_json::from_slice(&data)?; - Ok(Some(checkpoint)) - } - fn announcement_location(&self) -> String { format!("file://{}", self.path.to_str().unwrap()) } diff --git a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/mod.rs b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/mod.rs index e91aae15..6db41c73 100644 --- a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/mod.rs +++ b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/mod.rs @@ -6,6 +6,7 @@ pub mod s3; // https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/3e90734310fb1ca9a607ce3d334015fa7aaa9208/rust/hyperlane-base/src/settings/checkpoint_syncer.rs#L14 use std::fmt::Debug; +use std::sync::Arc; use std::{env, path::PathBuf}; use anyhow::{anyhow, bail, Context, Error, Result}; @@ -26,10 +27,10 @@ use super::SignedCheckpointWithMessageId; #[async_trait] pub trait FetchFromStorage: Debug + Send + Sync { /// Attempt to fetch the signed (checkpoint, messageId) tuple at this index + #[allow(unused)] async fn fetch(&self, index: u32) -> Result>; - /// Attemps to fetch the latest (checkpoint, messageId) tuple - async fn fetch_latest(&self) -> Result>; /// Return the announcement storage location for this syncer + #[allow(unused)] fn announcement_location(&self) -> String; } @@ -115,11 +116,11 @@ impl FromStr for CheckpointStorage { impl CheckpointStorage { /// Turn conf info a Checkpoint Syncer - pub async fn build(&self) -> Result> { + pub async fn build(&self) -> Result> { Ok(match self { - CheckpointStorage::LocalStorage { path } => Box::new(LocalStorage::new(path.clone())?), + CheckpointStorage::LocalStorage { path } => Arc::new(LocalStorage::new(path.clone())?), CheckpointStorage::S3 { bucket, folder, region } => { - Box::new(S3Storage::new(bucket.clone(), folder.clone(), region.clone())) + Arc::new(S3Storage::new(bucket.clone(), folder.clone(), region.clone())) } CheckpointStorage::Gcs { bucket, folder, service_account_key, user_secrets } => { let auth = if let Some(path) = service_account_key { @@ -131,7 +132,7 @@ impl CheckpointStorage { AuthFlow::NoAuth }; - Box::new(GcsStorageClientBuilder::new(auth).build(bucket, folder.to_owned()).await?) + Arc::new(GcsStorageClientBuilder::new(auth).build(bucket, folder.to_owned()).await?) } }) } diff --git a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/s3.rs b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/s3.rs index 3a982611..9096f069 100644 --- a/rust/theoros/src/types/hyperlane/checkpoint_fetchers/s3.rs +++ b/rust/theoros/src/types/hyperlane/checkpoint_fetchers/s3.rs @@ -98,10 +98,6 @@ impl S3Storage { fn checkpoint_key(index: u32) -> String { format!("checkpoint_{index}_with_id.json") } - - fn latest_checkpoint_key() -> String { - "checkpoint_latest_index.json".to_string() - } } #[async_trait] @@ -114,21 +110,6 @@ impl FetchFromStorage for S3Storage { .map_err(Into::into) } - async fn fetch_latest(&self) -> Result> { - let latest_index: u32 = self - .anonymously_read_from_bucket(S3Storage::latest_checkpoint_key()) - .await? - .map(|data| serde_json::from_slice(&data)) - .transpose() - .unwrap() - .unwrap(); - self.anonymously_read_from_bucket(S3Storage::checkpoint_key(latest_index)) - .await? - .map(|data| serde_json::from_slice(&data)) - .transpose() - .map_err(Into::into) - } - fn announcement_location(&self) -> String { match self.folder.as_deref() { None | Some("") => format!("s3://{}/{}", self.bucket, self.region.name()), diff --git a/rust/theoros/src/types/hyperlane/events/dispatch_event.rs b/rust/theoros/src/types/hyperlane/events/dispatch_event.rs index 4ff2e5e9..529fb259 100644 --- a/rust/theoros/src/types/hyperlane/events/dispatch_event.rs +++ b/rust/theoros/src/types/hyperlane/events/dispatch_event.rs @@ -1,8 +1,6 @@ -use alloy::primitives::keccak256; -use alloy::primitives::{hex, U256 as alloy_U256}; +use alloy::primitives::hex; use anyhow::{Context, Result}; use pragma_feeds::FeedType; -use pragma_utils::conversions::alloy::hex_str_to_u256; use starknet::core::types::{Felt, U256}; use pragma_utils::conversions::apibara::FromFieldBytes; @@ -14,8 +12,11 @@ const SPOT_MEDIAN_UPDATE_SIZE: usize = 107; #[derive(Debug, Clone)] pub struct DispatchEvent { + #[allow(unused)] pub sender: U256, + #[allow(unused)] pub destination_domain: u32, + #[allow(unused)] pub recipient_address: U256, pub message: DispatchMessage, } @@ -74,50 +75,6 @@ impl FromStarknetEventData for DispatchEvent { } } -impl DispatchEvent { - /// Generates a message id from a Dispatch Event. - pub fn id(&self) -> alloy_U256 { - let mut input = Vec::new(); - - // Formatting header part - input.push(self.message.header.version); - input.extend_from_slice(&self.message.header.nonce.to_be_bytes()); - input.extend_from_slice(&self.message.header.origin.to_be_bytes()); - input.extend_from_slice(&self.message.header.sender.high().to_be_bytes()); - input.extend_from_slice(&self.message.header.sender.low().to_be_bytes()); - input.extend_from_slice(&self.message.header.destination.to_be_bytes()); - input.extend_from_slice(&self.message.header.recipient.high().to_be_bytes()); - input.extend_from_slice(&self.message.header.recipient.low().to_be_bytes()); - - // Formatting body part - input.extend_from_slice(&self.message.body.nb_updated.to_be_bytes()); - - for update in &self.message.body.updates { - match update { - DispatchUpdate::SpotMedian { feed_id, update: spot_update } => { - let feed_id = hex_str_to_u256(feed_id).unwrap(); - input.extend_from_slice(&feed_id.to_be_bytes_vec()); - // Append metadata, i.e timestamp, nb sources & decimals - input.extend_from_slice(&spot_update.metadata.timestamp.to_be_bytes()); - input.extend_from_slice(&spot_update.metadata.num_sources_aggregated.to_be_bytes()); - input.extend_from_slice(&spot_update.metadata.decimals.to_be_bytes()); - // Append scaled price and volume - input.extend_from_slice(&spot_update.price.high().to_be_bytes()); - input.extend_from_slice(&spot_update.price.low().to_be_bytes()); - input.extend_from_slice(&spot_update.volume.high().to_be_bytes()); - input.extend_from_slice(&spot_update.volume.low().to_be_bytes()); - } - } - } - - let hash = keccak256(&input); - let message_id = - alloy_U256::from_be_bytes(<[u8; 32]>::try_from(hash.as_slice()).expect("Hash should be 32 bytes")); - - message_id - } -} - #[derive(Debug, Clone)] pub struct DispatchMessage { pub header: DispatchMessageHeader, @@ -126,11 +83,14 @@ pub struct DispatchMessage { #[derive(Debug, Clone)] pub struct DispatchMessageHeader { + #[allow(unused)] pub version: u8, pub nonce: u32, pub origin: u32, pub sender: U256, + #[allow(unused)] pub destination: u32, + #[allow(unused)] pub recipient: U256, } @@ -156,6 +116,7 @@ impl FromStarknetEventData for DispatchMessageHeader { #[derive(Debug, Clone)] pub struct DispatchMessageBody { + #[allow(unused)] pub nb_updated: u8, pub updates: Vec, } @@ -199,6 +160,25 @@ impl FromStarknetEventData for DispatchMessageBody { } } +#[derive(Debug, Clone)] +pub struct DispatchUpdateInfos { + pub nonce: u32, + pub emitter_chain_id: u32, + pub emitter_address: Felt, + pub update: DispatchUpdate, +} + +impl DispatchUpdateInfos { + pub fn new(event: &DispatchEvent, update: &DispatchUpdate) -> Self { + DispatchUpdateInfos { + nonce: event.message.header.nonce, + emitter_chain_id: event.message.header.origin, + emitter_address: Felt::from_dec_str(&event.message.header.sender.to_string()).unwrap(), + update: update.clone(), + } + } +} + // TODO: Should be a trait? #[derive(Debug, Clone)] pub enum DispatchUpdate { @@ -218,14 +198,14 @@ impl DispatchUpdate { let raw_feed_type = u16::from_be_bytes(data.drain(..2).collect::>().try_into().unwrap()); let feed_type = FeedType::try_from(raw_feed_type)?; - let pair_id_low = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); + let pair_id_high = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); let mut padded_data = [0u8; 16]; let extracted_data = data.drain(..12).collect::>(); padded_data[4..].copy_from_slice(&extracted_data); - let pair_id_high = u128::from_be_bytes(padded_data); - let pair_id = U256::from_words(pair_id_high, pair_id_low); + let pair_id_low = u128::from_be_bytes(padded_data); + let pair_id = U256::from_words(pair_id_low, pair_id_high); - let feed_id = build_feed_id(raw_asset_class, raw_feed_type, pair_id_low, pair_id_high); + let feed_id = build_feed_id(raw_asset_class, raw_feed_type, pair_id_high, pair_id_low); let update = match feed_type { FeedType::UniqueSpotMedian => { @@ -271,10 +251,10 @@ impl SpotMedianUpdate { let decimals = u8::from_be_bytes(data.drain(..1).collect::>().try_into().unwrap()); let price_high = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); // U256 let price_low = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); - let price = U256::from_words(price_high, price_low); + let price = U256::from_words(price_low, price_high); let volume_high = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); // U256 let volume_low = u128::from_be_bytes(data.drain(..16).collect::>().try_into().unwrap()); - let volume = U256::from_words(volume_high, volume_low); + let volume = U256::from_words(volume_low, volume_high); Ok(Self { pair_id: U256::from(0_u8), // This will get populated later @@ -297,8 +277,8 @@ impl SpotMedianUpdate { bytes.extend_from_slice(&self.price.high().to_be_bytes()); bytes.extend_from_slice(&self.price.low().to_be_bytes()); - bytes.extend_from_slice(&self.volume.low().to_be_bytes()); bytes.extend_from_slice(&self.volume.high().to_be_bytes()); + bytes.extend_from_slice(&self.volume.low().to_be_bytes()); bytes } } diff --git a/rust/theoros/src/types/mod.rs b/rust/theoros/src/types/mod.rs index 10b3b61f..d6f6d340 100644 --- a/rust/theoros/src/types/mod.rs +++ b/rust/theoros/src/types/mod.rs @@ -1,3 +1,3 @@ pub mod calldata; pub mod hyperlane; -pub mod rpc; +pub mod state; diff --git a/rust/theoros/src/types/rpc.rs b/rust/theoros/src/types/rpc.rs deleted file mode 100644 index 54feb797..00000000 --- a/rust/theoros/src/types/rpc.rs +++ /dev/null @@ -1,13 +0,0 @@ -use serde::{Deserialize, Serialize}; -use utoipa::ToSchema; - -pub type RpcDataFeedIdentifier = String; - -#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)] -pub struct RpcDataFeed { - pub feed_id: RpcDataFeedIdentifier, - /// The calldata binary represented as a hex string. - #[serde(skip_serializing_if = "Option::is_none")] - #[schema(value_type = Option)] - pub calldata: Option, -} diff --git a/rust/theoros/src/types/state.rs b/rust/theoros/src/types/state.rs new file mode 100644 index 00000000..279cca37 --- /dev/null +++ b/rust/theoros/src/types/state.rs @@ -0,0 +1,29 @@ +use std::sync::{atomic::AtomicUsize, Arc}; + +use prometheus::Registry; + +use crate::{ + rpc::{evm::HyperlaneValidatorsMapping, starknet::StarknetRpc}, + storage::TheorosStorage, +}; + +#[derive(Clone)] +pub struct AppState { + pub starknet_rpc: Arc, + pub hyperlane_validators_mapping: Arc, + pub storage: Arc, + #[allow(unused)] + pub metrics_registry: Registry, // already wrapped into an Arc + pub ws: Arc, +} + +pub struct WsState { + pub subscriber_counter: AtomicUsize, +} + +#[allow(clippy::new_without_default)] +impl WsState { + pub fn new() -> Self { + Self { subscriber_counter: AtomicUsize::new(0) } + } +} diff --git a/solidity/package-lock.json b/solidity/package-lock.json index bb92d1fd..f16798bd 100644 --- a/solidity/package-lock.json +++ b/solidity/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@pragma/solidity-sdk", + "name": "@pragmaoracle/solidity-sdk", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@pragma/solidity-sdk", + "name": "@pragmaoracle/solidity-sdk", "version": "1.0.0", "license": "MIT", "devDependencies": { diff --git a/solidity/test/PragmaDecoder.t.sol b/solidity/test/PragmaDecoder.t.sol index 093282af..3a67a8f1 100644 --- a/solidity/test/PragmaDecoder.t.sol +++ b/solidity/test/PragmaDecoder.t.sol @@ -37,7 +37,7 @@ contract PragmaHarnessTest is Test { setupRaw(); // encoded update bytes memory encodedUpdate = - hex"0100000170030100c1ec5070f1a4868b8e6bfa5bbd31ac77605c5af1a739bc4e7758d4ca1d88fa8835c1460646b647c4c4403b324c2297a04d70b84888dc873021f80d6d70ed015e1c00031b8b0000000067225b1100611a3d0060240f2bccef7e64f920eec05c5bfffbc48c6ceaa4efca8748772b60cbafc30536953cdd0dd5b8e24428e4fb6eab5c143daba15f62b24606e50d822508faefd53032e26a3b1d1510dfe82a2ab8d6c0fc0f010dcdd3c410ba2f9fdad3479b1400031b8b15704e0efd1955cfe1c1182ba083bd5309707bdd795397cbbbb106cfc9b29bb001000100000000000000000000004254432f555344000000000000000000000000000000000000000067225b1100080800000000000000000000068aa5cb9d63000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004254432f5553440000000067225b11"; + hex"010000017003010002c8960ad17eddf3ec435aea12d031c6a6298e5c8e786550c1238fb423a4f5661455ef5cac013d6cc34a4ce472ba2031cb2ae84dfd35d0ecd0b51b4d437dc0b81b0003c638000000000000000000611a3d0060240f2bccef7e64f920eec05c5bfffbc48c6ceaa4efca8748772b60cbafc30536953cdd0dd5b8e24428e4fb6eab5c143daba15f62b24606e50d822508faefff8c9ddbc7988bf343935dd1f19da8e03cccc7e63ae3cccadc04a64c9e6b79750003c638e03cccfc78838eafd29d5868d9e2333c684d10828874c31b7dbc01869ec98c2001006b000000000000000000004c5553442f555344000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004c5553442f5553440000000000000000"; uint8 numUpdates = pragmaHarness.exposed_updateDataInfoFromUpdate(encodedUpdate); assertEq(numUpdates, 1, "Number of updates should be 1"); } diff --git a/typescript/pragma-scripts/bun.lockb b/typescript/pragma-scripts/bun.lockb index f924019b5a84dad4927d8433412f9a6231544ae2..a0e56744c94438d81cb7b6472c2b16e874ce589c 100755 GIT binary patch delta 3957 zcmeHKdr(y86~Ff`4;KV{AiFCftJW8?3kxjELl;rxWsqk;#UQT*QDJd+9R!RJ6Rj}` zil1RblTm|MwWcWBm}H<@#xv~GZlRE8=A2)R9&Fm7N zz&9|3U{pCKEx}9_)G{zl?lqRX*9HZ=7hFfAcf;(CHZeB0KCH z!@tCOonxf$Auq|8(uu8c(ed9{%Uoi-q@I{}HjEN>+*3EY3fe+yf*45L&~!T6=RCss zV`|4#?$OdIh&)Z~p&6l*nxWC4JPj)Cfc66QXKP$_QW+MA%tGrMsgtHai-0DOPuS$m z0(|ts4R5y6M=za(_ZA}hj(h2Z%yH~4d=2ARfJ`qv2VXRNJVhv#_&79;yH3#iu)8w7 zu+@hJ$o0}ryKf}TCp`9HN90j;NH!&$-Y6#nNQjXPP7a_LxbXl9G3gWRJP}MXl*z9o zBSZ<%IFkTM*;K$42n0yLNSp1SXDnfFDP(2TEm*YuE2Ad4P=J`KlG^F)jO>Xrl&KxE zBMLEvH^-)mEHJa6I1W`04*i~AR#7u5-E`XfNe<_+R>T4KVF94 z1IMKT6b4F)6Ijpq>2}CVzP!B z>@Hgw{r5`=JH}7ck{HO4+T#9SN=V87a4F%`fIO=$>q$S0&)l`6YX5rv!eHLM!>d|X z`e(GscI}nDYkB3vD>oYswLOW-=sEWr-GoQ?dIK7kXd9LtsB|ygoIg`>=Ss@S89~XX z@*`Mzn7ppy&N2Vcp!|-Gx2|qa$#Abev%C24{U>9x8#d3Av8H?RHQ)6eOgvT`kr{o& zFLlcLv*DL>%XU1fcK_g`53hHBGvzDPJkJe!4T9;t-*u$rwcktLebC*}^Z31b6Tl06> zuaC`)i3?R5#tzhOlfK>V+Adf0@9tiAG(7sz*~u*zUClkApYPfeTXi*G=D{v#`&?gY?yZBj`4hj0{NtPTUEMC#vB~jUt_}2T?f85{f4piz-@(l-x$$wA zvzhOn897@U7j%~T4h)GdflUg_VOzpI*ru?Bd=k3^EkftPwAzLILiUO_hkXt0HnbF` z3D4mdvDfiTWjFCmW0ATXKAknf*2v4E=vGfbu2Ism;_7)DA=C?3V`klv^x5!!~s;4@qiwn z!#I+yN%gJ6#x33;=)g<_VgNegHGm3G19Y?S1L%kk0_cdR2jl>y zFbbgKJ(v~;IYS2|#BKK4&=9>cOldA-k~F{3)RrQpap=5Fu&UB@{2~gLf~N%%(*kHA z6ehhYN-rfL1)wsa^d$rK>Um1OhxRF>3fb=T0M?a$;@RcaaWxhAyij$hI>a_Na$e63 z^eZBr{*fm*Y1!);Mr{KI!uzPd8Wj+@pLZpo=?(QQI|W__ixQSZ_9Rmw%;K0l zYqxK!z4`kc%kRIuU~j89K`4dM&Mssr_;%}^tQZMs`eIk1PQ2A)2*;fqK_g^p?f4FG z+~URMVnH0|_)>7(^X+{!!9Udp>2`cYIKBbI0RA z!V;sYT=Z8OS67#mtzOOc7x>N^W(`sW4YR4}y=YipnKJ%|@u(riBMz=YVWSN~5CbhX zmK)X;87eJh#)>LKp~`GA84AkHs-aVBp69@z&og6q{4tHef9kOD(Pfy8dFD@54NnG| O4ma8sXU(WMFZm~fV=sOH delta 2679 zcmcImYiv|i5WeTOwCuvR^a1Rpm9~lnOS^QDcDE0<&{9iTS}c!lA6T-jMU+T{h^7vVn__4^${h3v_FVONC3seA3pv7iAt>BckeA$L6o4AeEoK2 z&OK+&oH=v)>{a#3CAH6U-$(l!21_=4QMheuxp8{dC;783A5udXzKJi`mh7M_ofPpBcVdAklKU_#{q0$2^NZ%;RK)hI`(-&MY1Ck zAtF2&8(coea%g^Nx(p}!^gXHKbO-c{sj|c!aO9?G+Fa9@GRdbmrO8S7Bu$(~z;Oz` zGWe9FB>NoW(?_+w2|m3lT}~PSy*FK)(*llx`q*Jf`+%=0tOB`&j09 z1b325P`^K$9bxGb2oUD?sl<0OeN9uiMN~f6sLP z%kr^~`G2S%GsH3VWR}5=<%9LPqp@|vFR9;I{a6|O$MUiEfAc!Jqx#`4AlK{3Qg6`j zz1e`egXZ1{x9sZykD|X2le^6CPPDx1C`CRf$Nl;bGFf_N{B}Jt{RUis0=m-b!RUN0}KD3AO$VhJ-=1MnEeQ-M(DO(E(5N-e-KtQX8|{zgkTnO7YPni9lc ze#h)CGcDFF<+lmI-Ii^pIWdh)EgHWm{D8Ird)4ojiL)_R23F39(6SO(1vCO7pb2OO zT7VS*{+lv$^BF<4>M%vs*JU~=j?b)BReUtSs{=Q6aaibG6A-255Ts~md&&# z0}lf1xO`Wp18id@0Nb{kPRPCnWX9uSt8u8U6O~H;%9QVMq1BBjy4K9u+59t%e$qoc77F z`qsQS^JiLYZ`)-hnc-;}Cs5z`zaZM{Jm+(5+&)KFUXRxdy@45v4`h4gLdXz*$L!d~juGYDwE5xAg0-DJ9qVEnI=@PeEqvnBxZeSXGHG7` diff --git a/typescript/pragma-scripts/package-lock.json b/typescript/pragma-scripts/package-lock.json index 3939119e..cc28b423 100644 --- a/typescript/pragma-scripts/package-lock.json +++ b/typescript/pragma-scripts/package-lock.json @@ -11,6 +11,7 @@ "dotenv": "^16.4.5", "ethers": "^6.13.3", "js-yaml": "^4.1.0", + "node-fetch": "^3.3.2", "pragma-utils": "file:../pragma-utils", "starknet": "^6.11.0" }, @@ -260,6 +261,14 @@ "node": ">=18" } }, + "node_modules/data-uri-to-buffer": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz", + "integrity": "sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==", + "engines": { + "node": ">= 12" + } + }, "node_modules/dotenv": { "version": "16.4.5", "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.5.tgz", @@ -331,6 +340,28 @@ "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==", "license": "MIT" }, + "node_modules/fetch-blob": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/fetch-blob/-/fetch-blob-3.2.0.tgz", + "integrity": "sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "paypal", + "url": "https://paypal.me/jimmywarting" + } + ], + "dependencies": { + "node-domexception": "^1.0.0", + "web-streams-polyfill": "^3.0.3" + }, + "engines": { + "node": "^12.20 || >= 14.13" + } + }, "node_modules/fetch-cookie": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-3.0.1.tgz", @@ -340,6 +371,17 @@ "tough-cookie": "^4.0.0" } }, + "node_modules/formdata-polyfill": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz", + "integrity": "sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==", + "dependencies": { + "fetch-blob": "^3.1.2" + }, + "engines": { + "node": ">=12.20.0" + } + }, "node_modules/fs-extra": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", @@ -391,6 +433,25 @@ "whatwg-fetch": "^3.4.1" } }, + "node_modules/isomorphic-fetch/node_modules/node-fetch": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", + "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -419,23 +480,39 @@ "resolved": "https://registry.npmjs.org/lossless-json/-/lossless-json-4.0.2.tgz", "integrity": "sha512-+z0EaLi2UcWi8MZRxA5iTb6m4Ys4E80uftGY+yG5KNFJb5EceQXOhdW/pWJZ8m97s26u7yZZAYMcKWNztSZssA==" }, + "node_modules/node-domexception": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz", + "integrity": "sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/jimmywarting" + }, + { + "type": "github", + "url": "https://paypal.me/jimmywarting" + } + ], + "engines": { + "node": ">=10.5.0" + } + }, "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.3.2.tgz", + "integrity": "sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==", "dependencies": { - "whatwg-url": "^5.0.0" + "data-uri-to-buffer": "^4.0.0", + "fetch-blob": "^3.1.4", + "formdata-polyfill": "^4.0.10" }, "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/node-fetch" } }, "node_modules/pako": { @@ -655,6 +732,14 @@ "requires-port": "^1.0.0" } }, + "node_modules/web-streams-polyfill": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz", + "integrity": "sha512-d2JWLCivmZYTSIoge9MsgFCZrt571BikcWGYkjC1khllbTeDlGqZ2D8vD8E/lJa8WGWbb7Plm8/XJYV7IJHZZw==", + "engines": { + "node": ">= 8" + } + }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/typescript/pragma-scripts/package.json b/typescript/pragma-scripts/package.json index 4bc3bc5a..27e32d1c 100644 --- a/typescript/pragma-scripts/package.json +++ b/typescript/pragma-scripts/package.json @@ -14,8 +14,9 @@ "dotenv": "^16.4.5", "ethers": "^6.13.3", "js-yaml": "^4.1.0", - "starknet": "^6.11.0", - "pragma-utils": "file:../pragma-utils" + "node-fetch": "^3.3.2", + "pragma-utils": "file:../pragma-utils", + "starknet": "^6.11.0" }, "scripts": { "generate_feed_id": "bun run src/generate_feed_id.ts", diff --git a/typescript/pragma-scripts/src/pragma/update_feed.ts b/typescript/pragma-scripts/src/pragma/update_feed.ts index 7c3389f4..2b39252e 100644 --- a/typescript/pragma-scripts/src/pragma/update_feed.ts +++ b/typescript/pragma-scripts/src/pragma/update_feed.ts @@ -1,9 +1,10 @@ import { Command, type OptionValues } from "commander"; -import { ethers } from "ethers"; +import { encodeBytes32String, ethers, getBytes, solidityPacked } from "ethers"; import dotenv from "dotenv"; import { getDeployedAddress } from "pragma-utils"; +import fetch from "node-fetch"; -const PRAGMA_SOL_ABI_PATH = "../../../solidity/out/Pragma.sol/Pragma.json"; +const PRAGMA_SOL_ABI_PATH = "../../../../solidity/out/Pragma.sol/Pragma.json"; dotenv.config(); const RPC_URL = process.env.RPC_URL; @@ -11,6 +12,10 @@ if (!RPC_URL) { throw new Error("RPC URL not set in .env file"); } +function snakeToCamel(s: string): string { + return s.replace(/_([a-z])/g, (g) => g[1].toUpperCase()); +} + function parseCommandLineArguments(): OptionValues { const program = new Command(); @@ -23,9 +28,9 @@ function parseCommandLineArguments(): OptionValues { ) .requiredOption("--feed-id ", "ID of the feed to update") .option( - "--theoros-endpoint ", - "Theoros endpoint URL", - "https://theoros.pragma.build/", + "--theoros-url ", + "Theoros URL", + "https://theoros.pragma.build", ) .parse(process.argv); @@ -36,14 +41,14 @@ function parseCommandLineArguments(): OptionValues { process.exit(1); } - if (!Number.isInteger(Number(options.feedId))) { - console.error("Error: Feed ID must be an integer"); + if (!options.feedId || typeof options.feedId !== "string") { + console.error("Error: Feed ID must be a valid string"); process.exit(1); } - if (options.theorosEndpoint) { + if (options.theorosUrl) { try { - new URL(options.theorosEndpoint); + new URL(options.theorosUrl); } catch (error) { console.error("Error: The Theoros endpoint URL is not valid"); process.exit(1); @@ -54,11 +59,13 @@ function parseCommandLineArguments(): OptionValues { } async function getCalldataFromTheoros( - theorosEndpoint: string, - feedId: string, -): Promise { + theorosUrl: string, + chain: string, + feedIds: string[], +): Promise { try { - const url = `${theorosEndpoint}/v1/calldata/${feedId}`; + const feedIdsParam = feedIds.join(","); + const url = `${theorosUrl}/v1/calldata?chain=${chain}&feed_ids=${feedIdsParam}`; console.log(`Fetching calldata from: ${url}`); const response = await fetch(url); @@ -69,15 +76,24 @@ async function getCalldataFromTheoros( const data = await response.json(); - // Assuming that we retrieve calldata as hex string from theoros - // TODO: change this part with real calldata from theoros - if (!data.calldata || typeof data.calldata !== "string") { - throw new Error("Invalid response format: calldata missing or invalid"); + if (!Array.isArray(data) || data.length === 0) { + throw new Error("Invalid response format: data is not a non-empty array"); + } + + // Find the object with the matching feed_id + const calldataObj = data.find((item) => item.feed_id === feedIds[0]); + if (!calldataObj) { + throw new Error(`Feed ID ${feedIds[0]} not found in response`); + } + if ( + !calldataObj.encoded_calldata || + typeof calldataObj.encoded_calldata !== "string" + ) { + throw new Error( + "Invalid response format: encoded_calldata missing or invalid", + ); } - const calldataHex = data.calldata.startsWith("0x") - ? data.calldata.slice(2) - : data.calldata; - return new Uint8Array(Buffer.from(calldataHex, "hex")); + return `0x${calldataObj.encoded_calldata}`; } catch (error) { console.error("Error fetching data from Theoros:", error); throw error; @@ -89,9 +105,13 @@ async function main() { const chain = options.chain; const feedId = options.feedId; - const theorosEndpoint = options.theorosEndpoint; + const theorosUrl = options.theorosUrl; - const pragmaAddress = getDeployedAddress(chain, "pragma", "Pragma"); + const pragmaAddress = getDeployedAddress( + snakeToCamel(chain), + "pragma", + "Pragma", + ); const privateKey = process.env.ETH_PRIVATE_KEY; if (!privateKey) { @@ -101,19 +121,19 @@ async function main() { console.log( `Updating feed ${feedId} for contract ${pragmaAddress} on chain ${chain}`, ); - console.log(`Using Theoros endpoint: ${theorosEndpoint}`); + console.log(`Using Theoros endpoint: ${theorosUrl}`); // 2. Get calldata from Theoros - let calldata: Uint8Array; + let calldata: string; try { - calldata = await getCalldataFromTheoros(theorosEndpoint, feedId); + calldata = await getCalldataFromTheoros(theorosUrl, chain, [feedId]); console.log("Calldata retrieved from Theoros:", calldata); } catch (error) { console.error("Failed to retrieve calldata from Theoros:", error); process.exit(1); } - // 3. Call `updateDataFeeds` with the calldata + // 3. Call updateDataFeeds with the calldata let abi; try { abi = await import(PRAGMA_SOL_ABI_PATH); @@ -126,7 +146,7 @@ async function main() { const contract = new ethers.Contract(pragmaAddress, abi.abi, wallet); try { - const tx = await contract.updateDataFeeds(calldata); + const tx = await contract.updateDataFeeds([calldata]); console.log("Transaction sent. Transaction hash:", tx.hash); // 4. Assertions - check that everything is correctly updated on the destination chain diff --git a/typescript/theoros-sdk/README.md b/typescript/theoros-sdk/README.md index 6a653bdc..a64cf94c 100644 --- a/typescript/theoros-sdk/README.md +++ b/typescript/theoros-sdk/README.md @@ -1,21 +1,33 @@ -# Theoros SDK +# 🧩 Theoros SDK -The official TypeScript SDK for interacting with the Pragma Theoros API. The Theoros SDK simplifies the process of fetching calldata for a given Feed ID, which can be used to update data on EVM chains. +The official TypeScript SDK for interacting with the Pragma Theoros API. The Theoros SDK simplifies the process of: -## Install +- Fetching calldata for given feed IDs. +- Subscribing to real-time data feed updates via WebSocket. + +# Installation ```bash -npm install @pragma/theoros-sdk +npm install @pragmaoracle/theoros-sdk ``` -## Usage +# Introduction + +The Theoros SDK provides a convenient way to interact with the Pragma Theoros API. It allows developers to: + +- Fetch available data feeds and their details. +- Retrieve the list of supported chains. +- Fetch calldata for specific feeds on a given chain. +- Subscribe to real-time updates for data feeds over WebSockets. -### Initializing the SDK +# Getting Started -To start using the Theoros SDK, import it and create an instance: +## Initializing the SDK + +Import the SDK and create an instance: ```typescript -import { TheorosSDK } from "@pragma/theoros-sdk"; +import { TheorosSDK } from "@pragmaoracle/theoros-sdk"; const sdk = new TheorosSDK({ baseUrl: "https://api.pragma.build/v1", // Optional, defaults to this value @@ -23,72 +35,173 @@ const sdk = new TheorosSDK({ }); ``` -- `baseUrl`: The base URL of the Pragma Theoros API. Defaults to `https://api.pragma.build/v1`. -- `timeout`: The request timeout in milliseconds. Defaults to `10000`. +- `baseUrl` (optional): The base URL of the Pragma Theoros API. Defaults to `'https://api.pragma.build/v1'`. +- `timeout` (optional): The request timeout in milliseconds. Defaults to `10000`. + +## Usage -### Fetching Available Feed IDs +### Fetching Available Feeds -Retrieve the list of available Feed IDs using the `getAvailableFeedIds` method: +Retrieve the list of available feeds: ```typescript -const feedIds = await sdk.getAvailableFeedIds(); -console.log("Available Feed IDs:", feedIds); +const feeds = await sdk.getAvailableFeeds(); +console.log("Available Feeds:", feeds); ``` -This method returns a promise that resolves to an array of string containing the Feed IDs. +This method returns a promise that resolves to an array of Feed objects, each containing: -### Fetching Calldata for a Feed ID +- `feed_id`: The unique identifier for the feed. +- `asset_class`: The asset class of the feed. +- `feed_type`: The type of the feed. +- `pair_id`: The pair identifier associated with the feed. -Once you have a Feed ID, you can fetch its calldata using the `getCalldata` method: +### Fetching Supported Chains + +Retrieve the list of supported chains: ```typescript -const feedId = feedIds[0]; // For example, use the first Feed ID -const calldataResponse = await sdk.getCalldata(feedId); -console.log("Calldata:", calldataResponse.calldata); +const chains = await sdk.getSupportedChains(); +console.log("Supported Chains:", chains); ``` -- `feedId`: The Feed ID for which you want to fetch the calldata. - The getCalldata method returns a promise that resolves to a `CalldataResponse` object containing: -- `calldata`: An array of numbers representing the calldata. +This method returns a promise that resolves to an array of strings representing the chain names. -#### Example +### Fetching Calldata -Here is a complete example demonstrating how to use the Theoros SDK: +Fetch calldata for specific feed IDs on a given chain: ```typescript -import { TheorosSDK } from "@pragma/theoros-sdk"; +const chain = "zircuit_testnet"; +const feedIds = ["0x4e5354522f555344", "0x4c5553442f555344"]; + +try { + const calldataResponses = await sdk.getCalldata(chain, feedIds); + console.log("Calldata Responses:", calldataResponses); +} catch (error) { + console.error("Error fetching calldata:", error); +} +``` -(async () => { - const sdk = new TheorosSDK({ - baseUrl: "https://api.pragma.build/v1", - }); +- `chain`: The name of the chain. +- `feedIds`: An array of feed IDs. + +The method returns a promise that resolves to an array of `CalldataResponse` objects, each containing: + +- `feed_id`: The feed ID. +- `encoded_calldata`: The calldata encoded as a hex string. + +### Subscribing to Data Feeds + +Subscribe to data feed updates over WebSocket: + +```typescript +const chain = "zircuit_testnet"; +const feedIds = ["0x4e5354522f555344", "0x4c5553442f555344"]; + +const subscription = sdk.subscribe(chain, feedIds); +``` + +### Handling Updates + +Listen for updates and other events: + +```typescript +subscription.on("update", (dataFeeds) => { + console.log("Data Feed Update:", dataFeeds); +}); + +subscription.on("error", (error) => { + console.error("Subscription Error:", error); +}); + +subscription.on("close", () => { + console.log("Subscription Closed"); +}); +``` + +- `'update'`: Emitted when new data feed updates are received. The callback receives an array of RpcDataFeed objects. +- `'error'`: Emitted when an error occurs. The callback receives an error object. +- `'close'`: Emitted when the subscription is closed. + +### Adding and Removing Feed IDs + +You can dynamically add or remove feed IDs from the subscription: + +```typescript +// Add new feed IDs +subscription.addFeedIds(["0x4e5354522f555344"]); + +// Remove feed IDs +subscription.removeFeedIds(["0x4e5354522f555344"]); +``` + +### Unsubscribing - try { - // Fetch available feed IDs - const feeds = await sdk.getAvailableFeedIds(); - console.log("Available Feed IDs:", feeds); - - if (feeds.length === 0) { - console.log("No feeds available."); - return; - } - - // Fetch calldata for the first available Feed ID - const calldataResponse = await sdk.getCalldata(feeds[0]); - console.log("Calldata:", calldataResponse.calldata); - } catch (error) { - console.error("An error occurred:", error); - } -})(); +To unsubscribe from all feeds and close the connection: + +```typescript +subscription.unsubscribe(); ``` -This script: +# Example + +Here's a complete example demonstrating how to use the SDK: + +```typescript +import { + TheorosSDK, + type Feed, + type RpcDataFeed, + type TheorosSDKError, +} from "@pragmaoracle/theoros-sdk"; -1. Initializes the SDK. -2. Retrieves the available Feed IDs. -3. Fetches the calldata for the first Feed ID. -4. Logs the calldata to the console. +const sdk = new TheorosSDK({ + baseUrl: "http://localhost:3000/v1", // Local Theoros instance +}); + +try { + // Fetch available feeds + const feeds = await sdk.getAvailableFeeds(); + console.log("📜 Available Feeds:", feeds); + + // Fetch supported chains + const chains = await sdk.getSupportedChains(); + console.log("⛓️‍💥 Supported Chains:", chains); + + // Choose a chain and feed IDs + const chain = chains[0]; + const feedIds = feeds.slice(0, 2).map((feed: Feed) => feed.feed_id); + + // Fetch calldata + const calldataResponses = await sdk.getCalldata(chain, feedIds); + console.log("👉 Calldata Responses:", calldataResponses); + + // Subscribe to data feed updates + const subscription = sdk.subscribe(chain, feedIds); + + subscription.on("update", (dataFeeds: RpcDataFeed[]) => { + console.log("👉 Data Feed Update:", dataFeeds); + }); + + subscription.on("error", (error: TheorosSDKError) => { + console.error("😱😱 Subscription Error:", error); + }); + + // Add a new feed ID after some time + setTimeout(() => { + subscription.addFeedIds(["0x574254432f555344"]); + }, 5000); + + // Unsubscribe after some time + setTimeout(() => { + subscription.unsubscribe(); + }, 15000); +} catch (error) { + console.error("An error occurred:", error); +} +``` -## License +# License -This project is licensed under the [MIT License](../../LICENSE.md). +This project is licensed under the [MIT](../../LICENSE) License. diff --git a/typescript/theoros-sdk/examples/index.ts b/typescript/theoros-sdk/examples/index.ts new file mode 100644 index 00000000..5f43a7b9 --- /dev/null +++ b/typescript/theoros-sdk/examples/index.ts @@ -0,0 +1,51 @@ +import { + TheorosSDK, + type Feed, + type RpcDataFeed, + type TheorosSDKError, +} from "@pragmaoracle/theoros-sdk"; + +const sdk = new TheorosSDK({ + baseUrl: "http://localhost:3000/v1", // Local Theoros instance +}); + +try { + // Fetch available feeds + const feeds = await sdk.getAvailableFeeds(); + console.log("📜 Available Feeds:", feeds); + + // Fetch supported chains + const chains = await sdk.getSupportedChains(); + console.log("⛓️‍💥 Supported Chains:", chains); + + // Choose a chain and feed IDs + const chain = chains[0]; + const feedIds = feeds.slice(0, 2).map((feed: Feed) => feed.feed_id); + + // Fetch calldata + const calldataResponses = await sdk.getCalldata(chain, feedIds); + console.log("👉 Calldata Responses:", calldataResponses); + + // Subscribe to data feed updates + const subscription = sdk.subscribe(chain, feedIds); + + subscription.on("update", (dataFeeds: RpcDataFeed[]) => { + console.log("👉 Data Feed Update:", dataFeeds); + }); + + subscription.on("error", (error: TheorosSDKError) => { + console.error("😱😱 Subscription Error:", error); + }); + + // Add a new feed ID after some time + setTimeout(() => { + subscription.addFeedIds(["0x574254432f555344"]); + }, 5000); + + // Unsubscribe after some time + setTimeout(() => { + subscription.unsubscribe(); + }, 30000); +} catch (error) { + console.error("An error occurred:", error); +} diff --git a/typescript/theoros-sdk/package-lock.json b/typescript/theoros-sdk/package-lock.json index 4f534e7a..9f232e40 100644 --- a/typescript/theoros-sdk/package-lock.json +++ b/typescript/theoros-sdk/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@pragma/theoros-sdk", + "name": "@pragmaoracle/theoros-sdk", "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@pragma/theoros-sdk", + "name": "@pragmaoracle/theoros-sdk", "version": "1.0.0", "license": "MIT", "dependencies": { diff --git a/typescript/theoros-sdk/package.json b/typescript/theoros-sdk/package.json index 9edade03..3eeaabe4 100644 --- a/typescript/theoros-sdk/package.json +++ b/typescript/theoros-sdk/package.json @@ -1,5 +1,5 @@ { - "name": "@pragma/theoros-sdk", + "name": "@pragmaoracle/theoros-sdk", "description": "The official SDK for Pragma Theoros", "version": "1.0.0", "keywords": [ diff --git a/typescript/theoros-sdk/src/index.ts b/typescript/theoros-sdk/src/index.ts index 87a37e29..886d391e 100644 --- a/typescript/theoros-sdk/src/index.ts +++ b/typescript/theoros-sdk/src/index.ts @@ -1,4 +1,5 @@ import axios, { type AxiosInstance } from "axios"; +import { EventEmitter } from "events"; export interface TheorosSDKConfig { baseUrl?: string; @@ -6,15 +7,166 @@ export interface TheorosSDKConfig { } export interface CalldataResponse { - calldata: number[]; + feed_id: string; + encoded_calldata: string; +} + +export interface Feed { + feed_id: string; + asset_class: string; + feed_type: string; + pair_id: string; +} + +export interface RpcDataFeed { + feed_id: string; + encoded_calldata: string; +} + +export class TheorosSDKError extends Error { + public cause?: any; + constructor(message: string, cause?: any) { + super(message); + this.name = "TheorosSDKError"; + this.cause = cause; + } +} + +export class Subscription extends EventEmitter { + private socket!: WebSocket; + private isClosed = false; + private chain: string; + private feedIds: Set; + private baseUrl: string; + private reconnectAttempts = 0; + private maxReconnectAttempts = 5; + + constructor(baseUrl: string, chain: string, feedIds: string[]) { + super(); + this.baseUrl = baseUrl; + this.chain = chain; + this.feedIds = new Set(feedIds); + this.connect(); + } + + private connect() { + const wsUrl = this.baseUrl + "/ws/calldata"; + this.socket = new WebSocket(wsUrl); + + this.socket.addEventListener("open", () => { + this.reconnectAttempts = 0; + const subscribeMessage = JSON.stringify({ + type: "subscribe", + chain: this.chain, + feed_ids: Array.from(this.feedIds), + }); + this.socket.send(subscribeMessage); + this.emit("open"); + }); + + this.socket.addEventListener("message", (event) => { + try { + const data = JSON.parse(event.data); + if (data.type === "data_feed_update") { + this.emit("update", data.data_feeds as RpcDataFeed[]); + } else if (data.type === "response") { + if (data.status === "error") { + this.emit("error", new TheorosSDKError(data.error)); + } + } + } catch (e) { + this.emit( + "error", + new TheorosSDKError("Invalid JSON message received", e), + ); + } + }); + + this.socket.addEventListener("error", (event) => { + this.emit("error", new TheorosSDKError("WebSocket error", event)); + }); + + this.socket.addEventListener("close", () => { + this.emit("close"); + if ( + !this.isClosed && + this.reconnectAttempts < this.maxReconnectAttempts + ) { + const timeout = Math.pow(2, this.reconnectAttempts) * 1000; + this.reconnectAttempts += 1; + setTimeout(() => this.connect(), timeout); + } else if (!this.isClosed) { + this.emit( + "error", + new TheorosSDKError("Max reconnection attempts reached"), + ); + } + }); + } + + /** + * Adds new feed IDs to the subscription. + * @param feedIds - Array of feed IDs to subscribe to. + */ + addFeedIds(feedIds: string[]) { + for (const id of feedIds) { + if (!this.feedIds.has(id)) { + this.feedIds.add(id); + if (this.socket.readyState === WebSocket.OPEN) { + const subscribeMessage = JSON.stringify({ + type: "subscribe", + chain: this.chain, + feed_ids: [id], + }); + this.socket.send(subscribeMessage); + } + } + } + } + + /** + * Removes feed IDs from the subscription. + * @param feedIds - Array of feed IDs to unsubscribe from. + */ + removeFeedIds(feedIds: string[]) { + for (const id of feedIds) { + if (this.feedIds.has(id)) { + this.feedIds.delete(id); + if (this.socket.readyState === WebSocket.OPEN) { + const unsubscribeMessage = JSON.stringify({ + type: "unsubscribe", + feed_ids: [id], + }); + this.socket.send(unsubscribeMessage); + } + } + } + } + + /** + * Unsubscribes from all feeds and closes the WebSocket connection. + */ + unsubscribe() { + this.isClosed = true; + if (this.socket.readyState === WebSocket.OPEN) { + const unsubscribeMessage = JSON.stringify({ + type: "unsubscribe", + feed_ids: Array.from(this.feedIds), + }); + this.socket.send(unsubscribeMessage); + this.socket.close(); + } else { + this.socket.close(); + } + } } export class TheorosSDK { private baseUrl: string; private httpClient: AxiosInstance; - constructor(config: TheorosSDKConfig) { - this.baseUrl = config.baseUrl || "https://api.pragma.build/v1"; + constructor(config: TheorosSDKConfig = {}) { + this.baseUrl = config.baseUrl || "https://theoros.pragma.build/v1"; this.httpClient = axios.create({ baseURL: this.baseUrl, @@ -25,27 +177,64 @@ export class TheorosSDK { }); } - // Fetch available data feeds - async getAvailableFeedIds(): Promise { + /** + * Retrieves all available data feeds. + * @returns A promise that resolves to an array of Feed objects. + */ + async getAvailableFeeds(): Promise { try { - const response = await this.httpClient.get("/data_feeds"); + const response = await this.httpClient.get("/data_feeds"); return response.data; } catch (error) { - throw new Error(`Error fetching data feeds: ${error}`); + throw new TheorosSDKError("Error fetching data feeds", error); } } - // Fetch calldata for a given Feed ID - async getCalldata(feedId: string): Promise { + /** + * Retrieves all supported chains. + * @returns A promise that resolves to an array of chain names. + */ + async getSupportedChains(): Promise { try { - const response = await this.httpClient.get( - `/calldata/${feedId}`, - ); + const response = await this.httpClient.get("/chains"); return response.data; } catch (error) { - throw new Error( - `Error fetching calldata for feed ID ${feedId}: ${error}`, + throw new TheorosSDKError("Error fetching supported chains", error); + } + } + + /** + * Fetches calldata for the specified chain and feed IDs. + * @param chain - The chain name. + * @param feedIds - An array of feed IDs. + * @returns A promise that resolves to an array of CalldataResponse objects. + */ + async getCalldata( + chain: string, + feedIds: string[], + ): Promise { + try { + const params = { + chain, + feed_ids: feedIds.join(","), + }; + const response = await this.httpClient.get( + "/calldata", + { params }, ); + return response.data; + } catch (error) { + throw new TheorosSDKError("Error fetching calldata", error); } } + + /** + * Subscribes to data feed updates over WebSocket. + * @param chain - The chain name. + * @param feedIds - An array of feed IDs. + * @returns A Subscription object that emits events on data updates. + */ + subscribe(chain: string, feedIds: string[]): Subscription { + return new Subscription(this.baseUrl, chain, feedIds); + } } diff --git a/typescript/theoros-sdk/tsconfig.json b/typescript/theoros-sdk/tsconfig.json index 238655f2..d5892f9e 100644 --- a/typescript/theoros-sdk/tsconfig.json +++ b/typescript/theoros-sdk/tsconfig.json @@ -22,6 +22,9 @@ // Some stricter flags (disabled by default) "noUnusedLocals": false, "noUnusedParameters": false, - "noPropertyAccessFromIndexSignature": false + "noPropertyAccessFromIndexSignature": false, + "paths": { + "@pragmaoracle/theoros-sdk": ["./src/index.ts"] + } } } From dc98734e473ecf4ae8e0210b0b3cc5a5ca8da638 Mon Sep 17 00:00:00 2001 From: 0xevolve Date: Mon, 4 Nov 2024 10:17:01 +0100 Subject: [PATCH 3/5] fix: external prometheus (#91) --- rust/theoros/src/cli.rs | 3 +++ rust/theoros/src/main.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/rust/theoros/src/cli.rs b/rust/theoros/src/cli.rs index b67f7347..a591d7e4 100644 --- a/rust/theoros/src/cli.rs +++ b/rust/theoros/src/cli.rs @@ -50,6 +50,9 @@ pub struct TheorosCli { value_parser = parse_evm_config )] pub evm_config: evm_config::EvmConfig, + + #[clap(env = "PROMETHEUS_EXTERNAL", long, default_value = "false")] + pub prometheus_external: bool, } /// Parse a Felt. diff --git a/rust/theoros/src/main.rs b/rust/theoros/src/main.rs index 248c4836..e2ffafd0 100644 --- a/rust/theoros/src/main.rs +++ b/rust/theoros/src/main.rs @@ -45,7 +45,7 @@ async fn main() -> Result<()> { ) .await?; - let metrics_service = MetricsService::new(false, config.metrics_port)?; + let metrics_service = MetricsService::new(config.prometheus_external, config.metrics_port)?; let state = AppState { starknet_rpc: Arc::new(starknet_rpc), From 880f706f23cdebcbaaf2dd31134f4d5a384af53a Mon Sep 17 00:00:00 2001 From: devops72 <43383438+devops72-sre@users.noreply.github.com> Date: Tue, 5 Nov 2024 09:04:42 +0530 Subject: [PATCH 4/5] feat: cicd workflow (#93) * Added ci * Added ci * Add multiport * rename directory * rename directory * modified dockerfile * modified dockerfile * Added infisical * corrected comments --------- Co-authored-by: devops72-sre <> --- infra/theoros/Dockerfile | 43 +++++++++++++++++++++++++++++++++++++ infra/theoros/buildspec.yml | 29 +++++++++++++++++++++++++ infra/theoros/config.yml | 9 ++++++++ infra/theoros/entrypoint.sh | 7 ++++++ 4 files changed, 88 insertions(+) create mode 100644 infra/theoros/Dockerfile create mode 100644 infra/theoros/buildspec.yml create mode 100644 infra/theoros/config.yml create mode 100644 infra/theoros/entrypoint.sh diff --git a/infra/theoros/Dockerfile b/infra/theoros/Dockerfile new file mode 100644 index 00000000..bce52586 --- /dev/null +++ b/infra/theoros/Dockerfile @@ -0,0 +1,43 @@ + +FROM public.ecr.aws/docker/library/rust:1.81.0-slim-bookworm AS build + +ARG PACKAGE_NAME=theoros + +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential pkg-config libssl-dev protobuf-compiler curl libprotobuf-dev && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +RUN apt-get update && apt-get install -y bash curl && curl -1sLf \ +'https://dl.cloudsmith.io/public/infisical/infisical-cli/setup.deb.sh' | bash \ +&& apt-get update && apt-get install -y infisical + +WORKDIR /app + +COPY ./rust . + +RUN cargo build --release --package ${PACKAGE_NAME} + +FROM public.ecr.aws/docker/library/debian:bookworm-slim + +RUN apt-get update && apt-get install -y --no-install-recommends \ + libssl-dev wget ca-certificates && \ + apt-get autoremove -y && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* +RUN groupadd pragma + +RUN useradd -g pragma pragma + +USER pragma + +WORKDIR /home/pragma +EXPOSE 3000 +EXPOSE 8080 +COPY --from=build /usr/bin/infisical /usr/bin/infisical +COPY infra/theoros/entrypoint.sh /home/pragma/entrypoint.sh +# Copy artifacts from base image +COPY --from=build /app/target/release/theoros /usr/local/bin/ + +ENTRYPOINT ["/bin/bash","/home/pragma/entrypoint.sh"] diff --git a/infra/theoros/buildspec.yml b/infra/theoros/buildspec.yml new file mode 100644 index 00000000..82795f84 --- /dev/null +++ b/infra/theoros/buildspec.yml @@ -0,0 +1,29 @@ +version: 0.2 +phases: + pre_build: + commands: + - echo Logging in to Amazon ECR... + - aws --version + - aws ecr get-login-password --region $ECR_REGION | docker login --username AWS --password-stdin $AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com + - REPOSITORY_URI=$AWS_ACCOUNT_ID.dkr.ecr.$ECR_REGION.amazonaws.com/$ECR_REPOSITORY_NAME + - COMMIT_HASH=$(echo $CODEBUILD_RESOLVED_SOURCE_VERSION | cut -c 1-7) + - IMAGE_TAG=${COMMIT_HASH:=latest} + build: + commands: + - echo Build started on `date` + - echo Building the Docker image... + - ls -ltr + - docker build -f infra/theoros/Dockerfile -t $REPOSITORY_URI:latest . + - docker tag $REPOSITORY_URI:latest $REPOSITORY_URI:$IMAGE_TAG + post_build: + commands: + - echo Pushing the Docker images... + - docker push $REPOSITORY_URI:latest + - docker push $REPOSITORY_URI:$IMAGE_TAG + - echo Writing image definitions file... + - printf '[{"name":"%s","imageUri":"%s"}]' $ECS_CONTAINER_NAME $REPOSITORY_URI:$IMAGE_TAG > imagedefinitions.json +artifacts: + files: + - imagedefinitions.json + - infra/theoros/config.yml + discard-paths: yes \ No newline at end of file diff --git a/infra/theoros/config.yml b/infra/theoros/config.yml new file mode 100644 index 00000000..aa01a2e4 --- /dev/null +++ b/infra/theoros/config.yml @@ -0,0 +1,9 @@ +path: "/" +container_port: 3000,8080 +health_check_path: "/health" +container_environment: + - region: "eu-west-3" + - prefix: "/conf/{{ SERVICE_NAME }}/{{ RUN_ENV }}" + - keys: + - INFISICAL_ENV + - INFISICAL_APP_PATH \ No newline at end of file diff --git a/infra/theoros/entrypoint.sh b/infra/theoros/entrypoint.sh new file mode 100644 index 00000000..886f6afd --- /dev/null +++ b/infra/theoros/entrypoint.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -euo pipefail +export INFISICAL_TOKEN=$(infisical login --method=universal-auth --client-id=${INFISICAL_CLIENT_ID} --client-secret=${INFISICAL_CLIENT_SECRET} --silent --plain) +infisical export --projectId=${INFISICAL_PROJECT_ID} --env=${INFISICAL_ENV} --path=${INFISICAL_APP_PATH} > .env +source .env +wget ${EVM_URL} -O evm_config.yaml +exec theoros ${ARGS} \ No newline at end of file From cf5e34b6658379f86576ce14ab8bcd23a0e48e13 Mon Sep 17 00:00:00 2001 From: adel Date: Tue, 5 Nov 2024 21:53:18 +0100 Subject: [PATCH 5/5] fix: remove unused param from calldata (#92) --- rust/theoros/src/types/calldata.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rust/theoros/src/types/calldata.rs b/rust/theoros/src/types/calldata.rs index 7f2dfd92..7b55de4f 100644 --- a/rust/theoros/src/types/calldata.rs +++ b/rust/theoros/src/types/calldata.rs @@ -66,13 +66,11 @@ impl Calldata { let payload = Payload { checkpoint: nonce_checkpoint.clone(), num_updates: 1, - // TODO: proof should be deleted proof_len: 0, proof: vec![], update_data_len: update.to_bytes().len() as u16, update_data: update.to_bytes(), feed_id, - // TODO: publish_time is a duplicated of update timestamp - remove? publish_time: update.metadata.timestamp, }; @@ -83,8 +81,6 @@ impl Calldata { nonce: update_info.nonce, signers_len: signatures.len() as u8, signatures, - // TODO: timestamp is a duplicated of update timestamp - remove? - timestamp: update.metadata.timestamp, payload, }; @@ -116,7 +112,6 @@ pub struct HyperlaneMessage { /// List of signatures pub signatures: Vec, pub nonce: u32, - pub timestamp: u64, /// Chain ID of the emitter (pragma chain id) pub emitter_chain_id: u32, /// Address of the emitter (pragma chain mailbox address) @@ -132,7 +127,6 @@ impl AsCalldata for HyperlaneMessage { bytes.extend_from_slice(&signer.signature.as_bytes()); } bytes.extend_from_slice(&self.nonce.to_be_bytes()); - bytes.extend_from_slice(&self.timestamp.to_be_bytes()); bytes.extend_from_slice(&self.emitter_chain_id.to_be_bytes()); bytes.extend_from_slice(&self.emitter_address.to_bytes_be()); bytes.extend_from_slice(&self.payload.as_bytes());