From 18c41f1b656aa914e6442a25f5b6e9694acac373 Mon Sep 17 00:00:00 2001 From: felix Date: Fri, 29 Dec 2023 18:58:56 +0800 Subject: [PATCH] feat: add RpcProvider --- sdk/packages/instaswap-core/src/types.ts | 4 ++-- sdk/packages/interface/src/components/ButtonClick.tsx | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/sdk/packages/instaswap-core/src/types.ts b/sdk/packages/instaswap-core/src/types.ts index 6a25fab..aa346bc 100644 --- a/sdk/packages/instaswap-core/src/types.ts +++ b/sdk/packages/instaswap-core/src/types.ts @@ -1,4 +1,4 @@ -import { AccountInterface, BigNumberish, Provider } from "starknet"; +import { AccountInterface, BigNumberish, RpcProvider } from "starknet"; import { FeeAmount } from "./constants"; export type Config = { @@ -9,7 +9,7 @@ export type Config = { ekuboCoreAddress: string; quoterAddress: string; account: AccountInterface | undefined; - provider?: Provider; + provider?: RpcProvider; }; export type LiquidityParams = { diff --git a/sdk/packages/interface/src/components/ButtonClick.tsx b/sdk/packages/interface/src/components/ButtonClick.tsx index ba49d96..725bad1 100644 --- a/sdk/packages/interface/src/components/ButtonClick.tsx +++ b/sdk/packages/interface/src/components/ButtonClick.tsx @@ -1,6 +1,6 @@ import { useAccount, useConnectors } from "@starknet-react/core"; import { useCallback, useMemo, useState, useEffect } from "react"; -import { Contract, uint256, CallData, RawArgs, Call, num } from "starknet"; +import { Contract, uint256, CallData, RawArgs, Call, num, RpcProvider } from "starknet"; import { Wrap } from "instaswap-core"; import { FeeAmount, SwapDirection } from "instaswap-core"; import { Provider, constants, cairo } from "starknet"; @@ -56,9 +56,8 @@ const ButtonClick = () => { () => "0x1090e3cfd9990c396f246cd1d5c7fb091905cba9f99739653db1f2960a3311f", [], ); - const provider = new Provider({ - sequencer: { network: constants.NetworkName.SN_GOERLI }, - }); + const infuraKey = "54aff2ddb77a4d01a5b0e61deb37e8d6"; + const provider = new RpcProvider({ nodeUrl: 'https://starknet-goerli.infura.io/v3/' + infuraKey }); const config = { erc1155Address: erc1155_address,