Skip to content

Commit 4c4af13

Browse files
authored
Merge pull request #2340 from CosmWasm/add-eureka-send-packet
feat: Add EurekaMsg
2 parents 9c7b750 + f4daded commit 4c4af13

File tree

10 files changed

+570
-0
lines changed

10 files changed

+570
-0
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ and this project adheres to
1212

1313
- cosmwasm-schema: The schema export now doesn't overwrite existing
1414
`additionalProperties` values anymore ([#2310])
15+
- cosmwasm-std: Added new `EurekaMsg` and `CosmosMsg::Eureka` variant ([#2340])
1516

1617
[#2310]: https://github.com/CosmWasm/cosmwasm/pull/2310
18+
[#2340]: https://github.com/CosmWasm/cosmwasm/pull/2340
1719

1820
## [2.2.0] - 2024-12-17
1921

contracts/ibc-reflect-send/schema/ibc-reflect-send.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,18 @@
305305
}
306306
},
307307
"additionalProperties": false
308+
},
309+
{
310+
"type": "object",
311+
"required": [
312+
"eureka"
313+
],
314+
"properties": {
315+
"eureka": {
316+
"$ref": "#/definitions/EurekaMsg"
317+
}
318+
},
319+
"additionalProperties": false
308320
}
309321
]
310322
},
@@ -364,6 +376,78 @@
364376
"type": "object",
365377
"additionalProperties": false
366378
},
379+
"EurekaMsg": {
380+
"description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts",
381+
"oneOf": [
382+
{
383+
"description": "Sends an IBC packet with given payloads over the existing channel.",
384+
"type": "object",
385+
"required": [
386+
"send_packet"
387+
],
388+
"properties": {
389+
"send_packet": {
390+
"type": "object",
391+
"required": [
392+
"channel_id",
393+
"payloads",
394+
"timeout"
395+
],
396+
"properties": {
397+
"channel_id": {
398+
"description": "existing channel to send the tokens over",
399+
"type": "string"
400+
},
401+
"payloads": {
402+
"type": "array",
403+
"items": {
404+
"$ref": "#/definitions/EurekaPayload"
405+
}
406+
},
407+
"timeout": {
408+
"$ref": "#/definitions/Timestamp"
409+
}
410+
},
411+
"additionalProperties": false
412+
}
413+
},
414+
"additionalProperties": false
415+
}
416+
]
417+
},
418+
"EurekaPayload": {
419+
"description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.",
420+
"type": "object",
421+
"required": [
422+
"destination_port",
423+
"encoding",
424+
"value",
425+
"version"
426+
],
427+
"properties": {
428+
"destination_port": {
429+
"description": "The port id on the chain where the packet is sent to (external chain).",
430+
"type": "string"
431+
},
432+
"encoding": {
433+
"description": "Encoding used to serialize the [EurekaPayload::value].",
434+
"type": "string"
435+
},
436+
"value": {
437+
"description": "Encoded payload data.",
438+
"allOf": [
439+
{
440+
"$ref": "#/definitions/Binary"
441+
}
442+
]
443+
},
444+
"version": {
445+
"description": "Version of the receiving contract.",
446+
"type": "string"
447+
}
448+
},
449+
"additionalProperties": false
450+
},
367451
"GovMsg": {
368452
"description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```",
369453
"oneOf": [

contracts/ibc-reflect-send/schema/ibc/packet_msg.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,18 @@
246246
}
247247
},
248248
"additionalProperties": false
249+
},
250+
{
251+
"type": "object",
252+
"required": [
253+
"eureka"
254+
],
255+
"properties": {
256+
"eureka": {
257+
"$ref": "#/definitions/EurekaMsg"
258+
}
259+
},
260+
"additionalProperties": false
249261
}
250262
]
251263
},
@@ -305,6 +317,78 @@
305317
"type": "object",
306318
"additionalProperties": false
307319
},
320+
"EurekaMsg": {
321+
"description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts",
322+
"oneOf": [
323+
{
324+
"description": "Sends an IBC packet with given payloads over the existing channel.",
325+
"type": "object",
326+
"required": [
327+
"send_packet"
328+
],
329+
"properties": {
330+
"send_packet": {
331+
"type": "object",
332+
"required": [
333+
"channel_id",
334+
"payloads",
335+
"timeout"
336+
],
337+
"properties": {
338+
"channel_id": {
339+
"description": "existing channel to send the tokens over",
340+
"type": "string"
341+
},
342+
"payloads": {
343+
"type": "array",
344+
"items": {
345+
"$ref": "#/definitions/EurekaPayload"
346+
}
347+
},
348+
"timeout": {
349+
"$ref": "#/definitions/Timestamp"
350+
}
351+
},
352+
"additionalProperties": false
353+
}
354+
},
355+
"additionalProperties": false
356+
}
357+
]
358+
},
359+
"EurekaPayload": {
360+
"description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.",
361+
"type": "object",
362+
"required": [
363+
"destination_port",
364+
"encoding",
365+
"value",
366+
"version"
367+
],
368+
"properties": {
369+
"destination_port": {
370+
"description": "The port id on the chain where the packet is sent to (external chain).",
371+
"type": "string"
372+
},
373+
"encoding": {
374+
"description": "Encoding used to serialize the [EurekaPayload::value].",
375+
"type": "string"
376+
},
377+
"value": {
378+
"description": "Encoded payload data.",
379+
"allOf": [
380+
{
381+
"$ref": "#/definitions/Binary"
382+
}
383+
]
384+
},
385+
"version": {
386+
"description": "Version of the receiving contract.",
387+
"type": "string"
388+
}
389+
},
390+
"additionalProperties": false
391+
},
308392
"GovMsg": {
309393
"description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```",
310394
"oneOf": [

contracts/ibc-reflect-send/schema/raw/execute.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,18 @@
294294
}
295295
},
296296
"additionalProperties": false
297+
},
298+
{
299+
"type": "object",
300+
"required": [
301+
"eureka"
302+
],
303+
"properties": {
304+
"eureka": {
305+
"$ref": "#/definitions/EurekaMsg"
306+
}
307+
},
308+
"additionalProperties": false
297309
}
298310
]
299311
},
@@ -353,6 +365,78 @@
353365
"type": "object",
354366
"additionalProperties": false
355367
},
368+
"EurekaMsg": {
369+
"description": "These are messages in the IBC lifecycle using the new Eureka approach. Only usable by IBC-enabled contracts",
370+
"oneOf": [
371+
{
372+
"description": "Sends an IBC packet with given payloads over the existing channel.",
373+
"type": "object",
374+
"required": [
375+
"send_packet"
376+
],
377+
"properties": {
378+
"send_packet": {
379+
"type": "object",
380+
"required": [
381+
"channel_id",
382+
"payloads",
383+
"timeout"
384+
],
385+
"properties": {
386+
"channel_id": {
387+
"description": "existing channel to send the tokens over",
388+
"type": "string"
389+
},
390+
"payloads": {
391+
"type": "array",
392+
"items": {
393+
"$ref": "#/definitions/EurekaPayload"
394+
}
395+
},
396+
"timeout": {
397+
"$ref": "#/definitions/Timestamp"
398+
}
399+
},
400+
"additionalProperties": false
401+
}
402+
},
403+
"additionalProperties": false
404+
}
405+
]
406+
},
407+
"EurekaPayload": {
408+
"description": "Payload value should be encoded in a format defined by the channel version, and the module on the other side should know how to parse this.",
409+
"type": "object",
410+
"required": [
411+
"destination_port",
412+
"encoding",
413+
"value",
414+
"version"
415+
],
416+
"properties": {
417+
"destination_port": {
418+
"description": "The port id on the chain where the packet is sent to (external chain).",
419+
"type": "string"
420+
},
421+
"encoding": {
422+
"description": "Encoding used to serialize the [EurekaPayload::value].",
423+
"type": "string"
424+
},
425+
"value": {
426+
"description": "Encoded payload data.",
427+
"allOf": [
428+
{
429+
"$ref": "#/definitions/Binary"
430+
}
431+
]
432+
},
433+
"version": {
434+
"description": "Version of the receiving contract.",
435+
"type": "string"
436+
}
437+
},
438+
"additionalProperties": false
439+
},
356440
"GovMsg": {
357441
"description": "This message type allows the contract interact with the [x/gov] module in order to cast votes.\n\n[x/gov]: https://github.com/cosmos/cosmos-sdk/tree/v0.45.12/x/gov\n\n## Examples\n\nCast a simple vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); use cosmwasm_std::{GovMsg, VoteOption};\n\n#[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::Vote { proposal_id: 4, option: VoteOption::Yes, })) } ```\n\nCast a weighted vote:\n\n``` # use cosmwasm_std::{ # HexBinary, # Storage, Api, Querier, DepsMut, Deps, entry_point, Env, StdError, MessageInfo, # Response, QueryResponse, # }; # type ExecuteMsg = (); # #[cfg(feature = \"cosmwasm_1_2\")] use cosmwasm_std::{Decimal, GovMsg, VoteOption, WeightedVoteOption};\n\n# #[cfg(feature = \"cosmwasm_1_2\")] #[entry_point] pub fn execute( deps: DepsMut, env: Env, info: MessageInfo, msg: ExecuteMsg, ) -> Result<Response, StdError> { // ... Ok(Response::new().add_message(GovMsg::VoteWeighted { proposal_id: 4, options: vec![ WeightedVoteOption { option: VoteOption::Yes, weight: Decimal::percent(65), }, WeightedVoteOption { option: VoteOption::Abstain, weight: Decimal::percent(35), }, ], })) } ```",
358442
"oneOf": [

0 commit comments

Comments
 (0)