-
Notifications
You must be signed in to change notification settings - Fork 110
[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
Conversation
- 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)
size-limit report 📦
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To constrcut a Crosschain Delta Order it is required to either: | |
To construct a Crosschain Delta Order it is required to either: |
src/examples/delta.ts
Outdated
@@ -29,14 +29,14 @@ const deltaSDK = constructPartialSDK( | |||
); | |||
|
|||
const DAI_TOKEN = '0x6b175474e89094c44da98b954eedeac495271d0f'; | |||
const PSP_TOKEN = '0xcafe001067cdef266afb7eb5a286dcfd277f3de5'; | |||
const USDC_TOKEN = '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
src/methods/delta/helpers/across.ts
Outdated
if beneficiary is an EOA and destToken on destChain = ETH | ||
order.destToken=ETH | ||
order.bridge.outputToken=WETH_DEST_CHAIN | ||
order.bridge.mutliCallHandler=NULL_ADDRESS |
There was a problem hiding this comment.
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
order.bridge.mutliCallHandler=NULL_ADDRESS | |
order.bridge.multiCallHandler=NULL_ADDRESS |
src/methods/delta/helpers/types.ts
Outdated
@@ -73,7 +69,7 @@ type DeltaAuctionTransaction = { | |||
auctionId: string; | |||
}; | |||
|
|||
export type ParaswapDeltaAuction = { | |||
export type VeloraDeltaAuction = { |
There was a problem hiding this comment.
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
src/methods/delta/postDeltaOrder.ts
Outdated
@@ -17,7 +17,7 @@ export type DeltaOrderToPost = { | |||
|
|||
export type PostDeltaOrderParams = Omit<DeltaOrderToPost, 'chainId'>; | |||
|
|||
type DeltaOrderApiResponse = ParaswapDeltaAuction; | |||
type DeltaOrderApiResponse = VeloraDeltaAuction; |
There was a problem hiding this comment.
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__'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this 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'; |
There was a problem hiding this comment.
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 ; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
Feat/velora more
…'SmartContract'`
Feat/velora more
chore: add js-level `beneficiaryType` validation
… into feat/velora