Skip to content

v0.0.11 #29

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

Merged
merged 4 commits into from
Jan 15, 2024
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
5 changes: 0 additions & 5 deletions .changeset/five-dodos-float.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/flat-wasps-matter.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/violet-points-exist.md

This file was deleted.

13 changes: 7 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,13 @@ jobs:
- name: Publish to Github Packages
run: pnpm ci:release

- name: Setup .npmrc file to publish to npm
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
scope: '@valorem-labs-inc'
- name: Unset GHP scope, set NPM scope (setup-node workaround https://github.com/actions/setup-node/issues/763)
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
pnpm config delete @valorem-labs-inc:registry --location project
pnpm config set @valorem-labs-inc:registry 'https://registry.npmjs.org' --location project
pnpm config set //registry.npmjs.org/:_authToken '${NODE_AUTH_TOKEN}' --location project

- name: Publish to NPM
env:
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @valorem-labs-inc/sdk

## 0.0.11

### Patch Changes

- 2071b42: pin `trade-interfaces` to v1.4.0
- c3fe828: add arbitrum sepolia deployments; drop arbitrum goerli
- d2a011a: fix CI workflow for NPM publishing
- d30df61: update readme
- 652f797: drop parcel for tsup...

## 0.0.10

### Patch Changes
Expand Down
63 changes: 57 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,71 @@ const valoremSDK = new ValoremSDK({
Here's how you can sign in and send requests to the Trade API using the SDK:

```typescript
import {
ValoremSDK,
OptionType,
get24HrTimestamps,
SupportedAsset,
type ParsedQuoteResponse,
} from '@valorem-labs-inc/sdk';

// ... continuing from `Getting Started` section above
const webTaker = valoremSDK.webTaker;
const clearinghouse = valoremSDK.clearinghouse;

// Sign in to the Trade API.
await webTaker.signIn();

// Now you can send requests to the Trade API.
```
// Now you can send requests to the Trade API! Let's walkthrough setting up a basic quote request.
// First we need to get the option ID for the option we want to buy, so let's define the parameters.
// We'll use WETH as the underlying asset, and USDC as the exercise.
// For the exercise window we will use the next 24 hours.

// Our mock tokens on Arbitrum Sepolia
const USDC = SupportedAsset.fromSymbolAndChainId('USDC', 421614);
const WETH = SupportedAsset.fromSymbolAndChainId('WETH', 421614);

const underlyingAsset = WETH.address;
const exerciseAsset = USDC.address;
const underlyingAmount = 1000000000000n; // 1 WETH, divided by 1e6
const exerciseAmount = 2500n; // 2500 USDC, divided by 1e6
const { exerciseTimestamp, expiryTimestamp } = get24HrTimestamps();

// Now we have all the information we need to create an OptionType.
const optionType = await OptionType.fromInfo({
optionInfo: {
underlyingAsset,
underlyingAmount,
exerciseAsset,
exerciseAmount,
exerciseTimestamp,
expiryTimestamp,
},
clearinghouse,
});

// And with the OptionType's id, we can initialize a quote request.
const quoteRequest = webTaker.createQuoteRequest({
optionId,
quantityToBuy: 1,
});

Yes, it's really that easy.
// Before we start sending requests, let's define a callback to handle responses from Market Makers.
// This one will automatically accept any quotes we receive.
async function onQuoteResponse(quote: ParsedQuoteResponse) {
await webTaker.acceptQuote({ quote });
}

// Continuously send requests and handle responses...
await webTaker.sendRFQ({
quoteRequest,
onQuoteResponse,
});
```

## Examples
For a more comprehensive example using the Valorem TypeScript SDK to create options, request quotes, and fulfill trade orders, check out the [example script in trade-interfaces](https://github.com/valorem-labs-inc/trade-interfaces/blob/main/examples/typescript/src/RFQ_taker.ts).

For a comprehensive example of using the Valorem TypeScript SDK to create options,
request quotes, and fulfill trade orders, check out the [example file](https://github.com/valorem-labs-inc/trade-interfaces/blob/main/examples/typescript/src/RFQ_taker.ts).
It covers token approvals, option type creation, and error handling in-depth.

## Documentation

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@valorem-labs-inc/sdk",
"version": "0.0.10",
"version": "0.0.11",
"repository": {
"type": "git",
"url": "https://github.com/valorem-labs-inc/typescript-sdk.git"
Expand Down Expand Up @@ -90,7 +90,7 @@
"@graphql-typed-document-node/core": "^3.2.0",
"date-fns": "^3.2.0",
"graphql": "^16.8.1",
"mathjs": "^12.2.1"
"mathjs": "^12.3.0"
},
"devDependencies": {
"@bufbuild/buf": "^1.28.1",
Expand All @@ -103,12 +103,12 @@
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/typescript": "^4.0.1",
"@graphql-codegen/typescript-operations": "^4.0.1",
"@types/node": "^20.10.8",
"@types/node": "^20.11.2",
"@vercel/style-guide": "^5.1.0",
"@vitest/coverage-v8": "^1.1.3",
"eslint": "^8.56.0",
"eslint-config-canonical": "^42.8.0",
"prettier": "^3.1.1",
"prettier": "^3.2.2",
"tsup": "^8.0.1",
"typedoc": "^0.25.7",
"typedoc-plugin-missing-exports": "^2.1.0",
Expand Down
Loading