Skip to content

Commit

Permalink
Merge pull request #161 from AbstractSDK/fix/adapterMsh
Browse files Browse the repository at this point in the history
Update adatper msg factory
  • Loading branch information
adairrr authored Dec 12, 2024
2 parents 741f9eb + 605f095 commit 6ee51d9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
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

0 comments on commit 6ee51d9

Please sign in to comment.