Object Store Gateway Contract Attributes
This library includes helper functions for appending event attributes in a CosmWasm-based
smart contract.
This is to be used in tandem with the event-stream-watching
capabilities of Object Store Gateway.
To generate access grants and revokes via the gateway, include the OsGatewayAttributeGenerator
in your Response declaration with the desired values:
```rust
mod somemod {
use cosmwasmstd::Response;
use osgatewaycontract_attributes::OsGatewayAttributeGenerator;
fn gengrantresponse() -> Response {
Response::new()
.addattributes(
OsGatewayAttributeGenerator::accessgrant(
// Scope Address
"scope1qzn7jghj8puprmdcvunm3330jutsj803zz",
// Grantee Address
"tp12vu3ww5tfta78fl3fvehacunrud4gtqqcpfwnr",
)
// An optional access grant id may be appended to requests to enable referral
// to grants after the event is processed. Fluent functions that are not
// required by the constructor function are completely optional and only have
// additional impacts on resulting grants when processed by Object Store Gateway.
.withaccessgrantid("myunique_id")
)
}
fn genrevokeresponse() -> Response {
Response::new()
.addattributes(
OsGatewayAttributeGenerator::accessrevoke(
// Scope Address
"scope1qzn7jghj8puprmdcvunm3330jutsj803zz",
// Grantee Address
"tp12vu3ww5tfta78fl3fvehacunrud4gtqqcpfwnr",
)
)
}
}
```