Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support Authz Grant for Send Authorization with an empty whitelist #127

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## v0.7.5 (2024-12-12)

### Fixed

#### **arch3-core**

- Fixed Authz Amino converter support for `/cosmos.authz.v1beta1.MsgGrant`
with inner `/cosmos.bank.v1beta1.SendAuthorization` authorization,
without an `allowList`. ([#124])

## v0.7.4 (2024-12-11)

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@archwayhq/arch3.js",
"version": "0.7.4",
"version": "0.7.5",
"description": "The all-in-one library for your awesome Archway dApp",
"homepage": "https://docs.archway.io",
"repository": "github:archway-network/arch3.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/arch3-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@archwayhq/arch3-core",
"version": "0.7.4",
"version": "0.7.5",
"description": "Core library to interact with Archway Network",
"homepage": "https://docs.archway.io",
"repository": "github:archway-network/arch3.js",
Expand Down
23 changes: 22 additions & 1 deletion packages/arch3-core/src/modules/authz/tx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Amino converter for /cosmos.authz.v1beta1.MsgGrant', () => {
});
});
describe('Grants send authorization with /cosmos.authz.v1beta1.SendAuthorization', () => {
it('encodes and decodes back to the same value', () => {
it('encodes and decodes back to the same value with an allowList', () => {
const message = {
granter: granterAddress,
grantee: granteeAddress,
Expand All @@ -62,6 +62,27 @@ describe('Amino converter for /cosmos.authz.v1beta1.MsgGrant', () => {
const toAmino = aminoConverters[MsgGrant.typeUrl].toAmino(message);
const result = aminoConverters[MsgGrant.typeUrl].fromAmino(toAmino);

expect(message).toStrictEqual(result);
});
it('encodes and decodes back to the same value without an allowList', () => {
const message = {
granter: granterAddress,
grantee: granteeAddress,
grant: {
authorization: {
typeUrl: SendAuthorization.typeUrl,
value: SendAuthorization.encode(
SendAuthorization.fromPartial({
spendLimit: [{ denom: archwayd.denom, amount: '1' }],
}),
).finish(),
},
expiration: undefined,
},
};
const toAmino = aminoConverters[MsgGrant.typeUrl].toAmino(message);
const result = aminoConverters[MsgGrant.typeUrl].fromAmino(toAmino);

expect(message).toStrictEqual(result);
});
});
Expand Down
2 changes: 1 addition & 1 deletion packages/arch3-core/src/modules/authz/tx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const createAuthzAminoConverters = (): AminoConverters => {
// eslint-disable-next-line camelcase, @typescript-eslint/naming-convention
spend_limit: spend.spendLimit,
// eslint-disable-next-line camelcase, @typescript-eslint/naming-convention
allow_list: spend.allowList,
allow_list: spend.allowList?.length ? spend.allowList : undefined,
},
};
break;
Expand Down
2 changes: 1 addition & 1 deletion packages/arch3-proto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@archwayhq/arch3-proto",
"version": "0.7.4",
"version": "0.7.5",
"description": "Protobuf definitions and RPC clients for the Archway Network",
"homepage": "https://docs.archway.io",
"repository": "github:archway-network/arch3.js",
Expand Down
Loading