@zoralabs/coins-sdk 0.2.11 → 0.3.1
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/CHANGELOG.md +60 -0
- package/dist/actions/createCoin.d.ts +52 -21
- package/dist/actions/createCoin.d.ts.map +1 -1
- package/dist/actions/updateCoinURI.d.ts +2 -2
- package/dist/actions/updateCoinURI.d.ts.map +1 -1
- package/dist/actions/updatePayoutRecipient.d.ts +2 -2
- package/dist/actions/updatePayoutRecipient.d.ts.map +1 -1
- package/dist/api/create.d.ts +8 -0
- package/dist/api/create.d.ts.map +1 -0
- package/dist/api/index.d.ts +4 -0
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/pool-config.d.ts +5 -0
- package/dist/api/pool-config.d.ts.map +1 -0
- package/dist/client/sdk.gen.d.ts +194 -1
- package/dist/client/sdk.gen.d.ts.map +1 -1
- package/dist/client/types.gen.d.ts +567 -0
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.cjs +423 -464
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +393 -434
- package/dist/index.js.map +1 -1
- package/dist/uploader/metadata.d.ts.map +1 -1
- package/dist/uploader/types.d.ts +4 -1
- package/dist/uploader/types.d.ts.map +1 -1
- package/dist/utils/rethrowDecodedRevert.d.ts +3 -0
- package/dist/utils/rethrowDecodedRevert.d.ts.map +1 -0
- package/package.json +2 -1
- package/src/actions/createCoin.ts +158 -111
- package/src/actions/tradeCoin.ts +2 -2
- package/src/actions/updateCoinURI.ts +3 -1
- package/src/actions/updatePayoutRecipient.ts +3 -1
- package/src/api/create.ts +24 -0
- package/src/api/index.ts +8 -0
- package/src/api/pool-config.ts +17 -0
- package/src/client/sdk.gen.ts +50 -0
- package/src/client/types.gen.ts +581 -0
- package/src/index.ts +4 -6
- package/src/uploader/metadata.ts +4 -1
- package/src/uploader/types.ts +4 -1
- package/src/utils/rethrowDecodedRevert.ts +50 -0
- package/dist/actions/getOnchainCoinDetails.d.ts +0 -32
- package/dist/actions/getOnchainCoinDetails.d.ts.map +0 -1
- package/dist/utils/getPrepurchaseHook.d.ts +0 -16
- package/dist/utils/getPrepurchaseHook.d.ts.map +0 -1
- package/src/actions/getOnchainCoinDetails.ts +0 -68
- package/src/utils/getPrepurchaseHook.ts +0 -59
|
@@ -1,138 +1,113 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
coinFactoryAddress,
|
|
3
|
+
coinFactoryABI as zoraFactoryImplABI,
|
|
4
|
+
} from "@zoralabs/protocol-deployments";
|
|
2
5
|
import {
|
|
3
6
|
Address,
|
|
4
7
|
TransactionReceipt,
|
|
5
8
|
WalletClient,
|
|
6
|
-
SimulateContractParameters,
|
|
7
9
|
ContractEventArgsFromTopics,
|
|
8
10
|
parseEventLogs,
|
|
9
|
-
zeroAddress,
|
|
10
|
-
keccak256,
|
|
11
|
-
toBytes,
|
|
12
11
|
Hex,
|
|
13
12
|
Account,
|
|
13
|
+
isAddressEqual,
|
|
14
14
|
} from "viem";
|
|
15
|
-
import { base
|
|
16
|
-
import { COIN_FACTORY_ADDRESS } from "../constants";
|
|
15
|
+
import { base } from "viem/chains";
|
|
17
16
|
import { validateClientNetwork } from "../utils/validateClientNetwork";
|
|
18
17
|
import { GenericPublicClient } from "../utils/genericPublicClient";
|
|
19
18
|
import { validateMetadataURIContent } from "../metadata";
|
|
20
19
|
import { ValidMetadataURI } from "../uploader/types";
|
|
21
|
-
import { getAttribution } from "../utils/attribution";
|
|
22
|
-
import {
|
|
23
|
-
COIN_ETH_PAIR_POOL_CONFIG,
|
|
24
|
-
COIN_ZORA_PAIR_POOL_CONFIG,
|
|
25
|
-
} from "../utils/poolConfigUtils";
|
|
26
|
-
import { getPrepurchaseHook } from "../utils/getPrepurchaseHook";
|
|
27
20
|
import { getChainFromId } from "../utils/getChainFromId";
|
|
21
|
+
import { postCreateContent } from "../api";
|
|
22
|
+
import { rethrowDecodedRevert } from "../utils/rethrowDecodedRevert";
|
|
28
23
|
|
|
29
24
|
export type CoinDeploymentLogArgs = ContractEventArgsFromTopics<
|
|
30
25
|
typeof zoraFactoryImplABI,
|
|
31
26
|
"CoinCreatedV4"
|
|
32
27
|
>;
|
|
33
28
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
29
|
+
const STARTING_MARKET_CAPS = {
|
|
30
|
+
LOW: "LOW",
|
|
31
|
+
HIGH: "HIGH",
|
|
32
|
+
} as const;
|
|
33
|
+
export type StartingMarketCap = keyof typeof STARTING_MARKET_CAPS;
|
|
38
34
|
|
|
39
|
-
export
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
export interface RawUriMetadata {
|
|
36
|
+
type: "RAW_URI";
|
|
37
|
+
uri: string;
|
|
42
38
|
}
|
|
43
39
|
|
|
40
|
+
const CONTENT_COIN_CURRENCIES = {
|
|
41
|
+
CREATOR_COIN: "CREATOR_COIN",
|
|
42
|
+
ZORA: "ZORA",
|
|
43
|
+
ETH: "ETH",
|
|
44
|
+
CREATOR_COIN_OR_ZORA: "CREATOR_COIN_OR_ZORA",
|
|
45
|
+
} as const;
|
|
46
|
+
export type ContentCoinCurrency = keyof typeof CONTENT_COIN_CURRENCIES;
|
|
47
|
+
|
|
48
|
+
export const CreateConstants = {
|
|
49
|
+
StartingMarketCaps: STARTING_MARKET_CAPS,
|
|
50
|
+
ContentCoinCurrencies: CONTENT_COIN_CURRENCIES,
|
|
51
|
+
} as const;
|
|
52
|
+
|
|
44
53
|
export type CreateCoinArgs = {
|
|
54
|
+
creator: string;
|
|
45
55
|
name: string;
|
|
46
56
|
symbol: string;
|
|
47
|
-
|
|
57
|
+
metadata: RawUriMetadata;
|
|
58
|
+
currency: ContentCoinCurrency;
|
|
48
59
|
chainId?: number;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
currency: InitialPurchaseCurrency;
|
|
55
|
-
amount: bigint;
|
|
56
|
-
};
|
|
60
|
+
startingMarketCap?: StartingMarketCap;
|
|
61
|
+
platformReferrer?: string;
|
|
62
|
+
additionalOwners?: Address[];
|
|
63
|
+
payoutRecipientOverride?: Address;
|
|
64
|
+
skipMetadataValidation?: boolean;
|
|
57
65
|
};
|
|
58
66
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
switch (currency) {
|
|
65
|
-
case DeployCurrency.ZORA:
|
|
66
|
-
return COIN_ZORA_PAIR_POOL_CONFIG[
|
|
67
|
-
chainId as keyof typeof COIN_ZORA_PAIR_POOL_CONFIG
|
|
68
|
-
];
|
|
69
|
-
case DeployCurrency.ETH:
|
|
70
|
-
return COIN_ETH_PAIR_POOL_CONFIG[
|
|
71
|
-
chainId as keyof typeof COIN_ETH_PAIR_POOL_CONFIG
|
|
72
|
-
];
|
|
73
|
-
default:
|
|
74
|
-
throw new Error("Invalid currency");
|
|
75
|
-
}
|
|
76
|
-
}
|
|
67
|
+
type TransactionParameters = {
|
|
68
|
+
to: Address;
|
|
69
|
+
data: Hex;
|
|
70
|
+
value: bigint;
|
|
71
|
+
};
|
|
77
72
|
|
|
78
73
|
export async function createCoinCall({
|
|
74
|
+
creator,
|
|
79
75
|
name,
|
|
80
76
|
symbol,
|
|
81
|
-
|
|
82
|
-
owners,
|
|
83
|
-
payoutRecipient,
|
|
77
|
+
metadata,
|
|
84
78
|
currency,
|
|
85
79
|
chainId = base.id,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
> {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (!currency) {
|
|
96
|
-
currency = chainId !== base.id ? DeployCurrency.ETH : DeployCurrency.ZORA;
|
|
80
|
+
payoutRecipientOverride,
|
|
81
|
+
additionalOwners,
|
|
82
|
+
platformReferrer,
|
|
83
|
+
skipMetadataValidation = false,
|
|
84
|
+
}: CreateCoinArgs): Promise<TransactionParameters[]> {
|
|
85
|
+
// Validate metadata URI
|
|
86
|
+
if (!skipMetadataValidation) {
|
|
87
|
+
await validateMetadataURIContent(metadata.uri as ValidMetadataURI);
|
|
97
88
|
}
|
|
98
89
|
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
90
|
+
const createContentRequest = await postCreateContent({
|
|
91
|
+
currency,
|
|
92
|
+
chainId,
|
|
93
|
+
metadata,
|
|
94
|
+
creator,
|
|
95
|
+
name,
|
|
96
|
+
symbol,
|
|
97
|
+
platformReferrer,
|
|
98
|
+
additionalOwners,
|
|
99
|
+
payoutRecipientOverride,
|
|
100
|
+
});
|
|
103
101
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
hookData: "0x" as Hex,
|
|
107
|
-
value: 0n,
|
|
108
|
-
};
|
|
109
|
-
if (initialPurchase) {
|
|
110
|
-
deployHook = await getPrepurchaseHook({
|
|
111
|
-
initialPurchase,
|
|
112
|
-
payoutRecipient,
|
|
113
|
-
chainId,
|
|
114
|
-
});
|
|
102
|
+
if (!createContentRequest.data?.calls) {
|
|
103
|
+
throw new Error("Failed to create content calldata");
|
|
115
104
|
}
|
|
116
105
|
|
|
117
|
-
return {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
payoutRecipient,
|
|
123
|
-
owners,
|
|
124
|
-
uri,
|
|
125
|
-
name,
|
|
126
|
-
symbol,
|
|
127
|
-
poolConfig,
|
|
128
|
-
platformReferrer,
|
|
129
|
-
deployHook.hook,
|
|
130
|
-
deployHook.hookData,
|
|
131
|
-
keccak256(toBytes(Math.random().toString())), // coinSalt
|
|
132
|
-
],
|
|
133
|
-
value: deployHook.value,
|
|
134
|
-
dataSuffix: getAttribution(),
|
|
135
|
-
} as const;
|
|
106
|
+
return createContentRequest.data.calls.map((data) => ({
|
|
107
|
+
to: data.to as Address,
|
|
108
|
+
data: data.data as Hex,
|
|
109
|
+
value: BigInt(data.value),
|
|
110
|
+
}));
|
|
136
111
|
}
|
|
137
112
|
|
|
138
113
|
/**
|
|
@@ -152,30 +127,102 @@ export function getCoinCreateFromLogs(
|
|
|
152
127
|
}
|
|
153
128
|
|
|
154
129
|
// Update createCoin to return both receipt and coin address
|
|
155
|
-
export async function createCoin(
|
|
156
|
-
call
|
|
157
|
-
walletClient
|
|
158
|
-
publicClient
|
|
130
|
+
export async function createCoin({
|
|
131
|
+
call,
|
|
132
|
+
walletClient,
|
|
133
|
+
publicClient,
|
|
134
|
+
options,
|
|
135
|
+
}: {
|
|
136
|
+
call: CreateCoinArgs;
|
|
137
|
+
walletClient: WalletClient;
|
|
138
|
+
publicClient: GenericPublicClient;
|
|
159
139
|
options?: {
|
|
160
140
|
gasMultiplier?: number;
|
|
161
141
|
account?: Account | Address;
|
|
162
|
-
|
|
163
|
-
|
|
142
|
+
skipValidateTransaction?: boolean;
|
|
143
|
+
};
|
|
144
|
+
}) {
|
|
164
145
|
validateClientNetwork(publicClient);
|
|
165
146
|
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
147
|
+
const chainId = call.chainId ?? publicClient.chain.id;
|
|
148
|
+
|
|
149
|
+
const callRequest = await createCoinCall({
|
|
150
|
+
...call,
|
|
151
|
+
chainId,
|
|
170
152
|
});
|
|
171
153
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
// Gas limit multiplier is a percentage argument.
|
|
175
|
-
request.gas = (request.gas * BigInt(options?.gasMultiplier ?? 100)) / 100n;
|
|
154
|
+
if (callRequest.length !== 1) {
|
|
155
|
+
throw new Error("Only one call is supported for this SDK version");
|
|
176
156
|
}
|
|
177
|
-
|
|
178
|
-
const
|
|
157
|
+
|
|
158
|
+
const createContentCall = callRequest[0];
|
|
159
|
+
|
|
160
|
+
if (!createContentCall) {
|
|
161
|
+
throw new Error("Failed to load create content calldata from API");
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const coinFactoryAddressForChain =
|
|
165
|
+
coinFactoryAddress[call.chainId as keyof typeof coinFactoryAddress];
|
|
166
|
+
|
|
167
|
+
// Sanity check that the call is for the correct factory contract
|
|
168
|
+
if (!isAddressEqual(createContentCall.to, coinFactoryAddressForChain)) {
|
|
169
|
+
throw new Error("Creator coin is not supported for this SDK version");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// Sanity check to ensure no buy orders are sent with there parameters
|
|
173
|
+
if (createContentCall.value !== 0n) {
|
|
174
|
+
throw new Error(
|
|
175
|
+
"Creator coin and purchase is not supported for this SDK version.",
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Prefer a LocalAccount from the wallet client when available to ensure
|
|
180
|
+
// offline signing (eth_sendRawTransaction) instead of wallet_sendTransaction
|
|
181
|
+
// which can error when a `from` field is present.
|
|
182
|
+
const selectedAccount =
|
|
183
|
+
(typeof options?.account === "string" ? undefined : options?.account) ??
|
|
184
|
+
walletClient.account;
|
|
185
|
+
|
|
186
|
+
if (!selectedAccount) {
|
|
187
|
+
throw new Error("Account is required");
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const viemCall = {
|
|
191
|
+
...createContentCall,
|
|
192
|
+
account: selectedAccount,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// simulate call
|
|
196
|
+
if (!options?.skipValidateTransaction) {
|
|
197
|
+
try {
|
|
198
|
+
await publicClient.call(viemCall);
|
|
199
|
+
} catch (err) {
|
|
200
|
+
rethrowDecodedRevert(err, zoraFactoryImplABI);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const gasEstimate = options?.skipValidateTransaction
|
|
205
|
+
? 10_000_000n
|
|
206
|
+
: await publicClient.estimateGas(viemCall);
|
|
207
|
+
const gasPrice = await publicClient.getGasPrice();
|
|
208
|
+
|
|
209
|
+
const hash = await (async () => {
|
|
210
|
+
try {
|
|
211
|
+
return await walletClient.sendTransaction({
|
|
212
|
+
...viemCall,
|
|
213
|
+
gasPrice,
|
|
214
|
+
gas: gasEstimate,
|
|
215
|
+
chain: publicClient.chain,
|
|
216
|
+
});
|
|
217
|
+
} catch (err) {
|
|
218
|
+
rethrowDecodedRevert(err, zoraFactoryImplABI);
|
|
219
|
+
}
|
|
220
|
+
})();
|
|
221
|
+
|
|
222
|
+
const receipt = await publicClient.waitForTransactionReceipt({
|
|
223
|
+
hash,
|
|
224
|
+
});
|
|
225
|
+
|
|
179
226
|
const deployment = getCoinCreateFromLogs(receipt);
|
|
180
227
|
|
|
181
228
|
return {
|
package/src/actions/tradeCoin.ts
CHANGED
|
@@ -130,8 +130,8 @@ export async function tradeCoin({
|
|
|
130
130
|
address: permit2Address[base.id],
|
|
131
131
|
functionName: "allowance",
|
|
132
132
|
args: [
|
|
133
|
-
permit.permit.details.token as Address,
|
|
134
133
|
typeof account === "string" ? account : account.address,
|
|
134
|
+
permit.permit.details.token as Address,
|
|
135
135
|
permit.permit.spender as Address,
|
|
136
136
|
],
|
|
137
137
|
});
|
|
@@ -177,7 +177,7 @@ export async function tradeCoin({
|
|
|
177
177
|
primaryType: "PermitSingle",
|
|
178
178
|
types: PERMIT_SINGLE_TYPES,
|
|
179
179
|
message,
|
|
180
|
-
account
|
|
180
|
+
account,
|
|
181
181
|
});
|
|
182
182
|
signatures.push({
|
|
183
183
|
signature,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { coinABI } from "@zoralabs/protocol-deployments";
|
|
2
2
|
import { validateClientNetwork } from "../utils/validateClientNetwork";
|
|
3
3
|
import {
|
|
4
|
+
Account,
|
|
4
5
|
Address,
|
|
5
6
|
parseEventLogs,
|
|
6
7
|
SimulateContractParameters,
|
|
@@ -35,12 +36,13 @@ export async function updateCoinURI(
|
|
|
35
36
|
args: UpdateCoinURIArgs,
|
|
36
37
|
walletClient: WalletClient,
|
|
37
38
|
publicClient: GenericPublicClient,
|
|
39
|
+
account?: Account | Address,
|
|
38
40
|
) {
|
|
39
41
|
validateClientNetwork(publicClient);
|
|
40
42
|
const call = updateCoinURICall(args);
|
|
41
43
|
const { request } = await publicClient.simulateContract({
|
|
42
44
|
...call,
|
|
43
|
-
account: walletClient.account
|
|
45
|
+
account: account ?? walletClient.account,
|
|
44
46
|
});
|
|
45
47
|
const hash = await walletClient.writeContract(request);
|
|
46
48
|
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { coinABI } from "@zoralabs/protocol-deployments";
|
|
2
2
|
import { validateClientNetwork } from "../utils/validateClientNetwork";
|
|
3
3
|
import {
|
|
4
|
+
Account,
|
|
4
5
|
Address,
|
|
5
6
|
parseEventLogs,
|
|
6
7
|
SimulateContractParameters,
|
|
@@ -31,12 +32,13 @@ export async function updatePayoutRecipient(
|
|
|
31
32
|
args: UpdatePayoutRecipientArgs,
|
|
32
33
|
walletClient: WalletClient,
|
|
33
34
|
publicClient: GenericPublicClient,
|
|
35
|
+
account?: Account | Address,
|
|
34
36
|
) {
|
|
35
37
|
validateClientNetwork(publicClient);
|
|
36
38
|
const call = updatePayoutRecipientCall(args);
|
|
37
39
|
const { request } = await publicClient.simulateContract({
|
|
38
40
|
...call,
|
|
39
|
-
account: walletClient.account!,
|
|
41
|
+
account: account ?? walletClient.account!,
|
|
40
42
|
});
|
|
41
43
|
const hash = await walletClient.writeContract(request);
|
|
42
44
|
const receipt = await publicClient.waitForTransactionReceipt({ hash });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PostCreateContentData,
|
|
3
|
+
PostCreateContentResponse,
|
|
4
|
+
} from "../client/types.gen";
|
|
5
|
+
import { postCreateContent as postCreateContentSDK } from "../client/sdk.gen";
|
|
6
|
+
import { getApiKeyMeta } from "./api-key";
|
|
7
|
+
import { RequestOptionsType } from "./query-types";
|
|
8
|
+
import { RequestResult } from "@hey-api/client-fetch";
|
|
9
|
+
|
|
10
|
+
type PostCreateContentQuery = PostCreateContentData["body"];
|
|
11
|
+
export type { PostCreateContentQuery, PostCreateContentResponse };
|
|
12
|
+
|
|
13
|
+
export type CoinCreateData = NonNullable<PostCreateContentResponse>;
|
|
14
|
+
|
|
15
|
+
export const postCreateContent = async (
|
|
16
|
+
body: PostCreateContentQuery,
|
|
17
|
+
options?: RequestOptionsType<PostCreateContentData>,
|
|
18
|
+
): Promise<RequestResult<PostCreateContentResponse>> => {
|
|
19
|
+
return await postCreateContentSDK({
|
|
20
|
+
...options,
|
|
21
|
+
body,
|
|
22
|
+
...getApiKeyMeta(),
|
|
23
|
+
});
|
|
24
|
+
};
|
package/src/api/index.ts
CHANGED
|
@@ -6,6 +6,14 @@ export type * from "./explore";
|
|
|
6
6
|
export * from "./queries";
|
|
7
7
|
export type * from "./queries";
|
|
8
8
|
|
|
9
|
+
// Export all of the pool config queries
|
|
10
|
+
export * from "./pool-config";
|
|
11
|
+
export type * from "./pool-config";
|
|
12
|
+
|
|
13
|
+
// Export all of the create queries
|
|
14
|
+
export * from "./create";
|
|
15
|
+
export type * from "./create";
|
|
16
|
+
|
|
9
17
|
// Only export the set function for external use.
|
|
10
18
|
// All other exports are for internal use.
|
|
11
19
|
export { setApiKey } from "./api-key";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getCreateContentPoolConfig as getCreateContentPoolConfigSDK,
|
|
3
|
+
GetCreateContentPoolConfigData,
|
|
4
|
+
GetCreateContentPoolConfigResponse,
|
|
5
|
+
} from "../client";
|
|
6
|
+
import { RequestOptionsType } from "./query-types";
|
|
7
|
+
import { RequestResult } from "@hey-api/client-fetch";
|
|
8
|
+
|
|
9
|
+
export const getCreateContentPoolConfig = async (
|
|
10
|
+
query: GetCreateContentPoolConfigData["query"],
|
|
11
|
+
options?: RequestOptionsType<GetCreateContentPoolConfigData>,
|
|
12
|
+
): Promise<RequestResult<GetCreateContentPoolConfigResponse>> => {
|
|
13
|
+
return getCreateContentPoolConfigSDK({
|
|
14
|
+
query,
|
|
15
|
+
...options,
|
|
16
|
+
});
|
|
17
|
+
};
|
package/src/client/sdk.gen.ts
CHANGED
|
@@ -31,6 +31,12 @@ import type {
|
|
|
31
31
|
PostQuoteData,
|
|
32
32
|
PostQuoteResponse,
|
|
33
33
|
PostQuoteError,
|
|
34
|
+
GetCreateContentPoolConfigData,
|
|
35
|
+
GetCreateContentPoolConfigResponse,
|
|
36
|
+
GetCreateContentPoolConfigError,
|
|
37
|
+
PostCreateContentData,
|
|
38
|
+
PostCreateContentResponse,
|
|
39
|
+
PostCreateContentError,
|
|
34
40
|
} from "./types.gen";
|
|
35
41
|
import { client as _heyApiClient } from "./client.gen";
|
|
36
42
|
|
|
@@ -319,3 +325,47 @@ export const postQuote = <ThrowOnError extends boolean = false>(
|
|
|
319
325
|
},
|
|
320
326
|
});
|
|
321
327
|
};
|
|
328
|
+
|
|
329
|
+
export const getCreateContentPoolConfig = <
|
|
330
|
+
ThrowOnError extends boolean = false,
|
|
331
|
+
>(
|
|
332
|
+
options?: Options<GetCreateContentPoolConfigData, ThrowOnError>,
|
|
333
|
+
) => {
|
|
334
|
+
return (options?.client ?? _heyApiClient).get<
|
|
335
|
+
GetCreateContentPoolConfigResponse,
|
|
336
|
+
GetCreateContentPoolConfigError,
|
|
337
|
+
ThrowOnError
|
|
338
|
+
>({
|
|
339
|
+
security: [
|
|
340
|
+
{
|
|
341
|
+
name: "api-key",
|
|
342
|
+
type: "apiKey",
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
url: "/create/content/pool-config",
|
|
346
|
+
...options,
|
|
347
|
+
});
|
|
348
|
+
};
|
|
349
|
+
|
|
350
|
+
export const postCreateContent = <ThrowOnError extends boolean = false>(
|
|
351
|
+
options?: Options<PostCreateContentData, ThrowOnError>,
|
|
352
|
+
) => {
|
|
353
|
+
return (options?.client ?? _heyApiClient).post<
|
|
354
|
+
PostCreateContentResponse,
|
|
355
|
+
PostCreateContentError,
|
|
356
|
+
ThrowOnError
|
|
357
|
+
>({
|
|
358
|
+
security: [
|
|
359
|
+
{
|
|
360
|
+
name: "api-key",
|
|
361
|
+
type: "apiKey",
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
url: "/create/content",
|
|
365
|
+
...options,
|
|
366
|
+
headers: {
|
|
367
|
+
"Content-Type": "application/json",
|
|
368
|
+
...options?.headers,
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
};
|