Skip to content
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

feat: update gateway for v3 #318

Merged
merged 4 commits into from
Aug 22, 2024
Merged

feat: update gateway for v3 #318

merged 4 commits into from
Aug 22, 2024

Conversation

gregdhill
Copy link
Contributor

@gregdhill gregdhill commented Aug 16, 2024

Closes #314

Example docs:

Install the SDK:

yarn add @gobob/bob-sdk

Create a client:

import { GatewaySDK } from '@gobob/bob-sdk';
 
const gatewaySDK = new GatewaySDK("bob"); // or "bob-sepolia"

Get a quote:

import type { GatewayQuoteParams } from '@gobob/bob-sdk';

const params: GatewayQuoteParams = {
  toChain: 'bob', // Destination chain
  toToken: 'SolvBTC.BBN', // Destination token (e.g. 'wBTC' or 'tBTC')
  toUserAddress: '0x0000', // User's wallet address
  amount: '10000', // Amount to transfer in token decimals
};

const quote = await gatewaySDK.getQuote(params);

Create and update order:

const { uuid, bitcoinAddress, opReturnHash } = await gatewaySDK.startOrder(quote, params);

const bitcoinTx = new bitcoin.Transaction();
// TODO: add inputs / outputs & sign

await gatewaySDK.finalizeOrder(uuid, bitcoinTx.toHex());

Copy link

vercel bot commented Aug 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bob ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 22, 2024 11:52am

Copy link

changeset-bot bot commented Aug 16, 2024

⚠️ No Changeset found

Latest commit: a46138a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

export type GatewayParams = {
fromChain: 'Bitcoin', // Source chain
fromToken: 'BTC', // Source token
fromUserAddress: EvmAddress, // Source chain wallet address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BitcoinAddress, right?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or long-term, an enum of one or the other

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now this is a copy of the Swing params, we won't do anything with it really

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. As long as it's not going through validation or being included in the hash I suppose it doesn't matter.

Signed-off-by: Gregory Hill <[email protected]>
@gregdhill gregdhill marked this pull request as ready for review August 22, 2024 11:52
@gregdhill gregdhill merged commit 5646bc7 into master Aug 22, 2024
4 checks passed
@gregdhill gregdhill deleted the feat/gateway-v3 branch August 22, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BOB Gateway v3 SDK
3 participants