Skip to content

Commit 13262d5

Browse files
committed
fix(safe): use api kit strategy in multisig upsert
Without this patch the Multisig upsert strategy is trying to construct the SafeAPIKit instance using the default constructor. The problem is that on Filecoin and Filecoin Calibration the transaction service is hosted by a third party and thus needs a custom txServiceUrl in the config.
1 parent 38d4b35 commit 13262d5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/lib/users/MultisigUpsertStrategy.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { z } from "zod";
2-
import SafeApiKit, { type SafeApiKitConfig } from "@safe-global/api-kit";
2+
import SafeApiKit from "@safe-global/api-kit";
33

44
import { SignatureRequestPurpose } from "../../graphql/schemas/typeDefs/signatureRequestTypeDefs.js";
55
import { SupabaseDataService } from "../../services/SupabaseDataService.js";
66
import { UserResponse } from "../../types/api.js";
77
import { isTypedMessage } from "../../utils/signatures.js";
8+
import { SafeApiStrategyFactory } from "../safe/SafeApiKitStrategy.js";
89

910
import type { UserUpsertStrategy } from "./UserUpsertStrategy.js";
1011
import type { MultisigUpdateRequest } from "./schemas.js";
@@ -30,17 +31,16 @@ export default class MultisigUpdateStrategy implements UserUpsertStrategy {
3031
private readonly dataService: SupabaseDataService;
3132
// Safe SDKs only support CommonJS, so TS interprets `SafeApiKit` as a namespace.
3233
// https://docs.safe.global/sdk/overview
33-
// Hence the explicit `default` here and on the instantiation further down.
34+
// Hence the explicit `default` here.
3435
private readonly safeApiKit: SafeApiKit.default;
3536

3637
constructor(
3738
private readonly address: string,
3839
private readonly request: MultisigUpdateRequest,
3940
) {
40-
const config: SafeApiKitConfig = {
41-
chainId: BigInt(request.chain_id),
42-
};
43-
this.safeApiKit = new SafeApiKit.default(config);
41+
this.safeApiKit = SafeApiStrategyFactory.getStrategy(
42+
this.request.chain_id,
43+
).createInstance();
4444
this.dataService = new SupabaseDataService();
4545
}
4646

0 commit comments

Comments
 (0)