@morpho-dev/router 0.1.9 → 0.1.11
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/drizzle/offers_v1.1/0006_add-callback-amount-to-queues-table.sql +1 -0
- package/dist/drizzle/offers_v1.1/0007_add-index-to-created-at.sql +2 -0
- package/dist/drizzle/offers_v1.1/meta/0006_snapshot.json +884 -0
- package/dist/drizzle/offers_v1.1/meta/0007_snapshot.json +932 -0
- package/dist/drizzle/offers_v1.1/meta/_journal.json +14 -0
- package/dist/index.browser.d.cts +140 -12
- package/dist/index.browser.d.ts +140 -12
- package/dist/index.browser.js +211 -47
- package/dist/index.browser.js.map +1 -1
- package/dist/index.browser.mjs +212 -48
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.node.d.cts +158 -12
- package/dist/index.node.d.ts +158 -12
- package/dist/index.node.js +347 -121
- package/dist/index.node.js.map +1 -1
- package/dist/index.node.mjs +349 -123
- package/dist/index.node.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -43,6 +43,20 @@
|
|
|
43
43
|
"when": 1758270235112,
|
|
44
44
|
"tag": "0005_add-missing-indices-to-liquidity-tables",
|
|
45
45
|
"breakpoints": true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"idx": 6,
|
|
49
|
+
"version": "7",
|
|
50
|
+
"when": 1758809713216,
|
|
51
|
+
"tag": "0006_add-callback-amount-to-queues-table",
|
|
52
|
+
"breakpoints": true
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"idx": 7,
|
|
56
|
+
"version": "7",
|
|
57
|
+
"when": 1758889033235,
|
|
58
|
+
"tag": "0007_add-index-to-created-at",
|
|
59
|
+
"breakpoints": true
|
|
46
60
|
}
|
|
47
61
|
]
|
|
48
62
|
}
|
package/dist/index.browser.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
2
|
-
import { Offer, Errors, Format, Maturity, LLTV, Compute
|
|
2
|
+
import { Chain, Offer, Errors, Format, Maturity, LLTV, Compute } from '@morpho-dev/mempool';
|
|
3
3
|
export * from '@morpho-dev/mempool';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
5
|
import { PublicActions, Address, Hex } from 'viem';
|
|
@@ -34,6 +34,7 @@ type LiquidityQueue = {
|
|
|
34
34
|
queueId: string;
|
|
35
35
|
availableLiquidityPoolId: string;
|
|
36
36
|
index: number;
|
|
37
|
+
callbackAmount: string;
|
|
37
38
|
updatedAt: Date;
|
|
38
39
|
};
|
|
39
40
|
type LiquidityPool = {
|
|
@@ -56,7 +57,7 @@ declare function fetch(parameters: {
|
|
|
56
57
|
type: CallbackType;
|
|
57
58
|
pairs: Array<{
|
|
58
59
|
user: Address;
|
|
59
|
-
|
|
60
|
+
loanToken: Address;
|
|
60
61
|
}>;
|
|
61
62
|
options?: {
|
|
62
63
|
batchSize?: number;
|
|
@@ -80,25 +81,56 @@ declare namespace Liquidity$1 {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
declare enum CallbackType {
|
|
83
|
-
BuyWithEmptyCallback = "buy_with_empty_callback"
|
|
84
|
+
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
85
|
+
SellWithdrawFromWallet = "sell_withdraw_from_wallet"
|
|
84
86
|
}
|
|
85
|
-
declare
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
|
|
88
|
+
type BuildLiquidityParameters = {
|
|
89
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
90
|
+
user: Address;
|
|
91
|
+
loanToken: Address;
|
|
92
|
+
chainId: Chain.Id;
|
|
93
|
+
amount: bigint;
|
|
94
|
+
index?: number;
|
|
95
|
+
updatedAt?: Date;
|
|
96
|
+
} | {
|
|
97
|
+
type: CallbackType.SellWithdrawFromWallet;
|
|
98
|
+
user: Address;
|
|
99
|
+
termId: string;
|
|
100
|
+
chainId: Chain.Id;
|
|
101
|
+
amount: bigint;
|
|
102
|
+
collaterals: Array<{
|
|
103
|
+
collateralAddress: Address;
|
|
104
|
+
balance: bigint;
|
|
105
|
+
callbackAmount: bigint;
|
|
106
|
+
}>;
|
|
91
107
|
index?: number;
|
|
92
108
|
updatedAt?: Date;
|
|
93
|
-
}
|
|
109
|
+
};
|
|
110
|
+
declare function buildLiquidity(parameters: BuildLiquidityParameters): Liquidity;
|
|
94
111
|
declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
|
|
112
|
+
declare function decode$1(parameters: {
|
|
113
|
+
type: CallbackType;
|
|
114
|
+
data: Hex;
|
|
115
|
+
}): Array<{
|
|
116
|
+
collateral: Address;
|
|
117
|
+
amount: bigint;
|
|
118
|
+
}>;
|
|
119
|
+
declare function encode$1(parameters: {
|
|
120
|
+
type: CallbackType;
|
|
121
|
+
data: {
|
|
122
|
+
collaterals: Address[];
|
|
123
|
+
amounts: bigint[];
|
|
124
|
+
};
|
|
125
|
+
}): Hex;
|
|
95
126
|
|
|
96
127
|
type Callback_CallbackType = CallbackType;
|
|
97
128
|
declare const Callback_CallbackType: typeof CallbackType;
|
|
129
|
+
declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
|
|
98
130
|
declare const Callback_buildLiquidity: typeof buildLiquidity;
|
|
99
131
|
declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
|
|
100
132
|
declare namespace Callback {
|
|
101
|
-
export { Callback_CallbackType as CallbackType, Callback_buildLiquidity as buildLiquidity, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
133
|
+
export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_buildLiquidity as buildLiquidity, decode$1 as decode, encode$1 as encode, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
102
134
|
}
|
|
103
135
|
|
|
104
136
|
type Cursor = {
|
|
@@ -578,7 +610,103 @@ declare function morpho(): (Rule<{
|
|
|
578
610
|
readonly hash: viem.Hex;
|
|
579
611
|
signature?: viem.Hex;
|
|
580
612
|
createdAt?: number;
|
|
581
|
-
}, "
|
|
613
|
+
}, "sell_offers_empty_callback", MorphoContext> | Rule<{
|
|
614
|
+
readonly offering: Address;
|
|
615
|
+
readonly assets: bigint;
|
|
616
|
+
readonly rate: bigint;
|
|
617
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
618
|
+
readonly expiry: number;
|
|
619
|
+
readonly nonce: bigint;
|
|
620
|
+
readonly buy: boolean;
|
|
621
|
+
readonly chainId: bigint;
|
|
622
|
+
readonly loanToken: Address;
|
|
623
|
+
readonly start: number;
|
|
624
|
+
readonly collaterals: readonly {
|
|
625
|
+
asset: Address;
|
|
626
|
+
oracle: Address;
|
|
627
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
628
|
+
}[];
|
|
629
|
+
readonly callback: {
|
|
630
|
+
readonly address: Address;
|
|
631
|
+
readonly data: viem.Hex;
|
|
632
|
+
readonly gasLimit: bigint;
|
|
633
|
+
};
|
|
634
|
+
readonly hash: viem.Hex;
|
|
635
|
+
signature?: viem.Hex;
|
|
636
|
+
createdAt?: number;
|
|
637
|
+
}, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
|
|
638
|
+
readonly offering: Address;
|
|
639
|
+
readonly assets: bigint;
|
|
640
|
+
readonly rate: bigint;
|
|
641
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
642
|
+
readonly expiry: number;
|
|
643
|
+
readonly nonce: bigint;
|
|
644
|
+
readonly buy: boolean;
|
|
645
|
+
readonly chainId: bigint;
|
|
646
|
+
readonly loanToken: Address;
|
|
647
|
+
readonly start: number;
|
|
648
|
+
readonly collaterals: readonly {
|
|
649
|
+
asset: Address;
|
|
650
|
+
oracle: Address;
|
|
651
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
652
|
+
}[];
|
|
653
|
+
readonly callback: {
|
|
654
|
+
readonly address: Address;
|
|
655
|
+
readonly data: viem.Hex;
|
|
656
|
+
readonly gasLimit: bigint;
|
|
657
|
+
};
|
|
658
|
+
readonly hash: viem.Hex;
|
|
659
|
+
signature?: viem.Hex;
|
|
660
|
+
createdAt?: number;
|
|
661
|
+
}, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
|
|
662
|
+
readonly offering: Address;
|
|
663
|
+
readonly assets: bigint;
|
|
664
|
+
readonly rate: bigint;
|
|
665
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
666
|
+
readonly expiry: number;
|
|
667
|
+
readonly nonce: bigint;
|
|
668
|
+
readonly buy: boolean;
|
|
669
|
+
readonly chainId: bigint;
|
|
670
|
+
readonly loanToken: Address;
|
|
671
|
+
readonly start: number;
|
|
672
|
+
readonly collaterals: readonly {
|
|
673
|
+
asset: Address;
|
|
674
|
+
oracle: Address;
|
|
675
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
676
|
+
}[];
|
|
677
|
+
readonly callback: {
|
|
678
|
+
readonly address: Address;
|
|
679
|
+
readonly data: viem.Hex;
|
|
680
|
+
readonly gasLimit: bigint;
|
|
681
|
+
};
|
|
682
|
+
readonly hash: viem.Hex;
|
|
683
|
+
signature?: viem.Hex;
|
|
684
|
+
createdAt?: number;
|
|
685
|
+
}, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
|
|
686
|
+
readonly offering: Address;
|
|
687
|
+
readonly assets: bigint;
|
|
688
|
+
readonly rate: bigint;
|
|
689
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
690
|
+
readonly expiry: number;
|
|
691
|
+
readonly nonce: bigint;
|
|
692
|
+
readonly buy: boolean;
|
|
693
|
+
readonly chainId: bigint;
|
|
694
|
+
readonly loanToken: Address;
|
|
695
|
+
readonly start: number;
|
|
696
|
+
readonly collaterals: readonly {
|
|
697
|
+
asset: Address;
|
|
698
|
+
oracle: Address;
|
|
699
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
700
|
+
}[];
|
|
701
|
+
readonly callback: {
|
|
702
|
+
readonly address: Address;
|
|
703
|
+
readonly data: viem.Hex;
|
|
704
|
+
readonly gasLimit: bigint;
|
|
705
|
+
};
|
|
706
|
+
readonly hash: viem.Hex;
|
|
707
|
+
signature?: viem.Hex;
|
|
708
|
+
createdAt?: number;
|
|
709
|
+
}, "sell_offers_callback_collateral_invalid", MorphoContext>)[];
|
|
582
710
|
|
|
583
711
|
type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
|
|
584
712
|
type ValidationRule_MorphoContext = MorphoContext;
|
package/dist/index.browser.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _morpho_dev_mempool from '@morpho-dev/mempool';
|
|
2
|
-
import { Offer, Errors, Format, Maturity, LLTV, Compute
|
|
2
|
+
import { Chain, Offer, Errors, Format, Maturity, LLTV, Compute } from '@morpho-dev/mempool';
|
|
3
3
|
export * from '@morpho-dev/mempool';
|
|
4
4
|
import * as viem from 'viem';
|
|
5
5
|
import { PublicActions, Address, Hex } from 'viem';
|
|
@@ -34,6 +34,7 @@ type LiquidityQueue = {
|
|
|
34
34
|
queueId: string;
|
|
35
35
|
availableLiquidityPoolId: string;
|
|
36
36
|
index: number;
|
|
37
|
+
callbackAmount: string;
|
|
37
38
|
updatedAt: Date;
|
|
38
39
|
};
|
|
39
40
|
type LiquidityPool = {
|
|
@@ -56,7 +57,7 @@ declare function fetch(parameters: {
|
|
|
56
57
|
type: CallbackType;
|
|
57
58
|
pairs: Array<{
|
|
58
59
|
user: Address;
|
|
59
|
-
|
|
60
|
+
loanToken: Address;
|
|
60
61
|
}>;
|
|
61
62
|
options?: {
|
|
62
63
|
batchSize?: number;
|
|
@@ -80,25 +81,56 @@ declare namespace Liquidity$1 {
|
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
declare enum CallbackType {
|
|
83
|
-
BuyWithEmptyCallback = "buy_with_empty_callback"
|
|
84
|
+
BuyWithEmptyCallback = "buy_with_empty_callback",
|
|
85
|
+
SellWithdrawFromWallet = "sell_withdraw_from_wallet"
|
|
84
86
|
}
|
|
85
|
-
declare
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
declare const WhitelistedCallbackAddresses: Record<CallbackType, readonly string[]>;
|
|
88
|
+
type BuildLiquidityParameters = {
|
|
89
|
+
type: CallbackType.BuyWithEmptyCallback;
|
|
90
|
+
user: Address;
|
|
91
|
+
loanToken: Address;
|
|
92
|
+
chainId: Chain.Id;
|
|
93
|
+
amount: bigint;
|
|
94
|
+
index?: number;
|
|
95
|
+
updatedAt?: Date;
|
|
96
|
+
} | {
|
|
97
|
+
type: CallbackType.SellWithdrawFromWallet;
|
|
98
|
+
user: Address;
|
|
99
|
+
termId: string;
|
|
100
|
+
chainId: Chain.Id;
|
|
101
|
+
amount: bigint;
|
|
102
|
+
collaterals: Array<{
|
|
103
|
+
collateralAddress: Address;
|
|
104
|
+
balance: bigint;
|
|
105
|
+
callbackAmount: bigint;
|
|
106
|
+
}>;
|
|
91
107
|
index?: number;
|
|
92
108
|
updatedAt?: Date;
|
|
93
|
-
}
|
|
109
|
+
};
|
|
110
|
+
declare function buildLiquidity(parameters: BuildLiquidityParameters): Liquidity;
|
|
94
111
|
declare function getCallbackIdForOffer(offer: Offer.Offer): string | null;
|
|
112
|
+
declare function decode$1(parameters: {
|
|
113
|
+
type: CallbackType;
|
|
114
|
+
data: Hex;
|
|
115
|
+
}): Array<{
|
|
116
|
+
collateral: Address;
|
|
117
|
+
amount: bigint;
|
|
118
|
+
}>;
|
|
119
|
+
declare function encode$1(parameters: {
|
|
120
|
+
type: CallbackType;
|
|
121
|
+
data: {
|
|
122
|
+
collaterals: Address[];
|
|
123
|
+
amounts: bigint[];
|
|
124
|
+
};
|
|
125
|
+
}): Hex;
|
|
95
126
|
|
|
96
127
|
type Callback_CallbackType = CallbackType;
|
|
97
128
|
declare const Callback_CallbackType: typeof CallbackType;
|
|
129
|
+
declare const Callback_WhitelistedCallbackAddresses: typeof WhitelistedCallbackAddresses;
|
|
98
130
|
declare const Callback_buildLiquidity: typeof buildLiquidity;
|
|
99
131
|
declare const Callback_getCallbackIdForOffer: typeof getCallbackIdForOffer;
|
|
100
132
|
declare namespace Callback {
|
|
101
|
-
export { Callback_CallbackType as CallbackType, Callback_buildLiquidity as buildLiquidity, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
133
|
+
export { Callback_CallbackType as CallbackType, Callback_WhitelistedCallbackAddresses as WhitelistedCallbackAddresses, Callback_buildLiquidity as buildLiquidity, decode$1 as decode, encode$1 as encode, Callback_getCallbackIdForOffer as getCallbackIdForOffer };
|
|
102
134
|
}
|
|
103
135
|
|
|
104
136
|
type Cursor = {
|
|
@@ -578,7 +610,103 @@ declare function morpho(): (Rule<{
|
|
|
578
610
|
readonly hash: viem.Hex;
|
|
579
611
|
signature?: viem.Hex;
|
|
580
612
|
createdAt?: number;
|
|
581
|
-
}, "
|
|
613
|
+
}, "sell_offers_empty_callback", MorphoContext> | Rule<{
|
|
614
|
+
readonly offering: Address;
|
|
615
|
+
readonly assets: bigint;
|
|
616
|
+
readonly rate: bigint;
|
|
617
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
618
|
+
readonly expiry: number;
|
|
619
|
+
readonly nonce: bigint;
|
|
620
|
+
readonly buy: boolean;
|
|
621
|
+
readonly chainId: bigint;
|
|
622
|
+
readonly loanToken: Address;
|
|
623
|
+
readonly start: number;
|
|
624
|
+
readonly collaterals: readonly {
|
|
625
|
+
asset: Address;
|
|
626
|
+
oracle: Address;
|
|
627
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
628
|
+
}[];
|
|
629
|
+
readonly callback: {
|
|
630
|
+
readonly address: Address;
|
|
631
|
+
readonly data: viem.Hex;
|
|
632
|
+
readonly gasLimit: bigint;
|
|
633
|
+
};
|
|
634
|
+
readonly hash: viem.Hex;
|
|
635
|
+
signature?: viem.Hex;
|
|
636
|
+
createdAt?: number;
|
|
637
|
+
}, "buy_offers_non_empty_callback", MorphoContext> | Rule<{
|
|
638
|
+
readonly offering: Address;
|
|
639
|
+
readonly assets: bigint;
|
|
640
|
+
readonly rate: bigint;
|
|
641
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
642
|
+
readonly expiry: number;
|
|
643
|
+
readonly nonce: bigint;
|
|
644
|
+
readonly buy: boolean;
|
|
645
|
+
readonly chainId: bigint;
|
|
646
|
+
readonly loanToken: Address;
|
|
647
|
+
readonly start: number;
|
|
648
|
+
readonly collaterals: readonly {
|
|
649
|
+
asset: Address;
|
|
650
|
+
oracle: Address;
|
|
651
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
652
|
+
}[];
|
|
653
|
+
readonly callback: {
|
|
654
|
+
readonly address: Address;
|
|
655
|
+
readonly data: viem.Hex;
|
|
656
|
+
readonly gasLimit: bigint;
|
|
657
|
+
};
|
|
658
|
+
readonly hash: viem.Hex;
|
|
659
|
+
signature?: viem.Hex;
|
|
660
|
+
createdAt?: number;
|
|
661
|
+
}, "sell_offers_non_whitelisted_callback", MorphoContext> | Rule<{
|
|
662
|
+
readonly offering: Address;
|
|
663
|
+
readonly assets: bigint;
|
|
664
|
+
readonly rate: bigint;
|
|
665
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
666
|
+
readonly expiry: number;
|
|
667
|
+
readonly nonce: bigint;
|
|
668
|
+
readonly buy: boolean;
|
|
669
|
+
readonly chainId: bigint;
|
|
670
|
+
readonly loanToken: Address;
|
|
671
|
+
readonly start: number;
|
|
672
|
+
readonly collaterals: readonly {
|
|
673
|
+
asset: Address;
|
|
674
|
+
oracle: Address;
|
|
675
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
676
|
+
}[];
|
|
677
|
+
readonly callback: {
|
|
678
|
+
readonly address: Address;
|
|
679
|
+
readonly data: viem.Hex;
|
|
680
|
+
readonly gasLimit: bigint;
|
|
681
|
+
};
|
|
682
|
+
readonly hash: viem.Hex;
|
|
683
|
+
signature?: viem.Hex;
|
|
684
|
+
createdAt?: number;
|
|
685
|
+
}, "sell_offers_callback_data_invalid", MorphoContext> | Rule<{
|
|
686
|
+
readonly offering: Address;
|
|
687
|
+
readonly assets: bigint;
|
|
688
|
+
readonly rate: bigint;
|
|
689
|
+
readonly maturity: number & _morpho_dev_mempool.Brand<"Maturity">;
|
|
690
|
+
readonly expiry: number;
|
|
691
|
+
readonly nonce: bigint;
|
|
692
|
+
readonly buy: boolean;
|
|
693
|
+
readonly chainId: bigint;
|
|
694
|
+
readonly loanToken: Address;
|
|
695
|
+
readonly start: number;
|
|
696
|
+
readonly collaterals: readonly {
|
|
697
|
+
asset: Address;
|
|
698
|
+
oracle: Address;
|
|
699
|
+
lltv: bigint & _morpho_dev_mempool.Brand<"LLTV">;
|
|
700
|
+
}[];
|
|
701
|
+
readonly callback: {
|
|
702
|
+
readonly address: Address;
|
|
703
|
+
readonly data: viem.Hex;
|
|
704
|
+
readonly gasLimit: bigint;
|
|
705
|
+
};
|
|
706
|
+
readonly hash: viem.Hex;
|
|
707
|
+
signature?: viem.Hex;
|
|
708
|
+
createdAt?: number;
|
|
709
|
+
}, "sell_offers_callback_collateral_invalid", MorphoContext>)[];
|
|
582
710
|
|
|
583
711
|
type ValidationRule_Batch<T, RuleName extends string, Ctx = void> = Batch<T, RuleName, Ctx>;
|
|
584
712
|
type ValidationRule_MorphoContext = MorphoContext;
|