Skip to content

Commit 6ee51d9

Browse files
authored
Merge pull request #161 from AbstractSDK/fix/adapterMsh
Update adatper msg factory
2 parents 741f9eb + 605f095 commit 6ee51d9

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.changeset/fluffy-queens-attend.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@abstract-money/core": patch
3+
---
4+
5+
Update adapter execute msg factory with proper api

packages/core/src/utils/modules/msg-factory/Adapter.msg-factory.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ import {
3333
export abstract class AdapterExecuteMsgFactory {
3434
/**
3535
* Make a request to an adapter module.
36-
* @param accountAddress
37-
* @param request
36+
* @param accountAddress optionally specify the account address to execute the request on. If not specified, the request must come from the account itself.
37+
* @param msg the message to execute on the adapter
3838
*/
3939
static executeAdapter = <TAppMsg>({
4040
accountAddress,
41-
request,
41+
...rest
4242
}: CamelCasedProperties<
4343
AdapterRequestMsg<TAppMsg>
4444
>): AdapterExecuteMsg<TAppMsg> => {
4545
return ModuleExecuteMsgFactory.module({
4646
account_address: accountAddress,
47-
request,
47+
msg: 'msg' in rest ? rest.msg : rest.request,
4848
})
4949
}
5050

packages/core/src/utils/modules/msg-factory/Adapter.types.ts

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ export type AdapterBaseExecuteMsg = {
66
to_remove?: string[] | null
77
}
88
}
9-
export type AdapterRequestMsg<TAppMsg> = {
10-
account_address?: string | null
11-
request: TAppMsg
12-
}
9+
export type AdapterRequestMsg<TAppMsg> =
10+
| {
11+
account_address?: string | null
12+
msg: TAppMsg
13+
}
14+
| /** @deprecated */ {
15+
account_address?: string | null
16+
/** @deprecated */
17+
request: TAppMsg
18+
}
1319

1420
export type AdapterExecuteMsg<TAppMsg> = ModuleExecuteMsg<
1521
AdapterBaseExecuteMsg,

0 commit comments

Comments
 (0)