Skip to content

Commit

Permalink
Add automationTime.queryFeeDetails RPC (#9)
Browse files Browse the repository at this point in the history
* Add automationTime.queryFeeDetails RPC

* Update version in package.json
  • Loading branch information
imstar15 authored Dec 27, 2022
1 parent c5cde9c commit c745a04
Show file tree
Hide file tree
Showing 16 changed files with 441 additions and 592 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oak.js",
"version": "0.1.2",
"version": "1.8.0",
"repository": "https://github.com/oak-foundation/oak.js",
"author": "OAK Team <contact@oak.tech>",
"license": "Apache-2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-augment/edgeware.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/api-augment/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oak-network/api-augment",
"version": "0.0.12",
"version": "1.8.0",
"main": "./build/index.js",
"license": "Apache-2.0",
"scripts": {
Expand Down
10 changes: 0 additions & 10 deletions packages/api-augment/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,16 +896,6 @@ declare module '@polkadot/api-base/types/errors' {
**/
[key: string]: AugmentedError<ApiType>;
};
sudo: {
/**
* Sender must be the Sudo account
**/
RequireSudo: AugmentedError<ApiType>;
/**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
};
system: {
/**
* The origin filter prevent the call to be dispatched.
Expand Down
18 changes: 0 additions & 18 deletions packages/api-augment/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,24 +797,6 @@ declare module '@polkadot/api-base/types/events' {
**/
[key: string]: AugmentedEvent<ApiType>;
};
sudo: {
/**
* The \[sudoer\] just switched identity; the old key is supplied if one existed.
**/
KeyChanged: AugmentedEvent<ApiType, [oldSudoer: Option<AccountId32>], { oldSudoer: Option<AccountId32> }>;
/**
* A sudo just took place. \[result\]
**/
Sudid: AugmentedEvent<ApiType, [sudoResult: Result<Null, SpRuntimeDispatchError>], { sudoResult: Result<Null, SpRuntimeDispatchError> }>;
/**
* A sudo just took place. \[result\]
**/
SudoAsDone: AugmentedEvent<ApiType, [sudoResult: Result<Null, SpRuntimeDispatchError>], { sudoResult: Result<Null, SpRuntimeDispatchError> }>;
/**
* Generic event
**/
[key: string]: AugmentedEvent<ApiType>;
};
system: {
/**
* `:code` was updated.
Expand Down
10 changes: 0 additions & 10 deletions packages/api-augment/src/interfaces/augment-api-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -665,16 +665,6 @@ declare module '@polkadot/api-base/types/storage' {
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
sudo: {
/**
* The `AccountId` of the sudo key.
**/
key: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
* Generic query
**/
[key: string]: QueryableStorageEntry<ApiType>;
};
system: {
/**
* The full account information for a particular account ID.
Expand Down
6 changes: 5 additions & 1 deletion packages/api-augment/src/interfaces/augment-api-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/rpc-core/types/jsonrpc';

import type { AutomationAction, AutostakingResult } from '@oak-foundation/api-augment/interfaces/automationTime';
import type { AutomationAction, AutomationFeeDetails, AutostakingResult } from '@oak-foundation/api-augment/interfaces/automationTime';
import type { AugmentedRpc } from '@polkadot/rpc-core/types';
import type { Metadata, StorageKey } from '@polkadot/types';
import type { Bytes, HashMap, Json, Null, Option, Text, U256, U64, Vec, bool, f64, i128, u32, u64 } from '@polkadot/types-codec';
Expand Down Expand Up @@ -86,6 +86,10 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
* Retrieve automation fees
**/
getTimeAutomationFees: AugmentedRpc<(action: AutomationAction | 'Notify' | 'NativeTransfer' | 'XCMP' | 'AutoCompoundDelegatedStake' | number | Uint8Array, executions: u32 | AnyNumber | Uint8Array) => Observable<Balance>>;
/**
* The transaction fee details
**/
queryFeeDetails: AugmentedRpc<(extrinsic: Extrinsic | IExtrinsic | string | Uint8Array) => Observable<AutomationFeeDetails>>;
};
babe: {
/**
Expand Down
59 changes: 0 additions & 59 deletions packages/api-augment/src/interfaces/augment-api-tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2003,65 +2003,6 @@ declare module '@polkadot/api-base/types/submittable' {
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
sudo: {
/**
* Authenticates the current sudo key and sets the given AccountId (`new`) as the new sudo
* key.
*
* The dispatch origin for this call must be _Signed_.
*
* # <weight>
* - O(1).
* - Limited storage reads.
* - One DB change.
* # </weight>
**/
setKey: AugmentedSubmittable<(updated: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress]>;
/**
* Authenticates the sudo key and dispatches a function call with `Root` origin.
*
* The dispatch origin for this call must be _Signed_.
*
* # <weight>
* - O(1).
* - Limited storage reads.
* - One DB write (event).
* - Weight of derivative `call` execution + 10,000.
* # </weight>
**/
sudo: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call]>;
/**
* Authenticates the sudo key and dispatches a function call with `Signed` origin from
* a given account.
*
* The dispatch origin for this call must be _Signed_.
*
* # <weight>
* - O(1).
* - Limited storage reads.
* - One DB write (event).
* - Weight of derivative `call` execution + 10,000.
* # </weight>
**/
sudoAs: AugmentedSubmittable<(who: MultiAddress | { Id: any } | { Index: any } | { Raw: any } | { Address32: any } | { Address20: any } | string | Uint8Array, call: Call | IMethod | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [MultiAddress, Call]>;
/**
* Authenticates the sudo key and dispatches a function call with `Root` origin.
* This function does not check the weight of the call, and instead allows the
* Sudo user to specify the weight of the call.
*
* The dispatch origin for this call must be _Signed_.
*
* # <weight>
* - O(1).
* - The weight of this call is defined by the caller.
* # </weight>
**/
sudoUncheckedWeight: AugmentedSubmittable<(call: Call | IMethod | string | Uint8Array, weight: Weight | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [Call, Weight]>;
/**
* Generic tx
**/
[key: string]: SubmittableExtrinsicFunction<ApiType>;
};
system: {
/**
* A dispatch that will fill the block weight up to the given ratio.
Expand Down
3 changes: 2 additions & 1 deletion packages/api-augment/src/interfaces/augment-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// this is required to allow for ambient/previous definitions
import '@polkadot/types/types/registry';

import type { AutomationAction, AutostakingResult } from '@oak-foundation/api-augment/interfaces/automationTime';
import type { AutomationAction, AutomationFeeDetails, AutostakingResult } from '@oak-foundation/api-augment/interfaces/automationTime';
import type { Data, StorageKey } from '@polkadot/types';
import type { BitVec, Bool, Bytes, F32, F64, I128, I16, I256, I32, I64, I8, Json, Null, OptionBool, Raw, Text, Type, U128, U16, U256, U32, U64, U8, USize, bool, f32, f64, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types-codec';
import type { AssetApproval, AssetApprovalKey, AssetBalance, AssetDestroyWitness, AssetDetails, AssetMetadata, TAssetBalance, TAssetDepositBalance } from '@polkadot/types/interfaces/assets';
Expand Down Expand Up @@ -135,6 +135,7 @@ declare module '@polkadot/types/types/registry' {
AuthoritySignature: AuthoritySignature;
AuthorityWeight: AuthorityWeight;
AutomationAction: AutomationAction;
AutomationFeeDetails: AutomationFeeDetails;
AutostakingResult: AutostakingResult;
AvailabilityBitfield: AvailabilityBitfield;
AvailabilityBitfieldRecord: AvailabilityBitfieldRecord;
Expand Down
11 changes: 11 additions & 0 deletions packages/api-augment/src/interfaces/automationTime/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@ const automationTime = {
],
type: 'Vec<Hash>',
},
queryFeeDetails: {
description: 'The transaction fee details',
params: [
{ name: 'extrinsic', type: 'Extrinsic' },
],
type: 'AutomationFeeDetails'
},
},
types: {
AutomationAction: {
Expand All @@ -48,6 +55,10 @@ const automationTime = {
period: 'i32',
apy: 'f64',
},
AutomationFeeDetails: {
executionFee: 'Balance',
xcmpFee: 'Balance',
},
},
runtime,
}
Expand Down
7 changes: 7 additions & 0 deletions packages/api-augment/src/interfaces/automationTime/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* eslint-disable */

import type { Enum, Struct, f64, i32 } from '@polkadot/types-codec';
import type { Balance } from '@polkadot/types/interfaces/runtime';

/** @name AutomationAction */
export interface AutomationAction extends Enum {
Expand All @@ -12,6 +13,12 @@ export interface AutomationAction extends Enum {
readonly type: 'Notify' | 'NativeTransfer' | 'Xcmp' | 'AutoCompoundDelegatedStake';
}

/** @name AutomationFeeDetails */
export interface AutomationFeeDetails extends Struct {
readonly executionFee: Balance;
readonly xcmpFee: Balance;
}

/** @name AutostakingResult */
export interface AutostakingResult extends Struct {
readonly period: i32;
Expand Down
Loading

0 comments on commit c745a04

Please sign in to comment.