Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: issues OK-23730 OK-23672 #3679

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/engine/src/vaults/impl/sol/Vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ export default class Vault extends VaultBase {
// https://docs.solana.com/developing/intro/rent
if (
rpcErrorData.code === -32002 &&
rpcErrorData.message.endsWith('without insufficient funds for rent')
rpcErrorData.message.endsWith('insufficient funds for rent')
) {
isNodeBehind = false;
throw new MinimumTransferBalanceRequiredError(
Expand Down
17 changes: 8 additions & 9 deletions packages/kit-bg/src/providers/ProviderApiSolana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import bs58 from 'bs58';
import isArray from 'lodash/isArray';
import isString from 'lodash/isString';

import { ETHMessageTypes } from '@onekeyhq/engine/src/types/message';
import { CommonMessageTypes } from '@onekeyhq/engine/src/types/message';
import { getActiveWalletAccount } from '@onekeyhq/kit/src/hooks';
import {
backgroundClass,
Expand Down Expand Up @@ -35,7 +35,7 @@ type SolanaSendOptions = {
class ProviderApiSolana extends ProviderApiBase {
public providerName = IInjectedProviderNames.solana;

private getConnectedAcccountPublicKey(
private getConnectedAccountPublicKey(
request: IJsBridgeMessagePayload,
): Promise<string> {
const [account] = this.backgroundApi.serviceDapp.getActiveConnectedAccounts(
Expand All @@ -55,7 +55,7 @@ class ProviderApiSolana extends ProviderApiBase {
params: {
accounts: [
{
publicKey: await this.getConnectedAcccountPublicKey({ origin }),
publicKey: await this.getConnectedAccountPublicKey({ origin }),
},
].filter((item) => !!item.publicKey),
},
Expand Down Expand Up @@ -168,7 +168,7 @@ class ProviderApiSolana extends ProviderApiBase {
throw web3Errors.rpc.invalidInput();
}

const publicKey = await this.getConnectedAcccountPublicKey(request);
const publicKey = await this.getConnectedAccountPublicKey(request);
const txid = (await this.backgroundApi.serviceDapp?.openSignAndSendModal(
request,
{
Expand Down Expand Up @@ -198,12 +198,11 @@ class ProviderApiSolana extends ProviderApiBase {
}

debugLogger.providerApi.info('solana signMessage', request, params);
const publicKey = await this.getConnectedAcccountPublicKey(request);
const publicKey = await this.getConnectedAccountPublicKey(request);
const signature =
await this.backgroundApi.serviceDapp?.openSignAndSendModal(request, {
unsignedMessage: {
// Use ETH_SIGN to sign plain message
type: ETHMessageTypes.ETH_SIGN,
type: CommonMessageTypes.SIGN_MESSAGE,
// TODO: different display needed?
message: bs58.decode(message).toString(),
},
Expand All @@ -221,10 +220,10 @@ class ProviderApiSolana extends ProviderApiBase {
// onlyIfTrusted: false show connection Modal
const { onlyIfTrusted = false } = params || {};

let publicKey = await this.getConnectedAcccountPublicKey(request);
let publicKey = await this.getConnectedAccountPublicKey(request);
if (!publicKey && !onlyIfTrusted) {
await this.backgroundApi.serviceDapp.openConnectionModal(request);
publicKey = await this.getConnectedAcccountPublicKey(request);
publicKey = await this.getConnectedAccountPublicKey(request);
}

if (!publicKey) {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit-bg/src/services/ServiceDapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ class ServiceDapp extends ServiceBase {
reject(error);
}
} else {
this._openModalByRouteParams({
this._openModalByRouteParamsDebounced({
routeNames,
routeParams,
modalParams,
Expand Down