Skip to content

Commit

Permalink
fix: support Authz Grant for Send Authorization with an empty whiteli…
Browse files Browse the repository at this point in the history
…st (#127)
  • Loading branch information
eliasmpw authored Dec 12, 2024
1 parent 803dcda commit 5ee5be9
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 5 deletions.
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

0 comments on commit 5ee5be9

Please sign in to comment.