Skip to content

Commit

Permalink
fix: update taker example to use v0.0.11 sdk
Browse files Browse the repository at this point in the history
- use Arb Sepolia
- use SupportedAsset class
  • Loading branch information
nickadamson committed Jan 15, 2024
1 parent 9c0bc24 commit b5a3d5f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 21 deletions.
6 changes: 3 additions & 3 deletions examples/typescript/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"trailingComma": "es5",
"singleQuote": true
}
"trailingComma": "es5",
"singleQuote": true
}
2 changes: 1 addition & 1 deletion examples/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"@bufbuild/protobuf": "^1.2.1",
"@connectrpc/connect": "^1.1.2",
"@connectrpc/connect-node": "^1.1.2",
"@valorem-labs-inc/sdk": "0.0.2-alpha.0",
"@valorem-labs-inc/sdk": "0.0.11",
"@wagmi/core": "^1.4.4",
"tsx": "^3.14.0",
"typescript": "^5.0.4",
Expand Down
29 changes: 12 additions & 17 deletions examples/typescript/src/RFQ_taker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
import {
Address,
createPublicClient,
createWalletClient,
http,
parseUnits,
} from 'viem';
import { createPublicClient, createWalletClient, http, parseUnits } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
import { arbitrumGoerli } from 'viem/chains';
import { arbitrumSepolia } from 'viem/chains';
import {
ERC20Contract,
ParsedQuoteResponse,
Expand All @@ -18,6 +12,7 @@ import {
trackCookieInterceptor,
Auth,
RFQ,
SupportedAsset,
} from '@valorem-labs-inc/sdk';
import { createPromiseClient } from '@connectrpc/connect';
import { createGrpcTransport } from '@connectrpc/connect-node';
Expand All @@ -31,12 +26,12 @@ const PRIVATE_KEY =
const account = privateKeyToAccount(PRIVATE_KEY);

const publicClient = createPublicClient({
chain: arbitrumGoerli,
chain: arbitrumSepolia,
transport: http(),
});
const walletClient = createWalletClient({
account,
chain: arbitrumGoerli,
chain: arbitrumSepolia,
transport: http(),
});

Expand Down Expand Up @@ -64,14 +59,14 @@ const valoremSDK = new ValoremSDK({
// get the WebTaker instance (essentially a wallet/account/signer, with some utility methods)
const webTaker = valoremSDK.webTaker;

// Our mock tokens on Arbitrum Goerli
const USDC_ADDRESS: Address = '0x8ae0eeedd35dbefe460df12a20823efde9e03458';
const WETH_ADDRESS: Address = '0x618b9a2db0cf23bb20a849daa2963c72770c1372';
// Our mock tokens on Arbitrum Sepolia
const USDC = SupportedAsset.fromSymbolAndChainId('USDC', 421614);
const WETH = SupportedAsset.fromSymbolAndChainId('WETH', 421614);

// contract instances
const clearinghouse = valoremSDK.clearinghouse;
const usdc = new ERC20Contract({
address: USDC_ADDRESS,
address: USDC.address,
publicClient,
walletClient,
});
Expand All @@ -95,10 +90,10 @@ async function authenticate() {
// 2. Initialize an option with Valorem Clearinghouse
async function createOptionType() {
// Configure your own option type here!
const underlyingAsset = WETH_ADDRESS;
const exerciseAsset = USDC_ADDRESS;
const underlyingAsset = WETH.address;
const exerciseAsset = USDC.address;
const underlyingAmount = 1000000000000n; // 1 WETH, divided by 1e6
const exerciseAmount = 1575n; // 1575 USDC, divided by 1e6
const exerciseAmount = 2500n; // 2500 USDC, divided by 1e6
const { exerciseTimestamp, expiryTimestamp } = get24HrTimestamps();

const optionInfo = {
Expand Down

0 comments on commit b5a3d5f

Please # to comment.