Skip to content

Commit

Permalink
Add offchain_localStorageClear RPC method (#6070)
Browse files Browse the repository at this point in the history
  • Loading branch information
khssnv authored Jan 24, 2025
1 parent beca93e commit 97fe4ea
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/rpc-augment/src/augment/jsonrpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,10 @@ declare module '@polkadot/rpc-core/types/jsonrpc' {
version: AugmentedRpc<() => Observable<Text>>;
};
offchain: {
/**
* Clear offchain local storage under given key and prefix
**/
localStorageClear: AugmentedRpc<(kind: StorageKind | 'PERSISTENT' | 'LOCAL' | number | Uint8Array, key: Bytes | string | Uint8Array) => Observable<Null>>;
/**
* Get offchain local storage under given key and prefix
**/
Expand Down
1 change: 1 addition & 0 deletions packages/types-support/src/metadata/v14/polkadot-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export default {
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageClear",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
Expand Down
1 change: 1 addition & 0 deletions packages/types-support/src/metadata/v14/substrate-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default {
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageClear",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
Expand Down
1 change: 1 addition & 0 deletions packages/types-support/src/metadata/v15/polkadot-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export default {
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageClear",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
Expand Down
1 change: 1 addition & 0 deletions packages/types-support/src/metadata/v15/substrate-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default {
"mmr_root",
"mmr_verifyProof",
"mmr_verifyProofStateless",
"offchain_localStorageClear",
"offchain_localStorageGet",
"offchain_localStorageSet",
"payment_queryFeeDetails",
Expand Down
15 changes: 15 additions & 0 deletions packages/types/src/interfaces/offchain/rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
import type { DefinitionsRpc } from '../../types/index.js';

export const rpc: DefinitionsRpc = {
localStorageClear: {
description: 'Clear offchain local storage under given key and prefix',
isUnsafe: true,
params: [
{
name: 'kind',
type: 'StorageKind'
},
{
name: 'key',
type: 'Bytes'
}
],
type: 'Null'
},
localStorageGet: {
description: 'Get offchain local storage under given key and prefix',
isUnsafe: true,
Expand Down

0 comments on commit 97fe4ea

Please sign in to comment.