mppx 0.4.7 → 0.4.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/CHANGELOG.md +15 -3
- package/README.md +13 -13
- package/dist/BodyDigest.d.ts.map +1 -1
- package/dist/BodyDigest.js.map +1 -1
- package/dist/Challenge.d.ts.map +1 -1
- package/dist/Challenge.js.map +1 -1
- package/dist/Credential.d.ts.map +1 -1
- package/dist/Credential.js.map +1 -1
- package/dist/Errors.js +64 -67
- package/dist/Errors.js.map +1 -1
- package/dist/PaymentRequest.d.ts.map +1 -1
- package/dist/PaymentRequest.js.map +1 -1
- package/dist/Receipt.d.ts.map +1 -1
- package/dist/Receipt.js.map +1 -1
- package/dist/Store.d.ts +14 -4
- package/dist/Store.d.ts.map +1 -1
- package/dist/Store.js +17 -0
- package/dist/Store.js.map +1 -1
- package/dist/cli/account.d.ts.map +1 -1
- package/dist/cli/account.js +40 -5
- package/dist/cli/account.js.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +24 -8
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/internal.d.ts.map +1 -1
- package/dist/cli/internal.js.map +1 -1
- package/dist/cli/plugins/stripe.d.ts.map +1 -1
- package/dist/cli/plugins/stripe.js.map +1 -1
- package/dist/cli/plugins/tempo.d.ts.map +1 -1
- package/dist/cli/plugins/tempo.js +11 -23
- package/dist/cli/plugins/tempo.js.map +1 -1
- package/dist/cli/utils.d.ts.map +1 -1
- package/dist/cli/utils.js.map +1 -1
- package/dist/client/internal/Fetch.d.ts +2 -0
- package/dist/client/internal/Fetch.d.ts.map +1 -1
- package/dist/client/internal/Fetch.js +1 -1
- package/dist/client/internal/Fetch.js.map +1 -1
- package/dist/internal/types.d.ts.map +1 -1
- package/dist/mcp-sdk/client/McpClient.d.ts.map +1 -1
- package/dist/mcp-sdk/client/McpClient.js +1 -1
- package/dist/mcp-sdk/client/McpClient.js.map +1 -1
- package/dist/mcp-sdk/server/Transport.d.ts.map +1 -1
- package/dist/mcp-sdk/server/Transport.js.map +1 -1
- package/dist/middlewares/elysia.d.ts.map +1 -1
- package/dist/middlewares/elysia.js +5 -1
- package/dist/middlewares/elysia.js.map +1 -1
- package/dist/middlewares/express.d.ts.map +1 -1
- package/dist/middlewares/express.js +5 -2
- package/dist/middlewares/express.js.map +1 -1
- package/dist/middlewares/hono.d.ts.map +1 -1
- package/dist/middlewares/hono.js.map +1 -1
- package/dist/proxy/Proxy.d.ts.map +1 -1
- package/dist/proxy/Proxy.js +3 -1
- package/dist/proxy/Proxy.js.map +1 -1
- package/dist/proxy/Service.js +1 -1
- package/dist/proxy/Service.js.map +1 -1
- package/dist/proxy/internal/Route.d.ts +2 -2
- package/dist/proxy/internal/Route.d.ts.map +1 -1
- package/dist/proxy/internal/Route.js +4 -2
- package/dist/proxy/internal/Route.js.map +1 -1
- package/dist/server/Mppx.d.ts.map +1 -1
- package/dist/server/Mppx.js +47 -11
- package/dist/server/Mppx.js.map +1 -1
- package/dist/server/Request.d.ts.map +1 -1
- package/dist/server/Request.js.map +1 -1
- package/dist/stripe/Methods.d.ts.map +1 -1
- package/dist/stripe/Methods.js.map +1 -1
- package/dist/tempo/Methods.d.ts.map +1 -1
- package/dist/tempo/Methods.js.map +1 -1
- package/dist/tempo/client/ChannelOps.d.ts.map +1 -1
- package/dist/tempo/client/ChannelOps.js.map +1 -1
- package/dist/tempo/client/Charge.d.ts.map +1 -1
- package/dist/tempo/client/Charge.js.map +1 -1
- package/dist/tempo/client/Session.d.ts.map +1 -1
- package/dist/tempo/client/Session.js.map +1 -1
- package/dist/tempo/client/SessionManager.d.ts.map +1 -1
- package/dist/tempo/client/SessionManager.js +1 -1
- package/dist/tempo/client/SessionManager.js.map +1 -1
- package/dist/tempo/internal/address.d.ts +3 -0
- package/dist/tempo/internal/address.d.ts.map +1 -0
- package/dist/tempo/internal/address.js +4 -0
- package/dist/tempo/internal/address.js.map +1 -0
- package/dist/tempo/internal/auto-swap.d.ts.map +1 -1
- package/dist/tempo/internal/auto-swap.js +4 -4
- package/dist/tempo/internal/auto-swap.js.map +1 -1
- package/dist/tempo/internal/fee-payer.d.ts +4 -1
- package/dist/tempo/internal/fee-payer.d.ts.map +1 -1
- package/dist/tempo/internal/fee-payer.js +12 -4
- package/dist/tempo/internal/fee-payer.js.map +1 -1
- package/dist/tempo/server/Charge.d.ts +11 -0
- package/dist/tempo/server/Charge.d.ts.map +1 -1
- package/dist/tempo/server/Charge.js +110 -51
- package/dist/tempo/server/Charge.js.map +1 -1
- package/dist/tempo/server/Session.d.ts +1 -1
- package/dist/tempo/server/Session.d.ts.map +1 -1
- package/dist/tempo/server/Session.js +31 -23
- package/dist/tempo/server/Session.js.map +1 -1
- package/dist/tempo/server/internal/transport.d.ts +1 -1
- package/dist/tempo/server/internal/transport.d.ts.map +1 -1
- package/dist/tempo/server/internal/transport.js +41 -1
- package/dist/tempo/server/internal/transport.js.map +1 -1
- package/dist/tempo/session/Chain.d.ts.map +1 -1
- package/dist/tempo/session/Chain.js +51 -10
- package/dist/tempo/session/Chain.js.map +1 -1
- package/dist/tempo/session/ChannelStore.d.ts +2 -0
- package/dist/tempo/session/ChannelStore.d.ts.map +1 -1
- package/dist/tempo/session/ChannelStore.js +4 -2
- package/dist/tempo/session/ChannelStore.js.map +1 -1
- package/dist/tempo/session/Receipt.d.ts.map +1 -1
- package/dist/tempo/session/Receipt.js.map +1 -1
- package/dist/tempo/session/Sse.d.ts.map +1 -1
- package/dist/tempo/session/Sse.js.map +1 -1
- package/dist/tempo/session/Voucher.d.ts.map +1 -1
- package/dist/tempo/session/Voucher.js +3 -2
- package/dist/tempo/session/Voucher.js.map +1 -1
- package/dist/viem/Client.d.ts.map +1 -1
- package/dist/viem/Client.js.map +1 -1
- package/package.json +2 -2
- package/src/BodyDigest.ts +1 -0
- package/src/Challenge.test-d.ts +1 -0
- package/src/Challenge.ts +1 -0
- package/src/Credential.ts +1 -0
- package/src/Errors.test.ts +27 -39
- package/src/Expires.test.ts +1 -0
- package/src/PaymentRequest.ts +1 -0
- package/src/Receipt.ts +1 -0
- package/src/Store.test-d.ts +59 -0
- package/src/Store.test.ts +56 -6
- package/src/Store.ts +31 -4
- package/src/cli/account.ts +65 -30
- package/src/cli/cli.test.ts +127 -1
- package/src/cli/cli.ts +23 -8
- package/src/cli/config.test.ts +1 -0
- package/src/cli/internal.ts +1 -0
- package/src/cli/plugins/stripe.ts +1 -0
- package/src/cli/plugins/tempo.ts +21 -24
- package/src/cli/utils.ts +1 -0
- package/src/client/Mppx.test-d.ts +1 -0
- package/src/client/internal/Fetch.browser.test.ts +1 -0
- package/src/client/internal/Fetch.test-d.ts +1 -0
- package/src/client/internal/Fetch.test.ts +1 -0
- package/src/client/internal/Fetch.ts +1 -1
- package/src/internal/constantTimeEqual.test.ts +1 -0
- package/src/internal/types.ts +1 -3
- package/src/mcp-sdk/client/McpClient.test-d.ts +1 -0
- package/src/mcp-sdk/client/McpClient.test.ts +1 -0
- package/src/mcp-sdk/client/McpClient.ts +2 -0
- package/src/mcp-sdk/server/Transport.test.ts +1 -0
- package/src/mcp-sdk/server/Transport.ts +1 -0
- package/src/middlewares/elysia.test.ts +90 -0
- package/src/middlewares/elysia.ts +5 -1
- package/src/middlewares/express.test.ts +62 -2
- package/src/middlewares/express.ts +6 -2
- package/src/middlewares/hono.ts +1 -0
- package/src/middlewares/internal/mppx.test.ts +1 -0
- package/src/middlewares/nextjs.test.ts +1 -0
- package/src/proxy/Proxy.test.ts +57 -0
- package/src/proxy/Proxy.ts +8 -1
- package/src/proxy/Service.test.ts +1 -0
- package/src/proxy/Service.ts +8 -2
- package/src/proxy/internal/Headers.test.ts +1 -0
- package/src/proxy/internal/Route.test.ts +57 -0
- package/src/proxy/internal/Route.ts +3 -1
- package/src/proxy/services/openai.test.ts +1 -0
- package/src/server/Mppx.test.ts +438 -0
- package/src/server/Mppx.ts +51 -13
- package/src/server/Request.test.ts +1 -0
- package/src/server/Request.ts +1 -0
- package/src/server/Response.test.ts +1 -0
- package/src/server/Transport.test.ts +1 -0
- package/src/stripe/Methods.ts +1 -0
- package/src/stripe/client/Charge.test.ts +1 -0
- package/src/stripe/server/Charge.test.ts +1 -0
- package/src/tempo/Attribution.test.ts +1 -0
- package/src/tempo/Methods.ts +1 -0
- package/src/tempo/client/ChannelOps.test.ts +1 -0
- package/src/tempo/client/ChannelOps.ts +1 -0
- package/src/tempo/client/Charge.ts +1 -0
- package/src/tempo/client/Session.test.ts +1 -0
- package/src/tempo/client/Session.ts +1 -0
- package/src/tempo/client/SessionManager.test.ts +28 -0
- package/src/tempo/client/SessionManager.ts +2 -1
- package/src/tempo/internal/address.ts +6 -0
- package/src/tempo/internal/auto-swap.test.ts +1 -0
- package/src/tempo/internal/auto-swap.ts +4 -3
- package/src/tempo/internal/defaults.test.ts +1 -0
- package/src/tempo/internal/fee-payer.test.ts +1 -0
- package/src/tempo/internal/fee-payer.ts +19 -4
- package/src/tempo/server/Charge.test.ts +1081 -31
- package/src/tempo/server/Charge.ts +159 -63
- package/src/tempo/server/Session.test.ts +896 -107
- package/src/tempo/server/Session.ts +41 -23
- package/src/tempo/server/Sse.test.ts +2 -0
- package/src/tempo/server/internal/transport.test.ts +30 -0
- package/src/tempo/server/internal/transport.ts +41 -2
- package/src/tempo/session/Chain.test.ts +145 -0
- package/src/tempo/session/Chain.ts +59 -10
- package/src/tempo/session/Channel.test.ts +1 -0
- package/src/tempo/session/ChannelStore.test.ts +11 -0
- package/src/tempo/session/ChannelStore.ts +7 -3
- package/src/tempo/session/Receipt.test.ts +1 -0
- package/src/tempo/session/Receipt.ts +1 -0
- package/src/tempo/session/Sse.test.ts +2 -0
- package/src/tempo/session/Sse.ts +1 -0
- package/src/tempo/session/Voucher.test.ts +1 -0
- package/src/tempo/session/Voucher.ts +4 -2
- package/src/viem/Account.test.ts +1 -0
- package/src/viem/Client.test.ts +1 -0
- package/src/viem/Client.ts +1 -0
|
@@ -2,6 +2,7 @@ import { Challenge, Credential, Mcp, Receipt } from 'mppx'
|
|
|
2
2
|
import { Transport } from 'mppx/server'
|
|
3
3
|
import { Methods } from 'mppx/tempo'
|
|
4
4
|
import { describe, expect, test } from 'vitest'
|
|
5
|
+
|
|
5
6
|
import { BadRequestError, ChannelClosedError } from '../Errors.js'
|
|
6
7
|
|
|
7
8
|
const realm = 'api.example.com'
|
package/src/stripe/Methods.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Challenge, Credential } from 'mppx'
|
|
|
2
2
|
import { Mppx, stripe } from 'mppx/client'
|
|
3
3
|
import { Mppx as Mppx_server, stripe as stripe_server } from 'mppx/server'
|
|
4
4
|
import { describe, expect, test, vi } from 'vitest'
|
|
5
|
+
|
|
5
6
|
import type { StripeJs } from '../internal/types.js'
|
|
6
7
|
import { charge as clientCharge_ } from './Charge.js'
|
|
7
8
|
|
|
@@ -2,6 +2,7 @@ import { Challenge, Credential } from 'mppx'
|
|
|
2
2
|
import { Mppx, stripe } from 'mppx/server'
|
|
3
3
|
import { afterEach, describe, expect, test, vi } from 'vitest'
|
|
4
4
|
import * as Http from '~test/Http.js'
|
|
5
|
+
|
|
5
6
|
import type { StripeClient } from '../internal/types.js'
|
|
6
7
|
|
|
7
8
|
const realm = 'api.example.com'
|
package/src/tempo/Methods.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { Addresses } from 'viem/tempo'
|
|
|
5
5
|
import { beforeAll, describe, expect, test } from 'vitest'
|
|
6
6
|
import { deployEscrow, openChannel } from '~test/tempo/session.js'
|
|
7
7
|
import { accounts, asset, chain, client, fundAccount, http } from '~test/tempo/viem.js'
|
|
8
|
+
|
|
8
9
|
import type { Challenge } from '../../Challenge.js'
|
|
9
10
|
import * as Credential from '../../Credential.js'
|
|
10
11
|
import {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
} from 'viem'
|
|
16
16
|
import { prepareTransactionRequest, signTransaction } from 'viem/actions'
|
|
17
17
|
import { Abis } from 'viem/tempo'
|
|
18
|
+
|
|
18
19
|
import type { Challenge } from '../../Challenge.js'
|
|
19
20
|
import * as Credential from '../../Credential.js'
|
|
20
21
|
import * as defaults from '../internal/defaults.js'
|
|
@@ -3,6 +3,7 @@ import type { Address } from 'viem'
|
|
|
3
3
|
import { prepareTransactionRequest, sendCallsSync, signTransaction } from 'viem/actions'
|
|
4
4
|
import { tempo as tempo_chain } from 'viem/chains'
|
|
5
5
|
import { Actions } from 'viem/tempo'
|
|
6
|
+
|
|
6
7
|
import * as Credential from '../../Credential.js'
|
|
7
8
|
import * as Method from '../../Method.js'
|
|
8
9
|
import * as Account from '../../viem/Account.js'
|
|
@@ -4,6 +4,7 @@ import { Addresses } from 'viem/tempo'
|
|
|
4
4
|
import { beforeAll, describe, expect, test } from 'vitest'
|
|
5
5
|
import { deployEscrow, openChannel } from '~test/tempo/session.js'
|
|
6
6
|
import { accounts, asset, chain, client, fundAccount } from '~test/tempo/viem.js'
|
|
7
|
+
|
|
7
8
|
import * as Challenge from '../../Challenge.js'
|
|
8
9
|
import * as Credential from '../../Credential.js'
|
|
9
10
|
import { chainId, escrowContract as escrowContractDefaults } from '../internal/defaults.js'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Hex } from 'ox'
|
|
2
2
|
import { type Address, parseUnits, type Account as viem_Account } from 'viem'
|
|
3
3
|
import { tempo as tempo_chain } from 'viem/chains'
|
|
4
|
+
|
|
4
5
|
import type * as Challenge from '../../Challenge.js'
|
|
5
6
|
import * as Method from '../../Method.js'
|
|
6
7
|
import * as Account from '../../viem/Account.js'
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Hex } from 'viem'
|
|
2
2
|
import { describe, expect, test, vi } from 'vitest'
|
|
3
|
+
|
|
3
4
|
import * as Challenge from '../../Challenge.js'
|
|
4
5
|
import { formatNeedVoucherEvent, parseEvent } from '../session/Sse.js'
|
|
5
6
|
import type { NeedVoucherEvent, SessionReceipt } from '../session/Types.js'
|
|
@@ -207,6 +208,33 @@ describe('Session', () => {
|
|
|
207
208
|
})
|
|
208
209
|
})
|
|
209
210
|
|
|
211
|
+
describe('.sse() headers normalization', () => {
|
|
212
|
+
test('preserves Headers instance properties when passed as headers', async () => {
|
|
213
|
+
const mockFetch = vi.fn().mockResolvedValue(makeSseResponse(['event: message\ndata: ok\n\n']))
|
|
214
|
+
|
|
215
|
+
const s = sessionManager({
|
|
216
|
+
account: '0x0000000000000000000000000000000000000001',
|
|
217
|
+
fetch: mockFetch as typeof globalThis.fetch,
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
const iterable = await s.sse('https://api.example.com/stream', {
|
|
221
|
+
headers: new Headers({ 'Content-Type': 'application/json', 'X-Custom': 'value' }),
|
|
222
|
+
})
|
|
223
|
+
|
|
224
|
+
for await (const _ of iterable) {
|
|
225
|
+
// drain
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const calledHeaders = (mockFetch.mock.calls[0]![1] as RequestInit).headers as Record<
|
|
229
|
+
string,
|
|
230
|
+
string
|
|
231
|
+
>
|
|
232
|
+
expect(calledHeaders['content-type']).toBe('application/json')
|
|
233
|
+
expect(calledHeaders['x-custom']).toBe('value')
|
|
234
|
+
expect(calledHeaders.Accept).toBe('text/event-stream')
|
|
235
|
+
})
|
|
236
|
+
})
|
|
237
|
+
|
|
210
238
|
describe('.close()', () => {
|
|
211
239
|
test('is no-op when not opened', async () => {
|
|
212
240
|
const mockFetch = vi.fn()
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Hex } from 'ox'
|
|
2
2
|
import type { Address } from 'viem'
|
|
3
|
+
|
|
3
4
|
import type * as Challenge from '../../Challenge.js'
|
|
4
5
|
import * as Fetch from '../../client/internal/Fetch.js'
|
|
5
6
|
import type * as Account from '../../viem/Account.js'
|
|
@@ -157,7 +158,7 @@ export function sessionManager(parameters: sessionManager.Parameters): SessionMa
|
|
|
157
158
|
const sseInit = {
|
|
158
159
|
...fetchInit,
|
|
159
160
|
headers: {
|
|
160
|
-
...fetchInit.headers,
|
|
161
|
+
...Fetch.normalizeHeaders(fetchInit.headers),
|
|
161
162
|
Accept: 'text/event-stream',
|
|
162
163
|
},
|
|
163
164
|
...(signal ? { signal } : {}),
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Address, Client } from 'viem'
|
|
2
|
-
import { isAddressEqual } from 'viem'
|
|
3
2
|
import { readContract } from 'viem/actions'
|
|
4
3
|
import { Actions, Addresses } from 'viem/tempo'
|
|
4
|
+
|
|
5
|
+
import * as TempoAddress from './address.js'
|
|
5
6
|
import * as defaults from './defaults.js'
|
|
6
7
|
|
|
7
8
|
/** Basis-point denominator (100% = 10 000 bps). */
|
|
@@ -26,7 +27,7 @@ export async function findCalls(
|
|
|
26
27
|
): Promise<findCalls.ReturnType> {
|
|
27
28
|
const { account, amountOut, tokenOut, tokenIn, slippage } = parameters
|
|
28
29
|
|
|
29
|
-
const candidates = tokenIn.filter((t) => !
|
|
30
|
+
const candidates = tokenIn.filter((t) => !TempoAddress.isEqual(t, tokenOut))
|
|
30
31
|
|
|
31
32
|
const balanceResults = await Promise.allSettled([
|
|
32
33
|
readContract(client, Actions.token.getBalance.call({ account, token: tokenOut }) as never),
|
|
@@ -108,7 +109,7 @@ export function resolve(
|
|
|
108
109
|
const tokenIn = value.tokenIn
|
|
109
110
|
? [
|
|
110
111
|
...value.tokenIn,
|
|
111
|
-
...defaultCurrencies.filter((d) => !value.tokenIn!.some((c) =>
|
|
112
|
+
...defaultCurrencies.filter((d) => !value.tokenIn!.some((c) => TempoAddress.isEqual(c, d))),
|
|
112
113
|
]
|
|
113
114
|
: defaultCurrencies
|
|
114
115
|
return {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { encodeFunctionData } from 'viem'
|
|
2
2
|
import { Abis, Addresses } from 'viem/tempo'
|
|
3
3
|
import { describe, expect, test } from 'vitest'
|
|
4
|
+
|
|
4
5
|
import { callScopes, FeePayerValidationError, validateCalls } from './fee-payer.js'
|
|
5
6
|
import * as Selectors from './selectors.js'
|
|
6
7
|
|
|
@@ -1,7 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { TempoAddress } from 'ox/tempo'
|
|
2
|
+
import { TxEnvelopeTempo } from 'ox/tempo'
|
|
3
|
+
import { decodeFunctionData } from 'viem'
|
|
2
4
|
import { Abis, Addresses } from 'viem/tempo'
|
|
5
|
+
|
|
6
|
+
import * as TempoAddress_internal from './address.js'
|
|
3
7
|
import * as Selectors from './selectors.js'
|
|
4
8
|
|
|
9
|
+
/** Returns true if the serialized transaction has a Tempo envelope prefix. */
|
|
10
|
+
export function isTempoTransaction(serialized: string | undefined): boolean {
|
|
11
|
+
return (
|
|
12
|
+
serialized?.startsWith(TxEnvelopeTempo.serializedType) === true ||
|
|
13
|
+
serialized?.startsWith(TxEnvelopeTempo.feePayerMagic) === true
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
5
17
|
/**
|
|
6
18
|
* Allowed call patterns for fee-payer sponsored transactions.
|
|
7
19
|
* Each inner array is an ordered list of function selectors.
|
|
@@ -15,7 +27,7 @@ export const callScopes = [
|
|
|
15
27
|
|
|
16
28
|
/** Validates that a set of transaction calls matches an allowed fee-payer pattern. */
|
|
17
29
|
export function validateCalls(
|
|
18
|
-
calls: readonly { data?: `0x${string}` | undefined; to?:
|
|
30
|
+
calls: readonly { data?: `0x${string}` | undefined; to?: TempoAddress.Address | undefined }[],
|
|
19
31
|
details: Record<string, string>,
|
|
20
32
|
) {
|
|
21
33
|
const callSelectors = calls.map((c) => c.data?.slice(0, 10))
|
|
@@ -31,11 +43,14 @@ export function validateCalls(
|
|
|
31
43
|
const approveCall = calls.find((c) => c.data?.slice(0, 10) === Selectors.approve)
|
|
32
44
|
if (approveCall) {
|
|
33
45
|
const { args } = decodeFunctionData({ abi: Abis.tip20, data: approveCall.data! })
|
|
34
|
-
if (!
|
|
46
|
+
if (!TempoAddress_internal.isEqual((args as [`0x${string}`])[0]!, Addresses.stablecoinDex))
|
|
35
47
|
throw new FeePayerValidationError('approve spender is not the DEX', details)
|
|
36
48
|
}
|
|
37
49
|
const buyCall = calls.find((c) => c.data?.slice(0, 10) === Selectors.swapExactAmountOut)
|
|
38
|
-
if (
|
|
50
|
+
if (
|
|
51
|
+
buyCall &&
|
|
52
|
+
(!buyCall.to || !TempoAddress_internal.isEqual(buyCall.to, Addresses.stablecoinDex))
|
|
53
|
+
)
|
|
39
54
|
throw new FeePayerValidationError('buy target is not the DEX', details)
|
|
40
55
|
}
|
|
41
56
|
|