@zoralabs/protocol-deployments 0.6.3 → 0.6.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoralabs/protocol-deployments",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "repository": "https://github.com/ourzora/zora-protocol",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/encoding.ts CHANGED
@@ -2,17 +2,11 @@ import {
2
2
  Address,
3
3
  decodeAbiParameters,
4
4
  encodeAbiParameters,
5
- encodeFunctionData,
6
5
  getAbiItem,
7
6
  } from "viem";
8
- import {
9
- uniswapV3SwapRouterABI,
10
- poolConfigEncodingABI,
11
- } from "./generated/wagmi";
12
- import { buySupplyWithSwapRouterHookAddress } from "./generated/wagmi";
7
+ import { poolConfigEncodingABI } from "./generated/wagmi";
13
8
 
14
9
  import { Hex } from "viem";
15
- import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from "abitype";
16
10
 
17
11
  /** ABI parameters for performing a SafeTransferFrom based swap when selling on secondary. */
18
12
  export const safeTransferSwapAbiParameters = [
@@ -31,123 +25,6 @@ export const buySupplyWithSwapRouterHookReturnParameters = [
31
25
  { name: "coinsPurchased", internalType: "uint256", type: "uint256" },
32
26
  ] as const;
33
27
 
34
- /**
35
- * Encodes the calldata for the BuySupplyWithSwapRouterHook.
36
- *
37
- * @param buyRecipient - The address of the recipient of the coins that are purchased.
38
- * @param swapRouterCall - The calldata to send for swapping on the swap router. For the call, the recipient of the swap
39
- * must be the hook contract.
40
- * @returns The encoded calldata.
41
- */
42
- export const encodeBuySupplyWithSwapRouterHookCalldata = (
43
- buyRecipient: Address,
44
- swapRouterCall: Hex,
45
- ) => {
46
- return encodeAbiParameters(buySupplyWithSwapRouterHookAbiParameters, [
47
- buyRecipient,
48
- swapRouterCall,
49
- ]);
50
- };
51
-
52
- type ExactInputSingleParams = AbiParametersToPrimitiveTypes<
53
- ExtractAbiFunction<
54
- typeof uniswapV3SwapRouterABI,
55
- "exactInputSingle"
56
- >["inputs"]
57
- >[0];
58
-
59
- type ExactInputParams = AbiParametersToPrimitiveTypes<
60
- ExtractAbiFunction<typeof uniswapV3SwapRouterABI, "exactInput">["inputs"]
61
- >[0];
62
-
63
- /**
64
- * Encodes the call data for buying supply with a single-hop swap router hook.
65
- * This function creates the hook call and hook data needed to buy Coin supply using ETH through a Uniswap V3 single-hop swap.
66
- *
67
- * @param buyRecipient - The address that will receive the coins purchased
68
- * @param exactInputSingleParams - The parameters for the exactInputSingle function on the swap router (recipient is omitted as it will be set to the hook address)
69
- * @param chainId - The chain ID to use for getting the hook address
70
- * @param ethValue - Optional amount of ETH to send with the call to the swap router
71
- * @returns Object containing the encoded hook call, hook data, and ETH value
72
- */
73
- export const encodeBuySupplyWithSingleHopSwapRouterHookCall = ({
74
- buyRecipient,
75
- exactInputSingleParams,
76
- chainId,
77
- ethValue,
78
- }: {
79
- buyRecipient: Address;
80
- exactInputSingleParams: Omit<ExactInputSingleParams, "recipient">;
81
- chainId: keyof typeof buySupplyWithSwapRouterHookAddress;
82
- // optional amount of ETH to send with the call to the swap router
83
- ethValue?: bigint;
84
- }) => {
85
- const hook = buySupplyWithSwapRouterHookAddress[chainId];
86
- const callToSwapRouter = encodeFunctionData({
87
- abi: uniswapV3SwapRouterABI,
88
- functionName: "exactInputSingle",
89
- args: [
90
- {
91
- recipient: hook,
92
- ...exactInputSingleParams,
93
- },
94
- ],
95
- });
96
-
97
- return {
98
- hook,
99
- hookData: encodeBuySupplyWithSwapRouterHookCalldata(
100
- buyRecipient,
101
- callToSwapRouter,
102
- ),
103
- value: ethValue,
104
- };
105
- };
106
-
107
- /**
108
- * Encodes the call data for buying supply with a multi-hop swap router hook.
109
- * This function creates the hook call and hook data needed to buy Coin supply using ETH through a Uniswap V3 multi-hop swap.
110
- *
111
- * @param buyRecipient - The address that will receive the coins purchased
112
- * @param exactInputParams - The parameters for the exactInput function on the swap router (recipient is omitted as it will be set to the hook address)
113
- * @param chainId - The chain ID to use for getting the hook address
114
- * @param ethValue - Optional amount of ETH to send with the call to the swap router
115
- * @returns Object containing the encoded hook call, hook data, and ETH value
116
- */
117
- export const encodeBuySupplyWithMultiHopSwapRouterHookCall = ({
118
- buyRecipient,
119
- exactInputParams,
120
- chainId,
121
- ethValue,
122
- }: {
123
- buyRecipient: Address;
124
- exactInputParams: Omit<ExactInputParams, "recipient">;
125
- chainId: keyof typeof buySupplyWithSwapRouterHookAddress;
126
- // optional amount of ETH to send with the call to the swap router
127
- ethValue?: bigint;
128
- }) => {
129
- const hook = buySupplyWithSwapRouterHookAddress[chainId];
130
- const callToSwapRouter = encodeFunctionData({
131
- abi: uniswapV3SwapRouterABI,
132
- functionName: "exactInput",
133
- args: [
134
- {
135
- recipient: hook,
136
- ...exactInputParams,
137
- },
138
- ],
139
- });
140
-
141
- return {
142
- hook,
143
- hookData: encodeBuySupplyWithSwapRouterHookCalldata(
144
- buyRecipient,
145
- callToSwapRouter,
146
- ),
147
- value: ethValue,
148
- };
149
- };
150
-
151
28
  /**
152
29
  * Decodes the return data from the BuySupplyWithSwapRouterHook.
153
30
  *