Skip to content

Commit bfea443

Browse files
authored
hlp/sdk-enableAlignedQuoteToken (#1865)
Signed-off-by: shankar <shankar@layerzerolabs.org>
1 parent 7303538 commit bfea443

14 files changed

Lines changed: 381 additions & 57 deletions

File tree

.changeset/light-crabs-train.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@layerzerolabs/hyperliquid-composer": patch
3+
"@layerzerolabs/oft-hyperliquid-example": patch
4+
---
5+
6+
alignedQuoteAsset support on core spot deployment + instructions on how to create a custom hyperliquid sdk action for sign + submit

examples/oft-hyperliquid/HYPERLIQUID.CHECKLIST.md

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -117,34 +117,49 @@ Block switching is not present in the default oft deploy script.
117117
- [ ] Make sure the asset bridge address on HyperCore has all the tokens minted in Step 2.3. Partial funding is not supported.
118118
- The final step to be executed after which the token will be listed on the spot order book.
119119

120-
### Step 2.7 : Enable quote token capability (Optional)
121-
122-
| Action | Performed by | Actionable with | Required for |
123-
| ------------------ | ----------------- | ----------------------------------------- | ------------ |
124-
| Enable Quote Token | CoreSpot Deployer | `npx @layerzerolabs/hyperliquid-composer` | HyperCore |
125-
| Blocked by | CoreSpot Deployer | Step 2.5 | none |
126-
127-
- [ ] **Review requirements first**: Check [Hyperliquid API requirements](https://t.me/hyperliquid_api/243) for eligibility criteria
128-
- [ ] Follow the [guide](https://github.com/LayerZero-Labs/devtools/blob/main/examples/oft-hyperliquid/HYPERLIQUID.README.md#step-66-enablequotetoken-optional)
129-
- [ ] Enables the token to be used as a quote asset for trading pairs (e.g., OTHER_TOKEN/YOUR_TOKEN)
130-
- [ ] Can be executed after trading fee share is set
131-
- [ ] This can be run even after deployment and linking are complete
132-
133-
### Step 2.8 : Set deployer fee share (Optional)
120+
### Step 2.7 : Set deployer fee share (Optional)
134121

135122
| Action | Performed by | Actionable with | Required for |
136123
| ---------------------- | ----------------- | ----------------------------------------- | ------------ |
137124
| Set Deployer Fee Share | CoreSpot Deployer | `npx @layerzerolabs/hyperliquid-composer` | HyperCore |
138125
| Blocked by | OFT Deployer | Step 0 | none |
139126
| Blocked by | CoreSpot Deployer | Step 2.1 | none |
140127

141-
- [ ] Follow the [guide](https://github.com/LayerZero-Labs/devtools/blob/main/examples/oft-hyperliquid/HYPERLIQUID.README.md#optional-setdeployertradingfeeshare)
128+
- [ ] Follow the [guide](https://github.com/LayerZero-Labs/devtools/blob/main/examples/oft-hyperliquid/HYPERLIQUID.README.md#step-67-setdeployertradingfeeshare-optional)
142129
- [ ] Trading fee share is usually 100% (default value) - this allocates the trading fees to the token deployer instead of burning it.
143130
- [ ] Do not lose or burn your deployer address as it collects tokens.
144131
- [ ] Step can be re-run as long as the new fee% is lower than the current one.
132+
- [ ] **Important**: If you plan to enable quote token capability (Step 2.8), read the [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets) documentation before setting this value as it requires a specific trading fee share.
145133
- Even though the default value is 100%, it is recommended that you set it
146134
- This can be run even after deployment and linking
147135

136+
### Step 2.8 : Enable quote token capability (Optional)
137+
138+
| Action | Performed by | Actionable with | Required for |
139+
| ------------------ | ----------------- | ----------------------------------------- | ------------ |
140+
| Enable Quote Token | CoreSpot Deployer | `npx @layerzerolabs/hyperliquid-composer` | HyperCore |
141+
| Blocked by | CoreSpot Deployer | Step 2.7 | none |
142+
143+
- [ ] **Review requirements first**: Read [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets) for all requirements
144+
- [ ] Requires specific trading fee share value (see Step 2.7 above)
145+
- [ ] Follow the [guide](https://github.com/LayerZero-Labs/devtools/blob/main/examples/oft-hyperliquid/HYPERLIQUID.README.md#step-657-enablequotetoken-optional)
146+
- [ ] Enables the token to be used as a quote asset for trading pairs (e.g., OTHER_TOKEN/YOUR_TOKEN)
147+
- [ ] Can be executed after trading fee share is set
148+
- [ ] This can be run even after deployment and linking are complete
149+
150+
### Step 2.8.5 : Enable aligned quote token capability (Optional)
151+
152+
| Action | Performed by | Actionable with | Required for |
153+
| -------------------------- | ----------------- | ----------------------------------------- | ------------ |
154+
| Enable Aligned Quote Token | CoreSpot Deployer | `npx @layerzerolabs/hyperliquid-composer` | HyperCore |
155+
| Blocked by | CoreSpot Deployer | Step 2.5 | none |
156+
157+
- [ ] Review requirements at: [Aligned Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/aligned-quote-assets)
158+
- [ ] Enables the token to be used as an aligned quote asset for trading pairs
159+
- [ ] Aligned quote tokens have special properties and requirements different from regular quote tokens
160+
- [ ] Can be executed after trading fee share is set
161+
- [ ] This can be run even after deployment and linking are complete
162+
148163
## Step 3.1 : Create a request to connect the HyperCoreSpot to HyperEVM OFT
149164

150165
| Action | Performed by | Actionable with | Required for |

examples/oft-hyperliquid/HYPERLIQUID.README.md

Lines changed: 96 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,22 @@ npx @layerzerolabs/hyperliquid-composer create-spot-deployment \
108108
[--log-level {info | verbose}]
109109
```
110110

111-
### 6. Enable Quote Token Capability (Optional)
111+
### 6. Set Trading Fee Share (Optional)
112112

113-
Enables your token to be used as a quote asset for trading pairs. **Requirements must be met** - see: [Hyperliquid API requirements](https://t.me/hyperliquid_api/243)
113+
Can be done at any time after deployment. **Note:** If you plan to enable quote token capability, read the [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets) documentation before setting this value.
114+
115+
```bash
116+
npx @layerzerolabs/hyperliquid-composer trading-fee \
117+
--token-index <coreIndex> \
118+
--share <[0%,100%]> \
119+
--network {testnet | mainnet} \
120+
--private-key $PRIVATE_KEY_HYPERLIQUID \
121+
[--log-level {info | verbose}]
122+
```
123+
124+
### 7. Enable Quote Token Capability (Optional)
125+
126+
Enables your token to be used as a quote asset for trading pairs. **Dependency:** Requires specific trading fee share value (see Step 6 above). See: [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets)
114127

115128
```bash
116129
npx @layerzerolabs/hyperliquid-composer enable-quote-token \
@@ -120,14 +133,13 @@ npx @layerzerolabs/hyperliquid-composer enable-quote-token \
120133
[--log-level {info | verbose}]
121134
```
122135

123-
### 7. Set Trading Fee Share (Optional)
136+
### 8. Enable Aligned Quote Token Capability (Optional)
124137

125-
Can be done at any time after deployment:
138+
Enables your token to be used as an aligned quote asset for trading pairs. Aligned quote tokens have special properties and requirements. See: [Aligned Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/aligned-quote-assets)
126139

127140
```bash
128-
npx @layerzerolabs/hyperliquid-composer trading-fee \
141+
npx @layerzerolabs/hyperliquid-composer enable-aligned-quote-token \
129142
--token-index <coreIndex> \
130-
--share <[0%,100%]> \
131143
--network {testnet | mainnet} \
132144
--private-key $PRIVATE_KEY_HYPERLIQUID \
133145
[--log-level {info | verbose}]
@@ -455,11 +467,34 @@ curl -X POST "https://api.hyperliquid.xyz/info" \
455467
-d '{ "type": "tokenDetails", "tokenId": "<YOUR_TOKEN_ID>"}'
456468
```
457469

458-
### Step 6/7 `enableQuoteToken` (Optional)
470+
### Step 6/7: `setDeployerTradingFeeShare` (Optional)
471+
472+
This is the step where you set the trading fee share for the deployer. It can be in the range of `[0%,100%]`.
473+
474+
A deployer fee share <https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees> is claimed per transaction on HyperCore. Half of the base rate (50%) is allocated as the deployer fee share. The deployer can choose to forgo this fee share by setting the share to `0%`. This causes the deployer's fee share part to be burnt. If it were to be set to `100%`, the deployer would receive the full fee share part of the fee.
475+
476+
> ⚠️ Note: The trading fee can be reset as long as the new share is lower than the previous share.
477+
> ⚠️ Note: This step can also be run after the core spot is deployed.
478+
> ⚠️ **Important**: If you plan to enable quote token capability (Step 6.5/7), read the [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets) documentation before setting this value as it requires a specific trading fee share.
479+
480+
```bash
481+
npx @layerzerolabs/hyperliquid-composer trading-fee \
482+
--token-index <coreIndex> \
483+
--share <[0%,100%]> \
484+
--network {testnet | mainnet} \
485+
--private-key $PRIVATE_KEY_HYPERLIQUID \
486+
[--log-level {info | verbose}]
487+
```
488+
489+
### Step 6.5/7 `enableQuoteToken` (Optional)
459490

460491
This step enables the token to be used as a quote asset for trading pairs. This allows other tokens to form trading pairs against your token (e.g., TOKEN/YOUR_TOKEN instead of only YOUR_TOKEN/USDC).
461492

462-
> ⚠️ **Requirements**: There are specific requirements that must be met for this to be successful. Please review the requirements at: [Hyperliquid API requirements](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/aligned-quote-assets) and contact the Hyperliquid team for the most upto date information.
493+
> ⚠️ **Requirements**:
494+
>
495+
> - Requires specific trading fee share value (see Step 6/7 above)
496+
> - Review all requirements at: [Permissionless Spot Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/permissionless-spot-quote-assets)
497+
> - Contact the Hyperliquid team for the most up-to-date information
463498
>
464499
> 📝 **Note**: This can be executed after the trading fee share is set and even after deployment and linking are complete.
465500
@@ -471,19 +506,20 @@ npx @layerzerolabs/hyperliquid-composer enable-quote-token \
471506
[--log-level {info | verbose}]
472507
```
473508

474-
### Step 7/7: `setDeployerTradingFeeShare` (Optional)
509+
### Step 6.7/7 `enableAlignedQuoteToken` (Optional)
475510

476-
This is the step where you set the trading fee share for the deployer. It can be in the range of `[0%,100%]`.
477-
478-
A deployer fee share <https://hyperliquid.gitbook.io/hyperliquid-docs/trading/fees> is claimed per transaction on HyperCore. Half of the base rate (50%) is allocated as the deployer fee share. The deployer can choose to forgo this fee share by setting the share to `0%`. This causes the deployer's fee share part to be burnt. If it were to be set to `100%`, the deployer would receive the full fee share part of the fee.
511+
This step enables the token to be used as an aligned quote asset for trading pairs. Aligned quote tokens have special properties and requirements different from regular quote tokens.
479512

480-
> ⚠️ Note: The trading fee can be reset as long as the new share is lower than the previous share.
481-
> ⚠️ Note: This step can also be run after the core spot is deployed.
513+
> ⚠️ **Requirements**:
514+
>
515+
> - Review requirements at: [Aligned Quote Assets](https://hyperliquid.gitbook.io/hyperliquid-docs/hypercore/aligned-quote-assets)
516+
> - Contact the Hyperliquid team for the most up-to-date information
517+
>
518+
> 📝 **Note**: This can be executed after the trading fee share is set and even after deployment and linking are complete.
482519
483520
```bash
484-
npx @layerzerolabs/hyperliquid-composer trading-fee \
521+
npx @layerzerolabs/hyperliquid-composer enable-aligned-quote-token \
485522
--token-index <coreIndex> \
486-
--share <[0%,100%]> \
487523
--network {testnet | mainnet} \
488524
--private-key $PRIVATE_KEY_HYPERLIQUID \
489525
[--log-level {info | verbose}]
@@ -532,3 +568,47 @@ npx hardhat lz:deploy --tags MyHyperLiquidComposer
532568
```
533569

534570
> ⚠️ Note: You would need to activate the composer's address on hypercore by transferring any amount of tokens from a wallet that has at least $1 in quote tokens. This $1 will be automatically debited from your accoutn to cover an activation fee.
571+
572+
## Advanced: Creating Custom Scripts
573+
574+
You can create your own custom scripts using the `HyperliquidClient` directly. This is useful for actions not covered by the CLI or for building custom automation.
575+
576+
### Example: Custom Action Script
577+
578+
```typescript
579+
import { HyperliquidClient } from "@layerzerolabs/hyperliquid-composer";
580+
import { Wallet } from "ethers";
581+
582+
async function customAction() {
583+
// Initialize wallet
584+
const wallet = new Wallet(process.env.PRIVATE_KEY!);
585+
586+
// Create client (testnet or mainnet)
587+
const isTestnet = true;
588+
const logLevel = "info";
589+
const hyperliquidClient = new HyperliquidClient(isTestnet, logLevel);
590+
591+
// Define your action
592+
const action = {
593+
type: "spotDeploy",
594+
enableAlignedQuoteToken: {
595+
token: 1234, // your token index
596+
},
597+
};
598+
599+
// Submit the action
600+
const response = await hyperliquidClient.submitHyperliquidAction(
601+
"/exchange",
602+
wallet,
603+
action,
604+
);
605+
606+
console.log("Response:", response);
607+
}
608+
609+
customAction();
610+
```
611+
612+
### Available Action Types
613+
614+
Refer to the [Hyperliquid API documentation](https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api) for all available action types and their parameters. The SDK supports any valid HyperCore action through `submitHyperliquidAction`.

0 commit comments

Comments
 (0)