8000 [FRNT-1039] Feat/Velora SDK by Velenir · Pull Request #194 · VeloraDEX/sdk · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[FRNT-1039] Feat/Velora SDK #194

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 43 commits into from
May 9, 2025
Merged

[FRNT-1039] Feat/Velora SDK #194

merged 43 commits into from
May 9, 2025

Conversation

Velenir
Copy link
Member
@Velenir Velenir commented May 6, 2025
  • Renames and other changes from ParaSwap to Velora
  • Order.bridge construction for Crosschain Delta Orders
  • Updated docs/DELTA.md readme portion with Crosschain Order info
  • Removed Legacy SDK support (this will be a breaking change)

Copy link
linear bot commented May 6, 2025

FRNT-1039

8000 Copy link
github-actions bot commented May 6, 2025

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 16.12 KB (-0.19% 🔽)
dist/sdk.esm.js 16.17 KB (+0.48% 🔺)

Copy link
Contributor
@andriy-shymkiv andriy-shymkiv left a comment

Choose a reason for hiding this comment

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

found a few minor points, but overall very good job!

docs/DELTA.md Outdated
beneficiary: anotherAccount, // if need to send destToken to another account on destChain
isBeneficiaryContract: false, // whether the beneficiary on destChain is a smart contract
// bridge, // user-constrcuted Bridge object for Crosschain Orders
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// bridge, // user-constrcuted Bridge object for Crosschain Orders
// bridge, // user-constructed Bridge object for Crosschain Orders

docs/DELTA.md Outdated
```

To constrcut a Crosschain Delta Order it is required to either:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
To constrcut a Crosschain Delta Order it is required to either:
To construct a Crosschain Delta Order it is required to either:

@@ -29,14 +29,14 @@ const deltaSDK = constructPartialSDK(
);

const DAI_TOKEN = '0x6b175474e89094c44da98b954eedeac495271d0f';
const PSP_TOKEN = '0xcafe001067cdef266afb7eb5a286dcfd277f3de5';
const USDC_TOKEN = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
Copy link
Contributor

Choose a reason for hiding this comment

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

the documentation still has PSP tokens, although they are automatically generated if I'm not mistaken

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, docs will be regenerated

if beneficiary is an EOA and destToken on destChain = ETH
order.destToken=ETH
order.bridge.outputToken=WETH_DEST_CHAIN
order.bridge.mutliCallHandler=NULL_ADDRESS
Copy link
Contributor

Choose a reason for hiding this comment

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

typo here and the same below

Suggested change
order.bridge.mutliCallHandler=NULL_ADDRESS
order.bridge.multiCallHandler=NULL_ADDRESS

@@ -73,7 +69,7 @@ type DeltaAuctionTransaction = {
auctionId: string;
};

export type ParaswapDeltaAuction = {
export type VeloraDeltaAuction = {
Copy link
Contributor

Choose a reason for hiding this comment

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

since we're already making the name more abstract, I'd rather change it to simply DeltaAuction

@@ -17,7 +17,7 @@ export type DeltaOrderToPost = {

export type PostDeltaOrderParams = Omit<DeltaOrderToPost, 'chainId'>;

type DeltaOrderApiResponse = ParaswapDeltaAuction;
type DeltaOrderApiResponse = VeloraDeltaAuction;
Copy link
Contributor

Choose a reason for hiding this comment

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

typo on the L14, partilly -> partially

README.md Outdated
@@ -48,15 +48,15 @@ Can be created by providing `chainId` and either `axios` or `window.fetch` (or a
const signer: JsonRpcSigner = ethers.Wallet.fromMnmemonic('__your_mnemonic__');
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
const signer: JsonRpcSigner = ethers.Wallet.fromMnmemonic('__your_mnemonic__');
const signer: JsonRpcSigner = ethers.Wallet.fromMnemonic('__your_mnemonic__');

README.md Outdated
@@ -402,7 +404,8 @@ if (auction?.status === 'EXECUTED') {

#### A more detailed example of Delta Order usage can be found in [examples/delta](./src/examples/delta.ts)

#### For more Delta protocol usage refer to [DELTA.md](./docs/DELTA.md)
For more Delta protocol usage, and **Corsschain Delta Orders**, refer to [DELTA.md](./docs/DELTA.md)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
For more Delta protocol usage, and **Corsschain Delta Orders**, refer to [DELTA.md](./docs/DELTA.md)
For more Delta protocol usage, and **Crosschain Delta Orders**, refer to [DELTA.md](./docs/DELTA.md)

Copy link
Member
@alexshchur alexshchur left a comment

Choose a reason for hiding this comment

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

Added few small amends in another branch

Also there are few things where we can improve further, after releasing the current update. I left comments on those. Wdyt?

@@ -20,12 +20,12 @@ const paraSwap = constructSimpleSDK(

```ts
const DAI_TOKEN = '0x6b175474e89094c44da98b954eedeac495271d0f';
const PSP_TOKEN = '0xcafe001067cdef266afb7eb5a286dcfd277f3de5';
const USDC_TOKEN = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48';
Copy link
Member

Choose a reason for hiding this comment

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

btw, now that we change it to USDC, it's not 18 decimals any more in the snippets down below

```ts
// poll if necessary
const auction = await deltaSDK.getDeltaOrderById(deltaAuction.id) F438 ;
Copy link
Member

Choose a reason for hiding this comment

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

how about creating an internal method that performs polling?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe polling should be done in userland.
Same as you would use react-query to fetch, cache, refetch, etc. You would use some library that already takes care of all edge cases, like refetchInterval.

Copy link
Member

Choose a reason for hiding this comment

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

outcome of DM convo: can add a sample in the doc with some simple polling helper lib (I can take care of that)

```

See more on accepted Permit variants in [Velora documentation](https://developers.velora.xyz/api/velora-api/velora-delta-api/build-a-delta-order-to-sign#supported-permits)
Copy link
Member

Choose a reason for hiding this comment

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

would it be feasible to integrate permit logic to into the SDK in the next iterations?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not feasible at all. Remember the complex logic to get Token's data for permit, how many tokens don't follow the standard for domain, version, nonce and other methods.

Copy link
Member

Choose a reason for hiding this comment

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

outcome after DM convo: permit2 seems worth embedding


To construct a Crosschain Delta Order it is required to either:
* construct Bridge object. Refer to [documentation](https://developers.velora.xyz/api/velora-api/velora-delta-api/build-a-delta-order-to-sign#sign-an-order-cross-chain) for how to do that.
Copy link
Member

Choose a reason for hiding this comment

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

is there a plan to integrate bridge params handling?

Copy link
Member Author

Choose a reason for hiding this comment

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

Literally the next line says that it is handled by SDK if only the user gives isBeneficiaryContract param

Copy link
Member Author

Choose a reason for hiding this comment

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

If you think it's not clear, feel free to reword

Copy link
Member

Choose a reason for hiding this comment

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

somehow I misread the next line as "in the case when beneficiary is tha contract", you can rely on SDK

Yes, I'd change the wording (specifically - order of options, "rely on SDK" option should go first imo) and also maybe change isBeneficiaryContract : boolean to smth like beneficiaryContract : "EOA" | "SmartContract", like by the API DOC link referred.

Wdyt?

Copy link
Member Author
@Velenir Velenir May 8, 2025

Choose a reason for hiding this comment

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

Reword all you like, but I believe a Boolean better conveys the intent.
beneficiaryContract implies address. Even something like beneficiaryType would be useless in vanilla JS, for example, always need TS to guide the correct value

@alexshchur alexshchur merged commit e792038 into master May 9, 2025
1 of 2 checks passed
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.

3 participants
0