Skip to content

Commit

Permalink
fix: type error
Browse files Browse the repository at this point in the history
  • Loading branch information
sidmorizon committed Dec 23, 2024
1 parent 23d7e4f commit 3631716
Show file tree
Hide file tree
Showing 6 changed files with 330 additions and 25 deletions.
6 changes: 3 additions & 3 deletions packages/example/components/chains/benfen/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ function Example() {
description="BUSD代币转账签名"
presupposeParams={signTokenTransactionParams}
onExecute={async (request: string) => {
const { from, to, amount ,token} = JSON.parse(request);
const { from, to, amount ,token} = JSON.parse(request) as { from: string, to: string, amount: number, token: string };

const transfer = new TransactionBlock();
transfer.setSender(from);
Expand Down Expand Up @@ -323,7 +323,7 @@ function Example() {
return JSON.stringify(res);
}}
onValidate={async (request: string, result: string) => {
const { transactionBlockBytes, signature } = JSON.parse(result);
const { transactionBlockBytes, signature } = JSON.parse(result) as { transactionBlockBytes: string, signature: string };
const publicKey = await verifyTransactionBlock(
Buffer.from(transactionBlockBytes, 'base64'),
signature,
Expand All @@ -340,7 +340,7 @@ function Example() {
description="BUSD代币转账签名并执行"
presupposeParams={signTokenTransactionParams}
onExecute={async (request: string) => {
const { from, to, amount, token } = JSON.parse(request);
const { from, to, amount, token } = JSON.parse(request) as { from: string, to: string, amount: number, token: string };

const transfer = new TransactionBlock();
transfer.setSender(from);
Expand Down
2 changes: 2 additions & 0 deletions packages/example/components/chains/solana/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ export default function Example() {
const tx = Transaction.from(Buffer.from(result, 'hex'));
const verified = tx.verifySignatures();

// TODO: type error, may be passed wrong options
// @ts-expect-error
const res = await connection.simulateTransaction(tx, {
sigVerify: false,
});
Expand Down
6 changes: 3 additions & 3 deletions packages/example/components/chains/suiStandard/example.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ function Example() {
description="USDC代币转账签名"
presupposeParams={signTokenTransactionParams}
onExecute={async (request: string) => {
const { from, to, amount ,token} = JSON.parse(request);
const { from, to, amount ,token} = JSON.parse(request) as { from: string, to: string, amount: number, token: string };

const transfer = new TransactionBlock();
transfer.setSender(from);
Expand Down Expand Up @@ -485,7 +485,7 @@ function Example() {
return JSON.stringify(res);
}}
onValidate={async (request: string, result: string) => {
const { transactionBlockBytes, signature } = JSON.parse(result);
const { transactionBlockBytes, signature } = JSON.parse(result) as { transactionBlockBytes: string, signature: string };
const publicKey = await verifyTransactionBlock(
Buffer.from(transactionBlockBytes, 'base64'),
signature,
Expand All @@ -502,7 +502,7 @@ function Example() {
description="USDC代币转账签名并执行"
presupposeParams={signTokenTransactionParams}
onExecute={async (request: string) => {
const { from, to, amount, token } = JSON.parse(request);
const { from, to, amount, token } = JSON.parse(request) as { from: string, to: string, amount: number, token: string };

const transfer = new TransactionBlock();
transfer.setSender(from);
Expand Down
4 changes: 4 additions & 0 deletions packages/example/components/chains/ton/params.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { Address, beginCell } = require("@ton/core");
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const { TonClient, JettonMaster } = require("@ton/ton");

const client = new TonClient({
Expand All @@ -16,7 +18,9 @@ async function getJettonWalletAddress(jettonMasterAddressStr: string, userAddres
throw new Error('Wallet address is empty');
}

// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
console.log('Wallet Address:', walletAddress.toString());
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return walletAddress.toString();
} catch (error) {
console.error('Error in getJettonWalletAddress:', error);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ export function ClientContextProvider({ children }: { children: ReactNode | Reac

useEffect(() => {
const claimedOrigin = localStorage.getItem('wallet_connect_dapp_origin') || origin;
let interval: NodeJS.Timer;
let interval: ReturnType<typeof setInterval>;
// simulates `UNKNOWN` validation by removing the verify iframe thus preventing POST message
if (claimedOrigin === 'unknown') {
//The interval is needed as Verify tries to init new iframe(with different urls) multiple times
Expand Down
Loading

0 comments on commit 3631716

Please sign in to comment.