Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenmarcus committed Jul 26, 2024
1 parent 1e422a5 commit fbd0988
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
11 changes: 8 additions & 3 deletions packages/sdk/src/execute/execute.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import type { providers } from 'near-api-js';
import type { ComposableCall, NearExecuteOptions } from '../types';
import {
checkCallbackUrl,
Expand All @@ -7,6 +6,8 @@ import {
validateSigningOptions,
} from './execute.utils';
import { callbackSideCheck } from './checkCallback';
import type { FinalExecutionOutcome } from '@near-js/types'; // Ensure consistent type import
import type { FinalExecutionOutcome as WalletSelectorFinalExecutionOutcome } from '@near-wallet-selector/core/node_modules/@near-js/types/lib/provider/response'; // Import the type directly

/**
* Base method for executing contract calls.
Expand All @@ -19,7 +20,7 @@ export const execute = async (
{ wallet, account, callbackUrl, callbackArgs }: NearExecuteOptions,
...calls: ComposableCall[]
): Promise<
void | providers.FinalExecutionOutcome | providers.FinalExecutionOutcome[]
void | FinalExecutionOutcome | FinalExecutionOutcome[]
> => {
validateSigningOptions({ wallet, account });

Expand All @@ -34,5 +35,9 @@ export const execute = async (
callbackArgs,
);

return checkCallbackUrl(callbackFinal, callbackArgs, wallet, outcomes);
return checkCallbackUrl(
callbackFinal,
callbackArgs,
wallet,
outcomes as WalletSelectorFinalExecutionOutcome[] );
};
2 changes: 1 addition & 1 deletion packages/sdk/src/execute/execute.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const batchExecuteWithNearAccount = async (
gas: new BN(call.gas),
attachedDeposit: new BN(call.deposit),
...(callbackUrl && { walletCallbackUrl: callbackUrl }),
}),
}) as any,
);
} catch (err: unknown) {
console.error(
Expand Down
19 changes: 10 additions & 9 deletions packages/wallet/src/bitte-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import type {
} from '@near-wallet-selector/core';
import { getCallbackUrl } from './utils';
import { createAction } from '@near-wallet-selector/wallet-utils';
import type { FinalExecutionOutcome as NearFinalExecutionOutcome } from '@near-js/types';


export enum TransactionSuccessEnum {
Expand Down Expand Up @@ -36,7 +37,7 @@ interface BitteWalletAccount {
}

export type CallBackArgs = {
args: object;
args: Record<string, unknown>;
type: TransactionSuccessEnum;
}

Expand Down Expand Up @@ -200,11 +201,11 @@ export const BitteWallet: WalletBehaviourFactory<
}
const account = state.wallet.account();

return account.signAndSendTransaction({
return await account.signAndSendTransaction({
receiverId: receiverId || contractId,
actions: actions.map((action) => createAction(action)) as any,
walletCallbackUrl: callback,
});
}) as any;
};


Expand Down Expand Up @@ -235,15 +236,15 @@ export const BitteWallet: WalletBehaviourFactory<
newUrl.searchParams.set('callbackUrl', callbackUrl);

try {
const response = await fetch(newUrl.toString())
const response = await fetch(newUrl.toString());
const data = await response.json();

const { isValid } = data
return isValid
const { isValid } = data;
return isValid;
} catch (e) {
return false
return false;
}
}
};

const getAvailableBalance = async (): Promise<void> => {
// const accountId = state.wallet.getAccountId();
Expand Down Expand Up @@ -336,6 +337,6 @@ export const BitteWallet: WalletBehaviourFactory<
getAccounts,
switchAccount,
signAndSendTransactions,
verifyMessage
verifyMessage,
};
};
4 changes: 2 additions & 2 deletions packages/wallet/src/mintbase-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ export const MintbaseWallet: WalletBehaviourFactory<

return account.signAndSendTransaction({
receiverId: receiverId || contractId,
actions: actions.map((action) => createAction(action)) as nearAPI.transactions.Action[],
actions: actions.map((action) => createAction(action) as unknown as nearAPI.transactions.Action),
walletCallbackUrl: callback,
});
})as unknown as FinalExecutionOutcome;
};


Expand Down

0 comments on commit fbd0988

Please sign in to comment.