Skip to content

Commit f7c3d93

Browse files
author
Isaac Herrera
authored
Merge pull request #32 from getsumer/ih/abstract-observer-refactor
fix: repare rpcMethodArgs
2 parents ff84086 + 509b3b1 commit f7c3d93

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sumer-sdk",
3-
"version": "6.0.0",
3+
"version": "6.0.1",
44
"description": "SDK that allows observing EVM-based provider requests",
55
"author": "Sumer Communities SL (by Wagmi Venture Studio) <[email protected]>",
66
"license": "AGPL-3.0-only",

src/core/Observer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ export abstract class Observer {
2424

2525
protected getMethodArgs({ methodArgs }: TargetExecution): string[] | Record<string, string> {
2626
if (methodArgs && methodArgs.length && methodArgs[0]['params']) {
27-
if (methodArgs[0]['params'].length > 1) {
28-
return methodArgs[0]['params'].filter((p: unknown) => typeof p === 'string')
27+
if (methodArgs[0]['params'].length >= 1) {
28+
return methodArgs[0]['params'].map((p: unknown) =>
29+
typeof p === 'string' ? p : JSON.stringify(p),
30+
)
2931
}
3032
return methodArgs[0]['params'][0]
3133
}

src/observers/TransactionObserver.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ export class TransactionObserver extends Observer {
1616
data: methodArgs['data'] ?? undefined,
1717
gas: methodArgs['gas'] ?? undefined,
1818
rpcMethodName: this.getMethodName(execution),
19-
...(Array.isArray(methodArgs) && {
20-
rpcMethodArgs: methodArgs,
21-
}),
22-
19+
rpcMethodArgs: Array.isArray(methodArgs) ? methodArgs : [JSON.stringify(methodArgs)],
2320
error: this.getTransactionError(result),
2421
metadata: this.getMetadata(execution),
2522
})

0 commit comments

Comments
 (0)