Skip to content

Commit

Permalink
fix tests after review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Sep 19, 2023
1 parent 6397a30 commit 55d39bc
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 44 deletions.
60 changes: 30 additions & 30 deletions src/generated/proto.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -62290,7 +62290,7 @@
* @interface IMsgSetBeforeSendHook
* @property {string|null} [sender] MsgSetBeforeSendHook sender
* @property {string|null} [denom] MsgSetBeforeSendHook denom
* @property {string|null} [cosmwasm_address] MsgSetBeforeSendHook cosmwasm_address
* @property {string|null} [contract_addr] MsgSetBeforeSendHook contract_addr
*/

/**
Expand Down Expand Up @@ -62325,12 +62325,12 @@
MsgSetBeforeSendHook.prototype.denom = "";

/**
* MsgSetBeforeSendHook cosmwasm_address.
* @member {string} cosmwasm_address
* MsgSetBeforeSendHook contract_addr.
* @member {string} contract_addr
* @memberof osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook
* @instance
*/
MsgSetBeforeSendHook.prototype.cosmwasm_address = "";
MsgSetBeforeSendHook.prototype.contract_addr = "";

/**
* Encodes the specified MsgSetBeforeSendHook message. Does not implicitly {@link osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook.verify|verify} messages.
Expand All @@ -62348,8 +62348,8 @@
writer.uint32(/* id 1, wireType 2 =*/10).string(message.sender);
if (message.denom != null && Object.hasOwnProperty.call(message, "denom"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.denom);
if (message.cosmwasm_address != null && Object.hasOwnProperty.call(message, "cosmwasm_address"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.cosmwasm_address);
if (message.contract_addr != null && Object.hasOwnProperty.call(message, "contract_addr"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.contract_addr);
return writer;
};

Expand Down Expand Up @@ -62391,7 +62391,7 @@
message.denom = reader.string();
break;
case 3:
message.cosmwasm_address = reader.string();
message.contract_addr = reader.string();
break;
default:
reader.skipType(tag & 7);
Expand Down Expand Up @@ -62434,9 +62434,9 @@
if (message.denom != null && message.hasOwnProperty("denom"))
if (!$util.isString(message.denom))
return "denom: string expected";
if (message.cosmwasm_address != null && message.hasOwnProperty("cosmwasm_address"))
if (!$util.isString(message.cosmwasm_address))
return "cosmwasm_address: string expected";
if (message.contract_addr != null && message.hasOwnProperty("contract_addr"))
if (!$util.isString(message.contract_addr))
return "contract_addr: string expected";
return null;
};

Expand All @@ -62456,8 +62456,8 @@
message.sender = String(object.sender);
if (object.denom != null)
message.denom = String(object.denom);
if (object.cosmwasm_address != null)
message.cosmwasm_address = String(object.cosmwasm_address);
if (object.contract_addr != null)
message.contract_addr = String(object.contract_addr);
return message;
};

Expand All @@ -62477,14 +62477,14 @@
if (options.defaults) {
object.sender = "";
object.denom = "";
object.cosmwasm_address = "";
object.contract_addr = "";
}
if (message.sender != null && message.hasOwnProperty("sender"))
object.sender = message.sender;
if (message.denom != null && message.hasOwnProperty("denom"))
object.denom = message.denom;
if (message.cosmwasm_address != null && message.hasOwnProperty("cosmwasm_address"))
object.cosmwasm_address = message.cosmwasm_address;
if (message.contract_addr != null && message.hasOwnProperty("contract_addr"))
object.contract_addr = message.contract_addr;
return object;
};

Expand Down Expand Up @@ -65432,7 +65432,7 @@
* Properties of a QueryBeforeSendHookAddressResponse.
* @memberof osmosis.tokenfactory.v1beta1
* @interface IQueryBeforeSendHookAddressResponse
* @property {string|null} [cosmwasm_address] QueryBeforeSendHookAddressResponse cosmwasm_address
* @property {string|null} [contract_addr] QueryBeforeSendHookAddressResponse contract_addr
*/

/**
Expand All @@ -65451,12 +65451,12 @@
}

/**
* QueryBeforeSendHookAddressResponse cosmwasm_address.
* @member {string} cosmwasm_address
* QueryBeforeSendHookAddressResponse contract_addr.
* @member {string} contract_addr
* @memberof osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse
* @instance
*/
QueryBeforeSendHookAddressResponse.prototype.cosmwasm_address = "";
QueryBeforeSendHookAddressResponse.prototype.contract_addr = "";

/**
* Encodes the specified QueryBeforeSendHookAddressResponse message. Does not implicitly {@link osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse.verify|verify} messages.
Expand All @@ -65470,8 +65470,8 @@
QueryBeforeSendHookAddressResponse.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.cosmwasm_address != null && Object.hasOwnProperty.call(message, "cosmwasm_address"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.cosmwasm_address);
if (message.contract_addr != null && Object.hasOwnProperty.call(message, "contract_addr"))
writer.uint32(/* id 1, wireType 2 =*/10).string(message.contract_addr);
return writer;
};

Expand Down Expand Up @@ -65507,7 +65507,7 @@
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.cosmwasm_address = reader.string();
message.contract_addr = reader.string();
break;
default:
reader.skipType(tag & 7);
Expand Down Expand Up @@ -65544,9 +65544,9 @@
QueryBeforeSendHookAddressResponse.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.cosmwasm_address != null && message.hasOwnProperty("cosmwasm_address"))
if (!$util.isString(message.cosmwasm_address))
return "cosmwasm_address: string expected";
if (message.contract_addr != null && message.hasOwnProperty("contract_addr"))
if (!$util.isString(message.contract_addr))
return "contract_addr: string expected";
return null;
};

Expand All @@ -65562,8 +65562,8 @@
if (object instanceof $root.osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse)
return object;
var message = new $root.osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse();
if (object.cosmwasm_address != null)
message.cosmwasm_address = String(object.cosmwasm_address);
if (object.contract_addr != null)
message.contract_addr = String(object.contract_addr);
return message;
};

Expand All @@ -65581,9 +65581,9 @@
options = {};
var object = {};
if (options.defaults)
object.cosmwasm_address = "";
if (message.cosmwasm_address != null && message.hasOwnProperty("cosmwasm_address"))
object.cosmwasm_address = message.cosmwasm_address;
object.contract_addr = "";
if (message.contract_addr != null && message.hasOwnProperty("contract_addr"))
object.contract_addr = message.contract_addr;
return object;
};

Expand Down
16 changes: 8 additions & 8 deletions src/generated/proto.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24931,8 +24931,8 @@ export namespace osmosis {
/** MsgSetBeforeSendHook denom */
denom?: (string|null);

/** MsgSetBeforeSendHook cosmwasm_address */
cosmwasm_address?: (string|null);
/** MsgSetBeforeSendHook contract_addr */
contract_addr?: (string|null);
}

/** Represents a MsgSetBeforeSendHook. */
Expand All @@ -24950,8 +24950,8 @@ export namespace osmosis {
/** MsgSetBeforeSendHook denom. */
public denom: string;

/** MsgSetBeforeSendHook cosmwasm_address. */
public cosmwasm_address: string;
/** MsgSetBeforeSendHook contract_addr. */
public contract_addr: string;

/**
* Encodes the specified MsgSetBeforeSendHook message. Does not implicitly {@link osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook.verify|verify} messages.
Expand Down Expand Up @@ -26388,8 +26388,8 @@ export namespace osmosis {
/** Properties of a QueryBeforeSendHookAddressResponse. */
interface IQueryBeforeSendHookAddressResponse {

/** QueryBeforeSendHookAddressResponse cosmwasm_address */
cosmwasm_address?: (string|null);
/** QueryBeforeSendHookAddressResponse contract_addr */
contract_addr?: (string|null);
}

/** Represents a QueryBeforeSendHookAddressResponse. */
Expand All @@ -26401,8 +26401,8 @@ export namespace osmosis {
*/
constructor(properties?: osmosis.tokenfactory.v1beta1.IQueryBeforeSendHookAddressResponse);

/** QueryBeforeSendHookAddressResponse cosmwasm_address. */
public cosmwasm_address: string;
/** QueryBeforeSendHookAddressResponse contract_addr. */
public contract_addr: string;

/**
* Encodes the specified QueryBeforeSendHookAddressResponse message. Does not implicitly {@link osmosis.tokenfactory.v1beta1.QueryBeforeSendHookAddressResponse.verify|verify} messages.
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/tokenfactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ export const msgSetBeforeSendHook = async (
cmNeutron: WalletWrapper,
creator: string,
denom: string,
cosmwasmAddress: string,
contractAddr: string,
): Promise<BroadcastTx200ResponseTxResponse> => {
const msgMint = new osmosis.tokenfactory.v1beta1.MsgSetBeforeSendHook({
sender: creator,
denom,
cosmwasm_address: cosmwasmAddress,
contract_addr: contractAddr,
});
const res = await cmNeutron.execTx(
{
Expand Down
11 changes: 7 additions & 4 deletions src/testcases/parallel/tokenfactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface AuthorityMetadata {
}

interface BeforeSendHook {
readonly cosmwasm_address: string;
readonly contract_addr: string;
}

describe('Neutron / Tokenfactory', () => {
Expand Down Expand Up @@ -264,7 +264,7 @@ describe('Neutron / Tokenfactory', () => {
neutronChain.sdk.url,
newTokenDenom,
);
expect(hookAfter.cosmwasm_address).toEqual(contractAddress);
expect(hookAfter.contract_addr).toEqual(contractAddress);

await neutronAccount.msgSend(contractAddress, {
amount: '1',
Expand Down Expand Up @@ -400,13 +400,14 @@ describe('Neutron / Tokenfactory', () => {
);
expect(res.admin).toEqual(contractAddress);
});

test('set_before_send_hook', async () => {
await neutronAccount.executeContract(
contractAddress,
JSON.stringify({
set_before_send_hook: {
denom,
cosm_wasm_addr: contractAddress,
contract_addr: contractAddress,
},
}),
);
Expand All @@ -424,10 +425,12 @@ describe('Neutron / Tokenfactory', () => {
JSON.stringify({
set_before_send_hook: {
denom,
cosm_wasm_addr: '',
contract_addr: '',
},
}),
);

// TODO: check that it actually sets hook by querying tokenfactory module
});

test('change admin', async () => {
Expand Down

0 comments on commit 55d39bc

Please sign in to comment.