@whetstone-research/doppler-sdk 1.0.33 → 1.0.35

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/README.md CHANGED
@@ -31,7 +31,11 @@ Use network-specific entrypoints:
31
31
 
32
32
  ```typescript
33
33
  import { DopplerSDK } from '@whetstone-research/doppler-sdk/evm';
34
- import { initializer, cpmm, cpmmMigrator } from '@whetstone-research/doppler-sdk/solana';
34
+ import {
35
+ initializer,
36
+ cpmm,
37
+ cpmmMigrator,
38
+ } from '@whetstone-research/doppler-sdk/solana';
35
39
  import { DopplerSolanaProvider } from '@whetstone-research/doppler-sdk/solana/react';
36
40
  ```
37
41
 
@@ -100,6 +104,10 @@ For runnable Solana flows, configure `examples/.env` and run with `pnpm tsx`, fo
100
104
  - [examples/solana-prediction-market.ts](./examples/solana-prediction-market.ts)
101
105
  - [examples/solana-swap.ts](./examples/solana-swap.ts)
102
106
 
107
+ To implement an independently deployed callback program, see
108
+ [Building a custom Solana hook](./docs/solana-custom-hooks.md) and the
109
+ [minimal Anchor example](./examples/solana-custom-hook/).
110
+
103
111
  Resolve managed swap cosigning before constructing a launch:
104
112
 
105
113
  ```typescript
@@ -136,6 +144,7 @@ import { base } from 'viem/chains';
136
144
 
137
145
  const params = new StaticAuctionBuilder(base.id)
138
146
  .tokenConfig({
147
+ type: 'standard',
139
148
  name: 'My Token',
140
149
  symbol: 'MTK',
141
150
  tokenURI: 'https://example.com/metadata.json',
@@ -179,7 +188,7 @@ console.log('Pool address:', result.poolAddress);
179
188
  console.log('Token address:', result.tokenAddress);
180
189
  ```
181
190
 
182
- If you set `cliffDuration > 0` or provide `allocations`, the SDK automatically uses the DERC20 V2 factory and exposes schedule-aware token reads via `sdk.getDerc20V2(tokenAddress)`. When `allocations` is provided, the SDK dedupes identical schedules internally and maps each recipient to the correct on-chain schedule.
191
+ Explicit `type: 'standard'` tokens with `cliffDuration > 0` or `allocations` use the legacy DERC20 V2 factory and expose schedule-aware reads via `sdk.getDerc20V2(tokenAddress)`. When `allocations` is provided, the SDK dedupes identical schedules internally and maps each recipient to the correct onchain schedule.
183
192
 
184
193
  For a runnable example, see [examples/multicurve-per-beneficiary-vesting.ts](./examples/multicurve-per-beneficiary-vesting.ts).
185
194
 
@@ -316,6 +325,7 @@ console.log('Token address:', result.tokenAddress);
316
325
  ### Opening Auction (Lifecycle + Bid Management)
317
326
 
318
327
  Support includes:
328
+
319
329
  - `sdk.buildOpeningAuction()` for `CreateOpeningAuctionParams`
320
330
  - `sdk.factory.simulateCreateOpeningAuction(params)` and `sdk.factory.createOpeningAuction(params)`
321
331
  - `sdk.getOpeningAuction(hookAddress)` for hook reads + `settleAuction()` / `claimIncentives()`
@@ -359,21 +369,21 @@ const params = sdk
359
369
  .withMigration({ type: 'uniswapV4', fee: 3000, tickSpacing: 60 })
360
370
  .withUserAddress('0x...')
361
371
  .withOpeningAuctionInitializer('0x...') // required on Base until deployed
362
- .build()
372
+ .build();
363
373
 
364
- const sim = await sdk.factory.simulateCreateOpeningAuction(params)
365
- const created = await sim.execute()
374
+ const sim = await sdk.factory.simulateCreateOpeningAuction(params);
375
+ const created = await sim.execute();
366
376
 
367
- const opening = await sdk.getOpeningAuction(created.openingAuctionHookAddress)
368
- await opening.getPhase()
377
+ const opening = await sdk.getOpeningAuction(created.openingAuctionHookAddress);
378
+ await opening.getPhase();
369
379
 
370
- const lifecycle = await sdk.getOpeningAuctionLifecycle('0x...')
371
- await lifecycle.getState(created.tokenAddress)
380
+ const lifecycle = await sdk.getOpeningAuctionLifecycle('0x...');
381
+ await lifecycle.getState(created.tokenAddress);
372
382
 
373
383
  await sdk.factory.completeOpeningAuction({
374
384
  asset: created.tokenAddress,
375
385
  initializerAddress: '0x...',
376
- })
386
+ });
377
387
  ```
378
388
 
379
389
  `completeOpeningAuction` auto-settles and auto-mines `dopplerSalt` when omitted; because completion mining can race with block timestamps/state changes, the SDK may re-mine and retry a few times if needed. `simulateCompleteOpeningAuction` requires the opening auction to already be settled.
@@ -384,9 +394,9 @@ See [examples/opening-auction-lifecycle.ts](./examples/opening-auction-lifecycle
384
394
 
385
395
  ### Multicurve Auction (V4 Multicurve Initializer)
386
396
 
387
- Multicurve auctions use a Uniswap V4-style initializer that seeds liquidity across multiple curves in a single pool. This enables richer distributions and can be combined with any supported migration path (V2, V3, V4, or NoOp). Multicurve initializer modes are modeled as a typed variant (`standard`, `scheduled`, `decay`, `rehype`) so new hook/initializer variations can be added without breaking existing integrations.
397
+ Multicurve auctions use `DopplerHookInitializer` by default to seed liquidity across multiple curves in a single Uniswap V4 pool. The typed initializer modes are `dopplerHookInitializer`, `standard`, `scheduled`, `decay`, and `rehype`; use `withV4MulticurveInitializer(address)` when explicitly targeting the legacy standard initializer.
388
398
 
389
- **Standard Multicurve with Migration:**
399
+ **Multicurve with Migration:**
390
400
 
391
401
  ```typescript
392
402
  import { MulticurveBuilder } from '@whetstone-research/doppler-sdk/evm';
@@ -433,10 +443,38 @@ console.log('Pool address:', result.poolAddress);
433
443
  console.log('Token address:', result.tokenAddress);
434
444
  ```
435
445
 
446
+ **Deterministic preview/create identities:**
447
+
448
+ By default, each independent multicurve assembly generates a new salt and may
449
+ predict a different token and pool identity. Supply an explicit 32-byte salt
450
+ when separate preview and create operations must assemble the same
451
+ `CreateParams`:
452
+
453
+ ```typescript
454
+ import type { Hex } from 'viem';
455
+
456
+ const salt =
457
+ '0x1111111111111111111111111111111111111111111111111111111111111111' satisfies Hex;
458
+
459
+ const deterministicParams = { ...params, salt };
460
+ const preview =
461
+ await sdk.factory.simulateCreateMulticurve(deterministicParams);
462
+ ```
463
+
464
+ Persist and reuse the salt with otherwise identical inputs for a later
465
+ independent create operation. Builder users can call `.withSalt(salt)` before
466
+ `.build()`. Omitting the salt, or clearing it with `.withSalt(undefined)`,
467
+ preserves the generated-salt behavior. Explicit salts must be `0x` followed by
468
+ exactly 64 hexadecimal characters.
469
+
470
+
436
471
  **Market Cap Presets (Low / Medium / High):**
437
472
 
438
473
  ```typescript
439
- import { MulticurveBuilder, FEE_TIERS } from '@whetstone-research/doppler-sdk/evm';
474
+ import {
475
+ MulticurveBuilder,
476
+ FEE_TIERS,
477
+ } from '@whetstone-research/doppler-sdk/evm';
440
478
  import { parseEther } from 'viem';
441
479
  import { base } from 'viem/chains';
442
480
 
@@ -942,7 +980,7 @@ For a runnable release-focused example covering legacy DERC20, DERC20 V2 schedul
942
980
 
943
981
  ### DopplerERC20V1 Tokens
944
982
 
945
- Use the newer DopplerERC20V1 token template by either setting `type: 'dopplerERC20V1'` explicitly or by passing fields such as `maxBalanceLimit` with `balanceLimitEnd`, `controller`, or `excludedFromBalanceLimit`. When selected, the SDK uses the configured `dopplerERC20V1Factory` by default. `withTokenFactory(address)` is a generic factory override and takes precedence, but it must point to a factory compatible with the selected token path and token data ABI. `controller` is optional and defaults to the zero address, set it only if early balance-limit disable should be possible. Standard configs without the specific fields still use the legacy `standard` path, where cliff/allocation vesting routes to legacy DERC20 V2. Keep explicit `type: 'dopplerERC20V1'` when you want its behavior but have no specific fields to infer from.
983
+ DopplerERC20V1 is the default token template when `type` is omitted. Set `type: 'dopplerERC20V1'` to make that choice explicit, or set `type: 'standard'` to use the legacy token path, where cliff/allocation vesting routes to the legacy DERC20 template. The SDK uses the configured `dopplerERC20V1Factory` by default; `withTokenFactory(address)` takes precedence but must point to a factory compatible with the selected token path and token data ABI. `controller` is optional and defaults to the zero address, so set it only if early balance-limit disable should be possible.
946
984
 
947
985
  When balance limiting is enabled on the default DopplerERC20V1 integration, the SDK encodes user exclusions plus determinable protocol recipients for the selected auction path into deployment-time `excludedFromBalanceLimit`, including initializers, hooks, PoolManager, migrators, known migration pools, no-op governance, launchpad governance multisigs, and standard GovernanceFactory timelocks for `default` or `custom` governance. Custom `withTokenFactory(address)` paths receive only the `excludedFromBalanceLimit` entries supplied in `tokenConfig`, so custom token factory users must provide any required deployment-time exclusions themselves. Custom `withGovernanceFactory(address)` paths skip standard-governance timelock auto-exclusion, so custom governance factory users must provide any required timelock exclusions themselves. Exclusions cannot be added later through the controller or governance.
948
986
 
@@ -1321,7 +1359,7 @@ const params = sdk
1321
1359
  tickSpacing: 10,
1322
1360
  })
1323
1361
  .withMigration({
1324
- type: 'dopplerHook',
1362
+ type: 'dopplerHookMigrator',
1325
1363
  fee: 3000,
1326
1364
  tickSpacing: 10,
1327
1365
  lockDuration: 30 * 24 * 60 * 60,
@@ -1349,14 +1387,19 @@ const params = sdk
1349
1387
  .build();
1350
1388
  ```
1351
1389
 
1352
- Note: `dopplerHook` migrator beneficiaries must include the current Airlock owner
1390
+ Note: `dopplerHookMigrator` beneficiaries must include the current Airlock owner
1353
1391
  with at least 5% shares, and total shares must sum to `1e18`.
1354
1392
  Unlike initializer-side Rehype pools, migrator-side Rehype uses a static
1355
1393
  `customFee`; there is no fee decay schedule in this mode.
1394
+ For backwards compatibility, the deprecated `DopplerHookMigrationConfig` type
1395
+ and its `type: 'dopplerHook'` discriminator remain accepted. New code should use
1396
+ `DopplerHookMigratorConfig` with `type: 'dopplerHookMigrator'`. Multicurve
1397
+ initializer params similarly accept the deprecated `type: 'dopplerHook'`
1398
+ discriminator, which resolves to `dopplerHookInitializer`.
1356
1399
 
1357
1400
  ```typescript
1358
1401
  migration: {
1359
- type: 'dopplerHook',
1402
+ type: 'dopplerHookMigrator',
1360
1403
  fee: 3000,
1361
1404
  useDynamicFee: false,
1362
1405
  tickSpacing: 10,
@@ -1,4 +1,4 @@
1
- import { MAX_HOOK_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, ACCOUNT_DISCRIMINATORS, CPMM_PROGRAM_ID, Q64_ONE, BPS_DENOM, getPoolAddress, sortMints, getPositionAddress, getOracleAddress } from './chunk-AFXFT3BD.js';
1
+ import { MAX_HOOK_ALLOWLIST, MAX_ORACLE_OBSERVATIONS, ACCOUNT_DISCRIMINATORS, CPMM_PROGRAM_ID, Q64_ONE, BPS_DENOM, getPoolAddress, sortMints, getPositionAddress, getOracleAddress } from './chunk-PWBQLC5V.js';
2
2
  import { getAddressCodec, getBooleanCodec, getU8Codec, getU16Codec, getU32Codec, getU64Codec, getU128Codec, transformCodec, getArrayCodec, fixCodecSize, getBytesCodec, getStructCodec, getHiddenPrefixDecoder, getConstantDecoder, mergeBytes, AccountRole, fixEncoderSize, getBytesEncoder, transformEncoder, getStructEncoder, getStructDecoder, fixDecoderSize, getBytesDecoder, combineCodec, SolanaError, SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS, getU64Encoder, getU64Decoder, getProgramDerivedAddress, getAddressEncoder, getU16Encoder, getBooleanEncoder, getArrayEncoder, getAddressDecoder, getU16Decoder, getBooleanDecoder, getArrayDecoder, getU128Encoder, getU32Encoder, getU128Decoder, getU32Decoder, getU8Encoder, getU8Decoder } from '@solana/kit';
3
3
  import { getAccountMetaFactory, getAddressFromResolvedInstructionAccount, getNonNullResolvedInstructionInput } from '@solana/program-client-core';
4
4
 
@@ -1989,6 +1989,307 @@ function parseInitializeSpotPoolInstruction(instruction) {
1989
1989
  )
1990
1990
  };
1991
1991
  }
1992
+ var INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR = new Uint8Array([
1993
+ 98,
1994
+ 227,
1995
+ 206,
1996
+ 159,
1997
+ 252,
1998
+ 134,
1999
+ 77,
2000
+ 21
2001
+ ]);
2002
+ function getInitializeSpotPoolWithHookDiscriminatorBytes() {
2003
+ return fixEncoderSize(getBytesEncoder(), 8).encode(
2004
+ INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR
2005
+ );
2006
+ }
2007
+ function getInitializeSpotPoolWithHookInstructionDataEncoder() {
2008
+ return transformEncoder(
2009
+ getStructEncoder([
2010
+ ["discriminator", fixEncoderSize(getBytesEncoder(), 8)],
2011
+ ["mintA", getAddressEncoder()],
2012
+ ["mintB", getAddressEncoder()],
2013
+ ["swapFeeBps", getU16Encoder()],
2014
+ ["hookProgram", getAddressEncoder()],
2015
+ ["hookFlags", getU32Encoder()]
2016
+ ]),
2017
+ (value) => ({
2018
+ ...value,
2019
+ discriminator: INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR
2020
+ })
2021
+ );
2022
+ }
2023
+ function getInitializeSpotPoolWithHookInstructionDataDecoder() {
2024
+ return getStructDecoder([
2025
+ ["discriminator", fixDecoderSize(getBytesDecoder(), 8)],
2026
+ ["mintA", getAddressDecoder()],
2027
+ ["mintB", getAddressDecoder()],
2028
+ ["swapFeeBps", getU16Decoder()],
2029
+ ["hookProgram", getAddressDecoder()],
2030
+ ["hookFlags", getU32Decoder()]
2031
+ ]);
2032
+ }
2033
+ function getInitializeSpotPoolWithHookInstructionDataCodec() {
2034
+ return combineCodec(
2035
+ getInitializeSpotPoolWithHookInstructionDataEncoder(),
2036
+ getInitializeSpotPoolWithHookInstructionDataDecoder()
2037
+ );
2038
+ }
2039
+ async function getInitializeSpotPoolWithHookInstructionAsync(input, config) {
2040
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2041
+ const originalAccounts = {
2042
+ config: { value: input.config ?? null, isWritable: false },
2043
+ pool: { value: input.pool ?? null, isWritable: true },
2044
+ protocolFeePosition: {
2045
+ value: input.protocolFeePosition ?? null,
2046
+ isWritable: true
2047
+ },
2048
+ protocolFeeOwner: {
2049
+ value: input.protocolFeeOwner ?? null,
2050
+ isWritable: false
2051
+ },
2052
+ authority: { value: input.authority ?? null, isWritable: false },
2053
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2054
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2055
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2056
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2057
+ payer: { value: input.payer ?? null, isWritable: true },
2058
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2059
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2060
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
2061
+ rent: { value: input.rent ?? null, isWritable: false },
2062
+ migrationAuthority: {
2063
+ value: input.migrationAuthority ?? null,
2064
+ isWritable: false
2065
+ },
2066
+ hookProgram: { value: input.hookProgram ?? null, isWritable: false }
2067
+ };
2068
+ const accounts = originalAccounts;
2069
+ const args = { ...input, hookProgram: input.hookProgramArg };
2070
+ if (!accounts.protocolFeeOwner.value) {
2071
+ accounts.protocolFeeOwner.value = await getProgramDerivedAddress({
2072
+ programAddress,
2073
+ seeds: [
2074
+ getBytesEncoder().encode(
2075
+ new Uint8Array([
2076
+ 112,
2077
+ 114,
2078
+ 111,
2079
+ 116,
2080
+ 111,
2081
+ 99,
2082
+ 111,
2083
+ 108,
2084
+ 95,
2085
+ 102,
2086
+ 101,
2087
+ 101,
2088
+ 95,
2089
+ 111,
2090
+ 119,
2091
+ 110,
2092
+ 101,
2093
+ 114
2094
+ ])
2095
+ ),
2096
+ getAddressEncoder().encode(
2097
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2098
+ )
2099
+ ]
2100
+ });
2101
+ }
2102
+ if (!accounts.protocolFeePosition.value) {
2103
+ accounts.protocolFeePosition.value = await getProgramDerivedAddress({
2104
+ programAddress,
2105
+ seeds: [
2106
+ getBytesEncoder().encode(
2107
+ new Uint8Array([112, 111, 115, 105, 116, 105, 111, 110])
2108
+ ),
2109
+ getAddressEncoder().encode(
2110
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2111
+ ),
2112
+ getAddressEncoder().encode(
2113
+ getAddressFromResolvedInstructionAccount(
2114
+ "protocolFeeOwner",
2115
+ accounts.protocolFeeOwner.value
2116
+ )
2117
+ ),
2118
+ getBytesEncoder().encode(new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0]))
2119
+ ]
2120
+ });
2121
+ }
2122
+ if (!accounts.authority.value) {
2123
+ accounts.authority.value = await getProgramDerivedAddress({
2124
+ programAddress,
2125
+ seeds: [
2126
+ getBytesEncoder().encode(
2127
+ new Uint8Array([97, 117, 116, 104, 111, 114, 105, 116, 121])
2128
+ ),
2129
+ getAddressEncoder().encode(
2130
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2131
+ )
2132
+ ]
2133
+ });
2134
+ }
2135
+ if (!accounts.vault0.value) {
2136
+ accounts.vault0.value = await getProgramDerivedAddress({
2137
+ programAddress,
2138
+ seeds: [
2139
+ getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 48])),
2140
+ getAddressEncoder().encode(
2141
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2142
+ )
2143
+ ]
2144
+ });
2145
+ }
2146
+ if (!accounts.vault1.value) {
2147
+ accounts.vault1.value = await getProgramDerivedAddress({
2148
+ programAddress,
2149
+ seeds: [
2150
+ getBytesEncoder().encode(new Uint8Array([118, 97, 117, 108, 116, 49])),
2151
+ getAddressEncoder().encode(
2152
+ getAddressFromResolvedInstructionAccount("pool", accounts.pool.value)
2153
+ )
2154
+ ]
2155
+ });
2156
+ }
2157
+ if (!accounts.systemProgram.value) {
2158
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2159
+ }
2160
+ if (!accounts.rent.value) {
2161
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
2162
+ }
2163
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2164
+ return Object.freeze({
2165
+ accounts: [
2166
+ getAccountMeta("config", accounts.config),
2167
+ getAccountMeta("pool", accounts.pool),
2168
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2169
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
2170
+ getAccountMeta("authority", accounts.authority),
2171
+ getAccountMeta("vault0", accounts.vault0),
2172
+ getAccountMeta("vault1", accounts.vault1),
2173
+ getAccountMeta("token0Mint", accounts.token0Mint),
2174
+ getAccountMeta("token1Mint", accounts.token1Mint),
2175
+ getAccountMeta("payer", accounts.payer),
2176
+ getAccountMeta("token0Program", accounts.token0Program),
2177
+ getAccountMeta("token1Program", accounts.token1Program),
2178
+ getAccountMeta("systemProgram", accounts.systemProgram),
2179
+ getAccountMeta("rent", accounts.rent),
2180
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority),
2181
+ getAccountMeta("hookProgram", accounts.hookProgram)
2182
+ ],
2183
+ data: getInitializeSpotPoolWithHookInstructionDataEncoder().encode(
2184
+ args
2185
+ ),
2186
+ programAddress
2187
+ });
2188
+ }
2189
+ function getInitializeSpotPoolWithHookInstruction(input, config) {
2190
+ const programAddress = config?.programAddress ?? CPMM_PROGRAM_ADDRESS;
2191
+ const originalAccounts = {
2192
+ config: { value: input.config ?? null, isWritable: false },
2193
+ pool: { value: input.pool ?? null, isWritable: true },
2194
+ protocolFeePosition: {
2195
+ value: input.protocolFeePosition ?? null,
2196
+ isWritable: true
2197
+ },
2198
+ protocolFeeOwner: {
2199
+ value: input.protocolFeeOwner ?? null,
2200
+ isWritable: false
2201
+ },
2202
+ authority: { value: input.authority ?? null, isWritable: false },
2203
+ vault0: { value: input.vault0 ?? null, isWritable: true },
2204
+ vault1: { value: input.vault1 ?? null, isWritable: true },
2205
+ token0Mint: { value: input.token0Mint ?? null, isWritable: false },
2206
+ token1Mint: { value: input.token1Mint ?? null, isWritable: false },
2207
+ payer: { value: input.payer ?? null, isWritable: true },
2208
+ token0Program: { value: input.token0Program ?? null, isWritable: false },
2209
+ token1Program: { value: input.token1Program ?? null, isWritable: false },
2210
+ systemProgram: { value: input.systemProgram ?? null, isWritable: false },
2211
+ rent: { value: input.rent ?? null, isWritable: false },
2212
+ migrationAuthority: {
2213
+ value: input.migrationAuthority ?? null,
2214
+ isWritable: false
2215
+ },
2216
+ hookProgram: { value: input.hookProgram ?? null, isWritable: false }
2217
+ };
2218
+ const accounts = originalAccounts;
2219
+ const args = { ...input, hookProgram: input.hookProgramArg };
2220
+ if (!accounts.systemProgram.value) {
2221
+ accounts.systemProgram.value = "11111111111111111111111111111111";
2222
+ }
2223
+ if (!accounts.rent.value) {
2224
+ accounts.rent.value = "SysvarRent111111111111111111111111111111111";
2225
+ }
2226
+ const getAccountMeta = getAccountMetaFactory(programAddress, "programId");
2227
+ return Object.freeze({
2228
+ accounts: [
2229
+ getAccountMeta("config", accounts.config),
2230
+ getAccountMeta("pool", accounts.pool),
2231
+ getAccountMeta("protocolFeePosition", accounts.protocolFeePosition),
2232
+ getAccountMeta("protocolFeeOwner", accounts.protocolFeeOwner),
2233
+ getAccountMeta("authority", accounts.authority),
2234
+ getAccountMeta("vault0", accounts.vault0),
2235
+ getAccountMeta("vault1", accounts.vault1),
2236
+ getAccountMeta("token0Mint", accounts.token0Mint),
2237
+ getAccountMeta("token1Mint", accounts.token1Mint),
2238
+ getAccountMeta("payer", accounts.payer),
2239
+ getAccountMeta("token0Program", accounts.token0Program),
2240
+ getAccountMeta("token1Program", accounts.token1Program),
2241
+ getAccountMeta("systemProgram", accounts.systemProgram),
2242
+ getAccountMeta("rent", accounts.rent),
2243
+ getAccountMeta("migrationAuthority", accounts.migrationAuthority),
2244
+ getAccountMeta("hookProgram", accounts.hookProgram)
2245
+ ],
2246
+ data: getInitializeSpotPoolWithHookInstructionDataEncoder().encode(
2247
+ args
2248
+ ),
2249
+ programAddress
2250
+ });
2251
+ }
2252
+ function parseInitializeSpotPoolWithHookInstruction(instruction) {
2253
+ if (instruction.accounts.length < 16) {
2254
+ throw new SolanaError(
2255
+ SOLANA_ERROR__PROGRAM_CLIENTS__INSUFFICIENT_ACCOUNT_METAS,
2256
+ {
2257
+ actualAccountMetas: instruction.accounts.length,
2258
+ expectedAccountMetas: 16
2259
+ }
2260
+ );
2261
+ }
2262
+ let accountIndex = 0;
2263
+ const getNextAccount = () => {
2264
+ const accountMeta = instruction.accounts[accountIndex];
2265
+ accountIndex += 1;
2266
+ return accountMeta;
2267
+ };
2268
+ return {
2269
+ programAddress: instruction.programAddress,
2270
+ accounts: {
2271
+ config: getNextAccount(),
2272
+ pool: getNextAccount(),
2273
+ protocolFeePosition: getNextAccount(),
2274
+ protocolFeeOwner: getNextAccount(),
2275
+ authority: getNextAccount(),
2276
+ vault0: getNextAccount(),
2277
+ vault1: getNextAccount(),
2278
+ token0Mint: getNextAccount(),
2279
+ token1Mint: getNextAccount(),
2280
+ payer: getNextAccount(),
2281
+ token0Program: getNextAccount(),
2282
+ token1Program: getNextAccount(),
2283
+ systemProgram: getNextAccount(),
2284
+ rent: getNextAccount(),
2285
+ migrationAuthority: getNextAccount(),
2286
+ hookProgram: getNextAccount()
2287
+ },
2288
+ data: getInitializeSpotPoolWithHookInstructionDataDecoder().decode(
2289
+ instruction.data
2290
+ )
2291
+ };
2292
+ }
1992
2293
  var ORACLE_CONSULT_DISCRIMINATOR = new Uint8Array([
1993
2294
  239,
1994
2295
  237,
@@ -4164,6 +4465,6 @@ function comparePoolAndOraclePrices(pool, oracle) {
4164
4465
  };
4165
4466
  }
4166
4467
 
4167
- export { ADD_LIQUIDITY_DISCRIMINATOR, CLOSE_POSITION_DISCRIMINATOR, COLLECT_FEES_DISCRIMINATOR, COLLECT_PROTOCOL_FEES_DISCRIMINATOR, CPMM_PROGRAM_ADDRESS, CREATE_POSITION_DISCRIMINATOR, INITIALIZE_CONFIG_DISCRIMINATOR, INITIALIZE_ORACLE_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, INITIALIZE_SPOT_POOL_DISCRIMINATOR, ORACLE_CONSULT_DISCRIMINATOR, ORACLE_UPDATE_DISCRIMINATOR, PAUSE_DISCRIMINATOR, PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR, REDEEM_PROTOCOL_SHARES_DISCRIMINATOR, REMOVE_LIQUIDITY_DISCRIMINATOR, SET_FEES_DISCRIMINATOR, SET_HOOK_DISCRIMINATOR, SWAP_EXACT_IN_DISCRIMINATOR, TRANSFER_ADMIN_DISCRIMINATOR, UNPAUSE_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, WITHDRAW_VAULT_EXCESS_DISCRIMINATOR, addLiquidityArgsCodec, addressToBase58EncodedBytes, ammConfigDataCodec, base64ToBytes, bytesToBase64, bytesToBase64EncodedBytes, calculateAccruedFees, calculateTwap, calculateTwapNumber, ceilDiv, collectFeesArgsCodec, collectProtocolFeesArgsCodec, comparePoolAndOraclePrices, computePrice0Q64, computePrice1Q64, consultTwap, createAccountMeta, createPositionArgsCodec, createReadonlyRemainingAccountMeta, decodeAmmConfig, decodeOracleState, decodePool, decodePosition, encodeAddLiquidityArgs, encodeCollectFeesArgs, encodeCollectProtocolFeesArgs, encodeCreatePositionArgs, encodeInitializeConfigArgs, encodeInitializeOracleArgs, encodeInitializePoolArgs, encodeInstructionData, encodeOracleConsultArgs, encodeRemoveLiquidityArgs, encodeSetFeesArgs, encodeSetHookArgs, encodeSwapExactInArgs, encodeTransferAdminArgs, fetchAllPools, fetchOracle, fetchOraclesBatch, fetchPool, fetchPoolPositions, fetchPoolsBatch, fetchPosition, fetchPositionByParams, fetchPositionsBatch, fetchUserPositions, filterActivePositions, filterPoolsByMint, getAddLiquidityDiscriminatorBytes, getAddLiquidityInstruction, getAddLiquidityInstructionAsync, getAddLiquidityInstructionDataCodec, getAddLiquidityInstructionDataDecoder, getAddLiquidityInstructionDataEncoder, getAddLiquidityQuote, getAddressFromAddressOrSigner, getAddressFromRemainingAccount, getClosePositionDiscriminatorBytes, getClosePositionInstruction, getClosePositionInstructionDataCodec, getClosePositionInstructionDataDecoder, getClosePositionInstructionDataEncoder, getCollectFeesDiscriminatorBytes, getCollectFeesInstruction, getCollectFeesInstructionAsync, getCollectFeesInstructionDataCodec, getCollectFeesInstructionDataDecoder, getCollectFeesInstructionDataEncoder, getCollectProtocolFeesDiscriminatorBytes, getCollectProtocolFeesInstruction, getCollectProtocolFeesInstructionAsync, getCollectProtocolFeesInstructionDataCodec, getCollectProtocolFeesInstructionDataDecoder, getCollectProtocolFeesInstructionDataEncoder, getCreatePositionDiscriminatorBytes, getCreatePositionInstruction, getCreatePositionInstructionAsync, getCreatePositionInstructionDataCodec, getCreatePositionInstructionDataDecoder, getCreatePositionInstructionDataEncoder, getInitializeConfigDiscriminatorBytes, getInitializeConfigInstruction, getInitializeConfigInstructionAsync, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataEncoder, getInitializeOracleDiscriminatorBytes, getInitializeOracleInstruction, getInitializeOracleInstructionAsync, getInitializeOracleInstructionDataCodec, getInitializeOracleInstructionDataDecoder, getInitializeOracleInstructionDataEncoder, getInitializePoolDiscriminatorBytes, getInitializePoolInstruction, getInitializePoolInstructionAsync, getInitializePoolInstructionDataCodec, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataEncoder, getInitializeSpotPoolDiscriminatorBytes, getInitializeSpotPoolInstruction, getInitializeSpotPoolInstructionAsync, getInitializeSpotPoolInstructionDataCodec, getInitializeSpotPoolInstructionDataDecoder, getInitializeSpotPoolInstructionDataEncoder, getK, getOracleAddressFromPool, getOracleAge, getOracleBufferStats, getOracleConsultDiscriminatorBytes, getOracleConsultInstruction, getOracleConsultInstructionAsync, getOracleConsultInstructionDataCodec, getOracleConsultInstructionDataDecoder, getOracleConsultInstructionDataEncoder, getOracleDeviation, getOracleForPool, getOracleSpotPrices, getOracleUpdateDiscriminatorBytes, getOracleUpdateInstruction, getOracleUpdateInstructionAsync, getOracleUpdateInstructionDataCodec, getOracleUpdateInstructionDataDecoder, getOracleUpdateInstructionDataEncoder, getPauseDiscriminatorBytes, getPauseInstruction, getPauseInstructionDataCodec, getPauseInstructionDataDecoder, getPauseInstructionDataEncoder, getPendingFees, getPoolAddressFromMints, getPoolByMints, getPositionAddressFromParams, getPositionValue, getPreviewSwapExactInDiscriminatorBytes, getPreviewSwapExactInInstruction, getPreviewSwapExactInInstructionDataCodec, getPreviewSwapExactInInstructionDataDecoder, getPreviewSwapExactInInstructionDataEncoder, getRedeemProtocolSharesDiscriminatorBytes, getRedeemProtocolSharesInstruction, getRedeemProtocolSharesInstructionAsync, getRedeemProtocolSharesInstructionDataCodec, getRedeemProtocolSharesInstructionDataDecoder, getRedeemProtocolSharesInstructionDataEncoder, getRemoveLiquidityDiscriminatorBytes, getRemoveLiquidityInstruction, getRemoveLiquidityInstructionAsync, getRemoveLiquidityInstructionDataCodec, getRemoveLiquidityInstructionDataDecoder, getRemoveLiquidityInstructionDataEncoder, getRemoveLiquidityQuote, getSetFeesDiscriminatorBytes, getSetFeesInstruction, getSetFeesInstructionDataCodec, getSetFeesInstructionDataDecoder, getSetFeesInstructionDataEncoder, getSetHookDiscriminatorBytes, getSetHookInstruction, getSetHookInstructionDataCodec, getSetHookInstructionDataDecoder, getSetHookInstructionDataEncoder, getSpotPrice0, getSpotPrice1, getSwapExactInDiscriminatorBytes, getSwapExactInInstruction, getSwapExactInInstructionAsync, getSwapExactInInstructionDataCodec, getSwapExactInInstructionDataDecoder, getSwapExactInInstructionDataEncoder, getSwapQuote, getSwapQuoteExactOut, getTransferAdminDiscriminatorBytes, getTransferAdminInstruction, getTransferAdminInstructionDataCodec, getTransferAdminInstructionDataDecoder, getTransferAdminInstructionDataEncoder, getTvl, getUnpauseDiscriminatorBytes, getUnpauseInstruction, getUnpauseInstructionDataCodec, getUnpauseInstructionDataDecoder, getUnpauseInstructionDataEncoder, getUpdateConfigDiscriminatorBytes, getUpdateConfigInstruction, getUpdateConfigInstructionDataCodec, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataEncoder, getWithdrawVaultExcessDiscriminatorBytes, getWithdrawVaultExcessInstruction, getWithdrawVaultExcessInstructionAsync, getWithdrawVaultExcessInstructionDataCodec, getWithdrawVaultExcessInstructionDataDecoder, getWithdrawVaultExcessInstructionDataEncoder, initializeConfigArgsCodec, initializeOracleArgsCodec, initializePoolArgsCodec, isOracleStale, isTransactionSigner, isqrt, maxBigInt, minBigInt, normalizeProgramAccountsResponse, numberToQ64, observationCodec, oracleConsultArgsCodec, oracleStateDataCodec, parseAddLiquidityInstruction, parseClosePositionInstruction, parseCollectFeesInstruction, parseCollectProtocolFeesInstruction, parseCreatePositionInstruction, parseInitializeConfigInstruction, parseInitializeOracleInstruction, parseInitializePoolInstruction, parseInitializeSpotPoolInstruction, parseOracleConsultInstruction, parseOracleUpdateInstruction, parsePauseInstruction, parsePreviewSwapExactInInstruction, parseRedeemProtocolSharesInstruction, parseRemoveLiquidityInstruction, parseSetFeesInstruction, parseSetHookInstruction, parseSwapExactInInstruction, parseTransferAdminInstruction, parseUnpauseInstruction, parseUpdateConfigInstruction, parseWithdrawVaultExcessInstruction, poolDataCodec, poolExists, positionDataCodec, q64Div, q64Mul, q64ToNumber, ratioToNumber, removeLiquidityArgsCodec, setFeesArgsCodec, setHookArgsCodec, sortPoolsByReserves, sortPositionsByShares, swapExactInArgsCodec, transferAdminArgsCodec, warnAccountDecodeFailure };
4168
- //# sourceMappingURL=chunk-PSLY7M7C.js.map
4169
- //# sourceMappingURL=chunk-PSLY7M7C.js.map
4468
+ export { ADD_LIQUIDITY_DISCRIMINATOR, CLOSE_POSITION_DISCRIMINATOR, COLLECT_FEES_DISCRIMINATOR, COLLECT_PROTOCOL_FEES_DISCRIMINATOR, CPMM_PROGRAM_ADDRESS, CREATE_POSITION_DISCRIMINATOR, INITIALIZE_CONFIG_DISCRIMINATOR, INITIALIZE_ORACLE_DISCRIMINATOR, INITIALIZE_POOL_DISCRIMINATOR, INITIALIZE_SPOT_POOL_DISCRIMINATOR, INITIALIZE_SPOT_POOL_WITH_HOOK_DISCRIMINATOR, ORACLE_CONSULT_DISCRIMINATOR, ORACLE_UPDATE_DISCRIMINATOR, PAUSE_DISCRIMINATOR, PREVIEW_SWAP_EXACT_IN_DISCRIMINATOR, REDEEM_PROTOCOL_SHARES_DISCRIMINATOR, REMOVE_LIQUIDITY_DISCRIMINATOR, SET_FEES_DISCRIMINATOR, SET_HOOK_DISCRIMINATOR, SWAP_EXACT_IN_DISCRIMINATOR, TRANSFER_ADMIN_DISCRIMINATOR, UNPAUSE_DISCRIMINATOR, UPDATE_CONFIG_DISCRIMINATOR, WITHDRAW_VAULT_EXCESS_DISCRIMINATOR, addLiquidityArgsCodec, addressToBase58EncodedBytes, ammConfigDataCodec, base64ToBytes, bytesToBase64, bytesToBase64EncodedBytes, calculateAccruedFees, calculateTwap, calculateTwapNumber, ceilDiv, collectFeesArgsCodec, collectProtocolFeesArgsCodec, comparePoolAndOraclePrices, computePrice0Q64, computePrice1Q64, consultTwap, createAccountMeta, createPositionArgsCodec, createReadonlyRemainingAccountMeta, decodeAmmConfig, decodeOracleState, decodePool, decodePosition, encodeAddLiquidityArgs, encodeCollectFeesArgs, encodeCollectProtocolFeesArgs, encodeCreatePositionArgs, encodeInitializeConfigArgs, encodeInitializeOracleArgs, encodeInitializePoolArgs, encodeInstructionData, encodeOracleConsultArgs, encodeRemoveLiquidityArgs, encodeSetFeesArgs, encodeSetHookArgs, encodeSwapExactInArgs, encodeTransferAdminArgs, fetchAllPools, fetchOracle, fetchOraclesBatch, fetchPool, fetchPoolPositions, fetchPoolsBatch, fetchPosition, fetchPositionByParams, fetchPositionsBatch, fetchUserPositions, filterActivePositions, filterPoolsByMint, getAddLiquidityDiscriminatorBytes, getAddLiquidityInstruction, getAddLiquidityInstructionAsync, getAddLiquidityInstructionDataCodec, getAddLiquidityInstructionDataDecoder, getAddLiquidityInstructionDataEncoder, getAddLiquidityQuote, getAddressFromAddressOrSigner, getAddressFromRemainingAccount, getClosePositionDiscriminatorBytes, getClosePositionInstruction, getClosePositionInstructionDataCodec, getClosePositionInstructionDataDecoder, getClosePositionInstructionDataEncoder, getCollectFeesDiscriminatorBytes, getCollectFeesInstruction, getCollectFeesInstructionAsync, getCollectFeesInstructionDataCodec, getCollectFeesInstructionDataDecoder, getCollectFeesInstructionDataEncoder, getCollectProtocolFeesDiscriminatorBytes, getCollectProtocolFeesInstruction, getCollectProtocolFeesInstructionAsync, getCollectProtocolFeesInstructionDataCodec, getCollectProtocolFeesInstructionDataDecoder, getCollectProtocolFeesInstructionDataEncoder, getCreatePositionDiscriminatorBytes, getCreatePositionInstruction, getCreatePositionInstructionAsync, getCreatePositionInstructionDataCodec, getCreatePositionInstructionDataDecoder, getCreatePositionInstructionDataEncoder, getInitializeConfigDiscriminatorBytes, getInitializeConfigInstruction, getInitializeConfigInstructionAsync, getInitializeConfigInstructionDataCodec, getInitializeConfigInstructionDataDecoder, getInitializeConfigInstructionDataEncoder, getInitializeOracleDiscriminatorBytes, getInitializeOracleInstruction, getInitializeOracleInstructionAsync, getInitializeOracleInstructionDataCodec, getInitializeOracleInstructionDataDecoder, getInitializeOracleInstructionDataEncoder, getInitializePoolDiscriminatorBytes, getInitializePoolInstruction, getInitializePoolInstructionAsync, getInitializePoolInstructionDataCodec, getInitializePoolInstructionDataDecoder, getInitializePoolInstructionDataEncoder, getInitializeSpotPoolDiscriminatorBytes, getInitializeSpotPoolInstruction, getInitializeSpotPoolInstructionAsync, getInitializeSpotPoolInstructionDataCodec, getInitializeSpotPoolInstructionDataDecoder, getInitializeSpotPoolInstructionDataEncoder, getInitializeSpotPoolWithHookDiscriminatorBytes, getInitializeSpotPoolWithHookInstruction, getInitializeSpotPoolWithHookInstructionAsync, getInitializeSpotPoolWithHookInstructionDataCodec, getInitializeSpotPoolWithHookInstructionDataDecoder, getInitializeSpotPoolWithHookInstructionDataEncoder, getK, getOracleAddressFromPool, getOracleAge, getOracleBufferStats, getOracleConsultDiscriminatorBytes, getOracleConsultInstruction, getOracleConsultInstructionAsync, getOracleConsultInstructionDataCodec, getOracleConsultInstructionDataDecoder, getOracleConsultInstructionDataEncoder, getOracleDeviation, getOracleForPool, getOracleSpotPrices, getOracleUpdateDiscriminatorBytes, getOracleUpdateInstruction, getOracleUpdateInstructionAsync, getOracleUpdateInstructionDataCodec, getOracleUpdateInstructionDataDecoder, getOracleUpdateInstructionDataEncoder, getPauseDiscriminatorBytes, getPauseInstruction, getPauseInstructionDataCodec, getPauseInstructionDataDecoder, getPauseInstructionDataEncoder, getPendingFees, getPoolAddressFromMints, getPoolByMints, getPositionAddressFromParams, getPositionValue, getPreviewSwapExactInDiscriminatorBytes, getPreviewSwapExactInInstruction, getPreviewSwapExactInInstructionDataCodec, getPreviewSwapExactInInstructionDataDecoder, getPreviewSwapExactInInstructionDataEncoder, getRedeemProtocolSharesDiscriminatorBytes, getRedeemProtocolSharesInstruction, getRedeemProtocolSharesInstructionAsync, getRedeemProtocolSharesInstructionDataCodec, getRedeemProtocolSharesInstructionDataDecoder, getRedeemProtocolSharesInstructionDataEncoder, getRemoveLiquidityDiscriminatorBytes, getRemoveLiquidityInstruction, getRemoveLiquidityInstructionAsync, getRemoveLiquidityInstructionDataCodec, getRemoveLiquidityInstructionDataDecoder, getRemoveLiquidityInstructionDataEncoder, getRemoveLiquidityQuote, getSetFeesDiscriminatorBytes, getSetFeesInstruction, getSetFeesInstructionDataCodec, getSetFeesInstructionDataDecoder, getSetFeesInstructionDataEncoder, getSetHookDiscriminatorBytes, getSetHookInstruction, getSetHookInstructionDataCodec, getSetHookInstructionDataDecoder, getSetHookInstructionDataEncoder, getSpotPrice0, getSpotPrice1, getSwapExactInDiscriminatorBytes, getSwapExactInInstruction, getSwapExactInInstructionAsync, getSwapExactInInstructionDataCodec, getSwapExactInInstructionDataDecoder, getSwapExactInInstructionDataEncoder, getSwapQuote, getSwapQuoteExactOut, getTransferAdminDiscriminatorBytes, getTransferAdminInstruction, getTransferAdminInstructionDataCodec, getTransferAdminInstructionDataDecoder, getTransferAdminInstructionDataEncoder, getTvl, getUnpauseDiscriminatorBytes, getUnpauseInstruction, getUnpauseInstructionDataCodec, getUnpauseInstructionDataDecoder, getUnpauseInstructionDataEncoder, getUpdateConfigDiscriminatorBytes, getUpdateConfigInstruction, getUpdateConfigInstructionDataCodec, getUpdateConfigInstructionDataDecoder, getUpdateConfigInstructionDataEncoder, getWithdrawVaultExcessDiscriminatorBytes, getWithdrawVaultExcessInstruction, getWithdrawVaultExcessInstructionAsync, getWithdrawVaultExcessInstructionDataCodec, getWithdrawVaultExcessInstructionDataDecoder, getWithdrawVaultExcessInstructionDataEncoder, initializeConfigArgsCodec, initializeOracleArgsCodec, initializePoolArgsCodec, isOracleStale, isTransactionSigner, isqrt, maxBigInt, minBigInt, normalizeProgramAccountsResponse, numberToQ64, observationCodec, oracleConsultArgsCodec, oracleStateDataCodec, parseAddLiquidityInstruction, parseClosePositionInstruction, parseCollectFeesInstruction, parseCollectProtocolFeesInstruction, parseCreatePositionInstruction, parseInitializeConfigInstruction, parseInitializeOracleInstruction, parseInitializePoolInstruction, parseInitializeSpotPoolInstruction, parseInitializeSpotPoolWithHookInstruction, parseOracleConsultInstruction, parseOracleUpdateInstruction, parsePauseInstruction, parsePreviewSwapExactInInstruction, parseRedeemProtocolSharesInstruction, parseRemoveLiquidityInstruction, parseSetFeesInstruction, parseSetHookInstruction, parseSwapExactInInstruction, parseTransferAdminInstruction, parseUnpauseInstruction, parseUpdateConfigInstruction, parseWithdrawVaultExcessInstruction, poolDataCodec, poolExists, positionDataCodec, q64Div, q64Mul, q64ToNumber, ratioToNumber, removeLiquidityArgsCodec, setFeesArgsCodec, setHookArgsCodec, sortPoolsByReserves, sortPositionsByShares, swapExactInArgsCodec, transferAdminArgsCodec, warnAccountDecodeFailure };
4469
+ //# sourceMappingURL=chunk-4N5U2MXE.js.map
4470
+ //# sourceMappingURL=chunk-4N5U2MXE.js.map