@basedone/core 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-KH53SPJC.mjs +13 -0
- package/dist/index.d.mts +29 -3
- package/dist/index.d.ts +29 -3
- package/dist/index.js +80 -6
- package/dist/index.mjs +76 -5
- package/dist/meta-44Z4QO5K.mjs +1474 -0
- package/dist/meta-VES4BWNR.mjs +1355 -0
- package/dist/perpDexs-BE7YAC5W.mjs +17 -0
- package/dist/perpDexs-F3JQZZLH.mjs +537 -0
- package/dist/spotMeta-HRQNZMVY.mjs +6442 -0
- package/dist/spotMeta-SHXGTDWD.mjs +26559 -0
- package/dist/staticMeta-2HYATSVU.mjs +25 -0
- package/dist/staticMeta-PLKPPG23.mjs +23 -0
- package/index.ts +1 -0
- package/lib/cloid/cloid.ts +4 -0
- package/lib/hip3/utils.ts +89 -0
- package/lib/meta/metadata.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __glob = (map) => (path) => {
|
|
4
|
+
var fn = map[path];
|
|
5
|
+
if (fn) return fn();
|
|
6
|
+
throw new Error("Module not found in bundle: " + path);
|
|
7
|
+
};
|
|
8
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
9
|
+
|
|
10
|
+
export {
|
|
11
|
+
__glob,
|
|
12
|
+
__publicField
|
|
13
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta } from '@nktkas/hyperliquid';
|
|
2
|
-
import { Hex } from '@nktkas/hyperliquid/
|
|
1
|
+
import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
|
|
2
|
+
import { Hex } from '@nktkas/hyperliquid/types';
|
|
3
3
|
|
|
4
4
|
declare function encodeSlug(slug: string): bigint;
|
|
5
5
|
declare function decodeSlug(value: bigint): string;
|
|
@@ -44,6 +44,7 @@ declare const CloidClientCode: {
|
|
|
44
44
|
readonly Chase: 6;
|
|
45
45
|
readonly Desktop: 7;
|
|
46
46
|
readonly API: 8;
|
|
47
|
+
readonly Stream: 9;
|
|
47
48
|
};
|
|
48
49
|
type ClientCodeType = keyof typeof CloidClientCode;
|
|
49
50
|
type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
|
|
@@ -54,6 +55,7 @@ declare const WidgetType: {
|
|
|
54
55
|
readonly SidePanel: 1;
|
|
55
56
|
readonly Widget: 2;
|
|
56
57
|
readonly FloatingWidget: 3;
|
|
58
|
+
readonly Stream: 4;
|
|
57
59
|
};
|
|
58
60
|
type WidgetType = keyof typeof WidgetType;
|
|
59
61
|
type WidgetTypeId = (typeof WidgetType)[WidgetType];
|
|
@@ -493,4 +495,28 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
493
495
|
*/
|
|
494
496
|
declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
|
|
495
497
|
|
|
496
|
-
|
|
498
|
+
declare function isHip3Symbol(symbol: string): boolean;
|
|
499
|
+
declare function getHip3Dex(symbol: string): string | null;
|
|
500
|
+
/**
|
|
501
|
+
* Enable HIP-3 DEX abstraction with the current agent wallet
|
|
502
|
+
* @param client Exchange client with agent wallet
|
|
503
|
+
* @returns Promise with success response
|
|
504
|
+
*/
|
|
505
|
+
declare function enableHip3DexAbstractionWithAgent(client: ExchangeClient): Promise<SuccessResponse>;
|
|
506
|
+
declare const UserDexAbstractionTypes: {
|
|
507
|
+
"HyperliquidTransaction:UserDexAbstraction": {
|
|
508
|
+
name: string;
|
|
509
|
+
type: string;
|
|
510
|
+
}[];
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Set HIP-3 DEX abstraction for a user
|
|
514
|
+
* @param client Exchange client with owner wallet
|
|
515
|
+
* @param enabled Whether to enable HIP-3 DEX abstraction
|
|
516
|
+
* @param user User address
|
|
517
|
+
* @returns Promise with success response
|
|
518
|
+
*/
|
|
519
|
+
declare function setHip3DexAbstraction(client: ExchangeClient, enabled: boolean, user: string): Promise<SuccessResponse>;
|
|
520
|
+
declare function getHip3DexAbstraction(client: InfoClient, user: string): Promise<boolean | null>;
|
|
521
|
+
|
|
522
|
+
export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForOrder, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta } from '@nktkas/hyperliquid';
|
|
2
|
-
import { Hex } from '@nktkas/hyperliquid/
|
|
1
|
+
import { SpotToken, PerpsMeta, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
|
|
2
|
+
import { Hex } from '@nktkas/hyperliquid/types';
|
|
3
3
|
|
|
4
4
|
declare function encodeSlug(slug: string): bigint;
|
|
5
5
|
declare function decodeSlug(value: bigint): string;
|
|
@@ -44,6 +44,7 @@ declare const CloidClientCode: {
|
|
|
44
44
|
readonly Chase: 6;
|
|
45
45
|
readonly Desktop: 7;
|
|
46
46
|
readonly API: 8;
|
|
47
|
+
readonly Stream: 9;
|
|
47
48
|
};
|
|
48
49
|
type ClientCodeType = keyof typeof CloidClientCode;
|
|
49
50
|
type CloidClientCodeId = (typeof CloidClientCode)[ClientCodeType];
|
|
@@ -54,6 +55,7 @@ declare const WidgetType: {
|
|
|
54
55
|
readonly SidePanel: 1;
|
|
55
56
|
readonly Widget: 2;
|
|
56
57
|
readonly FloatingWidget: 3;
|
|
58
|
+
readonly Stream: 4;
|
|
57
59
|
};
|
|
58
60
|
type WidgetType = keyof typeof WidgetType;
|
|
59
61
|
type WidgetTypeId = (typeof WidgetType)[WidgetType];
|
|
@@ -493,4 +495,28 @@ declare const formatSizeForOrder: ({ sz, szDecimals, }: {
|
|
|
493
495
|
*/
|
|
494
496
|
declare function getPriceDecimals(price: number, szDecimals: number, isSpot: boolean): number;
|
|
495
497
|
|
|
496
|
-
|
|
498
|
+
declare function isHip3Symbol(symbol: string): boolean;
|
|
499
|
+
declare function getHip3Dex(symbol: string): string | null;
|
|
500
|
+
/**
|
|
501
|
+
* Enable HIP-3 DEX abstraction with the current agent wallet
|
|
502
|
+
* @param client Exchange client with agent wallet
|
|
503
|
+
* @returns Promise with success response
|
|
504
|
+
*/
|
|
505
|
+
declare function enableHip3DexAbstractionWithAgent(client: ExchangeClient): Promise<SuccessResponse>;
|
|
506
|
+
declare const UserDexAbstractionTypes: {
|
|
507
|
+
"HyperliquidTransaction:UserDexAbstraction": {
|
|
508
|
+
name: string;
|
|
509
|
+
type: string;
|
|
510
|
+
}[];
|
|
511
|
+
};
|
|
512
|
+
/**
|
|
513
|
+
* Set HIP-3 DEX abstraction for a user
|
|
514
|
+
* @param client Exchange client with owner wallet
|
|
515
|
+
* @param enabled Whether to enable HIP-3 DEX abstraction
|
|
516
|
+
* @param user User address
|
|
517
|
+
* @returns Promise with success response
|
|
518
|
+
*/
|
|
519
|
+
declare function setHip3DexAbstraction(client: ExchangeClient, enabled: boolean, user: string): Promise<SuccessResponse>;
|
|
520
|
+
declare function getHip3DexAbstraction(client: InfoClient, user: string): Promise<boolean | null>;
|
|
521
|
+
|
|
522
|
+
export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, formatPriceAndSize, formatPriceForOrder, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getHip3Dex, getHip3DexAbstraction, getNextTierInfo, getPriceDecimals, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isTenantCloid, isTrackingIdCloid, isWidgetType, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction };
|
package/dist/index.js
CHANGED
|
@@ -36452,6 +36452,7 @@ __export(index_exports, {
|
|
|
36452
36452
|
TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT: () => TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT,
|
|
36453
36453
|
TESTNET_USDC_SPOT_TOKEN: () => TESTNET_USDC_SPOT_TOKEN,
|
|
36454
36454
|
USDC_SPOT_TOKEN: () => USDC_SPOT_TOKEN,
|
|
36455
|
+
UserDexAbstractionTypes: () => UserDexAbstractionTypes,
|
|
36455
36456
|
WidgetType: () => WidgetType,
|
|
36456
36457
|
WidgetTypeById: () => WidgetTypeById,
|
|
36457
36458
|
XP_BOOST_PERCENTAGES: () => XP_BOOST_PERCENTAGES,
|
|
@@ -36459,6 +36460,7 @@ __export(index_exports, {
|
|
|
36459
36460
|
calculateBoostPercentage: () => calculateBoostPercentage,
|
|
36460
36461
|
calculateTotalPupAmount: () => calculateTotalPupAmount,
|
|
36461
36462
|
decodeSlug: () => decodeSlug,
|
|
36463
|
+
enableHip3DexAbstractionWithAgent: () => enableHip3DexAbstractionWithAgent,
|
|
36462
36464
|
encodeSlug: () => encodeSlug,
|
|
36463
36465
|
formatPriceAndSize: () => formatPriceAndSize,
|
|
36464
36466
|
formatPriceForOrder: () => formatPriceForOrder,
|
|
@@ -36466,11 +36468,14 @@ __export(index_exports, {
|
|
|
36466
36468
|
getApprovalAmount: () => getApprovalAmount,
|
|
36467
36469
|
getClientCodeNameById: () => getClientCodeNameById,
|
|
36468
36470
|
getCloid: () => getCloid,
|
|
36471
|
+
getHip3Dex: () => getHip3Dex,
|
|
36472
|
+
getHip3DexAbstraction: () => getHip3DexAbstraction,
|
|
36469
36473
|
getNextTierInfo: () => getNextTierInfo,
|
|
36470
36474
|
getPriceDecimals: () => getPriceDecimals,
|
|
36471
36475
|
getWidgetTypeById: () => getWidgetTypeById,
|
|
36472
36476
|
isBasedCloid: () => isBasedCloid,
|
|
36473
36477
|
isClientCode: () => isClientCode,
|
|
36478
|
+
isHip3Symbol: () => isHip3Symbol,
|
|
36474
36479
|
isMiniAppCloid: () => isMiniAppCloid,
|
|
36475
36480
|
isMiniAppTriggeredCloid: () => isMiniAppTriggeredCloid,
|
|
36476
36481
|
isTenantCloid: () => isTenantCloid,
|
|
@@ -36479,7 +36484,8 @@ __export(index_exports, {
|
|
|
36479
36484
|
normaliseSlug: () => normaliseSlug,
|
|
36480
36485
|
normaliseTrackingId: () => normaliseTrackingId,
|
|
36481
36486
|
normalizeAirdropAmount: () => normalizeAirdropAmount,
|
|
36482
|
-
parseCloid: () => parseCloid
|
|
36487
|
+
parseCloid: () => parseCloid,
|
|
36488
|
+
setHip3DexAbstraction: () => setHip3DexAbstraction
|
|
36483
36489
|
});
|
|
36484
36490
|
module.exports = __toCommonJS(index_exports);
|
|
36485
36491
|
|
|
@@ -36689,7 +36695,8 @@ var CloidClientCode = {
|
|
|
36689
36695
|
Grid: 5,
|
|
36690
36696
|
Chase: 6,
|
|
36691
36697
|
Desktop: 7,
|
|
36692
|
-
API: 8
|
|
36698
|
+
API: 8,
|
|
36699
|
+
Stream: 9
|
|
36693
36700
|
};
|
|
36694
36701
|
var CloidClientCodeNameById = {
|
|
36695
36702
|
[CloidClientCode.Unset]: "Unset",
|
|
@@ -36700,7 +36707,8 @@ var CloidClientCodeNameById = {
|
|
|
36700
36707
|
[CloidClientCode.Grid]: "Grid",
|
|
36701
36708
|
[CloidClientCode.Chase]: "Chase",
|
|
36702
36709
|
[CloidClientCode.Desktop]: "Desktop",
|
|
36703
|
-
[CloidClientCode.API]: "API"
|
|
36710
|
+
[CloidClientCode.API]: "API",
|
|
36711
|
+
[CloidClientCode.Stream]: "Stream"
|
|
36704
36712
|
};
|
|
36705
36713
|
function getClientCodeNameById(id) {
|
|
36706
36714
|
return CloidClientCodeNameById[id] ?? `client_${id}`;
|
|
@@ -36710,13 +36718,15 @@ var WidgetType = {
|
|
|
36710
36718
|
// 0x00
|
|
36711
36719
|
SidePanel: 1,
|
|
36712
36720
|
Widget: 2,
|
|
36713
|
-
FloatingWidget: 3
|
|
36721
|
+
FloatingWidget: 3,
|
|
36722
|
+
Stream: 4
|
|
36714
36723
|
};
|
|
36715
36724
|
var WidgetTypeById = {
|
|
36716
36725
|
[WidgetType.Unset]: "Unset",
|
|
36717
36726
|
[WidgetType.SidePanel]: "SidePanel",
|
|
36718
36727
|
[WidgetType.Widget]: "Widget",
|
|
36719
|
-
[WidgetType.FloatingWidget]: "FloatingWidget"
|
|
36728
|
+
[WidgetType.FloatingWidget]: "FloatingWidget",
|
|
36729
|
+
[WidgetType.Stream]: "Stream"
|
|
36720
36730
|
};
|
|
36721
36731
|
function getWidgetTypeById(id) {
|
|
36722
36732
|
return WidgetTypeById[id] ?? `widget_${id}`;
|
|
@@ -37015,10 +37025,68 @@ var TESTNET_USDC_SPOT_TOKEN = {
|
|
|
37015
37025
|
var import_hyperliquid = require("@nktkas/hyperliquid");
|
|
37016
37026
|
|
|
37017
37027
|
// lib/hip3/utils.ts
|
|
37028
|
+
var import_signing = require("@nktkas/hyperliquid/signing");
|
|
37018
37029
|
function isHip3Symbol(symbol) {
|
|
37019
37030
|
if (!symbol) return false;
|
|
37020
37031
|
return symbol.includes(":");
|
|
37021
37032
|
}
|
|
37033
|
+
function getHip3Dex(symbol) {
|
|
37034
|
+
if (!symbol) return null;
|
|
37035
|
+
return symbol.split(":")[0];
|
|
37036
|
+
}
|
|
37037
|
+
async function enableHip3DexAbstractionWithAgent(client) {
|
|
37038
|
+
const nonce = Date.now();
|
|
37039
|
+
const action = {
|
|
37040
|
+
type: "agentEnableDexAbstraction"
|
|
37041
|
+
};
|
|
37042
|
+
const signature = await (0, import_signing.signL1Action)({
|
|
37043
|
+
wallet: client.wallet,
|
|
37044
|
+
action,
|
|
37045
|
+
isTestnet: client.isTestnet,
|
|
37046
|
+
nonce
|
|
37047
|
+
});
|
|
37048
|
+
return await client.transport.request("exchange", {
|
|
37049
|
+
action,
|
|
37050
|
+
signature,
|
|
37051
|
+
nonce
|
|
37052
|
+
});
|
|
37053
|
+
}
|
|
37054
|
+
var UserDexAbstractionTypes = {
|
|
37055
|
+
"HyperliquidTransaction:UserDexAbstraction": [
|
|
37056
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
37057
|
+
{ name: "user", type: "address" },
|
|
37058
|
+
{ name: "enabled", type: "bool" },
|
|
37059
|
+
{ name: "nonce", type: "uint64" }
|
|
37060
|
+
]
|
|
37061
|
+
};
|
|
37062
|
+
async function setHip3DexAbstraction(client, enabled, user) {
|
|
37063
|
+
const nonce = Date.now();
|
|
37064
|
+
const isTestnet = client.isTestnet;
|
|
37065
|
+
const action = {
|
|
37066
|
+
type: "userDexAbstraction",
|
|
37067
|
+
hyperliquidChain: isTestnet ? "Testnet" : "Mainnet",
|
|
37068
|
+
signatureChainId: isTestnet ? "0x66eee" : "0xa4b1",
|
|
37069
|
+
user,
|
|
37070
|
+
enabled,
|
|
37071
|
+
nonce
|
|
37072
|
+
};
|
|
37073
|
+
const signature = await (0, import_signing.signUserSignedAction)({
|
|
37074
|
+
wallet: client.wallet,
|
|
37075
|
+
action,
|
|
37076
|
+
types: UserDexAbstractionTypes
|
|
37077
|
+
});
|
|
37078
|
+
return await client.transport.request("exchange", {
|
|
37079
|
+
action,
|
|
37080
|
+
signature,
|
|
37081
|
+
nonce: action.nonce
|
|
37082
|
+
});
|
|
37083
|
+
}
|
|
37084
|
+
async function getHip3DexAbstraction(client, user) {
|
|
37085
|
+
return await client.transport.request("info", {
|
|
37086
|
+
type: "userDexAbstraction",
|
|
37087
|
+
user
|
|
37088
|
+
});
|
|
37089
|
+
}
|
|
37022
37090
|
|
|
37023
37091
|
// import("./data/**/*/staticMeta.json") in lib/meta/metadata.ts
|
|
37024
37092
|
var globImport_data_staticMeta_json = __glob({
|
|
@@ -37568,6 +37636,7 @@ function getPriceDecimals(price, szDecimals, isSpot) {
|
|
|
37568
37636
|
TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT,
|
|
37569
37637
|
TESTNET_USDC_SPOT_TOKEN,
|
|
37570
37638
|
USDC_SPOT_TOKEN,
|
|
37639
|
+
UserDexAbstractionTypes,
|
|
37571
37640
|
WidgetType,
|
|
37572
37641
|
WidgetTypeById,
|
|
37573
37642
|
XP_BOOST_PERCENTAGES,
|
|
@@ -37575,6 +37644,7 @@ function getPriceDecimals(price, szDecimals, isSpot) {
|
|
|
37575
37644
|
calculateBoostPercentage,
|
|
37576
37645
|
calculateTotalPupAmount,
|
|
37577
37646
|
decodeSlug,
|
|
37647
|
+
enableHip3DexAbstractionWithAgent,
|
|
37578
37648
|
encodeSlug,
|
|
37579
37649
|
formatPriceAndSize,
|
|
37580
37650
|
formatPriceForOrder,
|
|
@@ -37582,11 +37652,14 @@ function getPriceDecimals(price, szDecimals, isSpot) {
|
|
|
37582
37652
|
getApprovalAmount,
|
|
37583
37653
|
getClientCodeNameById,
|
|
37584
37654
|
getCloid,
|
|
37655
|
+
getHip3Dex,
|
|
37656
|
+
getHip3DexAbstraction,
|
|
37585
37657
|
getNextTierInfo,
|
|
37586
37658
|
getPriceDecimals,
|
|
37587
37659
|
getWidgetTypeById,
|
|
37588
37660
|
isBasedCloid,
|
|
37589
37661
|
isClientCode,
|
|
37662
|
+
isHip3Symbol,
|
|
37590
37663
|
isMiniAppCloid,
|
|
37591
37664
|
isMiniAppTriggeredCloid,
|
|
37592
37665
|
isTenantCloid,
|
|
@@ -37595,5 +37668,6 @@ function getPriceDecimals(price, szDecimals, isSpot) {
|
|
|
37595
37668
|
normaliseSlug,
|
|
37596
37669
|
normaliseTrackingId,
|
|
37597
37670
|
normalizeAirdropAmount,
|
|
37598
|
-
parseCloid
|
|
37671
|
+
parseCloid,
|
|
37672
|
+
setHip3DexAbstraction
|
|
37599
37673
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -208,7 +208,8 @@ var CloidClientCode = {
|
|
|
208
208
|
Grid: 5,
|
|
209
209
|
Chase: 6,
|
|
210
210
|
Desktop: 7,
|
|
211
|
-
API: 8
|
|
211
|
+
API: 8,
|
|
212
|
+
Stream: 9
|
|
212
213
|
};
|
|
213
214
|
var CloidClientCodeNameById = {
|
|
214
215
|
[CloidClientCode.Unset]: "Unset",
|
|
@@ -219,7 +220,8 @@ var CloidClientCodeNameById = {
|
|
|
219
220
|
[CloidClientCode.Grid]: "Grid",
|
|
220
221
|
[CloidClientCode.Chase]: "Chase",
|
|
221
222
|
[CloidClientCode.Desktop]: "Desktop",
|
|
222
|
-
[CloidClientCode.API]: "API"
|
|
223
|
+
[CloidClientCode.API]: "API",
|
|
224
|
+
[CloidClientCode.Stream]: "Stream"
|
|
223
225
|
};
|
|
224
226
|
function getClientCodeNameById(id) {
|
|
225
227
|
return CloidClientCodeNameById[id] ?? `client_${id}`;
|
|
@@ -229,13 +231,15 @@ var WidgetType = {
|
|
|
229
231
|
// 0x00
|
|
230
232
|
SidePanel: 1,
|
|
231
233
|
Widget: 2,
|
|
232
|
-
FloatingWidget: 3
|
|
234
|
+
FloatingWidget: 3,
|
|
235
|
+
Stream: 4
|
|
233
236
|
};
|
|
234
237
|
var WidgetTypeById = {
|
|
235
238
|
[WidgetType.Unset]: "Unset",
|
|
236
239
|
[WidgetType.SidePanel]: "SidePanel",
|
|
237
240
|
[WidgetType.Widget]: "Widget",
|
|
238
|
-
[WidgetType.FloatingWidget]: "FloatingWidget"
|
|
241
|
+
[WidgetType.FloatingWidget]: "FloatingWidget",
|
|
242
|
+
[WidgetType.Stream]: "Stream"
|
|
239
243
|
};
|
|
240
244
|
function getWidgetTypeById(id) {
|
|
241
245
|
return WidgetTypeById[id] ?? `widget_${id}`;
|
|
@@ -537,10 +541,71 @@ import {
|
|
|
537
541
|
} from "@nktkas/hyperliquid";
|
|
538
542
|
|
|
539
543
|
// lib/hip3/utils.ts
|
|
544
|
+
import {
|
|
545
|
+
signL1Action,
|
|
546
|
+
signUserSignedAction
|
|
547
|
+
} from "@nktkas/hyperliquid/signing";
|
|
540
548
|
function isHip3Symbol(symbol) {
|
|
541
549
|
if (!symbol) return false;
|
|
542
550
|
return symbol.includes(":");
|
|
543
551
|
}
|
|
552
|
+
function getHip3Dex(symbol) {
|
|
553
|
+
if (!symbol) return null;
|
|
554
|
+
return symbol.split(":")[0];
|
|
555
|
+
}
|
|
556
|
+
async function enableHip3DexAbstractionWithAgent(client) {
|
|
557
|
+
const nonce = Date.now();
|
|
558
|
+
const action = {
|
|
559
|
+
type: "agentEnableDexAbstraction"
|
|
560
|
+
};
|
|
561
|
+
const signature = await signL1Action({
|
|
562
|
+
wallet: client.wallet,
|
|
563
|
+
action,
|
|
564
|
+
isTestnet: client.isTestnet,
|
|
565
|
+
nonce
|
|
566
|
+
});
|
|
567
|
+
return await client.transport.request("exchange", {
|
|
568
|
+
action,
|
|
569
|
+
signature,
|
|
570
|
+
nonce
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
var UserDexAbstractionTypes = {
|
|
574
|
+
"HyperliquidTransaction:UserDexAbstraction": [
|
|
575
|
+
{ name: "hyperliquidChain", type: "string" },
|
|
576
|
+
{ name: "user", type: "address" },
|
|
577
|
+
{ name: "enabled", type: "bool" },
|
|
578
|
+
{ name: "nonce", type: "uint64" }
|
|
579
|
+
]
|
|
580
|
+
};
|
|
581
|
+
async function setHip3DexAbstraction(client, enabled, user) {
|
|
582
|
+
const nonce = Date.now();
|
|
583
|
+
const isTestnet = client.isTestnet;
|
|
584
|
+
const action = {
|
|
585
|
+
type: "userDexAbstraction",
|
|
586
|
+
hyperliquidChain: isTestnet ? "Testnet" : "Mainnet",
|
|
587
|
+
signatureChainId: isTestnet ? "0x66eee" : "0xa4b1",
|
|
588
|
+
user,
|
|
589
|
+
enabled,
|
|
590
|
+
nonce
|
|
591
|
+
};
|
|
592
|
+
const signature = await signUserSignedAction({
|
|
593
|
+
wallet: client.wallet,
|
|
594
|
+
action,
|
|
595
|
+
types: UserDexAbstractionTypes
|
|
596
|
+
});
|
|
597
|
+
return await client.transport.request("exchange", {
|
|
598
|
+
action,
|
|
599
|
+
signature,
|
|
600
|
+
nonce: action.nonce
|
|
601
|
+
});
|
|
602
|
+
}
|
|
603
|
+
async function getHip3DexAbstraction(client, user) {
|
|
604
|
+
return await client.transport.request("info", {
|
|
605
|
+
type: "userDexAbstraction",
|
|
606
|
+
user
|
|
607
|
+
});
|
|
608
|
+
}
|
|
544
609
|
|
|
545
610
|
// import("./data/**/*/staticMeta.json") in lib/meta/metadata.ts
|
|
546
611
|
var globImport_data_staticMeta_json = __glob({
|
|
@@ -1089,6 +1154,7 @@ export {
|
|
|
1089
1154
|
TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT,
|
|
1090
1155
|
TESTNET_USDC_SPOT_TOKEN,
|
|
1091
1156
|
USDC_SPOT_TOKEN,
|
|
1157
|
+
UserDexAbstractionTypes,
|
|
1092
1158
|
WidgetType,
|
|
1093
1159
|
WidgetTypeById,
|
|
1094
1160
|
XP_BOOST_PERCENTAGES,
|
|
@@ -1096,6 +1162,7 @@ export {
|
|
|
1096
1162
|
calculateBoostPercentage,
|
|
1097
1163
|
calculateTotalPupAmount,
|
|
1098
1164
|
decodeSlug,
|
|
1165
|
+
enableHip3DexAbstractionWithAgent,
|
|
1099
1166
|
encodeSlug,
|
|
1100
1167
|
formatPriceAndSize,
|
|
1101
1168
|
formatPriceForOrder,
|
|
@@ -1103,11 +1170,14 @@ export {
|
|
|
1103
1170
|
getApprovalAmount,
|
|
1104
1171
|
getClientCodeNameById,
|
|
1105
1172
|
getCloid,
|
|
1173
|
+
getHip3Dex,
|
|
1174
|
+
getHip3DexAbstraction,
|
|
1106
1175
|
getNextTierInfo,
|
|
1107
1176
|
getPriceDecimals,
|
|
1108
1177
|
getWidgetTypeById,
|
|
1109
1178
|
isBasedCloid,
|
|
1110
1179
|
isClientCode,
|
|
1180
|
+
isHip3Symbol,
|
|
1111
1181
|
isMiniAppCloid,
|
|
1112
1182
|
isMiniAppTriggeredCloid,
|
|
1113
1183
|
isTenantCloid,
|
|
@@ -1116,5 +1186,6 @@ export {
|
|
|
1116
1186
|
normaliseSlug,
|
|
1117
1187
|
normaliseTrackingId,
|
|
1118
1188
|
normalizeAirdropAmount,
|
|
1119
|
-
parseCloid
|
|
1189
|
+
parseCloid,
|
|
1190
|
+
setHip3DexAbstraction
|
|
1120
1191
|
};
|