Skip to content

refactor(nervous_system): create ic-nervous-system-agent crate for interacting with the NNS and SNSes - #1087

Merged
anchpop merged 1 commit into
masterfrom
@anchpop/create-nervous-system-interactions-crate
Aug 24, 2024
Merged

anchpop merged 1 commit into
masterfrom
@anchpop/create-nervous-system-interactions-crate

Conversation

@anchpop

@anchpop anchpop commented Aug 22, 2024 •

Copy link
Copy Markdown
Contributor

I thought it would make sense to have a crate where we would put various helper functions for interaction with SNSes and the NNS. Right now, the only rust helper functions I'm aware of are in some in //rs/nervous_system/tools/sync-with-released-nevous-system-wasms for interacting with SNS-W, so I moved just those for now. There are also some that were developed for use in system tests, but they are not trivial to extract so I haven't yet.

Next PR →

@anchpop
anchpop requested a review from a team as a code owner August 22, 2024 22:27
@anchpop anchpop changed the title refactor(nervous_system): create ic-nervous-system-interactions crate refactor(nervous_system): create ic-nervous-system-interactions crate for interacting with the NNS and SNSes Aug 22, 2024
@anchpop
anchpop force-pushed the @anchpop/create-nervous-system-interactions-crate branch from 3a5fc95 to 5ece81a Compare August 22, 2024 22:43
@anchpop
anchpop force-pushed the @anchpop/create-nervous-system-interactions-crate branch from 5ece81a to 414c387 Compare August 23, 2024 02:08
@anchpop
anchpop enabled auto-merge August 23, 2024 17:21
Comment thread Cargo.toml Resolved
@anchpop
anchpop force-pushed the @anchpop/create-nervous-system-interactions-crate branch 3 times, most recently from ce57b01 to 8b3eee8 Compare August 24, 2024 02:15
@anchpop anchpop changed the title refactor(nervous_system): create ic-nervous-system-interactions crate for interacting with the NNS and SNSes refactor(nervous_system): create ic-nervous-system-agent crate for interacting with the NNS and SNSes Aug 24, 2024
@anchpop
anchpop force-pushed the @anchpop/create-nervous-system-interactions-crate branch from 8b3eee8 to 7263dd2 Compare August 24, 2024 02:37
@anchpop
anchpop added this pull request to the merge queue Aug 24, 2024
Merged via the queue into master with commit 4cd7793 Aug 24, 2024
@anchpop
anchpop deleted the @anchpop/create-nervous-system-interactions-crate branch August 24, 2024 03:37
github-merge-queue Bot pushed a commit that referenced this pull request Aug 27, 2024
…ng with our canisters (#1091)

## Problem

Making requests to canisters in rust code is quite tedious because we
must get the request type, encode it, send it, check if the canister
returned an error, then decode the response. It is also

## Solution

Add a `Request` trait which can be used to contain the information
needed to perform a request: its method string, whether it's an update
call, and its response type.

Check out `interactions/sns_wasm.rs` to see how much it cleans up the
code.

## Notes

In the future I would like to automatically generate Request
implementations from our candid files or from the code that causes them
to be generated, but for now they are not that bad to implement
manually.

Right now, I only actually implement the trait for SNS-W's api, and only
use it in the `nervous_system/interaction` crate. I want to implement
this trait for other canisters' types as well, and use them in canister
code.

[← Previous PR](#1087)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants