Skip to content

Commit

Permalink
fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
zaidarain1 committed Jan 30, 2025
1 parent d6272c6 commit d7dacd1
Show file tree
Hide file tree
Showing 9 changed files with 195 additions and 124 deletions.
8 changes: 1 addition & 7 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ on:
branches:
- main

permissions:
pull-requests: read

env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.TS_IMMUTABLE_SDK_NX_TOKEN }}

Expand Down Expand Up @@ -44,11 +41,8 @@ jobs:
- name: setup
uses: ./.github/actions/setup

- name: reset nx
run: pnpm nx reset

- name: Build, Lint & Test
run: pnpm nx run-many -t build,lint,test -p @imtbl/sdk,@imtbl/checkout-widgets
run: pnpm --if-present nx affected -t build,lint,test

build-lint-test-examples:
name: Build, Lint & Test Examples
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"devDependencies": {
"@actions/core": "^1.10.1",
"@emotion/react": "^11.11.3",
"@nx/js": "^20.2.1",
"@nx/js": "^19.7.2",
"@swc-node/register": "^1.10.9",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.3.36",
Expand All @@ -28,7 +28,7 @@
"husky": "^8.0.3",
"lint-staged": "^13.2.0",
"node-gyp": "^9.3.1",
"nx": "^20.2.1",
"nx": "^19.7.2",
"process": "^0.11.10",
"string_decoder": "^1.3.0",
"syncpack": "^13.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/checkout/sdk/src/provider/validateProvider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ describe('provider validation', () => {
validateProvider(testCheckoutConfig, testBrowserProvider),
).rejects.toThrowError(
// eslint-disable-next-line max-len
'[WEB3_PROVIDER_ERROR] Cause:network changed: 13473 => 1 (event="changed", code=NETWORK_ERROR, version=6.13.4)',
'[WEB3_PROVIDER_ERROR] Cause:network changed: 13473 => 1 (event="changed", code=NETWORK_ERROR, version=6.13.5)',
);
});

Expand Down Expand Up @@ -130,7 +130,7 @@ describe('provider validation', () => {
),
).rejects.toThrowError(
// eslint-disable-next-line max-len
'[WEB3_PROVIDER_ERROR] Cause:network changed: 1 => 250 (event="changed", code=NETWORK_ERROR, version=6.13.4)',
'[WEB3_PROVIDER_ERROR] Cause:network changed: 1 => 250 (event="changed", code=NETWORK_ERROR, version=6.13.5)',
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
} from '@imtbl/checkout-sdk';

import { MenuItemProps } from '@biom3/react';
import { BrowserProvider } from 'ethers';
import { UnableToConnectDrawer } from '../../../components/UnableToConnectDrawer/UnableToConnectDrawer';
import { WalletDrawer } from '../../../components/WalletDrawer/WalletDrawer';
import { WalletChangeEvent } from '../../../components/WalletDrawer/WalletDrawerEvents';
Expand All @@ -23,7 +22,7 @@ type PurchaseConnectWalletDrawerProps = {
visible: boolean;
onClose: (address?: string) => void;
onConnect?: (
provider: BrowserProvider,
provider: WrappedBrowserProvider,
providerInfo: EIP6963ProviderInfo
) => void;
onError?: (errorType: ConnectEIP6963ProviderError) => void;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { EIP6963ProviderDetail, EIP6963ProviderInfo } from '@imtbl/checkout-sdk';
import { EIP6963ProviderDetail, EIP6963ProviderInfo, WrappedBrowserProvider } from '@imtbl/checkout-sdk';
import { useMemo } from 'react';
import { MenuItem } from '@biom3/react';
import { useTranslation } from 'react-i18next';
import { BrowserProvider } from 'ethers';
import { PurchaseConnectWalletDrawer } from './PurchaseConnectWalletDrawer';
import { useProvidersContext } from '../../../context/providers-context/ProvidersContext';

type PurchasePayWithWalletDrawerProps = {
visible: boolean;
onClose: (fromAddress?: string) => void;
onConnect: (providerType: 'from' | 'to', provider: BrowserProvider, providerInfo: EIP6963ProviderInfo) => void;
onConnect: (providerType: 'from' | 'to', provider: WrappedBrowserProvider, providerInfo: EIP6963ProviderInfo) => void;
onPayWithCard?: () => void;
walletOptions: EIP6963ProviderDetail[];
insufficientBalance?: boolean;
Expand Down Expand Up @@ -39,7 +38,7 @@ export function PurchasePayWithWalletDrawer({
return [];
}, [t, insufficientBalance, fromProviderInfo]);

const handleOnConnect = (provider: BrowserProvider, providerInfo: EIP6963ProviderInfo) => {
const handleOnConnect = (provider: WrappedBrowserProvider, providerInfo: EIP6963ProviderInfo) => {
onConnect('from', provider, providerInfo);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { ChainType } from '@0xsquid/squid-types';
import {
Stack, ButtCon, Button,
} from '@biom3/react';
import { Web3Provider } from '@ethersproject/providers';
import {
Checkout, WalletProviderRdns, EIP6963ProviderInfo, ChainId,
WrappedBrowserProvider,
} from '@imtbl/checkout-sdk';
import { Environment } from '@imtbl/config';
import { t } from 'i18next';
Expand Down Expand Up @@ -124,7 +124,7 @@ export function Purchase({

const handleWalletConnected = (
providerType: 'from' | 'to',
provider: Web3Provider,
provider: WrappedBrowserProvider,
providerInfo: EIP6963ProviderInfo,
) => {
sendConnectProviderSuccessEvent(
Expand Down Expand Up @@ -254,7 +254,7 @@ export function Purchase({
const squidMulticallAddress = '0xad6cea45f98444a922a2b4fe96b8c90f0862d2f4';

const handleDirectCryptoPayment = async (
provider: Web3Provider,
provider: WrappedBrowserProvider,
spenderAddress: string,
recipientAddress: string,
tokenAddress: string,
Expand All @@ -271,15 +271,15 @@ export function Purchase({

showHandover(PurchaseHandoverStep.PREPARING, {});

const gasPrice = await provider.getGasPrice();
const { gasPrice } = await provider.getFeeData();

const approveTxn = signResponse.transactions.find(
(txn) => txn.methodCall.startsWith('approve'),
);
if (!approveTxn) return;
showHandover(PurchaseHandoverStep.REQUEST_APPROVAL, {});

const approveTxnResponse = await signer.sendTransaction({
const approveTxnResponse = await (await signer).sendTransaction({
to: approveTxn.tokenAddress,
data: approveTxn.rawData,
gasPrice,
Expand All @@ -297,7 +297,7 @@ export function Purchase({
if (!executeTxn) return;
showHandover(PurchaseHandoverStep.REQUEST_EXECUTION, {});

const executeTxnResponse = await signer.sendTransaction({
const executeTxnResponse = await (await signer).sendTransaction({
to: executeTxn.tokenAddress,
data: executeTxn.rawData,
gasPrice,
Expand Down Expand Up @@ -355,7 +355,7 @@ export function Purchase({

if (!route) return;

const currentFromAddress = await fromProvider.getSigner().getAddress();
const currentFromAddress = await (await fromProvider.getSigner()).getAddress();
const { fromChain, toChain } = getRouteChains(chains, route);

if (currentFromAddress !== fromAddress) {
Expand Down Expand Up @@ -383,7 +383,7 @@ export function Purchase({
// eslint-disable-next-line no-console
console.log('allowance', allowance);

if (!allowance || allowance?.lt(fromAmount)) {
if (!allowance || allowance < BigInt(fromAmount)) {
showHandover(PurchaseHandoverStep.REQUEST_APPROVAL, {});

const approveTxnReceipt = await approve(fromProviderInfo, changeableProvider, route);
Expand All @@ -408,10 +408,10 @@ export function Purchase({

const fundingMethod = fromChain !== toChain ? 'squid' : 'direct';

sendPurchaseSuccessEvent(eventTarget, executeTxnReceipt.transactionHash, fundingMethod);
sendPurchaseSuccessEvent(eventTarget, executeTxnReceipt.hash, fundingMethod);

if (toChain === fromChain) {
showHandover(PurchaseHandoverStep.SUCCESS_ZKEVM, { transactionHash: executeTxnReceipt.transactionHash });
showHandover(PurchaseHandoverStep.SUCCESS_ZKEVM, { transactionHash: executeTxnReceipt.hash });
return;
}

Expand All @@ -426,11 +426,11 @@ export function Purchase({

showHandover(PurchaseHandoverStep.EXECUTING, {
routeDuration: formattedDuration,
transactionHash: executeTxnReceipt.transactionHash,
transactionHash: executeTxnReceipt.hash,
});

const status = await getStatus(squid, executeTxnReceipt.transactionHash);
const axelarscanUrl = `https://axelarscan.io/gmp/${executeTxnReceipt?.transactionHash}`;
const status = await getStatus(squid, executeTxnReceipt.hash);
const axelarscanUrl = `https://axelarscan.io/gmp/${executeTxnReceipt?.hash}`;

// eslint-disable-next-line no-console
console.log('status', status);
Expand Down
2 changes: 1 addition & 1 deletion packages/orderbook/src/seaport/transaction.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { TransactionMethods } from '@opensea/seaport-js/lib/utils/usecase';
import { PreparedTransactionRequest } from 'ethers';
import { TransactionBuilder } from '../types';
import { TransactionMethods } from './types';

// Add 20% more gas than estimate to prevent out of gas errors
// This can always be overwritten by the user signing the transaction
Expand Down
2 changes: 1 addition & 1 deletion packages/orderbook/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OrderComponents } from '@opensea/seaport-js/lib/types';
import { PreparedTransactionRequest, TypedDataDomain, TypedDataField } from 'ethers';
import { Fee as OpenapiFee, OrdersService, OrderStatus } from './openapi/sdk';
import { OrderComponents } from './seaport/types';

// Strictly re-export only the OrderStatusName enum from the openapi types
export { OrderStatusName } from './openapi/sdk';
Expand Down
Loading

0 comments on commit d7dacd1

Please sign in to comment.