diff --git a/jest.config.js b/jest.config.js index 8127320c85c9..6992109ea6ed 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,7 @@ const config = require('@polkadot/dev/config/jest'); module.exports = Object.assign({}, config, { moduleNameMapper: { - '@polkadot/api-(format|jsonrpc|provider|rx)(.*)$': '/packages/api-$1/src/$2', + '@polkadot/api-(codec|format|jsonrpc|provider|rx)(.*)$': '/packages/api-$1/src/$2', '@polkadot/api(.*)$': '/packages/api/src/$1', '@polkadot/extrinsics(.*)$': '/packages/type-extrinsics/src/$1', '@polkadot/jsonrpc(.*)$': '/packages/type-jsonrpc/src/$1', diff --git a/packages/api-codec/.nodoc b/packages/api-codec/.nodoc new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/api-codec/LICENSE b/packages/api-codec/LICENSE new file mode 100644 index 000000000000..b26ce95c95d2 --- /dev/null +++ b/packages/api-codec/LICENSE @@ -0,0 +1,15 @@ +ISC License (ISC) + +Copyright 2017-2018 @polkadot/api-codec authors & contributors + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. diff --git a/packages/api-codec/README.md b/packages/api-codec/README.md new file mode 100644 index 000000000000..0e19b4d4964b --- /dev/null +++ b/packages/api-codec/README.md @@ -0,0 +1,3 @@ +# @polkadot/api-codec + +Implementation of the parity-codec diff --git a/packages/api-codec/package.json b/packages/api-codec/package.json new file mode 100644 index 000000000000..95a5136d7603 --- /dev/null +++ b/packages/api-codec/package.json @@ -0,0 +1,35 @@ +{ + "name": "@polkadot/api-codec", + "version": "0.29.7", + "description": "Implementation of the Parity codec", + "main": "index.js", + "keywords": [ + "Polkadot", + "JsonRPC" + ], + "author": "Jaco Greeff ", + "maintainers": [ + "Jaco Greeff " + ], + "contributors": [], + "license": "ISC", + "engines": { + "node": ">=6.4" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/polkadot-js/api.git" + }, + "bugs": { + "url": "https://github.com/polkadot-js/api/issues" + }, + "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-codec#readme", + "dependencies": { + "@babel/runtime": "^7.0.0", + "@polkadot/util": "^0.30.4" + } +} diff --git a/packages/api-codec/src/Metadata.decoded.json b/packages/api-codec/src/Metadata.decoded.json new file mode 100644 index 000000000000..01f758d840ac --- /dev/null +++ b/packages/api-codec/src/Metadata.decoded.json @@ -0,0 +1,2199 @@ +{ + "outerEvent": { + "name": "Event", + "events": [ + { + "name": "system", + "events": [ + { + "name": "ExtrinsicSuccess", + "arguments": [], + "documentation": [ + " An extrinsic completed successfully." + ] + }, + { + "name": "ExtrinsicFailed", + "arguments": [], + "documentation": [ + " An extrinsic failed." + ] + } + ] + }, + { + "name": "balances", + "events": [ + { + "name": "NewAccount", + "arguments": [ + "AccountId", + "AccountIndex", + "NewAccountOutcome" + ], + "documentation": [ + " A new account was created." + ] + }, + { + "name": "ReapedAccount", + "arguments": [ + "AccountId" + ], + "documentation": [ + " An account was reaped." + ] + }, + { + "name": "Transfer", + "arguments": [ + "AccountId", + "AccountId", + "Balance", + "Balance" + ], + "documentation": [ + " Transfer succeeded (from, to, value, fees)." + ] + } + ] + }, + { + "name": "session", + "events": [ + { + "name": "NewSession", + "arguments": [ + "BlockNumber" + ], + "documentation": [ + " New session has happened. Note that the argument is the session index, not the block", + " number as the type might suggest." + ] + } + ] + }, + { + "name": "staking", + "events": [ + { + "name": "Reward", + "arguments": [ + "Balance" + ], + "documentation": [ + " All validators have been rewarded by the given balance." + ] + }, + { + "name": "OfflineWarning", + "arguments": [ + "AccountId", + "u32" + ], + "documentation": [ + " One validator (and their nominators) has been given a offline-warning (they're still", + " within their grace). The accrued number of slashes is recorded, too." + ] + }, + { + "name": "OfflineSlash", + "arguments": [ + "AccountId", + "Balance" + ], + "documentation": [ + " One validator (and their nominators) has been slashed by the given amount." + ] + } + ] + }, + { + "name": "democracy", + "events": [ + { + "name": "Tabled", + "arguments": [ + "PropIndex", + "Balance", + "Vec" + ], + "documentation": [] + }, + { + "name": "Started", + "arguments": [ + "ReferendumIndex", + "VoteThreshold" + ], + "documentation": [] + }, + { + "name": "Passed", + "arguments": [ + "ReferendumIndex" + ], + "documentation": [] + }, + { + "name": "NotPassed", + "arguments": [ + "ReferendumIndex" + ], + "documentation": [] + }, + { + "name": "Cancelled", + "arguments": [ + "ReferendumIndex" + ], + "documentation": [] + }, + { + "name": "Executed", + "arguments": [ + "ReferendumIndex", + "bool" + ], + "documentation": [] + } + ] + }, + { + "name": "council", + "events": [ + { + "name": "VoterReaped", + "arguments": [ + "AccountId", + "AccountId" + ], + "documentation": [ + " reaped voter, reaper" + ] + }, + { + "name": "BadReaperSlashed", + "arguments": [ + "AccountId" + ], + "documentation": [ + " slashed reaper" + ] + }, + { + "name": "TallyStarted", + "arguments": [ + "u32" + ], + "documentation": [ + " A tally (for approval votes of council seat(s)) has started." + ] + }, + { + "name": "TallyFinalised", + "arguments": [ + "Vec", + "Vec" + ], + "documentation": [ + " A tally (for approval votes of council seat(s)) has ended (with one or more new members)." + ] + } + ] + }, + { + "name": "council_voting", + "events": [ + { + "name": "TallyCancelation", + "arguments": [ + "Hash", + "u32", + "u32", + "u32" + ], + "documentation": [ + " A voting tally has happened for a referendum cancelation vote.", + " Last three are yes, no, abstain counts." + ] + }, + { + "name": "TallyReferendum", + "arguments": [ + "Hash", + "u32", + "u32", + "u32" + ], + "documentation": [ + " A voting tally has happened for a referendum vote.", + " Last three are yes, no, abstain counts." + ] + } + ] + }, + { + "name": "council_motions", + "events": [ + { + "name": "Proposed", + "arguments": [ + "AccountId", + "ProposalIndex", + "Hash", + "u32" + ], + "documentation": [ + " A motion (given hash) has been proposed (by given account) with a threshold (given u32)." + ] + }, + { + "name": "Voted", + "arguments": [ + "AccountId", + "Hash", + "bool", + "u32", + "u32" + ], + "documentation": [ + " A motion (given hash) has been voted on by given account, leaving", + " a tally (yes votes and no votes given as u32s respectively)." + ] + }, + { + "name": "Approved", + "arguments": [ + "Hash" + ], + "documentation": [ + " A motion was approved by the required threshold." + ] + }, + { + "name": "Disapproved", + "arguments": [ + "Hash" + ], + "documentation": [ + " A motion was not approved by the required threshold." + ] + }, + { + "name": "Executed", + "arguments": [ + "Hash", + "bool" + ], + "documentation": [ + " A motion was executed; `bool` is true if returned without error." + ] + } + ] + }, + { + "name": "treasury", + "events": [ + { + "name": "Proposed", + "arguments": [ + "ProposalIndex" + ], + "documentation": [ + " New proposal." + ] + }, + { + "name": "Spending", + "arguments": [ + "Balance" + ], + "documentation": [ + " We have ended a spend period and will now allocate funds." + ] + }, + { + "name": "Awarded", + "arguments": [ + "ProposalIndex", + "Balance", + "AccountId" + ], + "documentation": [ + " Some funds have been allocated." + ] + }, + { + "name": "Burnt", + "arguments": [ + "Balance" + ], + "documentation": [ + " Some of our funds have been burnt." + ] + }, + { + "name": "Rollover", + "arguments": [ + "Balance" + ], + "documentation": [ + " Spending has finished; this is the amount that rolls over until next spend." + ] + } + ] + } + ] + }, + "modules": [ + { + "prefix": "system", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [] + } + }, + "storage": { + "prefix": "System", + "functions": [ + { + "name": "AccountNonce", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "T::Index" + }, + "documentation": [] + }, + { + "name": "ExtrinsicCount", + "modifier": 0, + "type": "u32", + "documentation": [] + }, + { + "name": "BlockHash", + "modifier": 2, + "type": { + "key": "T::BlockNumber", + "value": "T::Hash" + }, + "documentation": [] + }, + { + "name": "ExtrinsicData", + "modifier": 2, + "type": { + "key": "u32", + "value": "Vec" + }, + "documentation": [] + }, + { + "name": "RandomSeed", + "modifier": 2, + "type": "T::Hash", + "documentation": [] + }, + { + "name": "Number", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " The current block number being processed. Set by `execute_block`." + ] + }, + { + "name": "ParentHash", + "modifier": 2, + "type": "T::Hash", + "documentation": [] + }, + { + "name": "ExtrinsicsRoot", + "modifier": 2, + "type": "T::Hash", + "documentation": [] + }, + { + "name": "Digest", + "modifier": 1, + "type": "T::Digest", + "documentation": [] + }, + { + "name": "Events", + "modifier": 1, + "type": "Vec>", + "documentation": [] + } + ] + } + }, + { + "prefix": "consensus", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "report_misbehavior", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "report", + "type": "MisbehaviorReport" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "note_offline", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "offline_val_indices", + "type": "Vec" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "remark", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "remark", + "type": "Vec" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "set_code", + "arguments": [ + { + "name": "new", + "type": "Vec" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "set_storage", + "arguments": [ + { + "name": "items", + "type": "Vec" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Consensus", + "functions": [ + { + "name": "OriginalAuthorities", + "modifier": 0, + "type": "Vec", + "documentation": [] + } + ] + } + }, + { + "prefix": "balances", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "transfer", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "dest", + "type": "RawAddress" + }, + { + "name": "value", + "type": "T::Balance" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "set_balance", + "arguments": [ + { + "name": "who", + "type": "RawAddress" + }, + { + "name": "free", + "type": "T::Balance" + }, + { + "name": "reserved", + "type": "T::Balance" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Balances", + "functions": [ + { + "name": "TotalIssuance", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The total amount of stake on the system." + ] + }, + { + "name": "ExistentialDeposit", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The minimum amount allowed to keep an account open." + ] + }, + { + "name": "ReclaimRebate", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The amount credited to a destination's account whose index was reclaimed." + ] + }, + { + "name": "TransferFee", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The fee required to make a transfer." + ] + }, + { + "name": "CreationFee", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The fee required to create an account. At least as big as ReclaimRebate." + ] + }, + { + "name": "NextEnumSet", + "modifier": 2, + "type": "T::AccountIndex", + "documentation": [ + " The next free enumeration set." + ] + }, + { + "name": "EnumSet", + "modifier": 1, + "type": { + "key": "T::AccountIndex", + "value": "Vec" + }, + "documentation": [ + " The enumeration sets." + ] + }, + { + "name": "FreeBalance", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "T::Balance" + }, + "documentation": [ + " The 'free' balance of a given account.", + "", + " This is the only balance that matters in terms of most operations on tokens. It is", + " alone used to determine the balance when in the contract execution environment. When this", + " balance falls below the value of `ExistentialDeposit`, then the 'current account' is", + " deleted: specifically `FreeBalance`. Furthermore, `OnFreeBalanceZero` callback", + " is invoked, giving a chance to external modules to cleanup data associated with", + " the deleted account.", + "", + " `system::AccountNonce` is also deleted if `ReservedBalance` is also zero (it also gets", + " collapsed to zero if it ever becomes less than `ExistentialDeposit`." + ] + }, + { + "name": "ReservedBalance", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "T::Balance" + }, + "documentation": [ + " The amount of the balance of a given account that is exterally reserved; this can still get", + " slashed, but gets slashed last of all.", + "", + " This balance is a 'reserve' balance that other subsystems use in order to set aside tokens", + " that are still 'owned' by the account holder, but which are unspendable. (This is different", + " and wholly unrelated to the `Bondage` system used in the staking module.)", + "", + " When this balance falls below the value of `ExistentialDeposit`, then this 'reserve account'", + " is deleted: specifically, `ReservedBalance`.", + "", + " `system::AccountNonce` is also deleted if `FreeBalance` is also zero (it also gets", + " collapsed to zero if it ever becomes less than `ExistentialDeposit`." + ] + }, + { + "name": "TransactionCodecBaseFee", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The fee to be paid for making a transaction; the base." + ] + }, + { + "name": "TransactionByteFee", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The fee to be paid for making a transaction; the per-byte portion." + ] + } + ] + } + }, + { + "prefix": "timestamp", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "set", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "now", + "type": "T::Moment" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Timestamp", + "functions": [ + { + "name": "Now", + "modifier": 2, + "type": "T::Moment", + "documentation": [ + " Current time for the current block." + ] + }, + { + "name": "BlockPeriod", + "modifier": 2, + "type": "T::Moment", + "documentation": [ + " The minimum (and advised) period between blocks." + ] + }, + { + "name": "DidUpdate", + "modifier": 1, + "type": "bool", + "documentation": [ + " Did the timestamp get updated in this block?" + ] + } + ] + } + }, + { + "prefix": "session", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "set_key", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "key", + "type": "T::SessionKey" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "set_length", + "arguments": [ + { + "name": "new", + "type": "T::BlockNumber" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "force_new_session", + "arguments": [ + { + "name": "apply_rewards", + "type": "bool" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Session", + "functions": [ + { + "name": "Validators", + "modifier": 2, + "type": "Vec", + "documentation": [ + " The current set of validators." + ] + }, + { + "name": "SessionLength", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " Current length of the session." + ] + }, + { + "name": "CurrentIndex", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " Current index of the session." + ] + }, + { + "name": "CurrentStart", + "modifier": 2, + "type": "T::Moment", + "documentation": [ + " Timestamp when current session started." + ] + }, + { + "name": "ForcingNewSession", + "modifier": 0, + "type": "bool", + "documentation": [ + " New session is being forced is this entry exists; in which case, the boolean value is whether", + " the new session should be considered a normal rotation (rewardable) or exceptional (slashable)." + ] + }, + { + "name": "LastLengthChange", + "modifier": 0, + "type": "T::BlockNumber", + "documentation": [ + " Block at which the session length last changed." + ] + }, + { + "name": "NextKeyFor", + "modifier": 0, + "type": { + "key": "T::AccountId", + "value": "T::SessionKey" + }, + "documentation": [ + " The next key for a given validator." + ] + }, + { + "name": "NextSessionLength", + "modifier": 0, + "type": "T::BlockNumber", + "documentation": [ + " The next session length." + ] + } + ] + } + }, + { + "prefix": "staking", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "stake", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "unstake", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "intentions_index", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "nominate", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "target", + "type": "Address" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "unnominate", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "target_index", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "register_preferences", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "intentions_index", + "type": "u32" + }, + { + "name": "prefs", + "type": "ValidatorPrefs" + } + ], + "documentation": [] + }, + { + "id": "0x0005", + "name": "set_sessions_per_era", + "arguments": [ + { + "name": "new", + "type": "T::BlockNumber" + } + ], + "documentation": [] + }, + { + "id": "0x0006", + "name": "set_bonding_duration", + "arguments": [ + { + "name": "new", + "type": "T::BlockNumber" + } + ], + "documentation": [] + }, + { + "id": "0x0007", + "name": "set_validator_count", + "arguments": [ + { + "name": "new", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0008", + "name": "force_new_era", + "arguments": [ + { + "name": "apply_rewards", + "type": "bool" + } + ], + "documentation": [] + }, + { + "id": "0x0009", + "name": "set_offline_slash_grace", + "arguments": [ + { + "name": "new", + "type": "u32" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Staking", + "functions": [ + { + "name": "ValidatorCount", + "modifier": 2, + "type": "u32", + "documentation": [ + " The ideal number of staking participants." + ] + }, + { + "name": "MinimumValidatorCount", + "modifier": 0, + "type": "u32", + "documentation": [ + " Minimum number of staking participants before emergency conditions are imposed." + ] + }, + { + "name": "SessionsPerEra", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " The length of a staking era in sessions." + ] + }, + { + "name": "SessionReward", + "modifier": 2, + "type": "Perbill", + "documentation": [ + " Maximum reward, per validator, that is provided per acceptable session." + ] + }, + { + "name": "OfflineSlash", + "modifier": 2, + "type": "Perbill", + "documentation": [ + " Slash, per validator that is taken for the first time they are found to be offline." + ] + }, + { + "name": "OfflineSlashGrace", + "modifier": 1, + "type": "u32", + "documentation": [ + " Number of instances of offline reports before slashing begins for validators." + ] + }, + { + "name": "BondingDuration", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " The length of the bonding duration in blocks." + ] + }, + { + "name": "CurrentEra", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " The current era index." + ] + }, + { + "name": "ValidatorPreferences", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "ValidatorPrefs" + }, + "documentation": [ + " Preferences that a validator has." + ] + }, + { + "name": "Intentions", + "modifier": 1, + "type": "Vec", + "documentation": [ + " All the accounts with a desire to stake." + ] + }, + { + "name": "Nominating", + "modifier": 0, + "type": { + "key": "T::AccountId", + "value": "T::AccountId" + }, + "documentation": [ + " All nominator -> nominee relationships." + ] + }, + { + "name": "NominatorsFor", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "Vec" + }, + "documentation": [ + " Nominators for a particular account." + ] + }, + { + "name": "CurrentNominatorsFor", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "Vec" + }, + "documentation": [ + " Nominators for a particular account that is in action right now." + ] + }, + { + "name": "CurrentSessionReward", + "modifier": 1, + "type": "T::Balance", + "documentation": [ + " Maximum reward, per validator, that is provided per acceptable session." + ] + }, + { + "name": "CurrentOfflineSlash", + "modifier": 1, + "type": "T::Balance", + "documentation": [ + " Slash, per validator that is taken for the first time they are found to be offline." + ] + }, + { + "name": "NextSessionsPerEra", + "modifier": 0, + "type": "T::BlockNumber", + "documentation": [ + " The next value of sessions per era." + ] + }, + { + "name": "LastEraLengthChange", + "modifier": 1, + "type": "T::BlockNumber", + "documentation": [ + " The session index at which the era length last changed." + ] + }, + { + "name": "StakeRange", + "modifier": 1, + "type": "PairOf", + "documentation": [ + " The highest and lowest staked validator slashable balances." + ] + }, + { + "name": "Bondage", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "T::BlockNumber" + }, + "documentation": [ + " The block at which the `who`'s funds become entirely liquid." + ] + }, + { + "name": "SlashCount", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "u32" + }, + "documentation": [ + " The number of times a given validator has been reported offline. This gets decremented by one each era that passes." + ] + }, + { + "name": "ForcingNewEra", + "modifier": 0, + "type": "()", + "documentation": [ + " We are forcing a new era." + ] + } + ] + } + }, + { + "prefix": "democracy", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "propose", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal", + "type": "Box" + }, + { + "name": "value", + "type": "T::Balance" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "second", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal", + "type": "PropIndex" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "vote", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "ref_index", + "type": "ReferendumIndex" + }, + { + "name": "approve_proposal", + "type": "bool" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "start_referendum", + "arguments": [ + { + "name": "proposal", + "type": "Box" + }, + { + "name": "vote_threshold", + "type": "VoteThreshold" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "cancel_referendum", + "arguments": [ + { + "name": "ref_index", + "type": "ReferendumIndex" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Democracy", + "functions": [ + { + "name": "PublicPropCount", + "modifier": 1, + "type": "PropIndex", + "documentation": [ + " The number of (public) proposals that have been made so far." + ] + }, + { + "name": "PublicProps", + "modifier": 1, + "type": "Vec<(PropIndex, T::Proposal, T::AccountId)>", + "documentation": [ + " The public proposals. Unsorted." + ] + }, + { + "name": "DepositOf", + "modifier": 0, + "type": { + "key": "PropIndex", + "value": "(T::Balance, Vec)" + }, + "documentation": [ + " Those who have locked a deposit." + ] + }, + { + "name": "LaunchPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " How often (in blocks) new public referenda are launched." + ] + }, + { + "name": "MinimumDeposit", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The minimum amount to be used as a deposit for a public referendum proposal." + ] + }, + { + "name": "VotingPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " How often (in blocks) to check for new votes." + ] + }, + { + "name": "ReferendumCount", + "modifier": 2, + "type": "ReferendumIndex", + "documentation": [ + " The next free referendum index, aka the number of referendums started so far." + ] + }, + { + "name": "NextTally", + "modifier": 2, + "type": "ReferendumIndex", + "documentation": [ + " The next referendum index that should be tallied." + ] + }, + { + "name": "ReferendumInfoOf", + "modifier": 0, + "type": { + "key": "ReferendumIndex", + "value": "(T::BlockNumber, T::Proposal, VoteThreshold)" + }, + "documentation": [ + " Information concerning any given referendum." + ] + }, + { + "name": "VotersFor", + "modifier": 1, + "type": { + "key": "ReferendumIndex", + "value": "Vec" + }, + "documentation": [ + " Get the voters for the current proposal." + ] + }, + { + "name": "VoteOf", + "modifier": 0, + "type": { + "key": "(ReferendumIndex, T::AccountId)", + "value": "bool" + }, + "documentation": [ + " Get the vote, if Some, of `who`." + ] + } + ] + } + }, + { + "prefix": "council", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "set_approvals", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "votes", + "type": "Vec" + }, + { + "name": "index", + "type": "VoteIndex" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "reap_inactive_voter", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "reporter_index", + "type": "u32" + }, + { + "name": "who", + "type": "Address" + }, + { + "name": "who_index", + "type": "u32" + }, + { + "name": "assumed_vote_index", + "type": "VoteIndex" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "retract_voter", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "index", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "submit_candidacy", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "slot", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "present_winner", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "candidate", + "type": "Address" + }, + { + "name": "total", + "type": "T::Balance" + }, + { + "name": "index", + "type": "VoteIndex" + } + ], + "documentation": [] + }, + { + "id": "0x0005", + "name": "set_desired_seats", + "arguments": [ + { + "name": "count", + "type": "u32" + } + ], + "documentation": [] + }, + { + "id": "0x0006", + "name": "remove_member", + "arguments": [ + { + "name": "who", + "type": "Address" + } + ], + "documentation": [] + }, + { + "id": "0x0007", + "name": "set_presentation_duration", + "arguments": [ + { + "name": "count", + "type": "T::BlockNumber" + } + ], + "documentation": [] + }, + { + "id": "0x0008", + "name": "set_term_duration", + "arguments": [ + { + "name": "count", + "type": "T::BlockNumber" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Council", + "functions": [ + { + "name": "CandidacyBond", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " How much should be locked up in order to submit one's candidacy." + ] + }, + { + "name": "VotingBond", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " How much should be locked up in order to be able to submit votes." + ] + }, + { + "name": "PresentSlashPerVoter", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " The punishment, per voter, if you provide an invalid presentation." + ] + }, + { + "name": "CarryCount", + "modifier": 2, + "type": "u32", + "documentation": [ + " How many runners-up should have their approvals persist until the next vote." + ] + }, + { + "name": "PresentationDuration", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " How long to give each top candidate to present themselves after the vote ends." + ] + }, + { + "name": "InactiveGracePeriod", + "modifier": 2, + "type": "VoteIndex", + "documentation": [ + " How many votes need to go by after a voter's last vote before they can be reaped if their", + " approvals are moot." + ] + }, + { + "name": "VotingPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " How often (in blocks) to check for new votes." + ] + }, + { + "name": "TermDuration", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " How long each position is active for." + ] + }, + { + "name": "DesiredSeats", + "modifier": 2, + "type": "u32", + "documentation": [ + " Number of accounts that should be sitting on the council." + ] + }, + { + "name": "ActiveCouncil", + "modifier": 1, + "type": "Vec<(T::AccountId, T::BlockNumber)>", + "documentation": [ + " The current council. When there's a vote going on, this should still be used for executive", + " matters." + ] + }, + { + "name": "VoteCount", + "modifier": 1, + "type": "VoteIndex", + "documentation": [ + " The total number of votes that have happened or are in progress." + ] + }, + { + "name": "ApprovalsOf", + "modifier": 1, + "type": { + "key": "T::AccountId", + "value": "Vec" + }, + "documentation": [ + " The last cleared vote index that this voter was last active at." + ] + }, + { + "name": "RegisterInfoOf", + "modifier": 0, + "type": { + "key": "T::AccountId", + "value": "(VoteIndex, u32)" + }, + "documentation": [ + " The vote index and list slot that the candidate `who` was registered or `None` if they are not", + " currently registered." + ] + }, + { + "name": "LastActiveOf", + "modifier": 0, + "type": { + "key": "T::AccountId", + "value": "VoteIndex" + }, + "documentation": [ + " The last cleared vote index that this voter was last active at." + ] + }, + { + "name": "Voters", + "modifier": 1, + "type": "Vec", + "documentation": [ + " The present voter list." + ] + }, + { + "name": "Candidates", + "modifier": 1, + "type": "Vec", + "documentation": [ + " The present candidate list." + ] + }, + { + "name": "CandidateCount", + "modifier": 1, + "type": "u32", + "documentation": [] + }, + { + "name": "NextFinalise", + "modifier": 0, + "type": "(T::BlockNumber, u32, Vec)", + "documentation": [ + " The accounts holding the seats that will become free on the next tally." + ] + }, + { + "name": "SnapshotedStakes", + "modifier": 2, + "type": "Vec", + "documentation": [ + " The stakes as they were at the point that the vote ended." + ] + }, + { + "name": "Leaderboard", + "modifier": 0, + "type": "Vec<(T::Balance, T::AccountId)>", + "documentation": [ + " Get the leaderboard if we;re in the presentation phase." + ] + } + ] + } + }, + { + "prefix": "council_voting", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "propose", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal", + "type": "Box" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "vote", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal", + "type": "T::Hash" + }, + { + "name": "approve", + "type": "bool" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "veto", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal_hash", + "type": "T::Hash" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "set_cooloff_period", + "arguments": [ + { + "name": "blocks", + "type": "T::BlockNumber" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "set_voting_period", + "arguments": [ + { + "name": "blocks", + "type": "T::BlockNumber" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "CouncilVoting", + "functions": [ + { + "name": "CooloffPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [] + }, + { + "name": "VotingPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [] + }, + { + "name": "Proposals", + "modifier": 2, + "type": "Vec<(T::BlockNumber, T::Hash)>", + "documentation": [] + }, + { + "name": "ProposalOf", + "modifier": 0, + "type": { + "key": "T::Hash", + "value": "T::Proposal" + }, + "documentation": [] + }, + { + "name": "ProposalVoters", + "modifier": 1, + "type": { + "key": "T::Hash", + "value": "Vec" + }, + "documentation": [] + }, + { + "name": "CouncilVoteOf", + "modifier": 0, + "type": { + "key": "(T::Hash, T::AccountId)", + "value": "bool" + }, + "documentation": [] + }, + { + "name": "VetoedProposal", + "modifier": 0, + "type": { + "key": "T::Hash", + "value": "(T::BlockNumber, Vec)" + }, + "documentation": [] + } + ] + } + }, + { + "prefix": "council_motions", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "propose", + "arguments": [ + { + "name": "origin", + "type": "::Origin" + }, + { + "name": "threshold", + "type": "u32" + }, + { + "name": "proposal", + "type": "Box<::Proposal>" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "vote", + "arguments": [ + { + "name": "origin", + "type": "::Origin" + }, + { + "name": "proposal", + "type": "T::Hash" + }, + { + "name": "index", + "type": "ProposalIndex" + }, + { + "name": "approve", + "type": "bool" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "CouncilMotions", + "functions": [ + { + "name": "Proposals", + "modifier": 1, + "type": "Vec", + "documentation": [ + " The (hashes of) the active proposals." + ] + }, + { + "name": "ProposalOf", + "modifier": 0, + "type": { + "key": "T::Hash", + "value": "::Proposal" + }, + "documentation": [ + " Actual proposal for a given hash, if it's current." + ] + }, + { + "name": "Voting", + "modifier": 0, + "type": { + "key": "T::Hash", + "value": "(ProposalIndex, u32, Vec, Vec)" + }, + "documentation": [ + " Votes for a given proposal: (required_yes_votes, yes_voters, no_voters)." + ] + }, + { + "name": "ProposalCount", + "modifier": 1, + "type": "u32", + "documentation": [ + " Proposals so far." + ] + } + ] + } + }, + { + "prefix": "treasury", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "propose_spend", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "value", + "type": "T::Balance" + }, + { + "name": "beneficiary", + "type": "T::AccountId" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "set_pot", + "arguments": [ + { + "name": "new_pot", + "type": "T::Balance" + } + ], + "documentation": [] + }, + { + "id": "0x0002", + "name": "configure", + "arguments": [ + { + "name": "proposal_bond", + "type": "Permill" + }, + { + "name": "proposal_bond_minimum", + "type": "T::Balance" + }, + { + "name": "spend_period", + "type": "T::BlockNumber" + }, + { + "name": "burn", + "type": "Permill" + } + ], + "documentation": [] + }, + { + "id": "0x0003", + "name": "reject_proposal", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "roposal_id", + "type": "ProposalIndex" + } + ], + "documentation": [] + }, + { + "id": "0x0004", + "name": "approve_proposal", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "proposal_id", + "type": "ProposalIndex" + } + ], + "documentation": [] + } + ] + } + }, + "storage": { + "prefix": "Treasury", + "functions": [ + { + "name": "ProposalBond", + "modifier": 2, + "type": "Permill", + "documentation": [ + " Proportion of funds that should be bonded in order to place a proposal. An accepted", + " proposal gets these back. A rejected proposal doesn't." + ] + }, + { + "name": "ProposalBondMinimum", + "modifier": 2, + "type": "T::Balance", + "documentation": [ + " Minimum amount of funds that should be placed in a deposit for making a proposal." + ] + }, + { + "name": "SpendPeriod", + "modifier": 2, + "type": "T::BlockNumber", + "documentation": [ + " Period between successive spends." + ] + }, + { + "name": "Burn", + "modifier": 2, + "type": "Permill", + "documentation": [ + " Percentage of spare funds (if any) that are burnt per spend period." + ] + }, + { + "name": "Pot", + "modifier": 1, + "type": "T::Balance", + "documentation": [ + " Total funds available to this module for spending." + ] + }, + { + "name": "ProposalCount", + "modifier": 1, + "type": "ProposalIndex", + "documentation": [ + " Number of proposals that have been made." + ] + }, + { + "name": "Proposals", + "modifier": 0, + "type": { + "key": "ProposalIndex", + "value": "Proposal" + }, + "documentation": [ + " Proposals that have been made." + ] + }, + { + "name": "Approvals", + "modifier": 1, + "type": "Vec", + "documentation": [ + " Proposal indices that have been approved but not yet awarded." + ] + } + ] + } + }, + { + "prefix": "contract", + "module": { + "name": "Module", + "call": { + "name": "Call", + "functions": [ + { + "id": "0x0000", + "name": "call", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "dest", + "type": "T::AccountId" + }, + { + "name": "value", + "type": "T::Balance" + }, + { + "name": "gas_limit", + "type": "T::Gas" + }, + { + "name": "data", + "type": "Vec" + } + ], + "documentation": [] + }, + { + "id": "0x0001", + "name": "create", + "arguments": [ + { + "name": "origin", + "type": "T::Origin" + }, + { + "name": "value", + "type": "T::Balance" + }, + { + "name": "gas_limit", + "type": "T::Gas" + }, + { + "name": "init_code", + "type": "Vec" + }, + { + "name": "data", + "type": "Vec" + } + ], + "documentation": [] + } + ] + } + } + } + ] +} diff --git a/packages/api-codec/src/Metadata.rpc.json b/packages/api-codec/src/Metadata.rpc.json new file mode 100644 index 000000000000..aca9c2c0e70d --- /dev/null +++ b/packages/api-codec/src/Metadata.rpc.json @@ -0,0 +1 @@ +{"jsonrpc":"2.0","result":[20,69,118,101,110,116,36,24,115,121,115,116,101,109,8,64,69,120,116,114,105,110,115,105,99,83,117,99,99,101,115,115,0,4,148,32,65,110,32,101,120,116,114,105,110,115,105,99,32,99,111,109,112,108,101,116,101,100,32,115,117,99,99,101,115,115,102,117,108,108,121,46,60,69,120,116,114,105,110,115,105,99,70,97,105,108,101,100,0,4,84,32,65,110,32,101,120,116,114,105,110,115,105,99,32,102,97,105,108,101,100,46,32,98,97,108,97,110,99,101,115,12,40,78,101,119,65,99,99,111,117,110,116,12,36,65,99,99,111,117,110,116,73,100,48,65,99,99,111,117,110,116,73,110,100,101,120,68,78,101,119,65,99,99,111,117,110,116,79,117,116,99,111,109,101,4,108,32,65,32,110,101,119,32,97,99,99,111,117,110,116,32,119,97,115,32,99,114,101,97,116,101,100,46,52,82,101,97,112,101,100,65,99,99,111,117,110,116,4,36,65,99,99,111,117,110,116,73,100,4,92,32,65,110,32,97,99,99,111,117,110,116,32,119,97,115,32,114,101,97,112,101,100,46,32,84,114,97,110,115,102,101,114,16,36,65,99,99,111,117,110,116,73,100,36,65,99,99,111,117,110,116,73,100,28,66,97,108,97,110,99,101,28,66,97,108,97,110,99,101,4,176,32,84,114,97,110,115,102,101,114,32,115,117,99,99,101,101,100,101,100,32,40,102,114,111,109,44,32,116,111,44,32,118,97,108,117,101,44,32,102,101,101,115,41,46,28,115,101,115,115,105,111,110,4,40,78,101,119,83,101,115,115,105,111,110,4,44,66,108,111,99,107,78,117,109,98,101,114,8,85,1,32,78,101,119,32,115,101,115,115,105,111,110,32,104,97,115,32,104,97,112,112,101,110,101,100,46,32,78,111,116,101,32,116,104,97,116,32,116,104,101,32,97,114,103,117,109,101,110,116,32,105,115,32,116,104,101,32,115,101,115,115,105,111,110,32,105,110,100,101,120,44,32,110,111,116,32,116,104,101,32,98,108,111,99,107,136,32,110,117,109,98,101,114,32,97,115,32,116,104,101,32,116,121,112,101,32,109,105,103,104,116,32,115,117,103,103,101,115,116,46,28,115,116,97,107,105,110,103,12,24,82,101,119,97,114,100,4,28,66,97,108,97,110,99,101,4,224,32,65,108,108,32,118,97,108,105,100,97,116,111,114,115,32,104,97,118,101,32,98,101,101,110,32,114,101,119,97,114,100,101,100,32,98,121,32,116,104,101,32,103,105,118,101,110,32,98,97,108,97,110,99,101,46,56,79,102,102,108,105,110,101,87,97,114,110,105,110,103,8,36,65,99,99,111,117,110,116,73,100,12,117,51,50,8,85,1,32,79,110,101,32,118,97,108,105,100,97,116,111,114,32,40,97,110,100,32,116,104,101,105,114,32,110,111,109,105,110,97,116,111,114,115,41,32,104,97,115,32,98,101,101,110,32,103,105,118,101,110,32,97,32,111,102,102,108,105,110,101,45,119,97,114,110,105,110,103,32,40,116,104,101,121,39,114,101,32,115,116,105,108,108,21,1,32,119,105,116,104,105,110,32,116,104,101,105,114,32,103,114,97,99,101,41,46,32,84,104,101,32,97,99,99,114,117,101,100,32,110,117,109,98,101,114,32,111,102,32,115,108,97,115,104,101,115,32,105,115,32,114,101,99,111,114,100,101,100,44,32,116,111,111,46,48,79,102,102,108,105,110,101,83,108,97,115,104,8,36,65,99,99,111,117,110,116,73,100,28,66,97,108,97,110,99,101,4,45,1,32,79,110,101,32,118,97,108,105,100,97,116,111,114,32,40,97,110,100,32,116,104,101,105,114,32,110,111,109,105,110,97,116,111,114,115,41,32,104,97,115,32,98,101,101,110,32,115,108,97,115,104,101,100,32,98,121,32,116,104,101,32,103,105,118,101,110,32,97,109,111,117,110,116,46,36,100,101,109,111,99,114,97,99,121,24,24,84,97,98,108,101,100,12,36,80,114,111,112,73,110,100,101,120,28,66,97,108,97,110,99,101,56,86,101,99,60,65,99,99,111,117,110,116,73,100,62,0,28,83,116,97,114,116,101,100,8,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,52,86,111,116,101,84,104,114,101,115,104,111,108,100,0,24,80,97,115,115,101,100,4,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,0,36,78,111,116,80,97,115,115,101,100,4,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,0,36,67,97,110,99,101,108,108,101,100,4,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,0,32,69,120,101,99,117,116,101,100,8,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,16,98,111,111,108,0,28,99,111,117,110,99,105,108,16,44,86,111,116,101,114,82,101,97,112,101,100,8,36,65,99,99,111,117,110,116,73,100,36,65,99,99,111,117,110,116,73,100,4,84,32,114,101,97,112,101,100,32,118,111,116,101,114,44,32,114,101,97,112,101,114,64,66,97,100,82,101,97,112,101,114,83,108,97,115,104,101,100,4,36,65,99,99,111,117,110,116,73,100,4,60,32,115,108,97,115,104,101,100,32,114,101,97,112,101,114,48,84,97,108,108,121,83,116,97,114,116,101,100,4,12,117,51,50,4,244,32,65,32,116,97,108,108,121,32,40,102,111,114,32,97,112,112,114,111,118,97,108,32,118,111,116,101,115,32,111,102,32,99,111,117,110,99,105,108,32,115,101,97,116,40,115,41,41,32,104,97,115,32,115,116,97,114,116,101,100,46,56,84,97,108,108,121,70,105,110,97,108,105,115,101,100,8,56,86,101,99,60,65,99,99,111,117,110,116,73,100,62,56,86,101,99,60,65,99,99,111,117,110,116,73,100,62,4,105,1,32,65,32,116,97,108,108,121,32,40,102,111,114,32,97,112,112,114,111,118,97,108,32,118,111,116,101,115,32,111,102,32,99,111,117,110,99,105,108,32,115,101,97,116,40,115,41,41,32,104,97,115,32,101,110,100,101,100,32,40,119,105,116,104,32,111,110,101,32,111,114,32,109,111,114,101,32,110,101,119,32,109,101,109,98,101,114,115,41,46,56,99,111,117,110,99,105,108,95,118,111,116,105,110,103,8,64,84,97,108,108,121,67,97,110,99,101,108,97,116,105,111,110,16,16,72,97,115,104,12,117,51,50,12,117,51,50,12,117,51,50,8,252,32,65,32,118,111,116,105,110,103,32,116,97,108,108,121,32,104,97,115,32,104,97,112,112,101,110,101,100,32,102,111,114,32,97,32,114,101,102,101,114,101,110,100,117,109,32,99,97,110,99,101,108,97,116,105,111,110,32,118,111,116,101,46,160,32,76,97,115,116,32,116,104,114,101,101,32,97,114,101,32,121,101,115,44,32,110,111,44,32,97,98,115,116,97,105,110,32,99,111,117,110,116,115,46,60,84,97,108,108,121,82,101,102,101,114,101,110,100,117,109,16,16,72,97,115,104,12,117,51,50,12,117,51,50,12,117,51,50,8,204,32,65,32,118,111,116,105,110,103,32,116,97,108,108,121,32,104,97,115,32,104,97,112,112,101,110,101,100,32,102,111,114,32,97,32,114,101,102,101,114,101,110,100,117,109,32,118,111,116,101,46,160,32,76,97,115,116,32,116,104,114,101,101,32,97,114,101,32,121,101,115,44,32,110,111,44,32,97,98,115,116,97,105,110,32,99,111,117,110,116,115,46,60,99,111,117,110,99,105,108,95,109,111,116,105,111,110,115,20,32,80,114,111,112,111,115,101,100,16,36,65,99,99,111,117,110,116,73,100,52,80,114,111,112,111,115,97,108,73,110,100,101,120,16,72,97,115,104,12,117,51,50,4,101,1,32,65,32,109,111,116,105,111,110,32,40,103,105,118,101,110,32,104,97,115,104,41,32,104,97,115,32,98,101,101,110,32,112,114,111,112,111,115,101,100,32,40,98,121,32,103,105,118,101,110,32,97,99,99,111,117,110,116,41,32,119,105,116,104,32,97,32,116,104,114,101,115,104,111,108,100,32,40,103,105,118,101,110,32,117,51,50,41,46,20,86,111,116,101,100,20,36,65,99,99,111,117,110,116,73,100,16,72,97,115,104,16,98,111,111,108,12,117,51,50,12,117,51,50,8,9,1,32,65,32,109,111,116,105,111,110,32,40,103,105,118,101,110,32,104,97,115,104,41,32,104,97,115,32,98,101,101,110,32,118,111,116,101,100,32,111,110,32,98,121,32,103,105,118,101,110,32,97,99,99,111,117,110,116,44,32,108,101,97,118,105,110,103,244,32,97,32,116,97,108,108,121,32,40,121,101,115,32,118,111,116,101,115,32,97,110,100,32,110,111,32,118,111,116,101,115,32,103,105,118,101,110,32,97,115,32,117,51,50,115,32,114,101,115,112,101,99,116,105,118,101,108,121,41,46,32,65,112,112,114,111,118,101,100,4,16,72,97,115,104,4,196,32,65,32,109,111,116,105,111,110,32,119,97,115,32,97,112,112,114,111,118,101,100,32,98,121,32,116,104,101,32,114,101,113,117,105,114,101,100,32,116,104,114,101,115,104,111,108,100,46,44,68,105,115,97,112,112,114,111,118,101,100,4,16,72,97,115,104,4,212,32,65,32,109,111,116,105,111,110,32,119,97,115,32,110,111,116,32,97,112,112,114,111,118,101,100,32,98,121,32,116,104,101,32,114,101,113,117,105,114,101,100,32,116,104,114,101,115,104,111,108,100,46,32,69,120,101,99,117,116,101,100,8,16,72,97,115,104,16,98,111,111,108,4,5,1,32,65,32,109,111,116,105,111,110,32,119,97,115,32,101,120,101,99,117,116,101,100,59,32,96,98,111,111,108,96,32,105,115,32,116,114,117,101,32,105,102,32,114,101,116,117,114,110,101,100,32,119,105,116,104,111,117,116,32,101,114,114,111,114,46,32,116,114,101,97,115,117,114,121,20,32,80,114,111,112,111,115,101,100,4,52,80,114,111,112,111,115,97,108,73,110,100,101,120,4,56,32,78,101,119,32,112,114,111,112,111,115,97,108,46,32,83,112,101,110,100,105,110,103,4,28,66,97,108,97,110,99,101,4,232,32,87,101,32,104,97,118,101,32,101,110,100,101,100,32,97,32,115,112,101,110,100,32,112,101,114,105,111,100,32,97,110,100,32,119,105,108,108,32,110,111,119,32,97,108,108,111,99,97,116,101,32,102,117,110,100,115,46,28,65,119,97,114,100,101,100,12,52,80,114,111,112,111,115,97,108,73,110,100,101,120,28,66,97,108,97,110,99,101,36,65,99,99,111,117,110,116,73,100,4,128,32,83,111,109,101,32,102,117,110,100,115,32,104,97,118,101,32,98,101,101,110,32,97,108,108,111,99,97,116,101,100,46,20,66,117,114,110,116,4,28,66,97,108,97,110,99,101,4,140,32,83,111,109,101,32,111,102,32,111,117,114,32,102,117,110,100,115,32,104,97,118,101,32,98,101,101,110,32,98,117,114,110,116,46,32,82,111,108,108,111,118,101,114,4,28,66,97,108,97,110,99,101,4,49,1,32,83,112,101,110,100,105,110,103,32,104,97,115,32,102,105,110,105,115,104,101,100,59,32,116,104,105,115,32,105,115,32,116,104,101,32,97,109,111,117,110,116,32,116,104,97,116,32,114,111,108,108,115,32,111,118,101,114,32,117,110,116,105,108,32,110,101,120,116,32,115,112,101,110,100,46,48,24,115,121,115,116,101,109,24,77,111,100,117,108,101,16,67,97,108,108,0,1,24,83,121,115,116,101,109,40,48,65,99,99,111,117,110,116,78,111,110,99,101,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,32,84,58,58,73,110,100,101,120,0,56,69,120,116,114,105,110,115,105,99,67,111,117,110,116,0,0,12,117,51,50,0,36,66,108,111,99,107,72,97,115,104,2,1,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,28,84,58,58,72,97,115,104,0,52,69,120,116,114,105,110,115,105,99,68,97,116,97,2,1,12,117,51,50,28,86,101,99,60,117,56,62,0,40,82,97,110,100,111,109,83,101,101,100,2,0,28,84,58,58,72,97,115,104,0,24,78,117,109,98,101,114,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,9,1,32,84,104,101,32,99,117,114,114,101,110,116,32,98,108,111,99,107,32,110,117,109,98,101,114,32,98,101,105,110,103,32,112,114,111,99,101,115,115,101,100,46,32,83,101,116,32,98,121,32,96,101,120,101,99,117,116,101,95,98,108,111,99,107,96,46,40,80,97,114,101,110,116,72,97,115,104,2,0,28,84,58,58,72,97,115,104,0,56,69,120,116,114,105,110,115,105,99,115,82,111,111,116,2,0,28,84,58,58,72,97,115,104,0,24,68,105,103,101,115,116,1,0,36,84,58,58,68,105,103,101,115,116,0,24,69,118,101,110,116,115,1,0,104,86,101,99,60,69,118,101,110,116,82,101,99,111,114,100,60,84,58,58,69,118,101,110,116,62,62,0,36,99,111,110,115,101,110,115,117,115,24,77,111,100,117,108,101,16,67,97,108,108,20,0,0,72,114,101,112,111,114,116,95,109,105,115,98,101,104,97,118,105,111,114,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,24,114,101,112,111,114,116,168,77,105,115,98,101,104,97,118,105,111,114,82,101,112,111,114,116,60,84,58,58,72,97,115,104,44,32,84,58,58,66,108,111,99,107,78,117,109,98,101,114,62,0,1,0,48,110,111,116,101,95,111,102,102,108,105,110,101,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,76,111,102,102,108,105,110,101,95,118,97,108,95,105,110,100,105,99,101,115,32,86,101,99,60,117,51,50,62,0,2,0,24,114,101,109,97,114,107,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,24,114,101,109,97,114,107,28,86,101,99,60,117,56,62,0,3,0,32,115,101,116,95,99,111,100,101,4,12,110,101,119,28,86,101,99,60,117,56,62,0,4,0,44,115,101,116,95,115,116,111,114,97,103,101,4,20,105,116,101,109,115,52,86,101,99,60,75,101,121,86,97,108,117,101,62,0,1,36,67,111,110,115,101,110,115,117,115,4,76,79,114,105,103,105,110,97,108,65,117,116,104,111,114,105,116,105,101,115,0,0,72,86,101,99,60,84,58,58,83,101,115,115,105,111,110,75,101,121,62,0,32,98,97,108,97,110,99,101,115,24,77,111,100,117,108,101,16,67,97,108,108,8,0,0,32,116,114,97,110,115,102,101,114,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,16,100,101,115,116,164,82,97,119,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,20,118,97,108,117,101,40,84,58,58,66,97,108,97,110,99,101,0,1,0,44,115,101,116,95,98,97,108,97,110,99,101,12,12,119,104,111,164,82,97,119,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,16,102,114,101,101,40,84,58,58,66,97,108,97,110,99,101,32,114,101,115,101,114,118,101,100,40,84,58,58,66,97,108,97,110,99,101,0,1,32,66,97,108,97,110,99,101,115,44,52,84,111,116,97,108,73,115,115,117,97,110,99,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,164,32,84,104,101,32,116,111,116,97,108,32,97,109,111,117,110,116,32,111,102,32,115,116,97,107,101,32,111,110,32,116,104,101,32,115,121,115,116,101,109,46,72,69,120,105,115,116,101,110,116,105,97,108,68,101,112,111,115,105,116,2,0,40,84,58,58,66,97,108,97,110,99,101,4,208,32,84,104,101,32,109,105,110,105,109,117,109,32,97,109,111,117,110,116,32,97,108,108,111,119,101,100,32,116,111,32,107,101,101,112,32,97,110,32,97,99,99,111,117,110,116,32,111,112,101,110,46,52,82,101,99,108,97,105,109,82,101,98,97,116,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,41,1,32,84,104,101,32,97,109,111,117,110,116,32,99,114,101,100,105,116,101,100,32,116,111,32,97,32,100,101,115,116,105,110,97,116,105,111,110,39,115,32,97,99,99,111,117,110,116,32,119,104,111,115,101,32,105,110,100,101,120,32,119,97,115,32,114,101,99,108,97,105,109,101,100,46,44,84,114,97,110,115,102,101,114,70,101,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,148,32,84,104,101,32,102,101,101,32,114,101,113,117,105,114,101,100,32,116,111,32,109,97,107,101,32,97,32,116,114,97,110,115,102,101,114,46,44,67,114,101,97,116,105,111,110,70,101,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,37,1,32,84,104,101,32,102,101,101,32,114,101,113,117,105,114,101,100,32,116,111,32,99,114,101,97,116,101,32,97,110,32,97,99,99,111,117,110,116,46,32,65,116,32,108,101,97,115,116,32,97,115,32,98,105,103,32,97,115,32,82,101,99,108,97,105,109,82,101,98,97,116,101,46,44,78,101,120,116,69,110,117,109,83,101,116,2,0,60,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,4,124,32,84,104,101,32,110,101,120,116,32,102,114,101,101,32,101,110,117,109,101,114,97,116,105,111,110,32,115,101,116,46,28,69,110,117,109,83,101,116,1,1,60,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,88,32,84,104,101,32,101,110,117,109,101,114,97,116,105,111,110,32,115,101,116,115,46,44,70,114,101,101,66,97,108,97,110,99,101,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,40,84,58,58,66,97,108,97,110,99,101,44,156,32,84,104,101,32,39,102,114,101,101,39,32,98,97,108,97,110,99,101,32,111,102,32,97,32,103,105,118,101,110,32,97,99,99,111,117,110,116,46,0,77,1,32,84,104,105,115,32,105,115,32,116,104,101,32,111,110,108,121,32,98,97,108,97,110,99,101,32,116,104,97,116,32,109,97,116,116,101,114,115,32,105,110,32,116,101,114,109,115,32,111,102,32,109,111,115,116,32,111,112,101,114,97,116,105,111,110,115,32,111,110,32,116,111,107,101,110,115,46,32,73,116,32,105,115,105,1,32,97,108,111,110,101,32,117,115,101,100,32,116,111,32,100,101,116,101,114,109,105,110,101,32,116,104,101,32,98,97,108,97,110,99,101,32,119,104,101,110,32,105,110,32,116,104,101,32,99,111,110,116,114,97,99,116,32,101,120,101,99,117,116,105,111,110,32,101,110,118,105,114,111,110,109,101,110,116,46,32,87,104,101,110,32,116,104,105,115,85,1,32,98,97,108,97,110,99,101,32,102,97,108,108,115,32,98,101,108,111,119,32,116,104,101,32,118,97,108,117,101,32,111,102,32,96,69,120,105,115,116,101,110,116,105,97,108,68,101,112,111,115,105,116,96,44,32,116,104,101,110,32,116,104,101,32,39,99,117,114,114,101,110,116,32,97,99,99,111,117,110,116,39,32,105,115,61,1,32,100,101,108,101,116,101,100,58,32,115,112,101,99,105,102,105,99,97,108,108,121,32,96,70,114,101,101,66,97,108,97,110,99,101,96,46,32,70,117,114,116,104,101,114,109,111,114,101,44,32,96,79,110,70,114,101,101,66,97,108,97,110,99,101,90,101,114,111,96,32,99,97,108,108,98,97,99,107,65,1,32,105,115,32,105,110,118,111,107,101,100,44,32,103,105,118,105,110,103,32,97,32,99,104,97,110,99,101,32,116,111,32,101,120,116,101,114,110,97,108,32,109,111,100,117,108,101,115,32,116,111,32,99,108,101,97,110,117,112,32,100,97,116,97,32,97,115,115,111,99,105,97,116,101,100,32,119,105,116,104,84,32,116,104,101,32,100,101,108,101,116,101,100,32,97,99,99,111,117,110,116,46,0,93,1,32,96,115,121,115,116,101,109,58,58,65,99,99,111,117,110,116,78,111,110,99,101,96,32,105,115,32,97,108,115,111,32,100,101,108,101,116,101,100,32,105,102,32,96,82,101,115,101,114,118,101,100,66,97,108,97,110,99,101,96,32,105,115,32,97,108,115,111,32,122,101,114,111,32,40,105,116,32,97,108,115,111,32,103,101,116,115,21,1,32,99,111,108,108,97,112,115,101,100,32,116,111,32,122,101,114,111,32,105,102,32,105,116,32,101,118,101,114,32,98,101,99,111,109,101,115,32,108,101,115,115,32,116,104,97,110,32,96,69,120,105,115,116,101,110,116,105,97,108,68,101,112,111,115,105,116,96,46,60,82,101,115,101,114,118,101,100,66,97,108,97,110,99,101,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,40,84,58,58,66,97,108,97,110,99,101,48,113,1,32,84,104,101,32,97,109,111,117,110,116,32,111,102,32,116,104,101,32,98,97,108,97,110,99,101,32,111,102,32,97,32,103,105,118,101,110,32,97,99,99,111,117,110,116,32,116,104,97,116,32,105,115,32,101,120,116,101,114,97,108,108,121,32,114,101,115,101,114,118,101,100,59,32,116,104,105,115,32,99,97,110,32,115,116,105,108,108,32,103,101,116,156,32,115,108,97,115,104,101,100,44,32,98,117,116,32,103,101,116,115,32,115,108,97,115,104,101,100,32,108,97,115,116,32,111,102,32,97,108,108,46,0,109,1,32,84,104,105,115,32,98,97,108,97,110,99,101,32,105,115,32,97,32,39,114,101,115,101,114,118,101,39,32,98,97,108,97,110,99,101,32,116,104,97,116,32,111,116,104,101,114,32,115,117,98,115,121,115,116,101,109,115,32,117,115,101,32,105,110,32,111,114,100,101,114,32,116,111,32,115,101,116,32,97,115,105,100,101,32,116,111,107,101,110,115,113,1,32,116,104,97,116,32,97,114,101,32,115,116,105,108,108,32,39,111,119,110,101,100,39,32,98,121,32,116,104,101,32,97,99,99,111,117,110,116,32,104,111,108,100,101,114,44,32,98,117,116,32,119,104,105,99,104,32,97,114,101,32,117,110,115,112,101,110,100,97,98,108,101,46,32,40,84,104,105,115,32,105,115,32,100,105,102,102,101,114,101,110,116,41,1,32,97,110,100,32,119,104,111,108,108,121,32,117,110,114,101,108,97,116,101,100,32,116,111,32,116,104,101,32,96,66,111,110,100,97,103,101,96,32,115,121,115,116,101,109,32,117,115,101,100,32,105,110,32,116,104,101,32,115,116,97,107,105,110,103,32,109,111,100,117,108,101,46,41,0,117,1,32,87,104,101,110,32,116,104,105,115,32,98,97,108,97,110,99,101,32,102,97,108,108,115,32,98,101,108,111,119,32,116,104,101,32,118,97,108,117,101,32,111,102,32,96,69,120,105,115,116,101,110,116,105,97,108,68,101,112,111,115,105,116,96,44,32,116,104,101,110,32,116,104,105,115,32,39,114,101,115,101,114,118,101,32,97,99,99,111,117,110,116,39,180,32,105,115,32,100,101,108,101,116,101,100,58,32,115,112,101,99,105,102,105,99,97,108,108,121,44,32,96,82,101,115,101,114,118,101,100,66,97,108,97,110,99,101,96,46,0,77,1,32,96,115,121,115,116,101,109,58,58,65,99,99,111,117,110,116,78,111,110,99,101,96,32,105,115,32,97,108,115,111,32,100,101,108,101,116,101,100,32,105,102,32,96,70,114,101,101,66,97,108,97,110,99,101,96,32,105,115,32,97,108,115,111,32,122,101,114,111,32,40,105,116,32,97,108,115,111,32,103,101,116,115,21,1,32,99,111,108,108,97,112,115,101,100,32,116,111,32,122,101,114,111,32,105,102,32,105,116,32,101,118,101,114,32,98,101,99,111,109,101,115,32,108,101,115,115,32,116,104,97,110,32,96,69,120,105,115,116,101,110,116,105,97,108,68,101,112,111,115,105,116,96,46,72,84,114,97,110,115,97,99,116,105,111,110,66,97,115,101,70,101,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,220,32,84,104,101,32,102,101,101,32,116,111,32,98,101,32,112,97,105,100,32,102,111,114,32,109,97,107,105,110,103,32,97,32,116,114,97,110,115,97,99,116,105,111,110,59,32,116,104,101,32,98,97,115,101,46,72,84,114,97,110,115,97,99,116,105,111,110,66,121,116,101,70,101,101,2,0,40,84,58,58,66,97,108,97,110,99,101,4,13,1,32,84,104,101,32,102,101,101,32,116,111,32,98,101,32,112,97,105,100,32,102,111,114,32,109,97,107,105,110,103,32,97,32,116,114,97,110,115,97,99,116,105,111,110,59,32,116,104,101,32,112,101,114,45,98,121,116,101,32,112,111,114,116,105,111,110,46,36,116,105,109,101,115,116,97,109,112,24,77,111,100,117,108,101,16,67,97,108,108,4,0,0,12,115,101,116,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,12,110,111,119,36,84,58,58,77,111,109,101,110,116,0,1,36,84,105,109,101,115,116,97,109,112,12,12,78,111,119,2,0,36,84,58,58,77,111,109,101,110,116,4,144,32,67,117,114,114,101,110,116,32,116,105,109,101,32,102,111,114,32,116,104,101,32,99,117,114,114,101,110,116,32,98,108,111,99,107,46,44,66,108,111,99,107,80,101,114,105,111,100,2,0,36,84,58,58,77,111,109,101,110,116,4,196,32,84,104,101,32,109,105,110,105,109,117,109,32,40,97,110,100,32,97,100,118,105,115,101,100,41,32,112,101,114,105,111,100,32,98,101,116,119,101,101,110,32,98,108,111,99,107,115,46,36,68,105,100,85,112,100,97,116,101,1,0,16,98,111,111,108,4,180,32,68,105,100,32,116,104,101,32,116,105,109,101,115,116,97,109,112,32,103,101,116,32,117,112,100,97,116,101,100,32,105,110,32,116,104,105,115,32,98,108,111,99,107,63,28,115,101,115,115,105,111,110,24,77,111,100,117,108,101,16,67,97,108,108,12,0,0,28,115,101,116,95,107,101,121,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,12,107,101,121,52,84,58,58,83,101,115,115,105,111,110,75,101,121,0,1,0,40,115,101,116,95,108,101,110,103,116,104,4,12,110,101,119,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,2,0,68,102,111,114,99,101,95,110,101,119,95,115,101,115,115,105,111,110,4,52,97,112,112,108,121,95,114,101,119,97,114,100,115,16,98,111,111,108,0,1,28,83,101,115,115,105,111,110,32,40,86,97,108,105,100,97,116,111,114,115,2,0,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,124,32,84,104,101,32,99,117,114,114,101,110,116,32,115,101,116,32,111,102,32,118,97,108,105,100,97,116,111,114,115,46,52,83,101,115,115,105,111,110,76,101,110,103,116,104,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,124,32,67,117,114,114,101,110,116,32,108,101,110,103,116,104,32,111,102,32,116,104,101,32,115,101,115,115,105,111,110,46,48,67,117,114,114,101,110,116,73,110,100,101,120,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,120,32,67,117,114,114,101,110,116,32,105,110,100,101,120,32,111,102,32,116,104,101,32,115,101,115,115,105,111,110,46,48,67,117,114,114,101,110,116,83,116,97,114,116,2,0,36,84,58,58,77,111,109,101,110,116,4,160,32,84,105,109,101,115,116,97,109,112,32,119,104,101,110,32,99,117,114,114,101,110,116,32,115,101,115,115,105,111,110,32,115,116,97,114,116,101,100,46,68,70,111,114,99,105,110,103,78,101,119,83,101,115,115,105,111,110,0,0,16,98,111,111,108,8,121,1,32,78,101,119,32,115,101,115,115,105,111,110,32,105,115,32,98,101,105,110,103,32,102,111,114,99,101,100,32,105,115,32,116,104,105,115,32,101,110,116,114,121,32,101,120,105,115,116,115,59,32,105,110,32,119,104,105,99,104,32,99,97,115,101,44,32,116,104,101,32,98,111,111,108,101,97,110,32,118,97,108,117,101,32,105,115,32,119,104,101,116,104,101,114,129,1,32,116,104,101,32,110,101,119,32,115,101,115,115,105,111,110,32,115,104,111,117,108,100,32,98,101,32,99,111,110,115,105,100,101,114,101,100,32,97,32,110,111,114,109,97,108,32,114,111,116,97,116,105,111,110,32,40,114,101,119,97,114,100,97,98,108,101,41,32,111,114,32,101,120,99,101,112,116,105,111,110,97,108,32,40,115,108,97,115,104,97,98,108,101,41,46,64,76,97,115,116,76,101,110,103,116,104,67,104,97,110,103,101,0,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,192,32,66,108,111,99,107,32,97,116,32,119,104,105,99,104,32,116,104,101,32,115,101,115,115,105,111,110,32,108,101,110,103,116,104,32,108,97,115,116,32,99,104,97,110,103,101,100,46,40,78,101,120,116,75,101,121,70,111,114,0,1,48,84,58,58,65,99,99,111,117,110,116,73,100,52,84,58,58,83,101,115,115,105,111,110,75,101,121,4,144,32,84,104,101,32,110,101,120,116,32,107,101,121,32,102,111,114,32,97,32,103,105,118,101,110,32,118,97,108,105,100,97,116,111,114,46,68,78,101,120,116,83,101,115,115,105,111,110,76,101,110,103,116,104,0,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,100,32,84,104,101,32,110,101,120,116,32,115,101,115,115,105,111,110,32,108,101,110,103,116,104,46,28,115,116,97,107,105,110,103,24,77,111,100,117,108,101,16,67,97,108,108,40,0,0,20,115,116,97,107,101,4,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,0,1,0,28,117,110,115,116,97,107,101,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,64,105,110,116,101,110,116,105,111,110,115,95,105,110,100,101,120,12,117,51,50,0,2,0,32,110,111,109,105,110,97,116,101,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,24,116,97,114,103,101,116,152,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,0,3,0,40,117,110,110,111,109,105,110,97,116,101,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,48,116,97,114,103,101,116,95,105,110,100,101,120,12,117,51,50,0,4,0,80,114,101,103,105,115,116,101,114,95,112,114,101,102,101,114,101,110,99,101,115,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,64,105,110,116,101,110,116,105,111,110,115,95,105,110,100,101,120,12,117,51,50,20,112,114,101,102,115,104,86,97,108,105,100,97,116,111,114,80,114,101,102,115,60,84,58,58,66,97,108,97,110,99,101,62,0,5,0,80,115,101,116,95,115,101,115,115,105,111,110,115,95,112,101,114,95,101,114,97,4,12,110,101,119,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,6,0,80,115,101,116,95,98,111,110,100,105,110,103,95,100,117,114,97,116,105,111,110,4,12,110,101,119,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,7,0,76,115,101,116,95,118,97,108,105,100,97,116,111,114,95,99,111,117,110,116,4,12,110,101,119,12,117,51,50,0,8,0,52,102,111,114,99,101,95,110,101,119,95,101,114,97,4,52,97,112,112,108,121,95,114,101,119,97,114,100,115,16,98,111,111,108,0,9,0,92,115,101,116,95,111,102,102,108,105,110,101,95,115,108,97,115,104,95,103,114,97,99,101,4,12,110,101,119,12,117,51,50,0,1,28,83,116,97,107,105,110,103,84,56,86,97,108,105,100,97,116,111,114,67,111,117,110,116,2,0,12,117,51,50,4,168,32,84,104,101,32,105,100,101,97,108,32,110,117,109,98,101,114,32,111,102,32,115,116,97,107,105,110,103,32,112,97,114,116,105,99,105,112,97,110,116,115,46,84,77,105,110,105,109,117,109,86,97,108,105,100,97,116,111,114,67,111,117,110,116,0,0,12,117,51,50,4,65,1,32,77,105,110,105,109,117,109,32,110,117,109,98,101,114,32,111,102,32,115,116,97,107,105,110,103,32,112,97,114,116,105,99,105,112,97,110,116,115,32,98,101,102,111,114,101,32,101,109,101,114,103,101,110,99,121,32,99,111,110,100,105,116,105,111,110,115,32,97,114,101,32,105,109,112,111,115,101,100,46,56,83,101,115,115,105,111,110,115,80,101,114,69,114,97,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,164,32,84,104,101,32,108,101,110,103,116,104,32,111,102,32,97,32,115,116,97,107,105,110,103,32,101,114,97,32,105,110,32,115,101,115,115,105,111,110,115,46,52,83,101,115,115,105,111,110,82,101,119,97,114,100,2,0,28,80,101,114,98,105,108,108,4,33,1,32,77,97,120,105,109,117,109,32,114,101,119,97,114,100,44,32,112,101,114,32,118,97,108,105,100,97,116,111,114,44,32,116,104,97,116,32,105,115,32,112,114,111,118,105,100,101,100,32,112,101,114,32,97,99,99,101,112,116,97,98,108,101,32,115,101,115,115,105,111,110,46,48,79,102,102,108,105,110,101,83,108,97,115,104,2,0,28,80,101,114,98,105,108,108,4,81,1,32,83,108,97,115,104,44,32,112,101,114,32,118,97,108,105,100,97,116,111,114,32,116,104,97,116,32,105,115,32,116,97,107,101,110,32,102,111,114,32,116,104,101,32,102,105,114,115,116,32,116,105,109,101,32,116,104,101,121,32,97,114,101,32,102,111,117,110,100,32,116,111,32,98,101,32,111,102,102,108,105,110,101,46,68,79,102,102,108,105,110,101,83,108,97,115,104,71,114,97,99,101,1,0,12,117,51,50,4,57,1,32,78,117,109,98,101,114,32,111,102,32,105,110,115,116,97,110,99,101,115,32,111,102,32,111,102,102,108,105,110,101,32,114,101,112,111,114,116,115,32,98,101,102,111,114,101,32,115,108,97,115,104,105,110,103,32,98,101,103,105,110,115,32,102,111,114,32,118,97,108,105,100,97,116,111,114,115,46,60,66,111,110,100,105,110,103,68,117,114,97,116,105,111,110,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,184,32,84,104,101,32,108,101,110,103,116,104,32,111,102,32,116,104,101,32,98,111,110,100,105,110,103,32,100,117,114,97,116,105,111,110,32,105,110,32,98,108,111,99,107,115,46,40,67,117,114,114,101,110,116,69,114,97,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,92,32,84,104,101,32,99,117,114,114,101,110,116,32,101,114,97,32,105,110,100,101,120,46,80,86,97,108,105,100,97,116,111,114,80,114,101,102,101,114,101,110,99,101,115,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,104,86,97,108,105,100,97,116,111,114,80,114,101,102,115,60,84,58,58,66,97,108,97,110,99,101,62,4,136,32,80,114,101,102,101,114,101,110,99,101,115,32,116,104,97,116,32,97,32,118,97,108,105,100,97,116,111,114,32,104,97,115,46,40,73,110,116,101,110,116,105,111,110,115,1,0,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,164,32,65,108,108,32,116,104,101,32,97,99,99,111,117,110,116,115,32,119,105,116,104,32,97,32,100,101,115,105,114,101,32,116,111,32,115,116,97,107,101,46,40,78,111,109,105,110,97,116,105,110,103,0,1,48,84,58,58,65,99,99,111,117,110,116,73,100,48,84,58,58,65,99,99,111,117,110,116,73,100,4,160,32,65,108,108,32,110,111,109,105,110,97,116,111,114,32,45,62,32,110,111,109,105,110,101,101,32,114,101,108,97,116,105,111,110,115,104,105,112,115,46,52,78,111,109,105,110,97,116,111,114,115,70,111,114,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,148,32,78,111,109,105,110,97,116,111,114,115,32,102,111,114,32,97,32,112,97,114,116,105,99,117,108,97,114,32,97,99,99,111,117,110,116,46,80,67,117,114,114,101,110,116,78,111,109,105,110,97,116,111,114,115,70,111,114,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,5,1,32,78,111,109,105,110,97,116,111,114,115,32,102,111,114,32,97,32,112,97,114,116,105,99,117,108,97,114,32,97,99,99,111,117,110,116,32,116,104,97,116,32,105,115,32,105,110,32,97,99,116,105,111,110,32,114,105,103,104,116,32,110,111,119,46,80,67,117,114,114,101,110,116,83,101,115,115,105,111,110,82,101,119,97,114,100,1,0,40,84,58,58,66,97,108,97,110,99,101,4,33,1,32,77,97,120,105,109,117,109,32,114,101,119,97,114,100,44,32,112,101,114,32,118,97,108,105,100,97,116,111,114,44,32,116,104,97,116,32,105,115,32,112,114,111,118,105,100,101,100,32,112,101,114,32,97,99,99,101,112,116,97,98,108,101,32,115,101,115,115,105,111,110,46,76,67,117,114,114,101,110,116,79,102,102,108,105,110,101,83,108,97,115,104,1,0,40,84,58,58,66,97,108,97,110,99,101,4,81,1,32,83,108,97,115,104,44,32,112,101,114,32,118,97,108,105,100,97,116,111,114,32,116,104,97,116,32,105,115,32,116,97,107,101,110,32,102,111,114,32,116,104,101,32,102,105,114,115,116,32,116,105,109,101,32,116,104,101,121,32,97,114,101,32,102,111,117,110,100,32,116,111,32,98,101,32,111,102,102,108,105,110,101,46,72,78,101,120,116,83,101,115,115,105,111,110,115,80,101,114,69,114,97,0,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,144,32,84,104,101,32,110,101,120,116,32,118,97,108,117,101,32,111,102,32,115,101,115,115,105,111,110,115,32,112,101,114,32,101,114,97,46,76,76,97,115,116,69,114,97,76,101,110,103,116,104,67,104,97,110,103,101,1,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,224,32,84,104,101,32,115,101,115,115,105,111,110,32,105,110,100,101,120,32,97,116,32,119,104,105,99,104,32,116,104,101,32,101,114,97,32,108,101,110,103,116,104,32,108,97,115,116,32,99,104,97,110,103,101,100,46,40,83,116,97,107,101,82,97,110,103,101,1,0,72,80,97,105,114,79,102,60,84,58,58,66,97,108,97,110,99,101,62,4,240,32,84,104,101,32,104,105,103,104,101,115,116,32,97,110,100,32,108,111,119,101,115,116,32,115,116,97,107,101,100,32,118,97,108,105,100,97,116,111,114,32,115,108,97,115,104,97,98,108,101,32,98,97,108,97,110,99,101,115,46,28,66,111,110,100,97,103,101,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,244,32,84,104,101,32,98,108,111,99,107,32,97,116,32,119,104,105,99,104,32,116,104,101,32,96,119,104,111,96,39,115,32,102,117,110,100,115,32,98,101,99,111,109,101,32,101,110,116,105,114,101,108,121,32,108,105,113,117,105,100,46,40,83,108,97,115,104,67,111,117,110,116,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,12,117,51,50,4,209,1,32,84,104,101,32,110,117,109,98,101,114,32,111,102,32,116,105,109,101,115,32,97,32,103,105,118,101,110,32,118,97,108,105,100,97,116,111,114,32,104,97,115,32,98,101,101,110,32,114,101,112,111,114,116,101,100,32,111,102,102,108,105,110,101,46,32,84,104,105,115,32,103,101,116,115,32,100,101,99,114,101,109,101,110,116,101,100,32,98,121,32,111,110,101,32,101,97,99,104,32,101,114,97,32,116,104,97,116,32,112,97,115,115,101,115,46,52,70,111,114,99,105,110,103,78,101,119,69,114,97,0,0,8,40,41,4,104,32,87,101,32,97,114,101,32,102,111,114,99,105,110,103,32,97,32,110,101,119,32,101,114,97,46,36,100,101,109,111,99,114,97,99,121,24,77,111,100,117,108,101,16,67,97,108,108,20,0,0,28,112,114,111,112,111,115,101,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,32,112,114,111,112,111,115,97,108,64,66,111,120,60,84,58,58,80,114,111,112,111,115,97,108,62,20,118,97,108,117,101,40,84,58,58,66,97,108,97,110,99,101,0,1,0,24,115,101,99,111,110,100,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,32,112,114,111,112,111,115,97,108,36,80,114,111,112,73,110,100,101,120,0,2,0,16,118,111,116,101,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,36,114,101,102,95,105,110,100,101,120,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,64,97,112,112,114,111,118,101,95,112,114,111,112,111,115,97,108,16,98,111,111,108,0,3,0,64,115,116,97,114,116,95,114,101,102,101,114,101,110,100,117,109,8,32,112,114,111,112,111,115,97,108,64,66,111,120,60,84,58,58,80,114,111,112,111,115,97,108,62,56,118,111,116,101,95,116,104,114,101,115,104,111,108,100,52,86,111,116,101,84,104,114,101,115,104,111,108,100,0,4,0,68,99,97,110,99,101,108,95,114,101,102,101,114,101,110,100,117,109,4,36,114,101,102,95,105,110,100,101,120,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,0,1,36,68,101,109,111,99,114,97,99,121,44,60,80,117,98,108,105,99,80,114,111,112,67,111,117,110,116,1,0,36,80,114,111,112,73,110,100,101,120,4,244,32,84,104,101,32,110,117,109,98,101,114,32,111,102,32,40,112,117,98,108,105,99,41,32,112,114,111,112,111,115,97,108,115,32,116,104,97,116,32,104,97,118,101,32,98,101,101,110,32,109,97,100,101,32,115,111,32,102,97,114,46,44,80,117,98,108,105,99,80,114,111,112,115,1,0,172,86,101,99,60,40,80,114,111,112,73,110,100,101,120,44,32,84,58,58,80,114,111,112,111,115,97,108,44,32,84,58,58,65,99,99,111,117,110,116,73,100,41,62,4,128,32,84,104,101,32,112,117,98,108,105,99,32,112,114,111,112,111,115,97,108,115,46,32,85,110,115,111,114,116,101,100,46,36,68,101,112,111,115,105,116,79,102,0,1,36,80,114,111,112,73,110,100,101,120,124,40,84,58,58,66,97,108,97,110,99,101,44,32,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,41,4,132,32,84,104,111,115,101,32,119,104,111,32,104,97,118,101,32,108,111,99,107,101,100,32,97,32,100,101,112,111,115,105,116,46,48,76,97,117,110,99,104,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,228,32,72,111,119,32,111,102,116,101,110,32,40,105,110,32,98,108,111,99,107,115,41,32,110,101,119,32,112,117,98,108,105,99,32,114,101,102,101,114,101,110,100,97,32,97,114,101,32,108,97,117,110,99,104,101,100,46,56,77,105,110,105,109,117,109,68,101,112,111,115,105,116,2,0,40,84,58,58,66,97,108,97,110,99,101,4,53,1,32,84,104,101,32,109,105,110,105,109,117,109,32,97,109,111,117,110,116,32,116,111,32,98,101,32,117,115,101,100,32,97,115,32,97,32,100,101,112,111,115,105,116,32,102,111,114,32,97,32,112,117,98,108,105,99,32,114,101,102,101,114,101,110,100,117,109,32,112,114,111,112,111,115,97,108,46,48,86,111,116,105,110,103,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,184,32,72,111,119,32,111,102,116,101,110,32,40,105,110,32,98,108,111,99,107,115,41,32,116,111,32,99,104,101,99,107,32,102,111,114,32,110,101,119,32,118,111,116,101,115,46,60,82,101,102,101,114,101,110,100,117,109,67,111,117,110,116,2,0,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,4,57,1,32,84,104,101,32,110,101,120,116,32,102,114,101,101,32,114,101,102,101,114,101,110,100,117,109,32,105,110,100,101,120,44,32,97,107,97,32,116,104,101,32,110,117,109,98,101,114,32,111,102,32,114,101,102,101,114,101,110,100,117,109,115,32,115,116,97,114,116,101,100,32,115,111,32,102,97,114,46,36,78,101,120,116,84,97,108,108,121,2,0,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,4,200,32,84,104,101,32,110,101,120,116,32,114,101,102,101,114,101,110,100,117,109,32,105,110,100,101,120,32,116,104,97,116,32,115,104,111,117,108,100,32,98,101,32,116,97,108,108,105,101,100,46,64,82,101,102,101,114,101,110,100,117,109,73,110,102,111,79,102,0,1,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,176,40,84,58,58,66,108,111,99,107,78,117,109,98,101,114,44,32,84,58,58,80,114,111,112,111,115,97,108,44,32,86,111,116,101,84,104,114,101,115,104,111,108,100,41,4,180,32,73,110,102,111,114,109,97,116,105,111,110,32,99,111,110,99,101,114,110,105,110,103,32,97,110,121,32,103,105,118,101,110,32,114,101,102,101,114,101,110,100,117,109,46,36,86,111,116,101,114,115,70,111,114,1,1,60,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,164,32,71,101,116,32,116,104,101,32,118,111,116,101,114,115,32,102,111,114,32,116,104,101,32,99,117,114,114,101,110,116,32,112,114,111,112,111,115,97,108,46,24,86,111,116,101,79,102,0,1,124,40,82,101,102,101,114,101,110,100,117,109,73,110,100,101,120,44,32,84,58,58,65,99,99,111,117,110,116,73,100,41,16,98,111,111,108,4,132,32,71,101,116,32,116,104,101,32,118,111,116,101,44,32,105,102,32,83,111,109,101,44,32,111,102,32,96,119,104,111,96,46,28,99,111,117,110,99,105,108,24,77,111,100,117,108,101,16,67,97,108,108,36,0,0,52,115,101,116,95,97,112,112,114,111,118,97,108,115,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,20,118,111,116,101,115,36,86,101,99,60,98,111,111,108,62,20,105,110,100,101,120,36,86,111,116,101,73,110,100,101,120,0,1,0,76,114,101,97,112,95,105,110,97,99,116,105,118,101,95,118,111,116,101,114,20,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,56,114,101,112,111,114,116,101,114,95,105,110,100,101,120,12,117,51,50,12,119,104,111,152,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,36,119,104,111,95,105,110,100,101,120,12,117,51,50,72,97,115,115,117,109,101,100,95,118,111,116,101,95,105,110,100,101,120,36,86,111,116,101,73,110,100,101,120,0,2,0,52,114,101,116,114,97,99,116,95,118,111,116,101,114,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,20,105,110,100,101,120,12,117,51,50,0,3,0,64,115,117,98,109,105,116,95,99,97,110,100,105,100,97,99,121,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,16,115,108,111,116,12,117,51,50,0,4,0,56,112,114,101,115,101,110,116,95,119,105,110,110,101,114,16,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,36,99,97,110,100,105,100,97,116,101,152,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,20,116,111,116,97,108,40,84,58,58,66,97,108,97,110,99,101,20,105,110,100,101,120,36,86,111,116,101,73,110,100,101,120,0,5,0,68,115,101,116,95,100,101,115,105,114,101,100,95,115,101,97,116,115,4,20,99,111,117,110,116,12,117,51,50,0,6,0,52,114,101,109,111,118,101,95,109,101,109,98,101,114,4,12,119,104,111,152,65,100,100,114,101,115,115,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,65,99,99,111,117,110,116,73,110,100,101,120,62,0,7,0,100,115,101,116,95,112,114,101,115,101,110,116,97,116,105,111,110,95,100,117,114,97,116,105,111,110,4,20,99,111,117,110,116,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,8,0,68,115,101,116,95,116,101,114,109,95,100,117,114,97,116,105,111,110,4,20,99,111,117,110,116,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,1,28,67,111,117,110,99,105,108,80,52,67,97,110,100,105,100,97,99,121,66,111,110,100,2,0,40,84,58,58,66,97,108,97,110,99,101,4,5,1,32,72,111,119,32,109,117,99,104,32,115,104,111,117,108,100,32,98,101,32,108,111,99,107,101,100,32,117,112,32,105,110,32,111,114,100,101,114,32,116,111,32,115,117,98,109,105,116,32,111,110,101,39,115,32,99,97,110,100,105,100,97,99,121,46,40,86,111,116,105,110,103,66,111,110,100,2,0,40,84,58,58,66,97,108,97,110,99,101,4,9,1,32,72,111,119,32,109,117,99,104,32,115,104,111,117,108,100,32,98,101,32,108,111,99,107,101,100,32,117,112,32,105,110,32,111,114,100,101,114,32,116,111,32,98,101,32,97,98,108,101,32,116,111,32,115,117,98,109,105,116,32,118,111,116,101,115,46,80,80,114,101,115,101,110,116,83,108,97,115,104,80,101,114,86,111,116,101,114,2,0,40,84,58,58,66,97,108,97,110,99,101,4,13,1,32,84,104,101,32,112,117,110,105,115,104,109,101,110,116,44,32,112,101,114,32,118,111,116,101,114,44,32,105,102,32,121,111,117,32,112,114,111,118,105,100,101,32,97,110,32,105,110,118,97,108,105,100,32,112,114,101,115,101,110,116,97,116,105,111,110,46,40,67,97,114,114,121,67,111,117,110,116,2,0,12,117,51,50,4,53,1,32,72,111,119,32,109,97,110,121,32,114,117,110,110,101,114,115,45,117,112,32,115,104,111,117,108,100,32,104,97,118,101,32,116,104,101,105,114,32,97,112,112,114,111,118,97,108,115,32,112,101,114,115,105,115,116,32,117,110,116,105,108,32,116,104,101,32,110,101,120,116,32,118,111,116,101,46,80,80,114,101,115,101,110,116,97,116,105,111,110,68,117,114,97,116,105,111,110,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,61,1,32,72,111,119,32,108,111,110,103,32,116,111,32,103,105,118,101,32,101,97,99,104,32,116,111,112,32,99,97,110,100,105,100,97,116,101,32,116,111,32,112,114,101,115,101,110,116,32,116,104,101,109,115,101,108,118,101,115,32,97,102,116,101,114,32,116,104,101,32,118,111,116,101,32,101,110,100,115,46,76,73,110,97,99,116,105,118,101,71,114,97,99,101,80,101,114,105,111,100,2,0,36,86,111,116,101,73,110,100,101,120,8,105,1,32,72,111,119,32,109,97,110,121,32,118,111,116,101,115,32,110,101,101,100,32,116,111,32,103,111,32,98,121,32,97,102,116,101,114,32,97,32,118,111,116,101,114,39,115,32,108,97,115,116,32,118,111,116,101,32,98,101,102,111,114,101,32,116,104,101,121,32,99,97,110,32,98,101,32,114,101,97,112,101,100,32,105,102,32,116,104,101,105,114,80,32,97,112,112,114,111,118,97,108,115,32,97,114,101,32,109,111,111,116,46,48,86,111,116,105,110,103,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,184,32,72,111,119,32,111,102,116,101,110,32,40,105,110,32,98,108,111,99,107,115,41,32,116,111,32,99,104,101,99,107,32,102,111,114,32,110,101,119,32,118,111,116,101,115,46,48,84,101,114,109,68,117,114,97,116,105,111,110,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,152,32,72,111,119,32,108,111,110,103,32,101,97,99,104,32,112,111,115,105,116,105,111,110,32,105,115,32,97,99,116,105,118,101,32,102,111,114,46,48,68,101,115,105,114,101,100,83,101,97,116,115,2,0,12,117,51,50,4,232,32,78,117,109,98,101,114,32,111,102,32,97,99,99,111,117,110,116,115,32,116,104,97,116,32,115,104,111,117,108,100,32,98,101,32,115,105,116,116,105,110,103,32,111,110,32,116,104,101,32,99,111,117,110,99,105,108,46,52,65,99,116,105,118,101,67,111,117,110,99,105,108,1,0,140,86,101,99,60,40,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,66,108,111,99,107,78,117,109,98,101,114,41,62,8,109,1,32,84,104,101,32,99,117,114,114,101,110,116,32,99,111,117,110,99,105,108,46,32,87,104,101,110,32,116,104,101,114,101,39,115,32,97,32,118,111,116,101,32,103,111,105,110,103,32,111,110,44,32,116,104,105,115,32,115,104,111,117,108,100,32,115,116,105,108,108,32,98,101,32,117,115,101,100,32,102,111,114,32,101,120,101,99,117,116,105,118,101,36,32,109,97,116,116,101,114,115,46,36,86,111,116,101,67,111,117,110,116,1,0,36,86,111,116,101,73,110,100,101,120,4,5,1,32,84,104,101,32,116,111,116,97,108,32,110,117,109,98,101,114,32,111,102,32,118,111,116,101,115,32,116,104,97,116,32,104,97,118,101,32,104,97,112,112,101,110,101,100,32,111,114,32,97,114,101,32,105,110,32,112,114,111,103,114,101,115,115,46,44,65,112,112,114,111,118,97,108,115,79,102,1,1,48,84,58,58,65,99,99,111,117,110,116,73,100,36,86,101,99,60,98,111,111,108,62,4,1,1,32,84,104,101,32,108,97,115,116,32,99,108,101,97,114,101,100,32,118,111,116,101,32,105,110,100,101,120,32,116,104,97,116,32,116,104,105,115,32,118,111,116,101,114,32,119,97,115,32,108,97,115,116,32,97,99,116,105,118,101,32,97,116,46,56,82,101,103,105,115,116,101,114,73,110,102,111,79,102,0,1,48,84,58,58,65,99,99,111,117,110,116,73,100,64,40,86,111,116,101,73,110,100,101,120,44,32,117,51,50,41,8,125,1,32,84,104,101,32,118,111,116,101,32,105,110,100,101,120,32,97,110,100,32,108,105,115,116,32,115,108,111,116,32,116,104,97,116,32,116,104,101,32,99,97,110,100,105,100,97,116,101,32,96,119,104,111,96,32,119,97,115,32,114,101,103,105,115,116,101,114,101,100,32,111,114,32,96,78,111,110,101,96,32,105,102,32,116,104,101,121,32,97,114,101,32,110,111,116,88,32,99,117,114,114,101,110,116,108,121,32,114,101,103,105,115,116,101,114,101,100,46,48,76,97,115,116,65,99,116,105,118,101,79,102,0,1,48,84,58,58,65,99,99,111,117,110,116,73,100,36,86,111,116,101,73,110,100,101,120,4,1,1,32,84,104,101,32,108,97,115,116,32,99,108,101,97,114,101,100,32,118,111,116,101,32,105,110,100,101,120,32,116,104,97,116,32,116,104,105,115,32,118,111,116,101,114,32,119,97,115,32,108,97,115,116,32,97,99,116,105,118,101,32,97,116,46,24,86,111,116,101,114,115,1,0,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,96,32,84,104,101,32,112,114,101,115,101,110,116,32,118,111,116,101,114,32,108,105,115,116,46,40,67,97,110,100,105,100,97,116,101,115,1,0,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,4,112,32,84,104,101,32,112,114,101,115,101,110,116,32,99,97,110,100,105,100,97,116,101,32,108,105,115,116,46,56,67,97,110,100,105,100,97,116,101,67,111,117,110,116,1,0,12,117,51,50,0,48,78,101,120,116,70,105,110,97,108,105,115,101,0,0,160,40,84,58,58,66,108,111,99,107,78,117,109,98,101,114,44,32,117,51,50,44,32,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,41,4,33,1,32,84,104,101,32,97,99,99,111,117,110,116,115,32,104,111,108,100,105,110,103,32,116,104,101,32,115,101,97,116,115,32,116,104,97,116,32,119,105,108,108,32,98,101,99,111,109,101,32,102,114,101,101,32,111,110,32,116,104,101,32,110,101,120,116,32,116,97,108,108,121,46,64,83,110,97,112,115,104,111,116,101,100,83,116,97,107,101,115,2,0,60,86,101,99,60,84,58,58,66,97,108,97,110,99,101,62,4,232,32,84,104,101,32,115,116,97,107,101,115,32,97,115,32,116,104,101,121,32,119,101,114,101,32,97,116,32,116,104,101,32,112,111,105,110,116,32,116,104,97,116,32,116,104,101,32,118,111,116,101,32,101,110,100,101,100,46,44,76,101,97,100,101,114,98,111,97,114,100,0,0,124,86,101,99,60,40,84,58,58,66,97,108,97,110,99,101,44,32,84,58,58,65,99,99,111,117,110,116,73,100,41,62,4,224,32,71,101,116,32,116,104,101,32,108,101,97,100,101,114,98,111,97,114,100,32,105,102,32,119,101,59,114,101,32,105,110,32,116,104,101,32,112,114,101,115,101,110,116,97,116,105,111,110,32,112,104,97,115,101,46,56,99,111,117,110,99,105,108,95,118,111,116,105,110,103,24,77,111,100,117,108,101,16,67,97,108,108,20,0,0,28,112,114,111,112,111,115,101,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,32,112,114,111,112,111,115,97,108,64,66,111,120,60,84,58,58,80,114,111,112,111,115,97,108,62,0,1,0,16,118,111,116,101,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,32,112,114,111,112,111,115,97,108,28,84,58,58,72,97,115,104,28,97,112,112,114,111,118,101,16,98,111,111,108,0,2,0,16,118,101,116,111,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,52,112,114,111,112,111,115,97,108,95,104,97,115,104,28,84,58,58,72,97,115,104,0,3,0,72,115,101,116,95,99,111,111,108,111,102,102,95,112,101,114,105,111,100,4,24,98,108,111,99,107,115,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,4,0,68,115,101,116,95,118,111,116,105,110,103,95,112,101,114,105,111,100,4,24,98,108,111,99,107,115,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,1,52,67,111,117,110,99,105,108,86,111,116,105,110,103,28,52,67,111,111,108,111,102,102,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,48,86,111,116,105,110,103,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,0,36,80,114,111,112,111,115,97,108,115,2,0,120,86,101,99,60,40,84,58,58,66,108,111,99,107,78,117,109,98,101,114,44,32,84,58,58,72,97,115,104,41,62,0,40,80,114,111,112,111,115,97,108,79,102,0,1,28,84,58,58,72,97,115,104,44,84,58,58,80,114,111,112,111,115,97,108,0,56,80,114,111,112,111,115,97,108,86,111,116,101,114,115,1,1,28,84,58,58,72,97,115,104,68,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,0,52,67,111,117,110,99,105,108,86,111,116,101,79,102,0,1,92,40,84,58,58,72,97,115,104,44,32,84,58,58,65,99,99,111,117,110,116,73,100,41,16,98,111,111,108,0,56,86,101,116,111,101,100,80,114,111,112,111,115,97,108,0,1,28,84,58,58,72,97,115,104,140,40,84,58,58,66,108,111,99,107,78,117,109,98,101,114,44,32,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,41,0,60,99,111,117,110,99,105,108,95,109,111,116,105,111,110,115,24,77,111,100,117,108,101,16,67,97,108,108,8,0,0,28,112,114,111,112,111,115,101,12,24,111,114,105,103,105,110,112,60,84,32,97,115,32,115,121,115,116,101,109,58,58,84,114,97,105,116,62,58,58,79,114,105,103,105,110,36,116,104,114,101,115,104,111,108,100,12,117,51,50,32,112,114,111,112,111,115,97,108,108,66,111,120,60,60,84,32,97,115,32,84,114,97,105,116,62,58,58,80,114,111,112,111,115,97,108,62,0,1,0,16,118,111,116,101,16,24,111,114,105,103,105,110,112,60,84,32,97,115,32,115,121,115,116,101,109,58,58,84,114,97,105,116,62,58,58,79,114,105,103,105,110,32,112,114,111,112,111,115,97,108,28,84,58,58,72,97,115,104,20,105,110,100,101,120,52,80,114,111,112,111,115,97,108,73,110,100,101,120,28,97,112,112,114,111,118,101,16,98,111,111,108,0,1,56,67,111,117,110,99,105,108,77,111,116,105,111,110,115,16,36,80,114,111,112,111,115,97,108,115,1,0,48,86,101,99,60,84,58,58,72,97,115,104,62,4,152,32,84,104,101,32,40,104,97,115,104,101,115,32,111,102,41,32,116,104,101,32,97,99,116,105,118,101,32,112,114,111,112,111,115,97,108,115,46,40,80,114,111,112,111,115,97,108,79,102,0,1,28,84,58,58,72,97,115,104,88,60,84,32,97,115,32,84,114,97,105,116,62,58,58,80,114,111,112,111,115,97,108,4,204,32,65,99,116,117,97,108,32,112,114,111,112,111,115,97,108,32,102,111,114,32,97,32,103,105,118,101,110,32,104,97,115,104,44,32,105,102,32,105,116,39,115,32,99,117,114,114,101,110,116,46,24,86,111,116,105,110,103,0,1,28,84,58,58,72,97,115,104,232,40,80,114,111,112,111,115,97,108,73,110,100,101,120,44,32,117,51,50,44,32,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,44,32,86,101,99,60,84,58,58,65,99,99,111,117,110,116,73,100,62,41,4,37,1,32,86,111,116,101,115,32,102,111,114,32,97,32,103,105,118,101,110,32,112,114,111,112,111,115,97,108,58,32,40,114,101,113,117,105,114,101,100,95,121,101,115,95,118,111,116,101,115,44,32,121,101,115,95,118,111,116,101,114,115,44,32,110,111,95,118,111,116,101,114,115,41,46,52,80,114,111,112,111,115,97,108,67,111,117,110,116,1,0,12,117,51,50,4,72,32,80,114,111,112,111,115,97,108,115,32,115,111,32,102,97,114,46,32,116,114,101,97,115,117,114,121,24,77,111,100,117,108,101,16,67,97,108,108,20,0,0,52,112,114,111,112,111,115,101,95,115,112,101,110,100,12,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,20,118,97,108,117,101,40,84,58,58,66,97,108,97,110,99,101,44,98,101,110,101,102,105,99,105,97,114,121,48,84,58,58,65,99,99,111,117,110,116,73,100,0,1,0,28,115,101,116,95,112,111,116,4,28,110,101,119,95,112,111,116,40,84,58,58,66,97,108,97,110,99,101,0,2,0,36,99,111,110,102,105,103,117,114,101,16,52,112,114,111,112,111,115,97,108,95,98,111,110,100,28,80,101,114,109,105,108,108,84,112,114,111,112,111,115,97,108,95,98,111,110,100,95,109,105,110,105,109,117,109,40,84,58,58,66,97,108,97,110,99,101,48,115,112,101,110,100,95,112,101,114,105,111,100,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,16,98,117,114,110,28,80,101,114,109,105,108,108,0,3,0,60,114,101,106,101,99,116,95,112,114,111,112,111,115,97,108,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,40,114,111,112,111,115,97,108,95,105,100,52,80,114,111,112,111,115,97,108,73,110,100,101,120,0,4,0,64,97,112,112,114,111,118,101,95,112,114,111,112,111,115,97,108,8,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,44,112,114,111,112,111,115,97,108,95,105,100,52,80,114,111,112,111,115,97,108,73,110,100,101,120,0,1,32,84,114,101,97,115,117,114,121,32,48,80,114,111,112,111,115,97,108,66,111,110,100,2,0,28,80,101,114,109,105,108,108,8,81,1,32,80,114,111,112,111,114,116,105,111,110,32,111,102,32,102,117,110,100,115,32,116,104,97,116,32,115,104,111,117,108,100,32,98,101,32,98,111,110,100,101,100,32,105,110,32,111,114,100,101,114,32,116,111,32,112,108,97,99,101,32,97,32,112,114,111,112,111,115,97,108,46,32,65,110,32,97,99,99,101,112,116,101,100,220,32,112,114,111,112,111,115,97,108,32,103,101,116,115,32,116,104,101,115,101,32,98,97,99,107,46,32,65,32,114,101,106,101,99,116,101,100,32,112,114,111,112,111,115,97,108,32,100,111,101,115,110,39,116,46,76,80,114,111,112,111,115,97,108,66,111,110,100,77,105,110,105,109,117,109,2,0,40,84,58,58,66,97,108,97,110,99,101,4,73,1,32,77,105,110,105,109,117,109,32,97,109,111,117,110,116,32,111,102,32,102,117,110,100,115,32,116,104,97,116,32,115,104,111,117,108,100,32,98,101,32,112,108,97,99,101,100,32,105,110,32,97,32,100,101,112,111,115,105,116,32,102,111,114,32,109,97,107,105,110,103,32,97,32,112,114,111,112,111,115,97,108,46,44,83,112,101,110,100,80,101,114,105,111,100,2,0,56,84,58,58,66,108,111,99,107,78,117,109,98,101,114,4,136,32,80,101,114,105,111,100,32,98,101,116,119,101,101,110,32,115,117,99,99,101,115,115,105,118,101,32,115,112,101,110,100,115,46,16,66,117,114,110,2,0,28,80,101,114,109,105,108,108,4,17,1,32,80,101,114,99,101,110,116,97,103,101,32,111,102,32,115,112,97,114,101,32,102,117,110,100,115,32,40,105,102,32,97,110,121,41,32,116,104,97,116,32,97,114,101,32,98,117,114,110,116,32,112,101,114,32,115,112,101,110,100,32,112,101,114,105,111,100,46,12,80,111,116,1,0,40,84,58,58,66,97,108,97,110,99,101,4,204,32,84,111,116,97,108,32,102,117,110,100,115,32,97,118,97,105,108,97,98,108,101,32,116,111,32,116,104,105,115,32,109,111,100,117,108,101,32,102,111,114,32,115,112,101,110,100,105,110,103,46,52,80,114,111,112,111,115,97,108,67,111,117,110,116,1,0,52,80,114,111,112,111,115,97,108,73,110,100,101,120,4,164,32,78,117,109,98,101,114,32,111,102,32,112,114,111,112,111,115,97,108,115,32,116,104,97,116,32,104,97,118,101,32,98,101,101,110,32,109,97,100,101,46,36,80,114,111,112,111,115,97,108,115,0,1,52,80,114,111,112,111,115,97,108,73,110,100,101,120,136,80,114,111,112,111,115,97,108,60,84,58,58,65,99,99,111,117,110,116,73,100,44,32,84,58,58,66,97,108,97,110,99,101,62,4,124,32,80,114,111,112,111,115,97,108,115,32,116,104,97,116,32,104,97,118,101,32,98,101,101,110,32,109,97,100,101,46,36,65,112,112,114,111,118,97,108,115,1,0,72,86,101,99,60,80,114,111,112,111,115,97,108,73,110,100,101,120,62,4,248,32,80,114,111,112,111,115,97,108,32,105,110,100,105,99,101,115,32,116,104,97,116,32,104,97,118,101,32,98,101,101,110,32,97,112,112,114,111,118,101,100,32,98,117,116,32,110,111,116,32,121,101,116,32,97,119,97,114,100,101,100,46,32,99,111,110,116,114,97,99,116,24,77,111,100,117,108,101,16,67,97,108,108,8,0,0,16,99,97,108,108,20,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,16,100,101,115,116,48,84,58,58,65,99,99,111,117,110,116,73,100,20,118,97,108,117,101,40,84,58,58,66,97,108,97,110,99,101,36,103,97,115,95,108,105,109,105,116,24,84,58,58,71,97,115,16,100,97,116,97,28,86,101,99,60,117,56,62,0,1,0,24,99,114,101,97,116,101,20,24,111,114,105,103,105,110,36,84,58,58,79,114,105,103,105,110,20,118,97,108,117,101,40,84,58,58,66,97,108,97,110,99,101,36,103,97,115,95,108,105,109,105,116,24,84,58,58,71,97,115,36,105,110,105,116,95,99,111,100,101,28,86,101,99,60,117,56,62,16,100,97,116,97,28,86,101,99,60,117,56,62,0,0],"id":1} diff --git a/packages/api-codec/src/Metadata.spec.js b/packages/api-codec/src/Metadata.spec.js new file mode 100644 index 000000000000..1277e088634d --- /dev/null +++ b/packages/api-codec/src/Metadata.spec.js @@ -0,0 +1,21 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import Metadata from './Metadata'; +import rpcdata from './Metadata.rpc.json'; + +describe('Metadata', () => { + it('decodes properly', () => { + const decoded = new Metadata().fromU8a( + Uint8Array.from(rpcdata.result) + ); + + const str = JSON.stringify(decoded.toJSON()); + + console.error(str); + console.error(decoded.getUniqTypes()); + + expect(str).not.toBe(null); + }); +}); diff --git a/packages/api-codec/src/Metadata.ts b/packages/api-codec/src/Metadata.ts new file mode 100644 index 000000000000..2df16d46ad2e --- /dev/null +++ b/packages/api-codec/src/Metadata.ts @@ -0,0 +1,333 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import CodecArray from './base/Array'; +import CodecBase from './base/Base'; +import CodecEnum from './base/Enum'; +import CodecEnumType from './base/EnumType'; +import CodecOption from './base/Option'; +import CodecStruct from './base/Struct'; +import String from './String'; +import Type from './Type'; +import U16 from './U16'; + +// Decodes the runtime metadata as passed through from the `state_getMetadata` call. This +// file is probably best understood from the bottom-up, i.e. start reading right at the +// end and work up. (Just so we don't use before definition) + +class EventMetadata extends CodecStruct { + constructor () { + super({ + name: String, + arguments: CodecArray.with(Type), + documentation: CodecArray.with(String) + }); + } + + get arguments (): CodecArray { + return this.raw.arguments as CodecArray; + } + + get documentation (): CodecArray { + return this.raw.documentation as CodecArray; + } + + get name (): String { + return this.raw.name as String; + } +} + +class OuterEventMetadataEvent extends CodecStruct { + constructor () { + super({ + name: String, + events: CodecArray.with(EventMetadata) + }); + } + + get events (): CodecArray { + return this.raw.events as CodecArray; + } + + get name (): String { + return this.raw.name as String; + } +} + +class OuterEventMetadata extends CodecStruct { + constructor () { + super({ + name: String, + events: CodecArray.with(OuterEventMetadataEvent) + }); + } + + get events (): CodecArray { + return this.raw.events as CodecArray; + } + + get name (): String { + return this.raw.name as String; + } +} + +class FunctionArgumentMetadata extends CodecStruct { + constructor () { + super({ + name: String, + type: Type + }); + } + + get name (): String { + return this.raw.name as String; + } + + get type (): Type { + return this.raw.type as Type; + } +} + +class FunctionMetadata extends CodecStruct { + constructor () { + super({ + id: U16, + name: String, + arguments: CodecArray.with(FunctionArgumentMetadata), + documentation: CodecArray.with(String) + }); + } + + get arguments (): CodecArray { + return this.raw.arguments as CodecArray; + } + + get documentation (): CodecArray { + return this.raw.documentation as CodecArray; + } + + get id (): U16 { + return this.raw.id as U16; + } + + get name (): String { + return this.raw.name as String; + } +} + +class CallMetadata extends CodecStruct { + constructor () { + super({ + name: String, + functions: CodecArray.with(FunctionMetadata) + }); + } + + get functions (): CodecArray { + return this.raw.functions as CodecArray; + } + + get name (): String { + return this.raw.name as String; + } +} + +class ModuleMetadata extends CodecStruct { + constructor () { + super({ + name: String, + call: CallMetadata + }); + } + + get call (): CallMetadata { + return this.raw.call as CallMetadata; + } + + get name (): String { + return this.raw.name as String; + } +} + +class StorageFunctionModifier extends CodecEnum { + constructor () { + super(['None', 'Default', 'Required']); + } +} + +class StorageFunctionType$Map extends CodecStruct { + constructor () { + super({ + key: Type, + value: Type + }); + } + + get key (): Type { + return this.raw.type as Type; + } + + get value (): Type { + return this.raw.value as Type; + } +} + +class StorageFunctionType extends CodecEnumType { + constructor () { + super([ + Type, + StorageFunctionType$Map + ], ['Plain', 'Map']); + } + + get isMap (): boolean { + return this.toNumber() === 1; + } + + get asMap (): StorageFunctionType$Map { + return (this.raw as CodecBase).raw; + } + + get asType (): Type { + return (this.raw as CodecBase).raw; + } +} + +class StorageFunctionMetadata extends CodecStruct { + constructor () { + super({ + name: String, + modifier: StorageFunctionModifier, + type: StorageFunctionType, + documentation: CodecArray.with(String) + }); + } + + get documentation (): CodecArray { + return this.raw.documentation as CodecArray; + } + + get name (): String { + return this.raw.name as String; + } + + get modifier (): StorageFunctionModifier { + return this.raw.modifier as StorageFunctionModifier; + } + + get type (): StorageFunctionType { + return this.raw.type as StorageFunctionType; + } +} + +class StorageMetadata extends CodecStruct { + constructor () { + super({ + prefix: String, + functions: CodecArray.with(StorageFunctionMetadata) + }); + } + + get functions (): CodecArray { + return this.raw.functions as CodecArray; + } + + get prefix (): String { + return this.raw.prefix as String; + } +} + +class RuntimeModuleMetadata extends CodecStruct { + constructor () { + super({ + prefix: String, + module: ModuleMetadata, + storage: CodecOption.with(StorageMetadata) + }); + } + + get module (): ModuleMetadata { + return this.raw.module as ModuleMetadata; + } + + get prefix (): String { + return this.raw.prefix as String; + } + + get storage (): StorageMetadata | undefined { + return (this.raw.storage as CodecOption).value; + } +} + +export default class RuntimeMetadata extends CodecStruct { + constructor (value?: any) { + super({ + outerEvent: OuterEventMetadata, + modules: CodecArray.with(RuntimeModuleMetadata) + }, value); + } + + // FIXME Really not crazy about having to manually add all the getters. Preferably it should + // be done automagically in the actual CodecStruct - however what is really important here + // here is that we should nbot lose the autocompletion and checking that TS gives us. So if + // we have to choose between the 2, manual defs it would have to be. + + get events (): CodecArray { + return (this.raw.outerEvent as OuterEventMetadata).events; + } + + get modules (): CodecArray { + return this.raw.modules as CodecArray; + } + + // Helper to retrieve a list of all type that are found, sorted and de-deuplicated + getUniqTypes (): Array { + // Quick and dirty flatten (.flat() not available) + const flatten = (list: Array): Array => + list.reduce((result, entry) => { + return result.concat( + Array.isArray(entry) + ? flatten(entry) + : entry + ); + }, []); + // Quick and dirty uniq + const uniq = (list: Array): Array => + list.reduce((result, entry) => { + if (!result.includes(entry)) { + result.push(entry); + } + + return result; + }, [] as Array); + + const events = this.events.map((module) => + module.events.map((event) => + event.arguments.map((argument) => + argument.raw + ) + ) + ); + const storages = this.modules.map((module) => + module.storage + ? module.storage.functions.map((fn) => + fn.type.isMap + ? [fn.type.asMap.key.raw, fn.type.asMap.value.raw] + : [fn.type.asType.raw] + ) + : [] + ); + const args = this.modules.map((module) => + module.module.call.functions.map((fn) => + fn.arguments.map((argument) => + argument.type.raw + ) + ) + ); + + return uniq( + flatten([events, storages, args]).filter((value) => value) + ).sort(); + } +} diff --git a/packages/api-codec/src/String.ts b/packages/api-codec/src/String.ts new file mode 100644 index 000000000000..b9df6c64413b --- /dev/null +++ b/packages/api-codec/src/String.ts @@ -0,0 +1,74 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import u8aFromUtf8 from '@polkadot/util/u8a/fromUtf8'; +import u8aToUtf8 from '@polkadot/util/u8a/toUtf8'; +import u8aConcat from '@polkadot/util/u8a/concat'; + +import CodecBase from './base/Base'; +import Length from './base/LengthCompact'; + +// This is a string wrapper, along with the length. It is used both for strings as well +// as stuff like documentation. +// +// TODO +// - Strings should probably be trimmed (docs do come through with extra padding) +// - Potentially we want a "TypeString" extension to this. Basically something that +// wraps the `Balance`, `T::AccountId`, etc. The reasoning - with a "TypeString" +// we can nicely strip types down like "T::AcountId" -> "AccountId" +export default class String extends CodecBase { + protected _length: Length; + + constructor (value: string = '') { + super(value); + + this._length = new Length(value.length); + } + + get length (): number { + return this.raw.length; + } + + byteLength (): number { + // NOTE String gets trimmed in the fromU8a, so get the original length from the length + // placeholder and the associtated byteLength from that encoding + return this._length.toNumber() + + this._length.byteLength(); + } + + fromJSON (input: any): String { + throw new Error('String::fromJSON: unimplemented'); + } + + fromU8a (input: Uint8Array): String { + this._length.fromU8a(input); + + const length = this._length.toNumber(); + const offset = this._length.byteLength(); + + this.raw = u8aToUtf8(input.subarray(offset, offset + length)).trim(); + + return this; + } + + toJSON (): any { + return this.toString(); + } + + toString (): string { + return this.raw; + } + + toU8a (): Uint8Array { + // NOTE Since we trim in the fromU8a, here we re-calculate the actual length + const encoded = u8aFromUtf8(this.raw); + + this._length.setValue(encoded.length); + + return u8aConcat( + this._length.toU8a(), + encoded + ); + } +} diff --git a/packages/api-codec/src/Type.ts b/packages/api-codec/src/Type.ts new file mode 100644 index 000000000000..3883241d232d --- /dev/null +++ b/packages/api-codec/src/Type.ts @@ -0,0 +1,96 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import String from './String'; + +// given a starting index, find the closing > +function findClosing (value: string, start: number): number { + let depth = 0; + + for (let index = start; index < value.length; index++) { + if (value[index] === '>') { + if (!depth) { + return index; + } else { + depth--; + } + } else if (value[index] === '<') { + depth++; + } + } + + throw new Error(`Unable to find closing matching <> on '${value}' (start ${start})`); +} + +function ungeneric (value: string): string { + for (let index = 0; index < value.length; index++) { + if (value[index] === '<') { + if (value.substr(index - 3, 3) !== 'Vec') { + const start = index + 1; + const end = findClosing(value, start); + + value = `${value.substr(0, index)}${value.substr(end + 1)}`; + } + } + } + + return value; +} + +// remove the type traits +function untrait (value: string): string { + return value + // anything `T::` to end up as `` + .replace(/T::/g, '') + // `system::` with `` - basically we find `` + .replace(/system::/g, '') + // replace `::` (possibly sanitiused just above) + .replace(/::/g, ''); +} + +// remove wrapping values, i.e. Box -> Proposal +function unwrap (check: string, value: string): string { + let index = 0; + + while (index !== -1) { + index = value.indexOf(check); + + if (index !== -1) { + const start = index + check.length; + const end = findClosing(value, start); + + value = `${value.substr(start, end - start)}`; + } + } + + return value; +} + +// This is a extended version of String, specifically to handle types. Here we rely full on +// what string provides us, however we also "tweak" the types received from the runtime, i.e. +// we remove the `T::` prefixes found in some types for consistency accross implementation. +export default class Type extends String { + fromU8a (input: Uint8Array): String { + super.fromU8a(input); + + // Hack around the Rust types to make them consistent for actual use + let result = untrait(this.raw); + + // `Box` -> `Proposal` + result = unwrap('Box<', result); + // `MisbehaviorReport` -> `MisbehaviorReport` + result = ungeneric(result); + + this.raw = result; + + return this; + } + + toU8a (): Uint8Array { + // Note Since we are mangling what we get in beyond recognition, we really should + // not allow the re-encoding. Additionally, this is probably more of a decoder-only + // helper, so treat it as such. + throw new Error('Type::toU8a: unimplemented'); + } +} diff --git a/packages/api-codec/src/U16.ts b/packages/api-codec/src/U16.ts new file mode 100644 index 000000000000..c78a0594a8db --- /dev/null +++ b/packages/api-codec/src/U16.ts @@ -0,0 +1,13 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import BN from 'bn.js'; + +import CodecNumber from './base/Number'; + +export default class U16 extends CodecNumber { + constructor (value?: BN | number) { + super(value, 16); + } +} diff --git a/packages/api-codec/src/base/Array.ts b/packages/api-codec/src/base/Array.ts new file mode 100644 index 000000000000..9f7194ad1100 --- /dev/null +++ b/packages/api-codec/src/base/Array.ts @@ -0,0 +1,117 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import u8aConcat from '@polkadot/util/u8a/concat'; + +import CodecBase from './Base'; +import Length from './LengthCompact'; + +// This manages codec arrays. Intrernally it keeps track of the length (as decoded) and allows +// construction with the passed `Type` in the constructor. It aims to be an array-like structure, +// i.e. while it wraps an array, it provides a `length` property to get the actual length, `at(index)` +// to retrieve a specific item. Additionally the helper functions `map`, `filter`, `forEach` and +// `reduce` is exposed on the interface. +export default class CodecArray < + T extends CodecBase +> extends CodecBase> { + private _length: Length; + private _Type: { new(value?: any): T }; + + constructor (Type: { new(value?: any): T }, value: Array = [] as Array) { + super( + value.map((entry) => + new Type(entry) + ) + ); + + this._length = new Length(value.length); + this._Type = Type; + } + + static with (Type: { new(value?: any): O }): { new(value?: any): CodecArray } { + return class extends CodecArray { + constructor (value?: Array) { + super(Type, value); + } + }; + } + + byteLength (): number { + return this.raw.reduce((total, raw) => { + return total + raw.byteLength(); + }, this._length.byteLength()); + } + + get length (): number { + return this.raw.length; + } + + at (index: number): T { + return this.raw[index]; + } + + filter (fn: (entry: T, index?: number) => any): Array { + return this.raw.filter(fn); + } + + forEach (fn: (entry: T, index?: number) => any): any { + return this.raw.forEach(fn); + } + + fromJSON (input: any): CodecArray { + this.raw = input.map((input: any) => + new this._Type().fromJSON(input) + ); + + return this; + } + + fromU8a (input: Uint8Array): CodecArray { + this._length.fromU8a(input); + + const length = this._length.toNumber(); + let offset = this._length.byteLength(); + this.raw = []; + + for (let index = 0; index < length; index++) { + const raw = new this._Type().fromU8a(input.subarray(offset)); + + this.raw.push(raw as T); + offset += raw.byteLength(); + } + + return this; + } + + map (fn: (entry: T, index?: number) => O): Array { + return this.raw.map(fn); + } + + reduce (fn: (result: O, entry: T, index?: number) => O, initial: O): O { + return this.raw.reduce(fn, initial); + } + + toJSON (): any { + return this.raw.map((entry) => + entry.toJSON() + ); + } + + toU8a (): Uint8Array { + return u8aConcat( + this._length.toU8a(), + ...this.raw.map((entry) => + entry.toU8a() + ) + ); + } + + toString (): string { + const data = this.raw.map((entry) => + entry.toString() + ).join(', '); + + return `[${data}]`; + } +} diff --git a/packages/api-codec/src/base/Base.ts b/packages/api-codec/src/base/Base.ts new file mode 100644 index 000000000000..90a74c36af7d --- /dev/null +++ b/packages/api-codec/src/base/Base.ts @@ -0,0 +1,41 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +// The actual base class for any type. As it stands, this should not be used on it's own, +// so we expose the interface, but throw on anything. This allows subclasses to actaully +// only implement part (things that are unused/unexpected should just error-out) +// +// TODO +// - This could probably be abstract, as long as we have the functions abstract as well +export default class CodecBase { + raw: T; + + constructor (value?: any) { + this.raw = value; + } + + byteLength (): number { + throw new Error('CodecBase::byteLength: unimplemented'); + } + + fromJSON (input: any): CodecBase { + throw new Error('CodecBase::fromJSON: unimplemented'); + } + + fromU8a (input: Uint8Array): CodecBase { + throw new Error('CodecBase::fromU8a: unimplemented'); + } + + toJSON (): any { + throw new Error('CodecBase::toJSON: unimplemented'); + } + + toString (): string { + throw new Error('CodecBase::toString: unimplemented'); + } + + toU8a (): Uint8Array { + throw new Error('CodecBase::toU8a: unimplemented'); + } +} diff --git a/packages/api-codec/src/base/Enum.ts b/packages/api-codec/src/base/Enum.ts new file mode 100644 index 000000000000..1bee0ea12f3a --- /dev/null +++ b/packages/api-codec/src/base/Enum.ts @@ -0,0 +1,54 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import CodecBase from './Base'; + +// A codec wrapper for an enum. Enums are encoded as a single byte, where the byte +// is a zero-indexed value. This class allows you to retrieve the value either +// by `toNumber()` exposing the actual raw index, or `toString()` returning a +// string representation (as provided as part of the constructor) +// +// TODO: +// - It would be great if this could actually wrap actual TS enums +export default class CodecEnum extends CodecBase { + private _strings: Array; + + constructor (strings: Array, value: number = 0) { + super(value); + + this._strings = strings; + } + + byteLength (): number { + return 1; + } + + fromJSON (input: any): CodecEnum { + this.raw = input; + + return this; + } + + fromU8a (input: Uint8Array): CodecEnum { + this.raw = input[0]; + + return this; + } + + toJSON (): any { + return this.raw; + } + + toU8a (): Uint8Array { + return new Uint8Array([this.raw]); + } + + toNumber (): number { + return this.raw; + } + + toString (): string { + return this._strings[this.raw]; + } +} diff --git a/packages/api-codec/src/base/EnumType.ts b/packages/api-codec/src/base/EnumType.ts new file mode 100644 index 000000000000..48bd13586fda --- /dev/null +++ b/packages/api-codec/src/base/EnumType.ts @@ -0,0 +1,59 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import CodecBase from './Base'; + +// This implements an enum, that based on the value wraps a different type. It is effectively an +// extension to enum where the value type is determined by the actual index. +// +// TODO: +// - As per Enum, actually use TS enum +// - It should rather probably extend Enum instead of copying code +// - There doesn't actually seem to be a way to get to the actual determined/wrapped value +export default class CodecEnumType extends CodecBase> { + private _Type: Array<{ new(value?: any): CodecBase }>; + private _index: number; + private _strings: Array; + + constructor (Type: Array<{ new(value?: any): CodecBase }>, strings: Array, index: number = 0) { + super( + new Type[index]() + ); + + this._Type = Type; + this._index = index; + this._strings = strings; + } + + byteLength (): number { + return 1 + this.raw.byteLength(); + } + + fromJSON (input: any): CodecEnumType { + throw new Error('CodecEnumType:fromJSON: unimplemented'); + } + + fromU8a (input: Uint8Array): CodecEnumType { + this._index = input[0]; + this.raw = new this._Type[this._index]().fromU8a(input.subarray(1)); + + return this; + } + + toJSON (): any { + return this.raw; + } + + toU8a (): Uint8Array { + throw new Error('CodecEnumType:toU8a: unimplemented'); + } + + toNumber (): number { + return this._index; + } + + toString (): string { + return this._strings[this._index]; + } +} diff --git a/packages/api-codec/src/base/LengthCompact.spec.js b/packages/api-codec/src/base/LengthCompact.spec.js new file mode 100644 index 000000000000..f16d8c590d72 --- /dev/null +++ b/packages/api-codec/src/base/LengthCompact.spec.js @@ -0,0 +1,26 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import LengthCompact from './LengthCompact'; + +describe('Compact', () => { + let compact; + + beforeEach(() => { + + }); + + // FIXME skipped since this one does not actually work as expected :() + // basically, bring in the tests since encoding with lengths are still + // proplematic (decoding at this point does work) + it.skip('encodes short u8', () => { + compact = new LengthCompact(78); + + expect( + compact.toU8a() + ).toEqual( + new Uint8Array([78 << 2]) + ); + }); +}); diff --git a/packages/api-codec/src/base/LengthCompact.ts b/packages/api-codec/src/base/LengthCompact.ts new file mode 100644 index 000000000000..425609f60a9e --- /dev/null +++ b/packages/api-codec/src/base/LengthCompact.ts @@ -0,0 +1,80 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import BN from 'bn.js'; +import bnToU8a from '@polkadot/util/bn/toU8a'; +import u8aConcat from '@polkadot/util/u8a/concat'; +import u8aToBn from '@polkadot/util/u8a/toBn'; + +import CodecBaseLength from './LengthFixed'; + +const MAX_VAL_U8 = new BN(2).pow(new BN(8 - 2)).subn(1); +const MAX_VAL_U16 = new BN(2).pow(new BN(16 - 2)).subn(1); +const MAX_VAL_U32 = new BN(2).pow(new BN(32 - 2)).subn(1); + +// A new compact length-encoding algorithm. It performs the same function as Length, however +// differs in that it uses a variable number of bytes to do the actual encoding. From the Rust +// implementation for compact encoding +// +// 0b00 00 00 00 / 00 00 00 00 / 00 00 00 00 / 00 00 00 00 +// (0 ... 2**6 - 1) (u8) +// xx xx xx 00 +// (2**6 ... 2**14 - 1) (u8, u16) low LH high +// yL yL yL 01 / yH yH yH yL +// (2**14 ... 2**30 - 1) (u16, u32) low LMMH high +// zL zL zL 10 / zM zM zM zL / zM zM zM zM / zH zH zH zM +// (2**30 ... 2**536 - 1) (u32, u64, u128, U256, U512, U520) straight LE-encoded +// nn nn nn 11 [ / zz zz zz zz ]{4 + n} +// +// Note: we use *LOW BITS* of the LSB in LE encoding to encode the 2 bit key. +export default class CodecLengthCompact extends CodecBaseLength { + byteLength (): number { + return this.toU8a().length; + } + + fromU8a (input: Uint8Array): CodecLengthCompact { + const flag = input[0] & 0b11; + + if (flag === 0b00) { + this.raw = new BN(input[0]).shrn(2); + } else if (flag === 0b01) { + this.raw = u8aToBn(input.slice(0, 2), true).shrn(2); + } else if (flag === 0b10) { + this.raw = u8aToBn(input.slice(0, 4), true).shrn(2); + } else { + this.raw = u8aToBn(input.subarray(1, 5), true); + } + + return this; + } + + toU8a (): Uint8Array { + if (this.raw.lte(MAX_VAL_U8)) { + return new Uint8Array([this.raw.toNumber() << 2]); + } else if (this.raw.lte(MAX_VAL_U16)) { + const u8a = bnToU8a(this.raw, 16, true); + + u8a.set([ + (u8a[0] << 2) | 0b01 + ]); + + return u8a; + } else if (this.raw.lte(MAX_VAL_U32)) { + const u8a = bnToU8a(this.raw, 32, true); + + u8a.set([ + (u8a[0] << 2) | 0b10 + ]); + + return u8a; + } + + return u8aConcat( + new Uint8Array([ + 0b11 + ]), + bnToU8a(this.raw, 32, true) + ); + } +} diff --git a/packages/api-codec/src/base/LengthFixed.ts b/packages/api-codec/src/base/LengthFixed.ts new file mode 100644 index 000000000000..86aa8fecbf39 --- /dev/null +++ b/packages/api-codec/src/base/LengthFixed.ts @@ -0,0 +1,61 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import BN from 'bn.js'; +import bnToBn from '@polkadot/util/bn/toBn'; +import bnToU8a from '@polkadot/util/bn/toU8a'; +import u8aToBn from '@polkadot/util/u8a/toBn'; + +import CodecBase from './Base'; + +// A basic u32 LE length-encoder. It is basically used in Vectors, Arrays and String +// (anything variable) to do the encoding/decoding for the length prefixes. (It has +// been superceded in use by the compact encoder, i.e. LengthCompact) +export default class CodecLengthFixed extends CodecBase { + constructor (value: BN | number = new BN(0)) { + super( + bnToBn(value) + ); + } + + byteLength (): number { + return 4; + } + + fromJSON (): CodecLengthFixed { + throw new Error('CodecLength::fromJSON: unimplemented'); + } + + fromNumber (value: BN | number): CodecLengthFixed { + this.raw = bnToBn(value); + + return this; + } + + fromU8a (input: Uint8Array): CodecLengthFixed { + this.raw = u8aToBn(input.subarray(0, 4), true); + + return this; + } + + toJSON (): any { + throw new Error('CodecLength::toJSON: unimplemented'); + } + + toNumber (): number { + return this.raw.toNumber(); + } + + toString (): string { + throw new Error('CodecLength::toString: unimplemented'); + } + + toU8a (): Uint8Array { + return bnToU8a(this.raw, 32, true); + } + + setValue (value: BN | number): void { + this.raw = bnToBn(value); + } +} diff --git a/packages/api-codec/src/base/Number.ts b/packages/api-codec/src/base/Number.ts new file mode 100644 index 000000000000..1889a6123657 --- /dev/null +++ b/packages/api-codec/src/base/Number.ts @@ -0,0 +1,73 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import BN from 'bn.js'; +import isHex from '@polkadot/util/is/hex'; +import bnToBn from '@polkadot/util/bn/toBn'; +import bnToHex from '@polkadot/util/bn/toHex'; +import bnToU8a from '@polkadot/util/bn/toU8a'; +import hexToBn from '@polkadot/util/hex/toBn'; +import u8aToBn from '@polkadot/util/u8a/toBn'; + +import CodecBase from './Base'; + +type BitLength = 8 | 16 | 32 | 64 | 128; + +const DEFAULT_VALUE = new BN(0); + +// A generic number codec. For Substrate all numbers are LE encoded, this handles the encoding +// and decoding of those numbers. Upon construction the bitLength is provided and any additional +// use keeps the number to this length. +// +// TODO: +// - Apart from encoding/decoding we don't actuall keep check on the sizes, is this good enough? +export default class CodecNumber extends CodecBase { + private _bitLength: BitLength; + + constructor (value: BN | number = DEFAULT_VALUE, bitLength: BitLength = 64) { + super( + bnToBn(value) + ); + + this._bitLength = bitLength; + } + + byteLength (): number { + return this._bitLength / 8; + } + + fromJSON (input: any): CodecNumber { + this.raw = isHex(input) + ? hexToBn(input) + : new BN(input); + + return this; + } + + fromU8a (input: Uint8Array): CodecNumber { + this.raw = u8aToBn(input.subarray(0, this.byteLength()), true); + + return this; + } + + toJSON (): any { + return this.toString(); + } + + toU8a (): Uint8Array { + return bnToU8a(this.raw, this._bitLength, true); + } + + toString (): string { + return bnToHex(this.raw, this._bitLength); + } + + toBn (): BN { + return this.raw; + } + + toNumber (): number { + return this.raw.toNumber(); + } +} diff --git a/packages/api-codec/src/base/Option.ts b/packages/api-codec/src/base/Option.ts new file mode 100644 index 000000000000..1cbb8244f715 --- /dev/null +++ b/packages/api-codec/src/base/Option.ts @@ -0,0 +1,88 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import isUndefined from '@polkadot/util/is/undefined'; + +import CodecBase from './Base'; + +// An Option is an optional field. Basically the first byte indicates that there is +// is value to follow. If the byte is `1` there is an actual value. So the CodecOption +// implements that - decodes, checks for optionality and wraps the required structure +// with a value if/as required/found. +export default class CodecOption extends CodecBase> { + private _hasValue: boolean; + + constructor (Value: { new(value?: any): CodecBase }, value?: any) { + super( + new Value(value) + ); + + this._hasValue = !isUndefined(value); + } + + static with (Type: { new(value?: any): CodecBase }): { new(value?: any): CodecOption } { + return class extends CodecOption { + constructor (value?: any) { + super(Type, value); + } + }; + } + + get value (): T | undefined { + return this._hasValue + ? this.raw.raw + : undefined; + } + + byteLength (): number { + const childLength = this._hasValue + ? this.raw.byteLength() + : 0; + + return 1 + childLength; + } + + fromJSON (input: any): CodecOption { + this._hasValue = !isUndefined(input); + + if (this._hasValue) { + this.raw.fromJSON(input); + } + + return this; + } + + fromU8a (input: Uint8Array): CodecOption { + this._hasValue = input[0] === 1; + + if (this._hasValue) { + this.raw.fromU8a(input.subarray(1)); + } + + return this; + } + + toJSON (): any { + return this._hasValue + ? this.raw.toJSON() + : undefined; + } + + toU8a (): Uint8Array { + const u8a = new Uint8Array(this.byteLength()); + + if (this._hasValue) { + u8a.set([1]); + u8a.set(this.raw.toU8a(), 1); + } + + return u8a; + } + + toString (): string { + return this._hasValue + ? this.raw.toString() + : ''; + } +} diff --git a/packages/api-codec/src/base/Struct.ts b/packages/api-codec/src/base/Struct.ts new file mode 100644 index 000000000000..3929afbe7bc2 --- /dev/null +++ b/packages/api-codec/src/base/Struct.ts @@ -0,0 +1,99 @@ +// Copyright 2017-2018 @polkadot/api-codec authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import u8aConcat from '@polkadot/util/u8a/concat'; + +import CodecBase from './Base'; + +// A Struct defines an Object with key/values - where the values are CodecCodecBase values. It removes +// a lot of repetition from the actual coding, define a structure type, pass it the key/CodecBase +// values in the constructor and it manages the decoding. It is important that the constructor +// values matches 100% to the order in th Rust code, i.e. don't go crazy and make it alphabetical, +// it needs to decoded in the specific defined order. +// +// TODO: +// - Check the constructor, something is really, really wrong with the way the defs are used +export default class CodecStruct < + S = { [index: string]: { new(value?: any): CodecBase } }, + T = { [K in keyof S]: CodecBase }, + V = { [K in keyof S]: any } +> extends CodecBase { + constructor (Struct: S, value: V = {} as V) { + super( + Object.keys(Struct).reduce((raw: T, key) => { + // @ts-ignore Ok, something weid is going on here or I just don't get it... it works, + // so ignore the checker, although it drives me batty. (It started when the [key in keyof T] + // was added, the idea is to provide better checks, which does backfire here, but works + // externally.) + raw[key] = new Struct[key](value[key]); + + return raw; + }, {} as T) + ); + } + + static with < + S = { [index: string]: { new(value?: any): CodecBase } } + > (Struct: S): { new(value?: any): CodecStruct } { + return class extends CodecStruct { + constructor (value?: any) { + super(Struct, value); + } + }; + } + + byteLength (): number { + return Object.values(this.raw).reduce((length, entry) => { + return length += entry.byteLength(); + }, 0); + } + + fromJSON (input: any): CodecStruct { + Object.keys(this.raw).forEach((key) => { + // @ts-ignore as above... + this.raw[key].fromJSON(input[key]); + }); + + return this; + } + + fromU8a (input: Uint8Array): CodecStruct { + Object.keys(this.raw).reduce((offset, key) => { + // @ts-ignore as above... + this.raw[key].fromU8a(input.subarray(offset)); + + // @ts-ignore as above... + return offset + this.raw[key].byteLength(); + }, 0); + + return this; + } + + toJSON (): any { + return Object.keys(this.raw).reduce((json, key) => { + // @ts-ignore as above... + json[key] = this.raw[key].toJSON(); + + return json; + }, {} as any); + } + + toU8a (): Uint8Array { + return u8aConcat( + ...Object.keys(this.raw).map((key) => + // @ts-ignore as above... + this.raw[key].toU8a() + ) + ); + } + + toString (): string { + const data = Object.keys(this.raw).map((key) => + // @ts-ignore as above... + `${key}: ${this.raw[key].toString()}` + ).join(', '); + + return `{${data}}`; + } +} diff --git a/packages/api-format/package.json b/packages/api-format/package.json index fdf311b40b2a..5b394cb12130 100644 --- a/packages/api-format/package.json +++ b/packages/api-format/package.json @@ -30,6 +30,7 @@ "homepage": "https://github.com/polkadot-js/api/tree/master/packages/api-format#readme", "dependencies": { "@babel/runtime": "^7.0.0", + "@polkadot/api-codec": "^0.29.7", "@polkadot/jsonrpc": "^0.29.7", "@polkadot/primitives": "^0.29.7", "@polkadot/util": "^0.30.4", diff --git a/packages/api-format/src/output.ts b/packages/api-format/src/output.ts index 8dec87c74272..0278af5162d6 100644 --- a/packages/api-format/src/output.ts +++ b/packages/api-format/src/output.ts @@ -5,6 +5,7 @@ import { Param$Types } from '@polkadot/params/types'; import { FormatterFunction } from './types'; +import Metadata from '@polkadot/api-codec/Metadata'; import addressEncode from '@polkadot/util-keyring/address/encode'; import bnDecode from '@polkadot/primitives/json/bn/decode'; import bytesDecode from '@polkadot/primitives/json/bytes/decode'; @@ -16,6 +17,27 @@ import isUndefined from '@polkadot/util/is/undefined'; import format from './format'; +// NOTE Here we are trying to do things a bit differently, i.e. more in line with where we think things +// could go with the primitive classes. (Good testbed anyway for the decoding, although maybe a bit messy +// with duplication). Overall, bit hackly since it shoehorns in a potential new implementation into an +// original way of doing things + +const metaDecode = (input: Array) => { + const metadata = new Metadata(); + + try { + metadata.fromU8a( + Uint8Array.from(input) + ); + } catch (error) { + console.error('current', JSON.stringify(metadata.toJSON()), error); + + throw error; + } + + return metadata; +}; + const formatters = new Map([ // publicKey -> address ['AccountId', addressEncode], @@ -23,6 +45,7 @@ const formatters = new Map([ ['Bytes', bytesDecode], ['Hash', hashDecode], ['Header', headerDecode], + ['MetaData', metaDecode], ['SignedBlock', blockDecode], ['u64', bnDecode] ]); diff --git a/packages/api-provider/test/e2e.basics.test.js b/packages/api-provider/test/e2e.basics.test.js new file mode 100644 index 000000000000..05a1417dbc5e --- /dev/null +++ b/packages/api-provider/test/e2e.basics.test.js @@ -0,0 +1,62 @@ +// Copyright 2017-2018 @polkadot/api-provider authors & contributors +// This software may be modified and distributed under the terms +// of the ISC license. See the LICENSE file for details. + +import Api from '../../api/src'; +import Ws from '../src/ws'; + +describe.skip('e2e basics', () => { + let api; + + beforeEach(() => { + jest.setTimeout(30000); + api = new Api(new Ws('ws://127.0.0.1:9944')); + }); + + it('subscribes to chain_newHead', (done) => { + let count = 0; + + // tslint:disable-next-line + api.chain + .newHead((error, data) => { + if (error) { + return done(error); + } + + expect(data).toBeDefined(); + + if (++count === 3) { + done(); + } + }) + .then((subscriptionId) => { + console.log('newHead: subscriptionId =', subscriptionId); + }); + }); + + it('retrieves the pending extrinsics', () => { + return api.author + .pendingExtrinsics() + .then((extrinsics) => { + console.error('extrinsics', extrinsics); + }) + .catch((error) => { + console.error(error); + + throw error; + }); + }); + + it('retrieves the wasm metadata', () => { + return api.state + .getMetadata() + .then((meta) => { + console.error(JSON.stringify(meta.toJSON())); + }) + .catch((error) => { + console.error(error); + + throw error; + }); + }); +}); diff --git a/packages/api-provider/test/e2e.test.js b/packages/api-provider/test/e2e.krummelanke.test.js similarity index 70% rename from packages/api-provider/test/e2e.test.js rename to packages/api-provider/test/e2e.krummelanke.test.js index 837f8b072133..18856f8b2813 100644 --- a/packages/api-provider/test/e2e.test.js +++ b/packages/api-provider/test/e2e.krummelanke.test.js @@ -7,7 +7,7 @@ import storage from '@polkadot/storage'; import Api from '../../api/src'; import Ws from '../src/ws'; -describe.skip('e2e', () => { +describe.skip('e2e krumme lanke', () => { let api; beforeEach(() => { @@ -15,27 +15,6 @@ describe.skip('e2e', () => { api = new Api(new Ws('ws://127.0.0.1:9944')); }); - it('subscribes to chain_newHead', (done) => { - let count = 0; - - // tslint:disable-next-line - api.chain - .newHead((error, data) => { - if (error) { - return done(error); - } - - expect(data).toBeDefined(); - - if (++count === 3) { - done(); - } - }) - .then((subscriptionId) => { - console.log('newHead: subscriptionId =', subscriptionId); - }); - }); - it('subscribes to storage', (done) => { api.state .subscribeStorage( @@ -85,17 +64,4 @@ describe.skip('e2e', () => { throw error; }); }); - - it('retrieves the pending extrinsics', () => { - return api.author - .pendingExtrinsics() - .then((extrinsics) => { - console.error('extrinsics', extrinsics); - }) - .catch((error) => { - console.error(error); - - throw error; - }); - }); }); diff --git a/packages/type-jsonrpc/src/state.ts b/packages/type-jsonrpc/src/state.ts index 403b75f4f4f9..8402a06079e1 100644 --- a/packages/type-jsonrpc/src/state.ts +++ b/packages/type-jsonrpc/src/state.ts @@ -27,6 +27,20 @@ const callAt: CreateItemOptions = { type: 'Bytes' }; +const getMetadata: CreateItemOptions = { + description: 'Returns the runtime metadata', + params: [], + type: 'MetaData' +}; + +const getMetadataAt: CreateItemOptions = { + description: 'Returns the runtime metadata', + params: [ + param('block', 'Hash') + ], + type: 'MetaData' +}; + const getStorage: CreateItemOptions = { description: 'Retrieves the storage for a key', params: [ @@ -110,6 +124,10 @@ export default (name: Interface$Sections): Section>>; @@ -48,12 +48,15 @@ export type BlockDecoded = { justification: BlockJustificationDecoded }; +export type MetaData = { +}; + export type KeyValue = { key: Uint8Array, value: Uint8Array } -export type Param$Value = Digest | Header | KeyValue | MisbehaviorReport | ExtrinsicDecoded | BN | Date | Uint8Array | boolean | number | string | null; +export type Param$Value = Digest | Header | KeyValue | MetaData | MisbehaviorReport | ExtrinsicDecoded | BN | Date | Uint8Array | boolean | number | string | null; export type Param$Value$Array = Array>>; diff --git a/tsconfig.json b/tsconfig.json index 8dee6b2cc86f..c51354a08c59 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,7 @@ "baseUrl": ".", "paths": { + "@polkadot/api-codec/*": ["packages/api-codec/src/*"], "@polkadot/api-format/*": ["packages/api-format/src/*"], "@polkadot/api-provider/*": ["packages/api-provider/src/*"], "@polkadot/api-rx/*": ["packages/api-rx/src/*"],