Skip to content

Commit

Permalink
fix: bbn registry
Browse files Browse the repository at this point in the history
  • Loading branch information
totraev committed Dec 2, 2024
1 parent b089b90 commit 4facf8c
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"dependencies": {
"@babylonlabs-io/babylon-proto-ts": "0.0.3-canary.3",
"@babylonlabs-io/bbn-core-ui": "^0.2.0",
"@babylonlabs-io/bbn-wallet-connect": "^0.1.4",
"@babylonlabs-io/bbn-wallet-connect": "^0.1.6",
"@babylonlabs-io/btc-staking-ts": "0.4.0-canary.3",
"@bitcoin-js/tiny-secp256k1-asmjs": "2.2.3",
"@bitcoinerlab/secp256k1": "^1.1.1",
Expand Down
11 changes: 6 additions & 5 deletions src/app/context/tomo/BBNConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const createProvider = (provider: CosmosProvider): IBBNProvider => {
connectWallet: async () => void provider.connectWallet(),
getAddress: () => provider.getAddress(),
getPublicKeyHex: async () => "",
getSigningStargateClient: () => provider.getSigningStargateClient(),
getSigningStargateClient: (options) =>
provider.getSigningStargateClient(options),
getBalance: (searchDenom) => provider.getBalance(searchDenom),
};
};
Expand All @@ -41,14 +42,14 @@ export const TomoBBNConnector = memo(() => {
}, [tomoWalletState.cosmos, walletList]);

const connect = useCallback(
async (btcWallet: any, btcProvider: CosmosProvider) => {
async (bbnWallet: any, bbnProvider: CosmosProvider) => {
if (!connector) return;

const wallet = createExternalWallet({
id: "tomo-bbn-connector",
name: btcWallet.name,
icon: btcWallet.img,
provider: createProvider(btcProvider),
name: bbnWallet.name,
icon: bbnWallet.img,
provider: createProvider(bbnProvider),
});

await connector.connect(wallet);
Expand Down
2 changes: 1 addition & 1 deletion src/app/context/tomo/BTCConnector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const createProvider = (provider: BTCProvider): IBTCProvider => {
vout: ordinal.outputValue,
})),
)
.catch((e) => []),
.catch(() => []),
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/app/context/wallet/BTCWalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export const BTCWalletProvider = ({ children }: PropsWithChildren) => {
btcWalletProvider?.getUtxos(address, amount) ?? [],
getBTCTipHeight: async () => btcWalletProvider?.getBTCTipHeight() ?? 0,
getInscriptions: async (): Promise<InscriptionIdentifier[]> =>
btcWalletProvider?.getInscriptions() ?? [],
btcWalletProvider?.getInscriptions().catch(() => []) ?? [],
}),
[btcWalletProvider],
);
Expand Down
6 changes: 5 additions & 1 deletion src/app/context/wallet/CosmosWalletProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"use client";

import {
BBNProvider,
useChainConnector,
Expand All @@ -17,6 +18,7 @@ import {

import { useError } from "@/app/context/Error/ErrorContext";
import { ErrorState } from "@/app/types/errors";
import { createBbnRegistry } from "@/utils/wallet/bbnRegistry";

interface CosmosWalletContextProps {
bech32Address: string;
Expand Down Expand Up @@ -59,7 +61,9 @@ export const CosmosWalletProvider = ({ children }: PropsWithChildren) => {

try {
const address = await provider.getAddress();
const client = await provider.getSigningStargateClient();
const client = await provider.getSigningStargateClient({
registry: createBbnRegistry(),
});
setSigningStargateClient(client);
setBBNWalletProvider(provider);
setCosmosBech32Address(address);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/wallet/bbnRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const createGeneratedType = <T>(messageType: any): GeneratedType => {
};

// Create the registry with the protos to register
export const getBbnRegistry = (): Registry => {
export const createBbnRegistry = (): Registry => {
const registry = new Registry();

protosToRegister.forEach((proto) => {
Expand Down

0 comments on commit 4facf8c

Please sign in to comment.