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

Update adatper msg factory #161

Merged
merged 1 commit 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
5 changes: 5 additions & 0 deletions .changeset/fluffy-queens-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@abstract-money/core": patch
---

Update adapter execute msg factory with proper api
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ import {
export abstract class AdapterExecuteMsgFactory {
/**
* Make a request to an adapter module.
* @param accountAddress
* @param request
* @param accountAddress optionally specify the account address to execute the request on. If not specified, the request must come from the account itself.
* @param msg the message to execute on the adapter
*/
static executeAdapter = <TAppMsg>({
accountAddress,
request,
...rest
}: CamelCasedProperties<
AdapterRequestMsg<TAppMsg>
>): AdapterExecuteMsg<TAppMsg> => {
return ModuleExecuteMsgFactory.module({
account_address: accountAddress,
request,
msg: 'msg' in rest ? rest.msg : rest.request,
})
}

Expand Down
14 changes: 10 additions & 4 deletions packages/core/src/utils/modules/msg-factory/Adapter.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ export type AdapterBaseExecuteMsg = {
to_remove?: string[] | null
}
}
export type AdapterRequestMsg<TAppMsg> = {
account_address?: string | null
request: TAppMsg
}
export type AdapterRequestMsg<TAppMsg> =
| {
account_address?: string | null
msg: TAppMsg
}
| /** @deprecated */ {
account_address?: string | null
/** @deprecated */
request: TAppMsg
}

export type AdapterExecuteMsg<TAppMsg> = ModuleExecuteMsg<
AdapterBaseExecuteMsg,
Expand Down
Loading