-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(billing): make all transactions via same signer implementation
- Loading branch information
1 parent
29d8b30
commit 3a59341
Showing
21 changed files
with
300 additions
and
271 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 18 additions & 3 deletions
21
...es/master-wallet/master-wallet.service.ts → apps/api/src/billing/lib/wallet/wallet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,37 @@ | ||
import { container, inject } from "tsyringe"; | ||
|
||
import { config } from "@src/billing/config"; | ||
import { BatchSigningClientService } from "@src/billing/lib/batch-signing-client/batch-signing-client.service"; | ||
import { TYPE_REGISTRY } from "@src/billing/providers/type-registry.provider"; | ||
import { MANAGED_MASTER_WALLET, UAKT_TOP_UP_MASTER_WALLET, USDC_TOP_UP_MASTER_WALLET } from "@src/billing/providers/wallet.provider"; | ||
import { MasterSigningClientService } from "@src/billing/services/master-signing-client/master-signing-client.service"; | ||
import { BillingConfigService } from "@src/billing/services/billing-config/billing-config.service"; | ||
import { MasterWalletType } from "@src/billing/types/wallet.type"; | ||
|
||
export const MANAGED_MASTER_SIGNING_CLIENT = "MANAGED_MASTER_SIGNING_CLIENT"; | ||
container.register(MANAGED_MASTER_SIGNING_CLIENT, { | ||
useFactory: c => new MasterSigningClientService(config, c.resolve(MANAGED_MASTER_WALLET), c.resolve(TYPE_REGISTRY), MANAGED_MASTER_SIGNING_CLIENT) | ||
useFactory: c => | ||
new BatchSigningClientService(c.resolve(BillingConfigService), c.resolve(MANAGED_MASTER_WALLET), c.resolve(TYPE_REGISTRY), MANAGED_MASTER_SIGNING_CLIENT) | ||
}); | ||
|
||
export const UAKT_TOP_UP_MASTER_SIGNING_CLIENT = "UAKT_TOP_UP_MASTER_SIGNING_CLIENT"; | ||
container.register(UAKT_TOP_UP_MASTER_SIGNING_CLIENT, { | ||
useFactory: c => new MasterSigningClientService(config, c.resolve(UAKT_TOP_UP_MASTER_WALLET), c.resolve(TYPE_REGISTRY), UAKT_TOP_UP_MASTER_SIGNING_CLIENT) | ||
useFactory: c => | ||
new BatchSigningClientService( | ||
c.resolve(BillingConfigService), | ||
c.resolve(UAKT_TOP_UP_MASTER_WALLET), | ||
c.resolve(TYPE_REGISTRY), | ||
UAKT_TOP_UP_MASTER_SIGNING_CLIENT | ||
) | ||
}); | ||
|
||
export const USDC_TOP_UP_MASTER_SIGNING_CLIENT = "USDC_TOP_UP_MASTER_SIGNING_CLIENT"; | ||
container.register(USDC_TOP_UP_MASTER_SIGNING_CLIENT, { | ||
useFactory: c => new MasterSigningClientService(config, c.resolve(USDC_TOP_UP_MASTER_WALLET), c.resolve(TYPE_REGISTRY), USDC_TOP_UP_MASTER_SIGNING_CLIENT) | ||
useFactory: c => | ||
new BatchSigningClientService( | ||
c.resolve(BillingConfigService), | ||
c.resolve(USDC_TOP_UP_MASTER_WALLET), | ||
c.resolve(TYPE_REGISTRY), | ||
USDC_TOP_UP_MASTER_SIGNING_CLIENT | ||
) | ||
}); | ||
|
||
export const InjectSigningClient = (walletType: MasterWalletType) => inject(`${walletType}_MASTER_SIGNING_CLIENT`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { container, inject } from "tsyringe"; | ||
|
||
import { config } from "@src/billing/config"; | ||
import { MasterWalletService } from "@src/billing/services/master-wallet/master-wallet.service"; | ||
import { Wallet } from "@src/billing/lib/wallet/wallet"; | ||
import { MasterWalletType } from "@src/billing/types/wallet.type"; | ||
|
||
export const MANAGED_MASTER_WALLET = "MANAGED_MASTER_WALLET"; | ||
container.register(MANAGED_MASTER_WALLET, { useFactory: () => new MasterWalletService(config.MASTER_WALLET_MNEMONIC) }); | ||
container.register(MANAGED_MASTER_WALLET, { useFactory: () => new Wallet(config.MASTER_WALLET_MNEMONIC) }); | ||
|
||
export const UAKT_TOP_UP_MASTER_WALLET = "UAKT_TOP_UP_MASTER_WALLET"; | ||
container.register(UAKT_TOP_UP_MASTER_WALLET, { useFactory: () => new MasterWalletService(config.UAKT_TOP_UP_MASTER_WALLET_MNEMONIC) }); | ||
container.register(UAKT_TOP_UP_MASTER_WALLET, { useFactory: () => new Wallet(config.UAKT_TOP_UP_MASTER_WALLET_MNEMONIC) }); | ||
|
||
export const USDC_TOP_UP_MASTER_WALLET = "USDC_TOP_UP_MASTER_WALLET"; | ||
container.register(USDC_TOP_UP_MASTER_WALLET, { useFactory: () => new MasterWalletService(config.USDC_TOP_UP_MASTER_WALLET_MNEMONIC) }); | ||
container.register(USDC_TOP_UP_MASTER_WALLET, { useFactory: () => new Wallet(config.USDC_TOP_UP_MASTER_WALLET_MNEMONIC) }); | ||
|
||
export const InjectWallet = (walletType: MasterWalletType) => inject(`${walletType}_MASTER_WALLET`); | ||
|
||
export const resolveWallet = (walletType: MasterWalletType) => container.resolve<MasterWalletService>(`${walletType}_MASTER_WALLET`); | ||
export const resolveWallet = (walletType: MasterWalletType) => container.resolve<Wallet>(`${walletType}_MASTER_WALLET`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.