Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update typescript interface function definion and bump version to 2.0.0 #23

Merged
merged 8 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "1.9.0-rc.4",
"version": "2.0.0-rc.1",
"repository": "https://github.com/oak-foundation/oak.js",
"author": "OAK Team <contact@oak.tech>",
"license": "Apache-2.0",
Expand Down
1 change: 0 additions & 1 deletion packages/api-augment/edgeware.json

This file was deleted.

1 change: 1 addition & 0 deletions packages/api-augment/metadata.json

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/api-augment/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@oak-network/api-augment",
"version": "1.8.1",
"version": "2.0.0",
"main": "./build/index.js",
"license": "Apache-2.0",
"scripts": {
"generate": "npm run load:meta && npm run generate:defs && npm run generate:meta && npm run lint",
"load:meta": "bash scripts/download-metadata",
"generate:defs": "ts-node --skip-project ../../node_modules/.bin/polkadot-types-from-defs --package @oak-foundation/api-augment/interfaces --input ./src/interfaces --endpoint ./edgeware.json",
"generate:meta": "ts-node --skip-project ../../node_modules/.bin/polkadot-types-from-chain --package @oak-foundation/api-augment/interfaces --endpoint ./edgeware.json --output ./src/interfaces",
"generate:defs": "ts-node --skip-project ../../node_modules/.bin/polkadot-types-from-defs --package @oak-foundation/api-augment/interfaces --input ./src/interfaces --endpoint ./metadata.json",
"generate:meta": "ts-node --skip-project ../../node_modules/.bin/polkadot-types-from-chain --package @oak-foundation/api-augment/interfaces --endpoint ./metadata.json --output ./src/interfaces",
"lint": "tsc --noEmit --pretty",
"clean:defs": "find ./src/interfaces ! -name 'definitions.ts' ! -name 'runtime.ts' -type f -exec rm {} +"
},
Expand Down
3 changes: 1 addition & 2 deletions packages/api-augment/scripts/download-metadata
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@
curl \
-H "Content-Type: application/json" \
-d '{"id":"1", "jsonrpc":"2.0", "method": "state_getMetadata", "params":[]}' \
http://localhost:8855 > edgeware.json
#http://54.89.28.91:9933 > edgeware.json
http://localhost:9946 > metadata.json
4 changes: 0 additions & 4 deletions packages/api-augment/src/interfaces/augment-api-consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ declare module '@polkadot/api-base/types/consts' {
};
automationTime: {
executionWeightFee: u128 & AugmentedConst<ApiType>;
/**
* The currencyId for the native currency.
**/
getNativeCurrencyId: u32 & AugmentedConst<ApiType>;
/**
* The maximum weight per block.
**/
Expand Down
8 changes: 3 additions & 5 deletions packages/api-augment/src/interfaces/augment-api-errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ declare module '@polkadot/api-base/types/errors' {
* The call can no longer be decoded.
**/
CallCannotBeDecoded: AugmentedError<ApiType>;
CannotReanchor: AugmentedError<ApiType>;
/**
* There can be no duplicate tasks.
**/
Expand All @@ -126,10 +127,6 @@ declare module '@polkadot/api-base/types/errors' {
* The message cannot be empty.
**/
EmptyMessage: AugmentedError<ApiType>;
/**
* The provided_id cannot be empty
**/
EmptyProvidedId: AugmentedError<ApiType>;
/**
* Incoverible currency ID.
**/
Expand Down Expand Up @@ -174,6 +171,7 @@ declare module '@polkadot/api-base/types/errors' {
* Sender cannot transfer money to self.
**/
TransferToSelf: AugmentedError<ApiType>;
UnsupportedFeePayment: AugmentedError<ApiType>;
/**
* Generic error
**/
Expand Down Expand Up @@ -1123,7 +1121,6 @@ declare module '@polkadot/api-base/types/errors' {
[key: string]: AugmentedError<ApiType>;
};
xcmpHandler: {
AssetNotFound: AugmentedError<ApiType>;
/**
* The version of the `VersionedMultiLocation` value used is not able
* to be interpreted.
Expand All @@ -1149,6 +1146,7 @@ declare module '@polkadot/api-base/types/errors' {
* Either the weight or fee per second is too large.
**/
FeeOverflow: AugmentedError<ApiType>;
TransactInfoNotFound: AugmentedError<ApiType>;
/**
* Either the instruction weight or the transact weight is too large.
**/
Expand Down
54 changes: 22 additions & 32 deletions packages/api-augment/src/interfaces/augment-api-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import '@polkadot/api-base/types/events';

import type { ApiTypes, AugmentedEvent } from '@polkadot/api-base/types';
import type { Bytes, Null, Option, Result, U8aFixed, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { BTreeMap, Bytes, Null, Option, Result, U8aFixed, bool, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';
import type { ITuple } from '@polkadot/types-codec/types';
import type { AccountId32, H256, Perbill, Percent } from '@polkadot/types/interfaces/runtime';
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, OrmlTraitsAssetRegistryAssetMetadata, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletMultisigTimepoint, PalletParachainStakingDelegationRequestsCancelledScheduledRequest, PalletParachainStakingDelegatorAdded, SpRuntimeDispatchError, SpRuntimeDispatchErrorWithPostInfo, SpWeightsWeightV2Weight, TuringRuntimeProxyType, XcmV3MultiAsset, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';
import type { FrameSupportDispatchDispatchInfo, FrameSupportTokensMiscBalanceStatus, OrmlTraitsAssetRegistryAssetMetadata, PalletDemocracyVoteAccountVote, PalletDemocracyVoteThreshold, PalletMultisigTimepoint, PalletParachainStakingDelegationRequestsCancelledScheduledRequest, PalletParachainStakingDelegatorAdded, SpRuntimeDispatchError, SpWeightsWeightV2Weight, TuringRuntimeProxyType, XcmV3MultiAsset, XcmV3MultiLocation, XcmV3MultiassetMultiAssets, XcmV3Response, XcmV3TraitsError, XcmV3TraitsOutcome, XcmV3Xcm, XcmVersionedMultiAssets, XcmVersionedMultiLocation } from '@polkadot/types/lookup';

export type __AugmentedEvent<ApiType extends ApiTypes> = AugmentedEvent<ApiType>;

Expand Down Expand Up @@ -48,64 +48,54 @@ declare module '@polkadot/api-base/types/events' {
[key: string]: AugmentedEvent<ApiType>;
};
automationTime: {
AutoCompoundDelegatorStakeFailed: AugmentedEvent<ApiType, [taskId: H256, errorMessage: Bytes, error: SpRuntimeDispatchErrorWithPostInfo], { taskId: H256, errorMessage: Bytes, error: SpRuntimeDispatchErrorWithPostInfo }>;
/**
* The call for the DynamicDispatch action can no longer be decoded.
**/
CallCannotBeDecoded: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256], { who: AccountId32, taskId: H256 }>;
/**
* The result of the DynamicDispatch action.
**/
DynamicDispatchResult: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256, result: Result<Null, SpRuntimeDispatchError>], { who: AccountId32, taskId: H256, result: Result<Null, SpRuntimeDispatchError> }>;
/**
* Notify event for the task.
**/
Notify: AugmentedEvent<ApiType, [message: Bytes], { message: Bytes }>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t this Notify in automationTime deleted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the Notify event is still there to support other test. We don't expose the extrins etc but the event still in the Event enum. Let me try to remove them all from the blockchain.

SuccesfullyAutoCompoundedDelegatorStake: AugmentedEvent<ApiType, [taskId: H256, amount: u128], { taskId: H256, amount: u128 }>;
/**
* Successfully transferred funds
**/
SuccessfullyTransferredFunds: AugmentedEvent<ApiType, [taskId: H256], { taskId: H256 }>;
SuccessfullyTransferredFunds: AugmentedEvent<ApiType, [taskId: Bytes], { taskId: Bytes }>;
/**
* Cancelled a task.
**/
TaskCancelled: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256], { who: AccountId32, taskId: H256 }>;
/**
* A recurring task attempted but failed to be rescheduled
**/
TaskFailedToReschedule: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256, error: SpRuntimeDispatchError], { who: AccountId32, taskId: H256, error: SpRuntimeDispatchError }>;
TaskCancelled: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes], { who: AccountId32, taskId: Bytes }>;
TaskCompleted: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes], { who: AccountId32, taskId: Bytes }>;
TaskExecuted: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes], { who: AccountId32, taskId: Bytes }>;
TaskExecutionFailed: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError], { who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError }>;
/**
* The task could not be run at the scheduled time.
**/
TaskMissed: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256, executionTime: u64], { who: AccountId32, taskId: H256, executionTime: u64 }>;
TaskMissed: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, executionTime: u64], { who: AccountId32, taskId: Bytes, executionTime: u64 }>;
/**
* A Task was not found.
**/
TaskNotFound: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256], { who: AccountId32, taskId: H256 }>;
TaskNotFound: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes], { who: AccountId32, taskId: Bytes }>;
/**
* A recurring task was not rescheduled
**/
TaskNotRescheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256, error: SpRuntimeDispatchError], { who: AccountId32, taskId: H256, error: SpRuntimeDispatchError }>;
TaskNotRescheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError], { who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError }>;
/**
* A recurring task was rescheduled
**/
TaskRescheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256], { who: AccountId32, taskId: H256 }>;
TaskRescheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, scheduleAs: Option<AccountId32>], { who: AccountId32, taskId: Bytes, scheduleAs: Option<AccountId32> }>;
/**
* A recurring task attempted but failed to be rescheduled
**/
TaskRescheduleFailed: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError], { who: AccountId32, taskId: Bytes, error: SpRuntimeDispatchError }>;
/**
* Schedule task success.
**/
TaskScheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: H256], { who: AccountId32, taskId: H256 }>;
TaskScheduled: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, scheduleAs: Option<AccountId32>], { who: AccountId32, taskId: Bytes, scheduleAs: Option<AccountId32> }>;
TaskTriggered: AugmentedEvent<ApiType, [who: AccountId32, taskId: Bytes, condition: BTreeMap<Bytes, Bytes>, encodedCall: Option<Bytes>], { who: AccountId32, taskId: Bytes, condition: BTreeMap<Bytes, Bytes>, encodedCall: Option<Bytes> }>;
/**
* Transfer Failed
**/
TransferFailed: AugmentedEvent<ApiType, [taskId: H256, error: SpRuntimeDispatchError], { taskId: H256, error: SpRuntimeDispatchError }>;
TransferFailed: AugmentedEvent<ApiType, [taskId: Bytes, error: SpRuntimeDispatchError], { taskId: Bytes, error: SpRuntimeDispatchError }>;
/**
* Failed to send XCMP
**/
XcmpTaskFailed: AugmentedEvent<ApiType, [taskId: H256, paraId: u32, error: SpRuntimeDispatchError], { taskId: H256, paraId: u32, error: SpRuntimeDispatchError }>;
/**
* Successfully sent XCMP
**/
XcmpTaskSucceeded: AugmentedEvent<ApiType, [taskId: H256, paraId: u32], { taskId: H256, paraId: u32 }>;
XcmpTaskFailed: AugmentedEvent<ApiType, [taskId: Bytes, destination: XcmV3MultiLocation, error: SpRuntimeDispatchError], { taskId: Bytes, destination: XcmV3MultiLocation, error: SpRuntimeDispatchError }>;
/**
* Generic event
**/
Expand Down Expand Up @@ -1158,8 +1148,8 @@ declare module '@polkadot/api-base/types/events' {
[key: string]: AugmentedEvent<ApiType>;
};
xcmpHandler: {
DestAssetConfigChanged: AugmentedEvent<ApiType, [assetLocation: XcmV3MultiLocation], { assetLocation: XcmV3MultiLocation }>;
DestAssetConfigRemoved: AugmentedEvent<ApiType, [assetLocation: XcmV3MultiLocation], { assetLocation: XcmV3MultiLocation }>;
TransactInfoChanged: AugmentedEvent<ApiType, [destination: XcmV3MultiLocation], { destination: XcmV3MultiLocation }>;
TransactInfoRemoved: AugmentedEvent<ApiType, [destination: XcmV3MultiLocation], { destination: XcmV3MultiLocation }>;
/**
* XCM fees failed to transfer.
**/
Expand All @@ -1171,7 +1161,7 @@ declare module '@polkadot/api-base/types/events' {
/**
* XCM sent to target chain.
**/
XcmSent: AugmentedEvent<ApiType, [paraId: u32], { paraId: u32 }>;
XcmSent: AugmentedEvent<ApiType, [destination: XcmV3MultiLocation], { destination: XcmV3MultiLocation }>;
/**
* XCM transacted in local chain.
**/
Expand Down
Loading