From 6f3572407088a0075d6958da188496de4684909b Mon Sep 17 00:00:00 2001 From: Alex Peters Date: Mon, 24 Apr 2023 11:46:03 +0200 Subject: [PATCH] Extract configured capabilities --- app/app.go | 3 +-- app/wasm.go | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 app/wasm.go diff --git a/app/app.go b/app/app.go index 758fe607cf..7f1e91936e 100644 --- a/app/app.go +++ b/app/app.go @@ -583,8 +583,7 @@ func NewWasmApp( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - // See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md - availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2" + availableCapabilities := strings.Join(AllCapabilities(), ",") app.WasmKeeper = wasm.NewKeeper( appCodec, keys[wasm.StoreKey], diff --git a/app/wasm.go b/app/wasm.go new file mode 100644 index 0000000000..a01074f9e4 --- /dev/null +++ b/app/wasm.go @@ -0,0 +1,14 @@ +package app + +// AllCapabilities returns all capabilities available with the current wasmvm +// See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md +// This functionality is going to be moved upstream: https://github.com/CosmWasm/wasmvm/issues/425 +func AllCapabilities() []string { + return []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + } +}