@metatrongg/sdk 0.8.0-dev.bf445a4 → 0.8.0-dev.e892968
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/browser/index.d.ts +10 -0
- package/dist/browser/index.js +1 -1
- package/dist/contracts/index.d.ts +141 -16
- package/dist/contracts/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/node/index.d.ts +10 -0
- package/dist/node/index.js +1 -1
- package/dist/webhook/express.js +1 -1
- package/dist/webhook/fastify.js +1 -1
- package/dist/webhook/hono.js +1 -1
- package/dist/webhook/index.js +1 -1
- package/package.json +1 -1
package/dist/webhook/fastify.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as e from"zod";const t=e.string().min(3).max(18).regex(/^[a-z][a-z0-9_]*$/),n=e.string().nullable(),r=e.string().max(256).nullable(),i=e.url().max(2048).nullable(),a=e.enum([`yellow`,`green`,`blue`,`white`,`black`]),o=e.enum([`super-admin`,`admin`,`read-only`]).nullable(),s=e.enum([`auto`,`online`,`offline`]),c=e.enum([`development`,`production`]),l=e.object({id:e.string().min(1),email:e.email().nullable(),emailVerified:e.boolean(),name:t,displayName:n,bio:r,websiteUrl:i,image:e.string().nullish(),banner:a,role:o,presenceStatusMode:s,environmentViewMode:c,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}),u=e.string().min(1);e.object({user:l,token:u.optional()}),e.object({error:e.string().min(1),traceId:e.string().min(1).optional()}),e.object({name:t,email:e.email(),password:e.string().min(8),image:e.url().optional(),callbackURL:e.url().optional()}),e.object({redirect:e.boolean(),token:u.optional(),url:e.url().optional(),user:l.optional()}),e.object({email:e.email(),password:e.string().min(1),callbackURL:e.url().optional(),rememberMe:e.boolean().optional()}),e.object({success:e.boolean()});const ee=e.object({id:e.string().min(1),token:e.string().min(1),userId:e.string().min(1),expiresAt:e.iso.datetime(),ipAddress:e.string().nullish(),userAgent:e.string().nullish(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.union([e.object({session:ee,user:l}),e.unknown()]),e.object({status:e.boolean()}),e.object({status:e.boolean()}),e.object({email:e.email(),callbackURL:e.url().optional()}),e.object({status:e.boolean()}),e.object({email:e.email(),redirectTo:e.url().optional()}),e.object({status:e.boolean()}),e.object({newPassword:e.string().min(8),token:e.string().min(1)}),e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),userinfo_endpoint:e.url(),revocation_endpoint:e.url(),registration_endpoint:e.url(),response_types_supported:e.array(e.enum([`code`])),grant_types_supported:e.array(e.enum([`authorization_code`,`refresh_token`,`client_credentials`])),code_challenge_methods_supported:e.array(e.enum([`S256`])),token_endpoint_auth_methods_supported:e.array(e.enum([`client_secret_basic`,`client_secret_post`,`none`])),scopes_supported:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`]))});const d=e.url().max(2048),f=e.string().min(1).regex(/^[A-Za-z0-9_:.-]+(?: [A-Za-z0-9_:.-]+)*$/);e.object({client_id:e.string().regex(/^tg_dc_[a-f0-9]{32}$/),client_id_issued_at:e.int().gte(0),client_name:e.string().min(1),redirect_uris:e.array(d),token_endpoint_auth_method:e.enum([`none`]),grant_types:e.array(e.enum([`authorization_code`,`refresh_token`])),response_types:e.array(e.enum([`code`])),scope:f}),e.object({error:e.enum([`invalid_redirect_uri`,`invalid_client_metadata`]),error_description:e.string().optional()}),e.object({redirect_uris:e.array(d).min(1).max(10),client_name:e.string().min(1).max(128).optional(),token_endpoint_auth_method:e.enum([`none`]).optional(),grant_types:e.array(e.enum([`authorization_code`,`refresh_token`])).optional(),response_types:e.array(e.enum([`code`])).optional(),scope:f.optional()});const p=e.string().regex(/^tg_(?:dev|prod|dc)_[A-Za-z0-9]{16,64}$/),m=e.string().min(1).max(2048),te=e.string().regex(/^[A-Za-z0-9_~.-]{43,128}$/),h=e.string().regex(/^[a-f0-9]{32}$/);e.object({request:h,app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),clientKind:e.enum([`app`,`connector`]),scopes:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`])).min(1),developerRole:e.object({approved:e.boolean(),policyVersion:e.string().min(1)}).nullable(),alreadyGranted:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`])),redirectUriHost:e.string().min(1),payment:e.object({tiersCents:e.array(e.int().gt(0)).min(1),currentLimitCents:e.int().gte(0).nullable(),currentMonthSpentCents:e.int().gte(0).nullable(),payoutChains:e.array(e.string().min(1))}).nullable()}),e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),tiersCents:e.array(e.int().gt(0)).min(1)}),e.object({app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),developer:e.object({studioName:e.string().nullable(),logoUrl:e.url().nullable(),studioUrl:e.url().nullable(),studioXHandle:e.string().nullable()})}),e.object({redirect:e.url()});const g=e.int().gte(100).lte(5e6).nullable();e.object({request:h,decision:e.enum([`allow`,`deny`]),acceptDeveloperPolicy:e.boolean().optional(),payment:e.object({monthlyLimitCents:g}).optional()}),e.object({access_token:e.string().min(1),token_type:e.enum([`Bearer`]),expires_in:e.int().gt(0),refresh_token:e.string().min(1).optional(),scope:f.optional()}),e.object({error:e.enum([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`unsupported_response_type`,`invalid_scope`,`access_denied`,`server_error`,`temporarily_unavailable`,`invalid_token`,`insufficient_scope`]),error_description:e.string().optional(),error_uri:e.url().optional(),state:m.optional()});const ne=e.string().regex(/^[A-Za-z0-9_~.-]{43,128}$/),_=e.string().regex(/^[a-f0-9]{64}$/),re=e.object({grant_type:e.enum([`authorization_code`]),code:e.string().min(1),redirect_uri:d,code_verifier:ne,client_id:p.optional(),client_secret:_.optional()}),ie=e.object({grant_type:e.enum([`refresh_token`]),refresh_token:e.string().min(1),scope:f.optional(),client_id:p.optional(),client_secret:_.optional()}),ae=e.object({grant_type:e.enum([`client_credentials`]),scope:f.optional(),client_id:p.optional(),client_secret:_.optional()});e.discriminatedUnion(`grant_type`,[re.extend({grant_type:e.literal(`authorization_code`)}),ie.extend({grant_type:e.literal(`refresh_token`)}),ae.extend({grant_type:e.literal(`client_credentials`)})]),e.object({sub:e.string().min(1),name:e.string().min(1).nullable(),picture:e.url().nullable()}),e.object({token:e.string().min(1),token_type_hint:e.enum([`access_token`,`refresh_token`]).optional(),client_id:p.optional(),client_secret:_.optional()});const oe=e.object({status:e.enum([`completed`]),intentId:e.string().min(1),paymentId:e.string().min(1),usdCents:e.int().gte(0),txHash:e.string().nullable()}),se=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),usdCents:e.int().gte(0)});e.discriminatedUnion(`status`,[oe.extend({status:e.literal(`completed`)}),se.extend({status:e.literal(`redirect`)})]),e.object({error:e.enum([`monthly_limit_exceeded`]),currentLimitCents:e.int().gte(0),monthSpentCents:e.int().gte(0),attemptedUsdCents:e.int().gte(0),redirectUrl:e.url()}),e.object({error:e.enum([`idempotency_key_reused`]),intentId:e.string().min(1)});const v=e.object({purpose:e.string().min(1).max(64).optional(),title:e.string().min(1).max(120).optional(),note:e.string().min(1).max(280).optional(),quantity:e.int().gte(1).lte(1e6).optional(),category:e.string().min(1).max(64).optional(),sessionId:e.string().min(1).max(128).optional(),groupId:e.string().min(1).max(128).optional(),image:e.url().max(2048).optional(),extra:e.record(e.string(),e.union([e.string().max(512),e.number(),e.boolean()])).optional()});e.object({chain:e.string().min(1),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),returnUri:e.url().max(2048),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/).optional(),rakeBps:e.int().gte(0).lte(3e3).optional(),metadata:v.optional()}),e.object({monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),periodStart:e.iso.datetime(),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable(),walletDelegated:e.boolean()}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),tokenDecimals:e.int().gte(0),usdRate:e.string().min(1),feed:e.object({aggregatorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),decimals:e.int().gte(0),answer:e.string().regex(/^\d+$/),updatedAt:e.iso.datetime()}),usdCents:e.int().gte(0).optional(),amount:e.string().regex(/^\d+$/).optional()});const ce=e.object({intentId:e.string().min(1),appId:e.string().min(1),status:e.enum([`pending`,`awaiting_funding`,`completed`,`denied`,`expired`]),paymentId:e.string().nullable(),txHash:e.string().nullable(),usdCents:e.int().gte(0),chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/).nullable(),creditedAmount:e.string().regex(/^\d+$/).nullable(),settlement:e.enum([`instant`,`locked`]).nullable(),resolvedAt:e.iso.datetime().nullable(),expiresAt:e.iso.datetime()});e.object({intentId:e.string().min(1),consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),chain:e.string().min(1),token:e.string(),amount:e.string(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appealable:e.boolean(),usdCents:e.int().gte(0),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable(),walletDelegated:e.boolean(),canonicalWalletAddress:e.string().nullable(),offlineDenialReason:e.enum([`no_active_play_session`,`driver_unavailable`,`wallet_not_delegated`,`deposit_cap_exceeded`,`insufficient_balance`,`fire_failed`]).nullable(),returnUriHost:e.string().min(1),status:e.enum([`pending`,`awaiting_funding`]),expiresAt:e.iso.datetime(),accessDenied:e.object({reason:e.enum([`not_invited`]),developer:e.object({studioName:e.string().nullable(),logoUrl:e.url().nullable(),studioUrl:e.url().nullable(),studioXHandle:e.string().nullable()})}).nullish()}),e.object({chain:e.string().min(1),chainId:e.int().gte(0),id:e.string().regex(/^0x[0-9a-fA-F]{32}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),data:e.string().regex(/^0x[0-9a-fA-F]*$/),appealable:e.boolean(),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),deadline:e.int().gte(0),routerAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}),e.object({redirect:e.url()});const le=e.object({method:e.enum([`signed`]),paymentId:e.string().min(1)}),ue=e.object({method:e.enum([`offline`])});e.discriminatedUnion(`method`,[le.extend({method:e.literal(`signed`)}),ue.extend({method:e.literal(`offline`)})]);const de=e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),periodStart:e.iso.datetime(),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable()});e.object({authorizations:e.array(de)});const fe=e.int().gte(100).lte(1e5).nullable();e.object({offlineAutoChargeEnabled:e.boolean().optional(),perTxOfflineCapCents:fe.optional(),monthlyLimitCents:g.optional()});const pe=e.object({clientName:e.string().min(1),connectedAt:e.iso.datetime()});e.object({connections:e.array(pe)});const me=e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitTronCents:e.int().gte(0).nullable(),monthSpentTronCents:e.int().gte(0),autoApproveTronCapCents:e.int().gte(0).nullable()});e.object({authorizations:e.array(me).max(200)}),e.object({monthlyTronLimitCents:e.int().gt(0).lte(1e8).nullish(),autoApproveTronCapCents:e.int().gt(0).lte(1e8).nullish()});const y=e.string().min(3).max(40).regex(/^[a-z0-9-]+$/),he=e.object({appId:e.uuid(),name:e.string().min(1).max(80),slug:y,bannerUrl:e.url().nullable(),thumbnailUrl:e.url().nullable(),thumbnailVideoUrl:e.url().nullable(),categories:e.array(e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`))),studio:e.object({name:e.string().min(1).max(80).nullable(),logoUrl:e.url().nullable()}).nullable(),firstPublishedAt:e.iso.datetime()});e.object({items:e.array(he),nextBefore:e.iso.datetime().nullable()});const b=e.array(e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`))).max(4),x=e.string().min(1).max(80),ge=e.object({url:e.url().max(2048),caption:e.string().max(200).optional(),order:e.int().gte(0)}),S=e.array(ge).max(6),_e=e.object({heading:e.string().min(1).max(80),body:e.string().min(1).max(2e3),order:e.int().gte(0)}),C=e.array(_e).max(8),ve=e.object({label:e.string().min(1).max(40),url:e.url().max(2048),order:e.int().gte(0)}),w=e.array(ve).max(10),ye=e.object({name:e.string().nullable(),logoUrl:e.url().nullable(),websiteUrl:e.url().nullable(),xHandle:e.string().nullable(),githubUrl:e.url().nullable()});e.object({appId:e.uuid(),slug:y,appName:e.string(),appLogoUrl:e.url().nullable(),categories:b,tagline:x,bannerUrl:e.url().nullable(),playUrl:e.url().nullable(),discordUrl:e.url().nullable(),twitterUrl:e.url().nullable(),redditUrl:e.url().nullable(),telegramUrl:e.url().nullable(),gallery:S,chapters:C,links:w,studio:ye,oauthScopes:e.array(e.string()),chains:e.array(e.string()),publishedAt:e.iso.datetime()});const be=e.object({1:e.int().gte(0),2:e.int().gte(0),3:e.int().gte(0),4:e.int().gte(0),5:e.int().gte(0)}),xe=e.object({average:e.number().gte(1).lte(5).nullable(),count:e.int().gte(0),distribution:be}),T=e.int().gte(1).lte(5),E=e.string().min(1).max(2e3),Se=e.object({name:e.string().min(1).max(80).nullable(),avatarUrl:e.url().nullable()}),D=e.string().min(1).max(2e3),O=e.object({body:D,repliedAt:e.iso.datetime()}).nullable(),Ce=e.object({id:e.uuid(),rating:T,body:E,author:Se,developerReply:O,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.object({aggregate:xe,reviews:e.array(Ce),total:e.int().gte(0),hasMore:e.boolean()});const we=e.enum([`newest`,`oldest`,`highest`,`lowest`]).default(`newest`),Te=e.enum([`payment`,`reward`]).nullable(),Ee=e.object({id:e.uuid(),rating:T,body:E,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}).nullable();e.object({eligible:e.boolean(),eligibleVia:Te,review:Ee,isAppOwner:e.boolean()}),e.object({rating:T,body:E}),e.object({developerReply:O}),e.object({body:D}),e.object({created:e.boolean()});const k=e.enum([`abuse`,`inappropriate_content`,`cheating`,`spam`,`other`]);e.object({category:k,details:e.string().max(2e3).optional()});const A=e.enum([`open`,`acknowledged`,`dismissed`]),De=e.object({id:e.uuid(),category:k,details:e.string().nullable(),status:A,acknowledgedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()});e.object({reports:e.array(De),total:e.int().gte(0),hasMore:e.boolean()}),e.object({status:e.enum([`acknowledged`,`dismissed`])});const Oe=e.object({id:e.string().min(1),family:e.enum([`evm`,`solana`]),displayName:e.string().min(1),chainId:e.int().optional(),paymentRouter:e.string().optional(),paymentProgram:e.string().optional()});e.object({chains:e.array(Oe)});const ke=e.object({id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vaultKind:e.enum([`credit`,`platform`]),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).nullable(),appealable:e.boolean(),vaultReleaseAt:e.iso.datetime().nullable(),consolidatedAt:e.iso.datetime().nullable(),status:e.enum([`pending`,`completed`,`expired`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),deadline:e.iso.datetime(),signedAt:e.iso.datetime(),completedAt:e.iso.datetime().nullable(),recipientApp:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}).nullable()});e.object({payments:e.array(ke),nextBefore:e.iso.datetime().nullable()});const Ae=e.object({kind:e.enum([`payment`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`,`incoming`]),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),beneficiaryApp:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vaultKind:e.enum([`credit`,`platform`]),targetKind:e.enum([`credit`,`pot`]),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).nullable(),appealable:e.boolean(),disputableLegId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vaultReleaseAt:e.iso.datetime().nullable(),consolidatedAt:e.iso.datetime().nullable(),status:e.enum([`pending`,`completed`,`expired`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),je=e.object({kind:e.enum([`payment_withdrawal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),Me=e.object({kind:e.enum([`matured_withdrawal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),Ne=e.object({kind:e.enum([`payout_sent`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),Pe=e.object({kind:e.enum([`credit_transferred`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),Fe=e.object({kind:e.enum([`pot_leg`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),distributionId:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),settlement:e.enum([`instant`,`locked`]),releaseAt:e.iso.datetime().nullable(),claimedAt:e.iso.datetime().nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),Ie=e.object({kind:e.enum([`payment_autoclaim`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),autoclaimKind:e.enum([`withdraw_matured`,`withdraw_escrow`,`claim_refund`]),status:e.enum([`pending`,`in_flight`,`succeeded`,`skipped`,`failed`]),attempts:e.int().gte(0),lastError:e.string().nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),settledAt:e.iso.datetime().nullable()}),Le=e.object({kind:e.enum([`appeal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`pending_onchain`,`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),resolvedAt:e.iso.datetime().nullable(),refundClaimedAt:e.iso.datetime().nullable(),hasRoom:e.boolean(),resolution:e.object({resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]{130}$/)}).nullable(),usdCents:e.int().gte(0).nullable()}),Re=e.object({kind:e.enum([`moonpay_buy`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),externalId:e.string().min(1),fiatAmountCents:e.int().gte(0),fiatCurrency:e.string().min(1),cryptoAmount:e.string().regex(/^\d+$/),cryptoToken:e.string().regex(/^0x[0-9a-fA-F]{40}$/),cryptoTxHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`completed`,`failed`])}),ze=e.object({kind:e.enum([`moonpay_sell`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),externalId:e.string().min(1),fiatAmountCents:e.int().gte(0),fiatCurrency:e.string().min(1),cryptoAmount:e.string().regex(/^\d+$/),cryptoToken:e.string().regex(/^0x[0-9a-fA-F]{40}$/),cryptoTxHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`completed`,`failed`])}),Be=e.object({kind:e.enum([`tron_deposit`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),amountCents:e.int().gt(0),status:e.enum([`completed`,`disputed`,`clawed_back`]),receiptUrl:e.url().nullable(),paymentIntentId:e.string().min(1).nullable()}),Ve=e.object({kind:e.enum([`tron_pot`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`,`outgoing`]),leg:e.enum([`stake`,`payout`,`dev_cut`,`purchase`,`referral`]),amountCents:e.int().gt(0),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),metadata:v.nullish()}),He=e.object({kind:e.enum([`tron_cashout`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),method:e.enum([`stripe`,`usdc`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),stripeTransferId:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),settledAt:e.iso.datetime().nullable()}),Ue=e.object({kind:e.enum([`referral_earning`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),referralAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),reversed:e.boolean(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),We=e.discriminatedUnion(`kind`,[Ae.extend({kind:e.literal(`payment`)}),je.extend({kind:e.literal(`payment_withdrawal`)}),Me.extend({kind:e.literal(`matured_withdrawal`)}),Ne.extend({kind:e.literal(`payout_sent`)}),Pe.extend({kind:e.literal(`credit_transferred`)}),Fe.extend({kind:e.literal(`pot_leg`)}),Ie.extend({kind:e.literal(`payment_autoclaim`)}),Le.extend({kind:e.literal(`appeal`)}),Re.extend({kind:e.literal(`moonpay_buy`)}),ze.extend({kind:e.literal(`moonpay_sell`)}),Be.extend({kind:e.literal(`tron_deposit`)}),Ve.extend({kind:e.literal(`tron_pot`)}),He.extend({kind:e.literal(`tron_cashout`)}),Ue.extend({kind:e.literal(`referral_earning`)})]);e.object({rows:e.array(We),nextBefore:e.iso.datetime().nullable(),nextCursor:e.string().nullable(),hasHidden:e.boolean()});const Ge=e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),creditedWei:e.string().regex(/^\d+$/),drainedWei:e.string().regex(/^\d+$/),outstandingWei:e.string().regex(/^\d+$/)});e.object({rows:e.array(Ge)}),e.object({enabled:e.boolean(),direction:e.enum([`buy`,`sell`,`both`]).nullable(),countryCode:e.string().regex(/^[A-Z]{2}$/).nullable(),regionSupported:e.boolean()}),e.object({url:e.url(),intentId:e.string().min(1),expiresAt:e.iso.datetime(),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({intentId:e.string().min(1)}),e.object({url:e.url(),transactionId:e.uuid(),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({usdcAmount:e.string().regex(/^\d+$/),chain:e.string().min(1).optional()}),e.object({enabled:e.boolean(),balanceCents:e.int().gte(0),frozenCents:e.int().gte(0),currency:e.enum([`tron`]),flagged:e.boolean(),minDepositCents:e.int().gt(0),maxDepositCents:e.int().gt(0)});const Ke=e.object({id:e.uuid(),kind:e.enum([`deposit`,`pot_stake`,`pot_payout`,`dev_earning`,`cashout_hold`,`cashout_release`,`dispute_freeze`,`dispute_unfreeze`,`hosted_billing`,`store_purchase`,`referral_earning`]),amountCents:e.int(),currency:e.string().min(1),createdAt:e.iso.datetime()});e.object({entries:e.array(Ke).max(100),nextBefore:e.iso.datetime().nullable()}),e.object({clientSecret:e.string().min(1),publishableKey:e.string().min(1),amountCents:e.int().gt(0),currency:e.string().min(1),depositId:e.uuid()}),e.object({amountCents:e.int().gt(0).lte(1e6)}),e.object({balanceCents:e.int().gte(0),rakeBps:e.int().gte(0).lte(3e3)});const qe=e.object({status:e.enum([`completed`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),balanceCents:e.int().gte(0)}),Je=e.object({status:e.enum([`insufficient_balance`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),balanceCents:e.int().gte(0)}),Ye=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),amountCents:e.int().gt(0),potId:e.string().regex(/^0x[0-9a-f]{32}$/)});e.discriminatedUnion(`status`,[qe.extend({status:e.literal(`completed`)}),Je.extend({status:e.literal(`insufficient_balance`)}),Ye.extend({status:e.literal(`redirect`)})]),e.object({potId:e.string().regex(/^0x[0-9a-f]{32}$/),amountCents:e.int().gt(0),returnUri:e.url(),metadata:v.optional()});const Xe=e.object({status:e.enum([`completed`]),balanceCents:e.int().gte(0)}),Ze=e.object({status:e.enum([`insufficient_balance`]),balanceCents:e.int().gte(0)}),Qe=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),amountCents:e.int().gt(0)});e.discriminatedUnion(`status`,[Xe.extend({status:e.literal(`completed`)}),Ze.extend({status:e.literal(`insufficient_balance`)}),Qe.extend({status:e.literal(`redirect`)})]),e.object({amountCents:e.int().gt(0),returnUri:e.url(),metadata:v.optional()}),e.object({intentId:e.string().min(1),consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),amountCents:e.int().gt(0),kind:e.enum([`pot_stake`,`store_purchase`]),potId:e.string().nullable(),monthlyLimitTronCents:e.int().gte(0).nullable(),monthSpentTronCents:e.int().gte(0),autoApproveTronCapCents:e.int().gte(0).nullable(),balanceCents:e.int().gte(0),returnUriHost:e.string().min(1),status:e.enum([`pending`]),expiresAt:e.iso.datetime()});const $e=e.object({status:e.enum([`redirect`]),redirect:e.url()}),et=e.object({status:e.enum([`insufficient_balance`]),balanceCents:e.int().gte(0)});e.discriminatedUnion(`status`,[$e.extend({status:e.literal(`redirect`)}),et.extend({status:e.literal(`insufficient_balance`)})]),e.object({status:e.enum([`distributed`,`replayed`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),potBalanceCents:e.int().gte(0)}),e.object({potId:e.string().regex(/^0x[0-9a-f]{32}$/),legs:e.array(e.object({recipientUserId:e.uuid(),amountCents:e.int().gt(0)})).max(64),rakeBps:e.int().gte(0).lte(1e4).optional(),devCutCents:e.int().gte(0).optional().default(0),closePot:e.boolean().optional().default(!0),metadata:v.optional()}),e.object({url:e.url()});const tt=e.object({id:e.uuid(),method:e.enum([`stripe`,`usdc`]),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),currency:e.string().min(1),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),createdAt:e.iso.datetime(),settledAt:e.iso.datetime().nullable()});e.object({method:e.enum([`stripe`,`usdc`]),amountCents:e.int().gt(0),chain:e.string().min(1).optional()}),e.object({requests:e.array(tt).max(100)});const nt=e.object({id:e.uuid(),method:e.enum([`stripe`,`usdc`]),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),currency:e.string().min(1),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),createdAt:e.iso.datetime(),settledAt:e.iso.datetime().nullable(),userId:e.uuid(),requestIdHex:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),usdcAmount:e.string().regex(/^\d+$/).nullable(),backendSignature:e.string().regex(/^0x[0-9a-f]+$/).nullable(),signatureDeadline:e.iso.datetime().nullable(),poolAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable()});e.object({requests:e.array(nt).max(100)}),e.object({reason:e.string().min(1).max(500)});const rt=e.array(e.object({id:e.enum([`ethereum-mainnet`,`base-mainnet`,`ethereum-sepolia`]),displayName:e.string().min(1),chainId:e.int().gt(0)})),j=e.string().min(1).max(24).regex(/^[a-z0-9]+$/).nullable(),it=e.object({id:e.string().min(1),name:e.string().min(1),deletedAt:e.iso.datetime().nullable()}).nullable(),M=e.object({native:e.string().regex(/^\d+(?:\.\d+)?$/),usdc:e.string().regex(/^\d+(?:\.\d+)?$/).optional()}),at=e.object({"ethereum-mainnet":M.optional(),"base-mainnet":M.optional(),"ethereum-sepolia":M.optional()}),ot=e.enum([`infinite`,`custom`,`scoped`]).nullable(),N=e.object({native:e.string().regex(/^\d+$/),usdc:e.string().regex(/^\d+$/)}).nullable(),st=e.object({mode:ot,caps:N,policyId:e.string().min(1).nullable()}),ct=e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),label:j,kind:e.enum([`personal`,`app`]),app:it,balances:at,delegation:st});e.object({chains:rt,wallets:e.array(ct)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),label:j}),e.object({label:j}),e.object({policyId:e.string().min(1).nullable()}),e.union([e.object({mode:e.enum([`infinite`])}),e.object({mode:e.enum([`custom`]),caps:N}),e.object({mode:e.enum([`scoped`])})]),e.object({ok:e.literal(!0)}),e.object({name:t.optional(),displayName:n.optional(),bio:e.string().min(1).max(256).nullish(),websiteUrl:i.optional(),banner:a.optional(),presenceStatusMode:s.optional(),environmentViewMode:c.optional()});const lt=e.object({id:e.string().min(1),title:e.string().max(500),gifUrl:e.url(),previewUrl:e.url(),width:e.int().gt(0),height:e.int().gt(0)});e.object({results:e.array(lt)});const P=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable()}),F=e.object({v:e.literal(1),alg:e.enum([`x25519-ecdh-hkdf-sha256-aes256gcm`]),senderPubKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),senderKeyId:e.string().min(1).max(128),recipientKeyId:e.string().min(1).max(128),iv:e.string().max(64).regex(/^[A-Za-z0-9_-]+$/),ct:e.string().max(16384).regex(/^[A-Za-z0-9_-]+$/)}).nullable(),ut=e.object({id:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3),envelope:F.optional(),attachment:e.object({url:e.url(),count:e.int().gt(0)}).nullable(),sentAt:e.iso.datetime()}).nullable(),dt=e.object({kind:e.enum([`direct`]),id:e.string().min(1),otherParticipant:P,lastMessage:ut,unreadCount:e.int().gte(0),pinnedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),I=e.string().min(1).max(80).regex(/^\S(?:.*\S)?$/),L=e.string().max(500).nullable(),ft=e.url().max(2048).nullable(),R=e.enum([`admin`,`member`]),pt=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable(),role:R}),z=e.object({kind:e.enum([`group`]),id:e.string().min(1),title:I,description:L,logoUrl:ft,participants:e.array(pt),myRole:R,lastMessage:ut,unreadCount:e.int().gte(0),pinnedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),B=e.discriminatedUnion(`kind`,[dt.extend({kind:e.literal(`direct`)}),z.extend({kind:e.literal(`group`)})]);e.object({threads:e.array(B)}),e.object({thread:B,created:e.boolean()});const mt=e.object({kind:e.enum([`direct`]).optional().default(`direct`),recipientUserId:e.string().min(1)}),ht=e.object({kind:e.enum([`group`]),title:I,description:L.optional(),invitedUserIds:e.array(e.string().min(1)).min(1).max(100)});e.object({ok:e.literal(!0)}),e.object({thread:z}),e.object({title:I.optional(),description:L.optional()});const gt=e.object({id:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3).nullable(),envelope:F.optional()}).nullable(),V=e.enum([`👍`,`👎`,`❤️`,`😂`,`😮`,`😢`,`🔥`,`🎉`,`🙏`,`👀`,`✅`,`🎮`]),H=e.object({emoji:V,count:e.int().gt(0),userIds:e.array(e.string().min(1))}),_t=e.enum([`image`]),U=e.object({id:e.string().min(1),kind:_t,url:e.url(),contentType:e.string().min(1),fileName:e.string().min(1),byteSize:e.int().gte(0),width:e.int().gt(0).nullable(),height:e.int().gt(0).nullable()}),vt=e.object({url:e.url(),title:e.string().max(500).nullable(),description:e.string().max(1e3).nullable(),imageUrl:e.url().nullable(),siteName:e.string().max(200).nullable()}),yt=e.object({id:e.string().min(1),threadId:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3),envelope:F.optional(),sentAt:e.iso.datetime(),editedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable(),replyTo:gt,reactions:e.array(H),attachments:e.array(U),linkPreviews:e.array(vt)});e.object({messages:e.array(yt),nextBefore:e.iso.datetime().nullable()});const bt=e.string().max(2e3);e.object({body:bt.optional(),envelope:F.optional(),replyToMessageId:e.string().min(1).optional(),attachmentIds:e.array(e.string().min(1)).max(3).optional()});const xt=e.string().min(1).max(2e3);e.object({body:xt.optional(),envelope:F.optional()}),e.object({aggregate:H.nullable()}),e.object({attachment:U}),e.object({userIds:e.array(e.string().min(1)).min(1).max(100)}),e.object({pinnedAt:e.iso.datetime()});const W=e.enum([`x25519`]),G=e.object({userId:e.string().min(1),keyId:e.string().min(1).max(128),publicKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),algorithm:W});e.object({key:G}),e.object({publicKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),keyId:e.string().min(1).max(128),algorithm:W});const St=e.object({threadId:e.string().min(1),key:G.nullable()});e.object({keys:e.array(St)}),e.object({threadIds:e.array(e.string().min(1)).min(1).max(200)}),e.object({exists:e.boolean(),attemptsRemaining:e.int().gte(0),kdfSalt:e.string().length(22).regex(/^[A-Za-z0-9_-]+$/).nullable(),kdfIterations:e.int().gte(1e5).lte(5e6).nullable()}),e.object({ok:e.literal(!0)}),e.object({scalar:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),secret:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),pinKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),kdfSalt:e.string().length(22).regex(/^[A-Za-z0-9_-]+$/),kdfIterations:e.int().gte(1e5).lte(5e6)}),e.union([e.object({result:e.enum([`ok`]),scalar:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/)}),e.object({result:e.enum([`wrong-pin`]),attemptsRemaining:e.int().gte(0)})]),e.object({pinKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/)}),e.object({role:R});const K=e.object({name:e.string().nullable(),handle:e.string().nullable()}).nullable(),q=e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),usdCents:e.int().nullable()});e.object({code:e.string().nullable(),xLinked:e.boolean(),referrer:K,refereeCount:e.int().gte(0),lifetimeEarnings:e.array(q),lifetimeUsdCents:e.int().nullable(),last30dEarnings:e.array(q),last30dUsdCents:e.int().nullable()}),e.object({code:e.string().min(1),generatedAt:e.iso.datetime()}),e.object({status:e.enum([`eligible`,`already-referred`,`self-referral`,`unknown-code`,`revoked-code`,`window-expired`]),referrer:K}),e.object({status:e.enum([`bound`,`already-referred`,`self-referral`,`unknown-code`,`revoked-code`,`window-expired`]),referrer:K}),e.object({code:e.string().min(1).max(64),source:e.enum([`signup-url`,`manual-claim`,`cookie-restore`]).optional().default(`manual-claim`)});const J=e.string().regex(/^[a-f0-9]{64}$/);e.object({playSessionId:J,expiresAt:e.iso.datetime()});const Y=e.uuid();e.object({appId:Y}),e.object({ok:e.literal(!0),ttlSeconds:e.int().gt(0)}),e.object({playSessionId:J,status:e.enum([`pending`,`active`,`ended`])});const Ct=e.uuid();e.object({playSessionId:J,userId:Ct}),e.object({status:e.enum([`pending`,`active`,`ended`])}),e.object({playSessionId:J}),e.object({status:e.enum([`ended`])}),e.object({playSessionId:J});const wt=e.object({appId:Y,name:e.string(),logoUrl:e.string().nullable(),sessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});e.object({apps:e.array(wt),totalSessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});const Tt=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),appId:Y,sessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});e.object({from:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),to:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),buckets:e.array(Tt)}),e.object({appId:Y,sessionCount:e.int().gte(0),uniquePlayerCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)}),e.object({followers:e.int().gte(0),following:e.int().gte(0),gamesPlayed:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0),reviewsLeft:e.int().gte(0),rewardsWon:e.int().gte(0),rewardsValueUsdCents:e.int().gte(0)});const Et=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),rewardsWon:e.int().gte(0),valueUsdCents:e.int().gte(0)});e.object({from:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),to:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),totalRewardsWon:e.int().gte(0),totalValueUsdCents:e.int().gte(0),buckets:e.array(Et)});const Dt=e.object({collectionId:e.string(),collectionAddress:e.string(),chain:e.string(),kind:e.enum([`erc721`,`erc1155`]),tokenId:e.string(),amount:e.string(),name:e.string().nullable(),imageAssetId:e.string().nullable(),bannerAssetId:e.string().nullable(),devMetadata:e.record(e.string(),e.unknown())});e.object({items:e.array(Dt)}),e.object({mintRequestId:e.string(),txHash:e.string(),status:e.enum([`submitted`,`completed`]),mintedTokenId:e.string().nullable()}),e.object({collectionAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),chain:e.string().min(1),toWallet:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),toUserId:e.string().optional(),tokenId:e.string().regex(/^\d+$/).optional(),amount:e.string().regex(/^\d+$/).optional()});const Ot=e.object({requesterId:e.string().min(1),requesterName:e.string().min(1),requesterDisplayName:e.string().nullable(),requesterImage:e.url().nullable(),friendshipId:e.string().min(1)}),kt=e.object({accepterId:e.string().min(1),accepterName:e.string().min(1),accepterDisplayName:e.string().nullable(),accepterImage:e.url().nullable(),friendshipId:e.string().min(1)}),At=e.object({appId:e.uuid(),appName:e.string().min(1),scope:e.enum([`publish`,`changes`])}),jt=e.object({appId:e.uuid(),appName:e.string().min(1),scope:e.enum([`publish`,`changes`]),notes:e.string().min(1).max(1e3)}),Mt=e.object({appId:e.uuid(),appName:e.string().min(1),appLogoUrl:e.url().nullable(),inviterId:e.string().min(1),inviterName:e.string().min(1),inviterDisplayName:e.string().nullable()}),Nt=e.object({appId:e.uuid(),appName:e.string().min(1),accepterId:e.string().min(1),accepterName:e.string().min(1),accepterDisplayName:e.string().nullable(),accepterImage:e.url().nullable()}),Pt=e.union([e.object({id:e.string().min(1),kind:e.enum([`friend_request`]),payload:Ot,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`friend_accepted`]),payload:kt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_page_approved`]),payload:At,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_page_rejected`]),payload:jt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_participant_invite`]),payload:Mt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_participant_accepted`]),payload:Nt,read:e.boolean(),createdAt:e.iso.datetime()})]);e.object({notifications:e.array(Pt),unreadCount:e.int().gte(0)}),e.object({ok:e.literal(!0)}),e.object({read:e.boolean()});const Ft=e.enum([`online`,`offline`]),It=e.object({user:P,friendshipId:e.string().min(1),acceptedAt:e.iso.datetime(),onlineStatus:Ft});e.object({friends:e.array(It)}),e.object({decision:e.enum([`accept`,`reject`])});const X=e.object({provider:e.enum([`twitter`,`discord`,`github`]),subject:e.string().min(1),username:e.string().nullable(),name:e.string().nullable(),profilePictureUrl:e.url().nullable(),verifiedAt:e.iso.datetime().nullable()});e.object({accounts:e.array(X)});const Z=e.string().nullable(),Lt=e.url().max(2048).nullable(),Q=e.object({studioName:e.string().min(1).max(80).nullable(),studioUrl:e.url().max(2048).nullable(),studioXHandle:Z,githubUrl:Lt,logoUrl:e.url().max(2048).nullable()}),Rt=e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().max(2048).nullable(),environment:e.enum([`development`,`production`])}),zt=e.object({profile:Q,apps:e.array(Rt)}).nullable(),Bt=e.object({followers:e.int().gte(0),following:e.int().gte(0)}),Vt=e.object({gamesPlayed:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0),reviewsLeft:e.int().gte(0),rewardsWon:e.int().gte(0),rewardsValueUsdCents:e.int().gte(0)}),Ht=e.object({appId:e.string().min(1),name:e.string().min(1),logoUrl:e.url().max(2048).nullable(),sessionCount:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0)}),Ut=e.object({appId:e.string().min(1),appName:e.string().min(1),appLogoUrl:e.url().max(2048).nullable(),rating:e.int().gte(1).lte(5),body:e.string(),createdAt:e.iso.datetime()}),Wt=e.object({isFollowing:e.boolean(),isFollowedBy:e.boolean(),friendship:e.enum([`none`,`pending_out`,`pending_in`,`accepted`]),friendshipId:e.string().min(1).nullable()}).nullable();e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),bio:e.string().nullable(),websiteUrl:e.url().max(2048).nullable(),image:e.url().nullable(),banner:a,createdAt:e.iso.datetime(),socials:e.array(X),developer:zt,counts:Bt,stats:Vt,topGames:e.array(Ht),recentReviews:e.array(Ut),relationship:Wt});const Gt=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable(),socials:e.array(X)});e.object({results:e.array(Gt)}),e.object({ok:e.literal(!0),friendshipId:e.string().min(1)});const Kt=e.object({id:e.string().min(1),keyPrefix:e.string().min(1),scopes:e.array(e.enum([`developer:read`,`developer:apps`,`developer:pages`])),createdAt:e.iso.datetime(),expiresAt:e.iso.datetime().nullable(),lastUsedAt:e.iso.datetime().nullable(),revokedAt:e.iso.datetime().nullable()});e.object({key:Kt,secret:e.string().min(1)}),e.object({scopes:e.array(e.enum([`developer:read`,`developer:apps`,`developer:pages`])).min(1),expiresAt:e.iso.datetime().nullish()}),e.object({keys:e.array(Kt)}),e.object({ok:e.literal(!0)}),e.object({id:e.string().min(1)});const $=e.string().regex(/^[A-Za-z0-9 ._-]{1,40}$/),qt=e.object({chain:e.string().min(1),custody:e.enum([`server`])});e.object({name:$,chains:e.array(qt).optional()});const Jt=e.string().min(1).max(2048),Yt=e.enum([`eth`,`tron`]),Xt=e.array(Yt).min(1).max(2);e.object({name:$.optional(),logoUrl:e.url().max(2048).nullish(),testAccess:e.enum([`private`,`public`]).optional(),redirectUris:e.array(e.url().max(2048)).max(20).optional(),embedOrigins:e.array(Jt).max(20).optional(),acceptedCurrencies:Xt.optional(),paymentStatusWebhookUrl:e.url().max(2048).nullish(),paymentStatusWebhookUrlTest:e.url().max(2048).nullish()}),e.object({logoUrl:e.url().nullable()});const Zt=e.object({chain:e.string().min(1),token:e.string().min(1),tokenDecimals:e.int(),lockedWei:e.string(),unlockedWei:e.string(),walletBalanceWei:e.string().nullable()});e.object({appId:e.string().min(1),balances:e.array(Zt)}),e.object({appId:e.string().min(1),availableCents:e.int().gte(0),lockedCents:e.int().gte(0),totalCents:e.int().gte(0)});const Qt=e.object({ts:e.iso.datetime(),sumCents:e.number(),paymentCount:e.int()});e.object({appId:e.string().min(1),range:e.string().min(1),bucketSecs:e.int(),windowSecs:e.int(),chain:e.string().nullable(),buckets:e.array(Qt)});const $t=e.object({ts:e.iso.datetime(),sessionCount:e.int(),uniquePlayerCount:e.int(),totalDurationSeconds:e.int()});e.object({appId:e.string().min(1),range:e.string().min(1),bucketSecs:e.int(),windowSecs:e.int(),buckets:e.array($t)}),e.object({appId:e.string().min(1),earnedCents:e.int(),earningEventCount:e.int(),distinctPayers:e.int(),sessionCount:e.int(),uniquePlayerCount:e.int(),totalPlaytimeSeconds:e.int()});const en=e.object({chain:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),custody:e.enum([`server`]).nullable(),walletId:e.string().nullable(),autoSweepEnabled:e.boolean(),sweepThresholdCents:e.int().nullable()});e.object({appId:e.string().min(1),wallets:e.array(en)}),e.object({appId:e.string().min(1),chain:e.string().min(1),autoSweepEnabled:e.boolean(),sweepThresholdCents:e.int().nullable()}),e.object({enabled:e.boolean(),thresholdCents:e.int().gt(0).nullish()}),e.object({appId:e.string().min(1),chain:e.string().min(1),custody:e.enum([`server`]),walletId:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({appId:e.string().min(1),chain:e.string().min(1),token:e.string().min(1),txHash:e.string().min(1),amountWei:e.string().min(1),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({appId:e.string().min(1),chain:e.string().min(1),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),transfers:e.array(e.object({token:e.string().min(1),txHash:e.string().min(1),amountWei:e.string().min(1)}))});const tn=e.object({id:e.string().min(1),clientId:e.string().min(1),environment:e.enum([`development`,`production`]),secretLast4:e.string().min(1),createdAt:e.iso.datetime(),lastUsedAt:e.iso.datetime().nullable()});e.object({key:tn,clientSecret:e.string().min(1)}),e.object({ok:e.literal(!0),status:e.enum([`pending`,`approved`])}),e.object({reason:e.string().min(1).max(500).optional()}),e.object({secret:e.string().regex(/^[a-f0-9]{64}$/),secretLast4:e.string().length(4)});const nn=e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable()});e.object({appeals:e.array(nn)});const rn=e.object({paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),vaultReleaseAt:e.iso.datetime(),signedAt:e.iso.datetime(),matured:e.boolean(),hasActiveAppeal:e.boolean()});e.object({deposits:e.array(rn)}),e.object({appCount:e.int().gte(0),availableCents:e.int().gte(0),lockedCents:e.int().gte(0),totalCents:e.int().gte(0)});const an=e.object({userId:e.string().min(1),status:e.enum([`invited`,`accepted`,`revoked`]),name:e.string().nullable(),email:e.string().nullable(),image:e.url().nullable(),invitedAt:e.iso.datetime(),respondedAt:e.iso.datetime().nullable()});e.object({participants:e.array(an)}),e.object({identifier:e.string().min(1).max(80)});const on=e.object({appId:e.string().min(1),appName:e.string().min(1),appLogoUrl:e.url().nullable(),status:e.enum([`invited`,`accepted`,`revoked`]),invitedAt:e.iso.datetime()});e.object({invites:e.array(on)});const sn=e.object({id:e.string().min(1),displayName:e.string().nullable(),email:e.string().nullable()}).nullable(),cn=e.string().min(1).max(80).nullable(),ln=e.string().min(10).max(1e3).nullable(),un=e.object({policyVersion:e.string().min(1),policyAcceptedAt:e.iso.datetime(),logoUrl:e.url().max(2048).nullable(),email:e.email().nullable(),xHandle:Z,teamName:cn,projectDescription:ln}),dn=e.object({reason:e.string().min(1).max(500).optional()}),fn=e.object({id:e.string().min(1),userId:e.string().min(1),user:sn,kind:e.enum([`role`,`production`]),status:e.enum([`pending`,`approved`,`rejected`,`cancelled`]),appId:e.string().min(1).nullable(),payload:e.union([e.object({kind:e.enum([`role`]),data:un}),e.object({kind:e.enum([`production`]),data:dn})]),reviewedBy:e.string().min(1).nullable(),reviewedAt:e.iso.datetime().nullable(),reviewNotes:e.string().nullable(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}).nullable(),pn=e.object({chain:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),mn=e.object({id:e.string().min(1),name:$,logoUrl:e.url().max(2048).nullable(),environment:e.enum([`development`,`production`]),productionApprovedAt:e.iso.datetime().nullable(),testAccess:e.enum([`private`,`public`]),createdAt:e.iso.datetime(),redirectUris:e.array(e.url().max(2048)),embedOrigins:e.array(Jt),acceptedCurrencies:Xt,payoutAddresses:e.array(pn),keys:e.array(tn),pendingProductionRequestId:e.string().min(1).nullable(),paymentStatusWebhookUrl:e.url().max(2048).nullable(),paymentStatusWebhookSecretLast4:e.string().length(4).nullable(),paymentStatusWebhookUrlTest:e.url().max(2048).nullable(),paymentStatusWebhookSecretLast4Test:e.string().length(4).nullable()});e.object({roleStatus:e.enum([`none`,`pending`,`approved`,`rejected`,`cancelled`]),latestRequest:fn,profile:Q.nullable(),apps:e.array(mn)}),e.object({studioName:e.string().min(1).max(80).nullish(),studioUrl:e.url().max(2048).nullish(),studioXHandle:Z.optional(),githubUrl:Lt.optional(),logoUrl:e.url().max(2048).nullish()}),e.object({acceptPolicy:e.literal(!0),logoUrl:e.url().max(2048).optional(),email:e.email().optional(),teamName:cn.optional(),projectDescription:ln.optional()}),e.object({appId:e.uuid(),slug:y.nullable(),status:e.enum([`draft`,`pending_review`,`published`,`hidden`]),categories:b,tagline:x.nullable(),bannerUrl:e.url().max(2048).nullable(),thumbnailUrl:e.url().max(2048).nullable(),thumbnailVideoUrl:e.url().max(2048).nullable(),playUrl:e.url().max(2048).nullable(),discordUrl:e.url().max(2048).nullable(),twitterUrl:e.url().max(2048).nullable(),redditUrl:e.url().max(2048).nullable(),telegramUrl:e.url().max(2048).nullable(),gallery:S,chapters:C,links:w,firstPublishedAt:e.iso.datetime().nullable(),reviewedAt:e.iso.datetime().nullable(),reviewNotes:e.string().nullable(),hiddenAt:e.iso.datetime().nullable(),hiddenReasonPublic:e.string().nullable(),pendingReview:e.boolean()}),e.object({slug:y.nullish(),categories:b.optional(),tagline:x.nullish(),bannerUrl:e.url().max(2048).nullish(),thumbnailUrl:e.url().max(2048).nullish(),thumbnailVideoUrl:e.url().max(2048).nullish(),playUrl:e.url().max(2048).nullish(),discordUrl:e.url().max(2048).nullish(),twitterUrl:e.url().max(2048).nullish(),redditUrl:e.url().max(2048).nullish(),telegramUrl:e.url().max(2048).nullish(),gallery:S.optional(),chapters:C.optional(),links:w.optional()}),e.object({url:e.url().max(2048)});const hn=e.object({playSessionId:e.string().min(1),userId:e.uuid(),appId:e.uuid(),status:e.enum([`pending`,`active`]),userHalfFresh:e.boolean(),gameHalfFresh:e.boolean(),active:e.boolean(),startedAt:e.iso.datetime(),activatedAt:e.iso.datetime().nullable(),lastSeenAt:e.iso.datetime().nullable()});e.object({players:e.array(hn),total:e.int().gte(0),liveCount:e.int().gte(0),generatedAt:e.iso.datetime()});const gn=e.object({id:e.string().min(1),email:e.email().nullable(),role:o,addedBy:e.string().min(1).nullable(),addedAt:e.iso.datetime(),lastAccessedAt:e.iso.datetime().nullable()});e.object({admins:e.array(gn)}),e.object({id:e.string()}),e.object({email:e.email(),role:o.optional()}),e.object({id:e.string(),role:o}),e.object({role:o});const _n=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),email:e.email().nullable(),createdAt:e.iso.datetime(),bannedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable()});e.object({users:e.array(_n),total:e.int().gte(0),offset:e.int().gte(0),limit:e.int().gt(0)}),e.object({id:e.string(),banned:e.boolean()}),e.object({banned:e.boolean(),reason:e.string().min(1).max(280).optional()});const vn=e.object({id:e.string().min(1),actorId:e.string().min(1).nullable(),actorKind:e.enum([`user`,`system`,`service`]),action:e.string().min(1),targetType:e.string().min(1),targetId:e.string().min(1),purpose:e.string().min(1),legalBasis:e.enum([`consent`,`contract`,`legitimate-interest`,`legal-obligation`,`vital-interest`,`public-task`]),occurredAt:e.iso.datetime(),attributes:e.record(e.string(),e.unknown()),traceId:e.string().min(1).nullable()});e.object({rows:e.array(vn),total:e.int().gte(0),offset:e.int().gte(0),limit:e.int().gt(0)}),e.object({requests:e.array(fn)}),e.object({id:e.string().min(1),status:e.enum([`pending`,`approved`,`rejected`,`cancelled`])}),e.object({decision:e.enum([`approve`,`reject`]),notes:e.string().min(1).max(1e3).optional()});const yn=e.object({id:e.string().min(1),name:e.string(),environment:e.enum([`development`,`production`]),logoUrl:e.url().nullable(),productionApprovedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),bn=e.object({userId:e.string().min(1),email:e.email(),displayName:e.string().nullable(),image:e.url().nullable(),studio:Q.nullable(),apps:e.array(yn),grantedAt:e.iso.datetime().nullable()});e.object({developers:e.array(bn)});const xn=e.object({appId:e.uuid(),appName:e.string(),ownerDisplayName:e.string().nullable(),ownerImage:e.string().nullable(),ownerUserId:e.uuid(),ownerEmail:e.string().nullable(),appLogoUrl:e.string().nullable(),slug:e.string().nullable(),status:e.enum([`draft`,`pending_review`,`published`,`hidden`]),categories:b,tagline:e.string().nullable(),submittedAt:e.iso.datetime().nullable(),firstPublishedAt:e.iso.datetime().nullable(),hiddenAt:e.iso.datetime().nullable(),hiddenReasonInternal:e.string().nullable(),pendingChangesSubmittedAt:e.iso.datetime().nullable()});e.object({items:e.array(xn)}),e.object({status:e.enum([`draft`,`pending_review`,`published`,`hidden`])}),e.object({reasonPublic:e.string().min(1).max(500),reasonInternal:e.string().max(2e3).optional()}),e.union([e.object({decision:e.enum([`approve`])}),e.object({decision:e.enum([`reject`]),notes:e.string().min(1).max(1e3)})]);const Sn=e.object({field:e.string(),label:e.string(),from:e.string(),to:e.string()});e.object({appId:e.uuid(),submittedAt:e.iso.datetime().nullable(),changes:e.array(Sn)}),e.object({purchaseFeeBps:e.int().gte(0).lte(1e4),stakeFeeBps:e.int().gte(0).lte(1e4),updatedAt:e.iso.datetime(),updatedBy:e.string().min(1).nullable()});const Cn=e.object({chain:e.string().min(1),chainId:e.int().gte(0),to:e.string().regex(/^0x[0-9a-fA-F]{40}$/),calldataHex:e.string().regex(/^0x[0-9a-fA-F]*$/)}),wn=e.object({target:e.enum([`purchase`]),envelope:Cn});e.object({purchaseFeeBps:e.int().gte(0).lte(1e4),stakeFeeBps:e.int().gte(0).lte(1e4),updatedAt:e.iso.datetime(),updatedBy:e.string().min(1).nullable(),envelopes:e.array(wn)}),e.object({purchaseFeeBps:e.int().gte(0).lte(1e4).optional(),stakeFeeBps:e.int().gte(0).lte(1e4).optional()}),e.object({appId:e.string().min(1),platformFeeBps:e.int().gte(0).lte(1e4).nullable(),rakeCapBps:e.int().gte(0).lte(3e3).nullable(),effectivePlatformFeeBps:e.int().gte(0).lte(1e4),effectiveRakeCapBps:e.int().gte(0).lte(3e3),updatedAt:e.iso.datetime().nullable(),updatedBy:e.string().min(1).nullable()}),e.object({platformFeeBps:e.int().gte(0).lte(1e4).nullish(),rakeCapBps:e.int().gte(0).lte(3e3).nullish()}),e.object({chain:e.string().min(1),vaultAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),action:e.enum([`add`,`remove`])}),e.object({chain:e.string().min(1),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),newTreasury:e.string().regex(/^0x[0-9a-fA-F]{40}$/)});const Tn=e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),reason:e.string().min(1),flaggedBy:e.string().min(1),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),reason:e.string().min(1).max(2e3)}),e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),removed:e.literal(!0)}),e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({entries:e.array(Tn)}),e.object({chain:e.string().min(1),target:e.enum([`router`,`credit_vault`,`platform_vault`]),newOperator:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({chain:e.string().min(1),target:e.enum([`router`,`credit_vault`,`platform_vault`]),action:e.enum([`pause`,`unpause`])}),e.object({chain:e.string().min(1),vaultAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),lockSeconds:e.int().gte(0)}),e.object({chain:e.string().min(1),account:e.string().regex(/^0x[0-9a-fA-F]{40}$/),lockSeconds:e.int().gte(0)});const En=e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable(),resolvedBy:e.string().nullable(),resolutionNotes:e.string().nullable()});e.object({appeals:e.array(En),nextCursorFiledAt:e.iso.datetime().nullable()});const Dn=e.enum([`pending_onchain`,`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),On=e.enum([`purchase`,`pot`,`matured`]),kn=e.object({source:On,chain:e.string(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),depositId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellantUserId:e.string().nullable(),respondent:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),respondentUserId:e.string().nullable(),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable(),resolution:e.object({resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}).nullable(),refundClaimedAt:e.iso.datetime().nullable()}),An=e.enum([`party`,`admin`,`system`]),jn=e.object({id:e.string().min(1),senderUserId:e.string().nullable(),senderRole:An,body:e.string().nullable(),attachments:e.array(U),sentAt:e.iso.datetime()});e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),threadId:e.string().nullable(),status:Dn,readOnly:e.boolean(),canResolve:e.boolean(),detail:kn,messages:e.array(jn)}),e.object({message:jn}),e.object({body:e.string().min(1).max(4e3).optional(),attachmentIds:e.array(e.string().min(1)).max(3).optional()}),e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/),status:e.enum([`resolved_refund`,`resolved_dismiss`])}),e.object({decision:e.enum([`refund`,`dismiss`]),notes:e.string().min(1).max(2e3).optional()}),e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}),e.object({paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),amount:e.string().regex(/^\d+$/),reason:e.string().min(1).max(2e3)}),e.object({legId:e.string().regex(/^0x[0-9a-f]{32}$/),reason:e.string().min(1).max(2e3)});const Mn=e.object({kind:e.enum([`direct`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/)}),Nn=e.object({kind:e.enum([`pull`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/)});e.discriminatedUnion(`kind`,[Mn.extend({kind:e.literal(`direct`)}),Nn.extend({kind:e.literal(`pull`)})]),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),recipientUserId:e.string().min(1).optional(),metadata:v.optional()}),e.object({distributionId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),closePot:e.boolean(),legs:e.array(e.object({recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`])}))}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),closePot:e.boolean().optional().default(!0),legs:e.array(e.object({recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),recipientUserId:e.string().min(1).optional(),amount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).optional().default(`locked`)})).min(1).max(50),metadata:v.optional()}),e.object({potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/)}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/)}),e.object({status:e.enum([`ok`])});const Pn=e.object({id:e.string(),purpose:e.string(),version:e.string(),grantedAt:e.iso.datetime(),withdrawnAt:e.iso.datetime().nullable()}),Fn=e.object({accountId:e.string(),providerId:e.string(),hasPassword:e.boolean(),scope:e.string().nullable(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}),In=e.object({id:e.string(),action:e.string(),targetType:e.string(),targetId:e.string(),purpose:e.string(),legalBasis:e.string(),occurredAt:e.iso.datetime(),traceId:e.string().nullable(),attributes:e.record(e.string(),e.unknown())}),Ln=e.object({id:e.string(),threadId:e.string(),contentMode:e.enum([`plaintext`,`e2e-encrypted`]),body:e.string().nullable(),envelope:e.unknown().optional(),note:e.string().nullable(),sentAt:e.iso.datetime(),editedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable()});e.object({user:l,sessions:e.array(ee),consents:e.array(Pn),accounts:e.array(Fn),auditEvents:e.array(In),messages:e.array(Ln),exportedAt:e.iso.datetime()}),e.object({name:t.optional(),image:e.string().min(1).max(2048).nullish()});const Rn=e.object({purpose:e.string(),version:e.string(),grantedAt:e.iso.datetime(),withdrawnAt:e.iso.datetime().nullable()});e.object({consents:e.array(Rn)});const zn=e.string().regex(/^[a-z][a-z0-9-]{2,63}$/);e.object({purpose:zn,version:e.string().min(1).max(64),granted:e.boolean()}),e.object({token:e.string().min(1),callbackURL:e.url().optional()}),e.object({response_type:e.enum([`code`]),client_id:p,redirect_uri:d,scope:f,state:m,code_challenge:te,code_challenge_method:e.enum([`S256`]),prompt:e.enum([`consent`]).optional()}),e.object({request:h}),e.object({client_id:e.string().min(1),return_uri:e.url()}),e.object({clientId:e.string().min(1)}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/).optional(),usdCents:e.int().gte(0).nullish()}),e.void(),e.void(),e.void(),e.object({genre:e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`)).optional(),q:e.string().min(1).max(200).optional(),before:e.iso.datetime().optional(),limit:e.int().gte(1).lte(48).optional().default(24)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({sort:we.optional(),limit:e.int().gte(1).lte(50).optional().default(10),offset:e.int().gte(0).nullish().default(0)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({appId:e.uuid()}),e.object({sort:we.optional(),limit:e.int().gte(1).lte(50).optional().default(10),offset:e.int().gte(0).nullish().default(0)}),e.object({appId:e.uuid(),reviewId:e.uuid()}),e.object({appId:e.uuid(),reviewId:e.uuid()}),e.object({appId:e.uuid()}),e.object({id:e.uuid()}),e.object({status:A.optional(),limit:e.int().gte(1).lte(50).optional().default(20),offset:e.int().gte(0).nullish().default(0)}),e.object({id:e.uuid(),reportId:e.uuid()}),e.object({status:e.enum([`pending`,`completed`,`expired`,`all`]).optional().default(`completed`),limit:e.int().gte(1).lte(100).optional().default(20),before:e.iso.datetime().optional()}),e.object({kind:e.string().optional(),direction:e.enum([`outgoing`,`incoming`]).optional(),sort:e.enum([`newest`,`oldest`,`value_desc`,`value_asc`]).optional().default(`newest`),chain:e.string().min(1).optional(),limit:e.int().gte(1).lte(100).optional().default(20),cursor:e.string().min(1).optional(),before:e.iso.datetime().optional(),includeInactive:e.enum([`true`,`false`]).optional().default(`false`)}),e.object({groupId:e.string().min(1).max(128)}),e.object({chain:e.string().min(1).optional()}),e.object({before:e.iso.datetime().optional()}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({file:e.string()}),e.object({q:e.string().max(200).optional()}),e.union([mt,ht]),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({limit:e.int().gt(0).lte(100).optional(),before:e.iso.datetime().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1),emoji:V}),e.object({id:e.string().min(1),msgId:e.string().min(1),emoji:V}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({regenerate:e.boolean().optional()}),e.object({code:e.string().min(1).max(64)}),e.object({days:e.int().gt(0).lte(366).optional().default(30)}),e.object({appId:e.uuid()}),e.object({days:e.int().gt(0).lte(366).optional().default(30)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({handle:e.string().min(1)}),e.object({q:e.string().min(1).max(64),limit:e.int().gte(1).lte(50).optional().default(20)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({range:e.string().optional(),chain:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({range:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({kind:e.string().optional(),direction:e.enum([`outgoing`,`incoming`]).optional(),sort:e.enum([`newest`,`oldest`,`value_desc`,`value_asc`]).optional().default(`newest`),chain:e.string().min(1).optional(),limit:e.int().gte(1).lte(100).optional().default(20),cursor:e.string().min(1).optional(),before:e.iso.datetime().optional(),includeInactive:e.enum([`true`,`false`]).optional().default(`false`)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({token:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional()}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),env:e.enum([`development`,`production`])}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({chain:e.string().optional()}),e.object({chain:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({file:e.string()}),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({bannerUrl:e.url()}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({thumbnailUrl:e.url()}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({thumbnailVideoUrl:e.url()}),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({search:e.string().optional(),offset:e.int().gte(0).nullish(),limit:e.int().gt(0).lte(100).optional()}),e.object({id:e.string().min(1)}),e.object({action:e.string().optional(),actorId:e.string().optional(),targetType:e.string().optional(),targetId:e.string().optional(),offset:e.int().gte(0).nullish(),limit:e.int().gt(0).lte(100).optional()}),e.object({status:e.enum([`pending`,`approved`,`rejected`,`cancelled`]).optional(),kind:e.enum([`role`,`production`]).optional()}),e.object({id:e.string().min(1)}),e.object({status:e.union([e.enum([`draft`,`pending_review`,`published`,`hidden`]),e.enum([`all`]),e.enum([`pending_changes`])]).optional()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({processorId:e.string().min(1)}),e.object({chain:e.string().min(1).optional()}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({status:e.array(e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`])).optional(),chain:e.string().min(1).optional(),cursorFiledAt:e.iso.datetime().optional(),limit:e.int().gte(1).lte(100).optional()}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({file:e.string()}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({file:e.string()}),e.object({appealId:e.string().min(1)}),e.void(),e.void();const Bn=e.object({event:e.enum([`intent.completed`,`intent.denied`,`intent.expired`,`intent.txhash_indexed`]),deliveredAt:e.iso.datetime(),intent:ce});async function Vn(e){let t=e.signatureHeader;if(typeof t!=`string`||t===``)return{ok:!1,reason:`missing_signature`};let n=e.timestampHeader;if(typeof n!=`string`||n===``)return{ok:!1,reason:`missing_timestamp`};let r=Number(n);if(!Number.isFinite(r)||r<=0)return{ok:!1,reason:`invalid_timestamp`};let i=e.toleranceSeconds??300,a=Math.floor((e.now??Date.now())/1e3);if(Math.abs(a-r)>i)return{ok:!1,reason:`stale_timestamp`};if(!Un(await Hn(e.secret,`${n}.${e.rawBody}`),t))return{ok:!1,reason:`signature_mismatch`};let o;try{o=JSON.parse(e.rawBody)}catch{return{ok:!1,reason:`schema_mismatch`}}let s=Bn.safeParse(o);return s.success?{ok:!0,body:s.data}:{ok:!1,reason:`schema_mismatch`}}async function Hn(e,t){let n=new TextEncoder,r=await crypto.subtle.importKey(`raw`,n.encode(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),i=await crypto.subtle.sign(`HMAC`,r,n.encode(t)),a=new Uint8Array(i),o=``;for(let e of a)o+=e.toString(16).padStart(2,`0`);return o}function Un(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n.length!==r.length)return!1;let i=0;for(let e=0;e<n.length;e++)i|=n.charCodeAt(e)^r.charCodeAt(e);return i===0}function Wn(e){return async(t,n)=>{let r=await Gn(t,e.getRawBody),i=await Vn({secret:e.secret,rawBody:r,signatureHeader:Kn(t.headers[`x-metatron-signature`]),timestampHeader:Kn(t.headers[`x-metatron-timestamp`]),toleranceSeconds:e.toleranceSeconds});if(!i.ok){if(e.onInvalid!==void 0){await e.onInvalid(t,n,i);return}n.code(400).send({error:`invalid_webhook`,reason:i.reason});return}t.tronWebhook=i.body}}async function Gn(e,t){if(t!==void 0)return await t(e);if(typeof e.rawBody==`string`)return e.rawBody;if(e.rawBody instanceof Uint8Array)return new TextDecoder().decode(e.rawBody);throw TypeError("@metatrongg/sdk: fastify webhook preHandler needs a raw body; register @fastify/raw-body or pass `getRawBody`")}function Kn(e){return e===void 0?null:typeof e==`string`?e:e[0]??null}export{Wn as createMetatronWebhookFastifyPreHandler};
|
|
1
|
+
import*as e from"zod";const t=e.string().min(3).max(18).regex(/^[a-z][a-z0-9_]*$/),n=e.string().nullable(),r=e.string().max(256).nullable(),i=e.url().max(2048).nullable(),a=e.enum([`yellow`,`green`,`blue`,`white`,`black`]),o=e.enum([`super-admin`,`admin`,`read-only`]).nullable(),s=e.enum([`auto`,`online`,`offline`]),ee=e.enum([`development`,`production`]),c=e.object({id:e.string().min(1),email:e.email().nullable(),emailVerified:e.boolean(),name:t,displayName:n,bio:r,websiteUrl:i,image:e.string().nullish(),banner:a,role:o,presenceStatusMode:s,environmentViewMode:ee,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}),l=e.string().min(1);e.object({user:c,token:l.optional()}),e.object({error:e.string().min(1),traceId:e.string().min(1).optional()}),e.object({name:t,email:e.email(),password:e.string().min(8),image:e.url().optional(),callbackURL:e.url().optional()}),e.object({redirect:e.boolean(),token:l.optional(),url:e.url().optional(),user:c.optional()}),e.object({email:e.email(),password:e.string().min(1),callbackURL:e.url().optional(),rememberMe:e.boolean().optional()}),e.object({success:e.boolean()});const u=e.object({id:e.string().min(1),token:e.string().min(1),userId:e.string().min(1),expiresAt:e.iso.datetime(),ipAddress:e.string().nullish(),userAgent:e.string().nullish(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.union([e.object({session:u,user:c}),e.unknown()]),e.object({status:e.boolean()}),e.object({status:e.boolean()}),e.object({email:e.email(),callbackURL:e.url().optional()}),e.object({status:e.boolean()}),e.object({email:e.email(),redirectTo:e.url().optional()}),e.object({status:e.boolean()}),e.object({newPassword:e.string().min(8),token:e.string().min(1)}),e.object({issuer:e.url(),authorization_endpoint:e.url(),token_endpoint:e.url(),userinfo_endpoint:e.url(),revocation_endpoint:e.url(),registration_endpoint:e.url(),response_types_supported:e.array(e.enum([`code`])),grant_types_supported:e.array(e.enum([`authorization_code`,`refresh_token`,`client_credentials`])),code_challenge_methods_supported:e.array(e.enum([`S256`])),token_endpoint_auth_methods_supported:e.array(e.enum([`client_secret_basic`,`client_secret_post`,`none`])),scopes_supported:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`]))});const d=e.url().max(2048),f=e.string().min(1).regex(/^[A-Za-z0-9_:.-]+(?: [A-Za-z0-9_:.-]+)*$/);e.object({client_id:e.string().regex(/^tg_dc_[a-f0-9]{32}$/),client_id_issued_at:e.int().gte(0),client_name:e.string().min(1),redirect_uris:e.array(d),token_endpoint_auth_method:e.enum([`none`]),grant_types:e.array(e.enum([`authorization_code`,`refresh_token`])),response_types:e.array(e.enum([`code`])),scope:f}),e.object({error:e.enum([`invalid_redirect_uri`,`invalid_client_metadata`]),error_description:e.string().optional()}),e.object({redirect_uris:e.array(d).min(1).max(10),client_name:e.string().min(1).max(128).optional(),token_endpoint_auth_method:e.enum([`none`]).optional(),grant_types:e.array(e.enum([`authorization_code`,`refresh_token`])).optional(),response_types:e.array(e.enum([`code`])).optional(),scope:f.optional()});const p=e.string().regex(/^tg_(?:dev|prod|dc)_[A-Za-z0-9]{16,64}$/),m=e.string().min(1).max(2048),te=e.string().regex(/^[A-Za-z0-9_~.-]{43,128}$/),h=e.string().regex(/^[a-f0-9]{32}$/);e.object({request:h,app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),clientKind:e.enum([`app`,`connector`]),scopes:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`])).min(1),developerRole:e.object({approved:e.boolean(),policyVersion:e.string().min(1)}).nullable(),alreadyGranted:e.array(e.enum([`openid`,`profile`,`payments:charge`,`inventory:read`,`developer:read`,`developer:apps`,`developer:pages`])),redirectUriHost:e.string().min(1),payment:e.object({tiersCents:e.array(e.int().gt(0)).min(1),currentLimitCents:e.int().gte(0).nullable(),currentMonthSpentCents:e.int().gte(0).nullable(),payoutChains:e.array(e.string().min(1))}).nullable()}),e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),tiersCents:e.array(e.int().gt(0)).min(1)}),e.object({app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),developer:e.object({studioName:e.string().nullable(),logoUrl:e.url().nullable(),studioUrl:e.url().nullable(),studioXHandle:e.string().nullable()})}),e.object({redirect:e.url()});const g=e.int().gte(100).lte(5e6).nullable();e.object({request:h,decision:e.enum([`allow`,`deny`]),acceptDeveloperPolicy:e.boolean().optional(),payment:e.object({monthlyLimitCents:g}).optional()}),e.object({access_token:e.string().min(1),token_type:e.enum([`Bearer`]),expires_in:e.int().gt(0),refresh_token:e.string().min(1).optional(),scope:f.optional()}),e.object({error:e.enum([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`unsupported_response_type`,`invalid_scope`,`access_denied`,`server_error`,`temporarily_unavailable`,`invalid_token`,`insufficient_scope`]),error_description:e.string().optional(),error_uri:e.url().optional(),state:m.optional()});const ne=e.string().regex(/^[A-Za-z0-9_~.-]{43,128}$/),_=e.string().regex(/^[a-f0-9]{64}$/),re=e.object({grant_type:e.enum([`authorization_code`]),code:e.string().min(1),redirect_uri:d,code_verifier:ne,client_id:p.optional(),client_secret:_.optional()}),ie=e.object({grant_type:e.enum([`refresh_token`]),refresh_token:e.string().min(1),scope:f.optional(),client_id:p.optional(),client_secret:_.optional()}),ae=e.object({grant_type:e.enum([`client_credentials`]),scope:f.optional(),client_id:p.optional(),client_secret:_.optional()});e.discriminatedUnion(`grant_type`,[re.extend({grant_type:e.literal(`authorization_code`)}),ie.extend({grant_type:e.literal(`refresh_token`)}),ae.extend({grant_type:e.literal(`client_credentials`)})]),e.object({sub:e.string().min(1),name:e.string().min(1).nullable(),picture:e.url().nullable()}),e.object({token:e.string().min(1),token_type_hint:e.enum([`access_token`,`refresh_token`]).optional(),client_id:p.optional(),client_secret:_.optional()});const oe=e.object({status:e.enum([`completed`]),intentId:e.string().min(1),paymentId:e.string().min(1),usdCents:e.int().gte(0),txHash:e.string().nullable()}),se=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),usdCents:e.int().gte(0)});e.discriminatedUnion(`status`,[oe.extend({status:e.literal(`completed`)}),se.extend({status:e.literal(`redirect`)})]),e.object({error:e.enum([`monthly_limit_exceeded`]),currentLimitCents:e.int().gte(0),monthSpentCents:e.int().gte(0),attemptedUsdCents:e.int().gte(0),redirectUrl:e.url()}),e.object({error:e.enum([`idempotency_key_reused`]),intentId:e.string().min(1)});const v=e.object({purpose:e.string().min(1).max(64).optional(),title:e.string().min(1).max(120).optional(),note:e.string().min(1).max(280).optional(),quantity:e.int().gte(1).lte(1e6).optional(),category:e.string().min(1).max(64).optional(),sessionId:e.string().min(1).max(128).optional(),groupId:e.string().min(1).max(128).optional(),image:e.url().max(2048).optional(),extra:e.record(e.string(),e.union([e.string().max(512),e.number(),e.boolean()])).optional()});e.object({chain:e.string().min(1),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),returnUri:e.url().max(2048),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/).optional(),rakeBps:e.int().gte(0).lte(3e3).optional(),metadata:v.optional()}),e.object({monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),periodStart:e.iso.datetime(),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable(),walletDelegated:e.boolean()}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),tokenDecimals:e.int().gte(0),usdRate:e.string().min(1),feed:e.object({aggregatorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),decimals:e.int().gte(0),answer:e.string().regex(/^\d+$/),updatedAt:e.iso.datetime()}),usdCents:e.int().gte(0).optional(),amount:e.string().regex(/^\d+$/).optional()});const ce=e.object({intentId:e.string().min(1),appId:e.string().min(1),status:e.enum([`pending`,`awaiting_funding`,`completed`,`denied`,`expired`]),paymentId:e.string().nullable(),txHash:e.string().nullable(),usdCents:e.int().gte(0),chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/).nullable(),creditedAmount:e.string().regex(/^\d+$/).nullable(),settlement:e.enum([`instant`,`locked`]).nullable(),resolvedAt:e.iso.datetime().nullable(),expiresAt:e.iso.datetime()});e.object({intentId:e.string().min(1),consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),chain:e.string().min(1),token:e.string(),amount:e.string(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appealable:e.boolean(),usdCents:e.int().gte(0),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable(),walletDelegated:e.boolean(),canonicalWalletAddress:e.string().nullable(),offlineDenialReason:e.enum([`no_active_play_session`,`driver_unavailable`,`wallet_not_delegated`,`deposit_cap_exceeded`,`insufficient_balance`,`fire_failed`]).nullable(),returnUriHost:e.string().min(1),status:e.enum([`pending`,`awaiting_funding`]),expiresAt:e.iso.datetime(),accessDenied:e.object({reason:e.enum([`not_invited`]),developer:e.object({studioName:e.string().nullable(),logoUrl:e.url().nullable(),studioUrl:e.url().nullable(),studioXHandle:e.string().nullable()})}).nullish()}),e.object({chain:e.string().min(1),chainId:e.int().gte(0),id:e.string().regex(/^0x[0-9a-fA-F]{32}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),data:e.string().regex(/^0x[0-9a-fA-F]*$/),appealable:e.boolean(),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),deadline:e.int().gte(0),routerAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}),e.object({redirect:e.url()});const le=e.object({method:e.enum([`signed`]),paymentId:e.string().min(1)}),ue=e.object({method:e.enum([`offline`])});e.discriminatedUnion(`method`,[le.extend({method:e.literal(`signed`)}),ue.extend({method:e.literal(`offline`)})]);const de=e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitCents:e.int().gte(0).nullable(),monthSpentCents:e.int().gte(0),periodStart:e.iso.datetime(),offlineAutoChargeEnabled:e.boolean(),perTxOfflineCapCents:e.int().gte(0).nullable()});e.object({authorizations:e.array(de)});const fe=e.int().gte(100).lte(1e5).nullable();e.object({offlineAutoChargeEnabled:e.boolean().optional(),perTxOfflineCapCents:fe.optional(),monthlyLimitCents:g.optional()});const pe=e.object({clientName:e.string().min(1),connectedAt:e.iso.datetime()});e.object({connections:e.array(pe)});const me=e.object({consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),monthlyLimitTronCents:e.int().gte(0).nullable(),monthSpentTronCents:e.int().gte(0),autoApproveTronCapCents:e.int().gte(0).nullable()});e.object({authorizations:e.array(me).max(200)}),e.object({monthlyTronLimitCents:e.int().gt(0).lte(1e8).nullish(),autoApproveTronCapCents:e.int().gt(0).lte(1e8).nullish()});const y=e.string().min(3).max(40).regex(/^[a-z0-9-]+$/),he=e.object({appId:e.uuid(),name:e.string().min(1).max(80),slug:y,bannerUrl:e.url().nullable(),thumbnailUrl:e.url().nullable(),thumbnailVideoUrl:e.url().nullable(),categories:e.array(e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`))),studio:e.object({name:e.string().min(1).max(80).nullable(),logoUrl:e.url().nullable()}).nullable(),firstPublishedAt:e.iso.datetime()});e.object({items:e.array(he),nextBefore:e.iso.datetime().nullable()});const b=e.array(e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`))).max(4),x=e.string().min(1).max(80),ge=e.object({url:e.url().max(2048),caption:e.string().max(200).optional(),order:e.int().gte(0)}),S=e.array(ge).max(6),_e=e.object({heading:e.string().min(1).max(80),body:e.string().min(1).max(2e3),order:e.int().gte(0)}),C=e.array(_e).max(8),ve=e.object({label:e.string().min(1).max(40),url:e.url().max(2048),order:e.int().gte(0)}),w=e.array(ve).max(10),ye=e.object({name:e.string().nullable(),logoUrl:e.url().nullable(),websiteUrl:e.url().nullable(),xHandle:e.string().nullable(),githubUrl:e.url().nullable()});e.object({appId:e.uuid(),slug:y,appName:e.string(),appLogoUrl:e.url().nullable(),categories:b,tagline:x,bannerUrl:e.url().nullable(),playUrl:e.url().nullable(),discordUrl:e.url().nullable(),twitterUrl:e.url().nullable(),redditUrl:e.url().nullable(),telegramUrl:e.url().nullable(),gallery:S,chapters:C,links:w,studio:ye,oauthScopes:e.array(e.string()),chains:e.array(e.string()),publishedAt:e.iso.datetime()});const be=e.object({1:e.int().gte(0),2:e.int().gte(0),3:e.int().gte(0),4:e.int().gte(0),5:e.int().gte(0)}),xe=e.object({average:e.number().gte(1).lte(5).nullable(),count:e.int().gte(0),distribution:be}),T=e.int().gte(1).lte(5),E=e.string().min(1).max(2e3),Se=e.object({name:e.string().min(1).max(80).nullable(),avatarUrl:e.url().nullable()}),D=e.string().min(1).max(2e3),O=e.object({body:D,repliedAt:e.iso.datetime()}).nullable(),Ce=e.object({id:e.uuid(),rating:T,body:E,author:Se,developerReply:O,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.object({aggregate:xe,reviews:e.array(Ce),total:e.int().gte(0),hasMore:e.boolean()});const k=e.enum([`newest`,`oldest`,`highest`,`lowest`]).default(`newest`),we=e.enum([`payment`,`reward`]).nullable(),Te=e.object({id:e.uuid(),rating:T,body:E,createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}).nullable();e.object({eligible:e.boolean(),eligibleVia:we,review:Te,isAppOwner:e.boolean()}),e.object({rating:T,body:E}),e.object({developerReply:O}),e.object({body:D}),e.object({created:e.boolean()});const A=e.enum([`abuse`,`inappropriate_content`,`cheating`,`spam`,`other`]);e.object({category:A,details:e.string().max(2e3).optional()});const j=e.enum([`open`,`acknowledged`,`dismissed`]),Ee=e.object({id:e.uuid(),category:A,details:e.string().nullable(),status:j,acknowledgedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()});e.object({reports:e.array(Ee),total:e.int().gte(0),hasMore:e.boolean()}),e.object({status:e.enum([`acknowledged`,`dismissed`])});const De=e.object({id:e.string().min(1),family:e.enum([`evm`,`solana`]),displayName:e.string().min(1),chainId:e.int().optional(),paymentRouter:e.string().optional(),paymentProgram:e.string().optional()});e.object({chains:e.array(De)});const Oe=e.object({id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vaultKind:e.enum([`credit`,`platform`]),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).nullable(),appealable:e.boolean(),vaultReleaseAt:e.iso.datetime().nullable(),consolidatedAt:e.iso.datetime().nullable(),status:e.enum([`pending`,`completed`,`expired`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),deadline:e.iso.datetime(),signedAt:e.iso.datetime(),completedAt:e.iso.datetime().nullable(),recipientApp:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}).nullable()});e.object({payments:e.array(Oe),nextBefore:e.iso.datetime().nullable()});const ke=e.object({kind:e.enum([`payment`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`,`incoming`]),payer:e.string().regex(/^0x[0-9a-fA-F]{40}$/),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),beneficiaryApp:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vaultKind:e.enum([`credit`,`platform`]),targetKind:e.enum([`credit`,`pot`]),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).nullable(),appealable:e.boolean(),disputableLegId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vaultReleaseAt:e.iso.datetime().nullable(),consolidatedAt:e.iso.datetime().nullable(),status:e.enum([`pending`,`completed`,`expired`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),Ae=e.object({kind:e.enum([`payment_withdrawal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),je=e.object({kind:e.enum([`matured_withdrawal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),Me=e.object({kind:e.enum([`payout_sent`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),Ne=e.object({kind:e.enum([`credit_transferred`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),Pe=e.object({kind:e.enum([`pot_leg`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),distributionId:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),settlement:e.enum([`instant`,`locked`]),releaseAt:e.iso.datetime().nullable(),claimedAt:e.iso.datetime().nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),metadata:v.nullish(),usdCents:e.int().gte(0).nullable()}),Fe=e.object({kind:e.enum([`payment_autoclaim`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),autoclaimKind:e.enum([`withdraw_matured`,`withdraw_escrow`,`claim_refund`]),status:e.enum([`pending`,`in_flight`,`succeeded`,`skipped`,`failed`]),attempts:e.int().gte(0),lastError:e.string().nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),settledAt:e.iso.datetime().nullable()}),Ie=e.object({kind:e.enum([`appeal`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),counterparty:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`pending_onchain`,`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),blockNumber:e.string().regex(/^\d+$/).nullable(),logIndex:e.int().gte(0).nullable(),resolvedAt:e.iso.datetime().nullable(),refundClaimedAt:e.iso.datetime().nullable(),hasRoom:e.boolean(),resolution:e.object({resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]{130}$/)}).nullable(),usdCents:e.int().gte(0).nullable()}),Le=e.object({kind:e.enum([`moonpay_buy`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),externalId:e.string().min(1),fiatAmountCents:e.int().gte(0),fiatCurrency:e.string().min(1),cryptoAmount:e.string().regex(/^\d+$/),cryptoToken:e.string().regex(/^0x[0-9a-fA-F]{40}$/),cryptoTxHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`completed`,`failed`])}),Re=e.object({kind:e.enum([`moonpay_sell`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),externalId:e.string().min(1),fiatAmountCents:e.int().gte(0),fiatCurrency:e.string().min(1),cryptoAmount:e.string().regex(/^\d+$/),cryptoToken:e.string().regex(/^0x[0-9a-fA-F]{40}$/),cryptoTxHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`completed`,`failed`])}),ze=e.object({kind:e.enum([`tron_deposit`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),amountCents:e.int().gt(0),status:e.enum([`completed`,`disputed`,`clawed_back`]),receiptUrl:e.url().nullable(),paymentIntentId:e.string().min(1).nullable()}),Be=e.object({userId:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),handle:e.string().nullable(),displayName:e.string().nullable(),role:e.enum([`stake`,`payout`,`dev_cut`,`purchase`,`referral`]),amountCents:e.int()}),Ve=e.object({kind:e.enum([`tron_pot`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`incoming`,`outgoing`]),leg:e.enum([`stake`,`payout`,`dev_cut`,`purchase`,`referral`]),amountCents:e.int().gt(0),usdCents:e.int(),status:e.enum([`settled`]),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable(),slug:e.string().nullable(),bannerUrl:e.url().nullable()}).nullable(),involvedUsers:e.array(Be).nullish(),metadata:v.nullish()}),He=e.object({kind:e.enum([`tron_cashout`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),occurredAt:e.iso.datetime(),role:e.enum([`outgoing`]),method:e.enum([`stripe`,`usdc`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/).nullable(),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),stripeTransferId:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),settledAt:e.iso.datetime().nullable()}),Ue=e.object({kind:e.enum([`referral_earning`]),groupId:e.string().min(1).nullable(),id:e.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),chain:e.string().min(1),occurredAt:e.iso.datetime(),role:e.enum([`incoming`]),referralAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),reversed:e.boolean(),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),logIndex:e.int().gte(0),usdCents:e.int().gte(0).nullable()}),We=e.discriminatedUnion(`kind`,[ke.extend({kind:e.literal(`payment`)}),Ae.extend({kind:e.literal(`payment_withdrawal`)}),je.extend({kind:e.literal(`matured_withdrawal`)}),Me.extend({kind:e.literal(`payout_sent`)}),Ne.extend({kind:e.literal(`credit_transferred`)}),Pe.extend({kind:e.literal(`pot_leg`)}),Fe.extend({kind:e.literal(`payment_autoclaim`)}),Ie.extend({kind:e.literal(`appeal`)}),Le.extend({kind:e.literal(`moonpay_buy`)}),Re.extend({kind:e.literal(`moonpay_sell`)}),ze.extend({kind:e.literal(`tron_deposit`)}),Ve.extend({kind:e.literal(`tron_pot`)}),He.extend({kind:e.literal(`tron_cashout`)}),Ue.extend({kind:e.literal(`referral_earning`)})]);e.object({rows:e.array(We),nextBefore:e.iso.datetime().nullable(),nextCursor:e.string().nullable(),hasHidden:e.boolean()});const Ge=e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),creditedWei:e.string().regex(/^\d+$/),drainedWei:e.string().regex(/^\d+$/),outstandingWei:e.string().regex(/^\d+$/)});e.object({rows:e.array(Ge)}),e.object({enabled:e.boolean(),direction:e.enum([`buy`,`sell`,`both`]).nullable(),countryCode:e.string().regex(/^[A-Z]{2}$/).nullable(),regionSupported:e.boolean()}),e.object({url:e.url(),intentId:e.string().min(1),expiresAt:e.iso.datetime(),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({intentId:e.string().min(1)}),e.object({url:e.url(),transactionId:e.uuid(),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({usdcAmount:e.string().regex(/^\d+$/),chain:e.string().min(1).optional()}),e.object({enabled:e.boolean(),balanceCents:e.int().gte(0),frozenCents:e.int().gte(0),currency:e.enum([`tron`]),flagged:e.boolean(),minDepositCents:e.int().gt(0),maxDepositCents:e.int().gt(0)});const Ke=e.object({id:e.uuid(),kind:e.enum([`deposit`,`pot_stake`,`pot_payout`,`dev_earning`,`cashout_hold`,`cashout_release`,`dispute_freeze`,`dispute_unfreeze`,`hosted_billing`,`store_purchase`,`referral_earning`]),amountCents:e.int(),currency:e.string().min(1),createdAt:e.iso.datetime()});e.object({entries:e.array(Ke).max(100),nextBefore:e.iso.datetime().nullable()}),e.object({clientSecret:e.string().min(1),publishableKey:e.string().min(1),amountCents:e.int().gt(0),currency:e.string().min(1),depositId:e.uuid()}),e.object({amountCents:e.int().gt(0).lte(1e6)}),e.object({balanceCents:e.int().gte(0),rakeBps:e.int().gte(0).lte(3e3)});const qe=e.object({status:e.enum([`completed`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),balanceCents:e.int().gte(0)}),Je=e.object({status:e.enum([`insufficient_balance`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),balanceCents:e.int().gte(0)}),Ye=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),amountCents:e.int().gt(0),potId:e.string().regex(/^0x[0-9a-f]{32}$/)});e.discriminatedUnion(`status`,[qe.extend({status:e.literal(`completed`)}),Je.extend({status:e.literal(`insufficient_balance`)}),Ye.extend({status:e.literal(`redirect`)})]),e.object({potId:e.string().regex(/^0x[0-9a-f]{32}$/),amountCents:e.int().gt(0),returnUri:e.url(),metadata:v.optional()});const Xe=e.object({status:e.enum([`completed`]),balanceCents:e.int().gte(0)}),Ze=e.object({status:e.enum([`insufficient_balance`]),balanceCents:e.int().gte(0)}),Qe=e.object({status:e.enum([`redirect`]),intentId:e.string().min(1),redirectUrl:e.url(),amountCents:e.int().gt(0)});e.discriminatedUnion(`status`,[Xe.extend({status:e.literal(`completed`)}),Ze.extend({status:e.literal(`insufficient_balance`)}),Qe.extend({status:e.literal(`redirect`)})]),e.object({amountCents:e.int().gt(0),returnUri:e.url(),metadata:v.optional()}),e.object({intentId:e.string().min(1),consentId:e.string().min(1),app:e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().nullable()}),amountCents:e.int().gt(0),kind:e.enum([`pot_stake`,`store_purchase`]),potId:e.string().nullable(),monthlyLimitTronCents:e.int().gte(0).nullable(),monthSpentTronCents:e.int().gte(0),autoApproveTronCapCents:e.int().gte(0).nullable(),balanceCents:e.int().gte(0),returnUriHost:e.string().min(1),status:e.enum([`pending`]),expiresAt:e.iso.datetime()});const $e=e.object({status:e.enum([`redirect`]),redirect:e.url()}),et=e.object({status:e.enum([`insufficient_balance`]),balanceCents:e.int().gte(0)});e.discriminatedUnion(`status`,[$e.extend({status:e.literal(`redirect`)}),et.extend({status:e.literal(`insufficient_balance`)})]),e.object({status:e.enum([`distributed`,`replayed`]),potId:e.string().regex(/^0x[0-9a-f]{32}$/),potBalanceCents:e.int().gte(0)}),e.object({potId:e.string().regex(/^0x[0-9a-f]{32}$/),legs:e.array(e.object({recipientUserId:e.uuid(),amountCents:e.int().gt(0)})).max(64),rakeBps:e.int().gte(0).lte(1e4).optional(),devCutCents:e.int().gte(0).optional().default(0),closePot:e.boolean().optional().default(!0),metadata:v.optional()}),e.object({url:e.url()});const tt=e.object({id:e.uuid(),method:e.enum([`stripe`,`usdc`]),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),currency:e.string().min(1),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),createdAt:e.iso.datetime(),settledAt:e.iso.datetime().nullable()});e.object({method:e.enum([`stripe`,`usdc`]),amountCents:e.int().gt(0),chain:e.string().min(1).optional()}),e.object({requests:e.array(tt).max(100)});const nt=e.object({id:e.uuid(),method:e.enum([`stripe`,`usdc`]),status:e.enum([`pending`,`approved`,`rejected`,`settled`,`failed`]),amountCents:e.int().gt(0),feeCents:e.int().gte(0),currency:e.string().min(1),destinationAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),chain:e.string().min(1).nullable(),txHash:e.string().min(1).nullable(),rejectionReason:e.string().min(1).nullable(),createdAt:e.iso.datetime(),settledAt:e.iso.datetime().nullable(),userId:e.uuid(),requestIdHex:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),usdcAmount:e.string().regex(/^\d+$/).nullable(),backendSignature:e.string().regex(/^0x[0-9a-f]+$/).nullable(),signatureDeadline:e.iso.datetime().nullable(),poolAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable()});e.object({requests:e.array(nt).max(100)}),e.object({reason:e.string().min(1).max(500)});const rt=e.array(e.object({id:e.enum([`ethereum-mainnet`,`base-mainnet`,`ethereum-sepolia`]),displayName:e.string().min(1),chainId:e.int().gt(0)})),M=e.string().min(1).max(24).regex(/^[a-z0-9]+$/).nullable(),it=e.object({id:e.string().min(1),name:e.string().min(1),deletedAt:e.iso.datetime().nullable()}).nullable(),N=e.object({native:e.string().regex(/^\d+(?:\.\d+)?$/),usdc:e.string().regex(/^\d+(?:\.\d+)?$/).optional()}),at=e.object({"ethereum-mainnet":N.optional(),"base-mainnet":N.optional(),"ethereum-sepolia":N.optional()}),ot=e.enum([`infinite`,`custom`,`scoped`]).nullable(),st=e.object({native:e.string().regex(/^\d+$/),usdc:e.string().regex(/^\d+$/)}).nullable(),ct=e.object({mode:ot,caps:st,policyId:e.string().min(1).nullable()}),lt=e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),label:M,kind:e.enum([`personal`,`app`]),app:it,balances:at,delegation:ct});e.object({chains:rt,wallets:e.array(lt)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),label:M}),e.object({label:M}),e.object({policyId:e.string().min(1).nullable()}),e.union([e.object({mode:e.enum([`infinite`])}),e.object({mode:e.enum([`custom`]),caps:st}),e.object({mode:e.enum([`scoped`])})]),e.object({ok:e.literal(!0)}),e.object({name:t.optional(),displayName:n.optional(),bio:e.string().min(1).max(256).nullish(),websiteUrl:i.optional(),banner:a.optional(),presenceStatusMode:s.optional(),environmentViewMode:ee.optional()});const ut=e.object({id:e.string().min(1),title:e.string().max(500),gifUrl:e.url(),previewUrl:e.url(),width:e.int().gt(0),height:e.int().gt(0)});e.object({results:e.array(ut)});const dt=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable()}),P=e.object({v:e.literal(1),alg:e.enum([`x25519-ecdh-hkdf-sha256-aes256gcm`]),senderPubKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),senderKeyId:e.string().min(1).max(128),recipientKeyId:e.string().min(1).max(128),iv:e.string().max(64).regex(/^[A-Za-z0-9_-]+$/),ct:e.string().max(16384).regex(/^[A-Za-z0-9_-]+$/)}).nullable(),ft=e.object({id:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3),envelope:P.optional(),attachment:e.object({url:e.url(),count:e.int().gt(0)}).nullable(),sentAt:e.iso.datetime()}).nullable(),pt=e.object({kind:e.enum([`direct`]),id:e.string().min(1),otherParticipant:dt,lastMessage:ft,unreadCount:e.int().gte(0),pinnedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),F=e.string().min(1).max(80).regex(/^\S(?:.*\S)?$/),I=e.string().max(500).nullable(),mt=e.url().max(2048).nullable(),L=e.enum([`admin`,`member`]),ht=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable(),role:L}),R=e.object({kind:e.enum([`group`]),id:e.string().min(1),title:F,description:I,logoUrl:mt,participants:e.array(ht),myRole:L,lastMessage:ft,unreadCount:e.int().gte(0),pinnedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),z=e.discriminatedUnion(`kind`,[pt.extend({kind:e.literal(`direct`)}),R.extend({kind:e.literal(`group`)})]);e.object({threads:e.array(z)}),e.object({thread:z,created:e.boolean()});const gt=e.object({kind:e.enum([`direct`]).optional().default(`direct`),recipientUserId:e.string().min(1)}),_t=e.object({kind:e.enum([`group`]),title:F,description:I.optional(),invitedUserIds:e.array(e.string().min(1)).min(1).max(100)});e.object({ok:e.literal(!0)}),e.object({thread:R}),e.object({title:F.optional(),description:I.optional()});const vt=e.object({id:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3).nullable(),envelope:P.optional()}).nullable(),B=e.enum([`👍`,`👎`,`❤️`,`😂`,`😮`,`😢`,`🔥`,`🎉`,`🙏`,`👀`,`✅`,`🎮`]),V=e.object({emoji:B,count:e.int().gt(0),userIds:e.array(e.string().min(1))}),yt=e.enum([`image`]),H=e.object({id:e.string().min(1),kind:yt,url:e.url(),contentType:e.string().min(1),fileName:e.string().min(1),byteSize:e.int().gte(0),width:e.int().gt(0).nullable(),height:e.int().gt(0).nullable()}),bt=e.object({url:e.url(),title:e.string().max(500).nullable(),description:e.string().max(1e3).nullable(),imageUrl:e.url().nullable(),siteName:e.string().max(200).nullable()}),xt=e.object({id:e.string().min(1),threadId:e.string().min(1),senderUserId:e.string().min(1),body:e.string().max(2e3),envelope:P.optional(),sentAt:e.iso.datetime(),editedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable(),replyTo:vt,reactions:e.array(V),attachments:e.array(H),linkPreviews:e.array(bt)});e.object({messages:e.array(xt),nextBefore:e.iso.datetime().nullable()});const St=e.string().max(2e3);e.object({body:St.optional(),envelope:P.optional(),replyToMessageId:e.string().min(1).optional(),attachmentIds:e.array(e.string().min(1)).max(3).optional()});const Ct=e.string().min(1).max(2e3);e.object({body:Ct.optional(),envelope:P.optional()}),e.object({aggregate:V.nullable()}),e.object({attachment:H}),e.object({userIds:e.array(e.string().min(1)).min(1).max(100)}),e.object({pinnedAt:e.iso.datetime()});const U=e.enum([`x25519`]),W=e.object({userId:e.string().min(1),keyId:e.string().min(1).max(128),publicKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),algorithm:U});e.object({key:W}),e.object({publicKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),keyId:e.string().min(1).max(128),algorithm:U});const wt=e.object({threadId:e.string().min(1),key:W.nullable()});e.object({keys:e.array(wt)}),e.object({threadIds:e.array(e.string().min(1)).min(1).max(200)}),e.object({exists:e.boolean(),attemptsRemaining:e.int().gte(0),kdfSalt:e.string().length(22).regex(/^[A-Za-z0-9_-]+$/).nullable(),kdfIterations:e.int().gte(1e5).lte(5e6).nullable()}),e.object({ok:e.literal(!0)}),e.object({scalar:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),secret:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),pinKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/),kdfSalt:e.string().length(22).regex(/^[A-Za-z0-9_-]+$/),kdfIterations:e.int().gte(1e5).lte(5e6)}),e.union([e.object({result:e.enum([`ok`]),scalar:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/)}),e.object({result:e.enum([`wrong-pin`]),attemptsRemaining:e.int().gte(0)})]),e.object({pinKey:e.string().length(43).regex(/^[A-Za-z0-9_-]+$/)}),e.object({role:L});const G=e.object({name:e.string().nullable(),handle:e.string().nullable()}).nullable(),K=e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),usdCents:e.int().nullable()});e.object({code:e.string().nullable(),xLinked:e.boolean(),referrer:G,refereeCount:e.int().gte(0),lifetimeEarnings:e.array(K),lifetimeUsdCents:e.int().nullable(),last30dEarnings:e.array(K),last30dUsdCents:e.int().nullable()}),e.object({code:e.string().min(1),generatedAt:e.iso.datetime()}),e.object({status:e.enum([`eligible`,`already-referred`,`self-referral`,`unknown-code`,`revoked-code`,`window-expired`]),referrer:G}),e.object({status:e.enum([`bound`,`already-referred`,`self-referral`,`unknown-code`,`revoked-code`,`window-expired`]),referrer:G}),e.object({code:e.string().min(1).max(64),source:e.enum([`signup-url`,`manual-claim`,`cookie-restore`]).optional().default(`manual-claim`)});const q=e.string().regex(/^[a-f0-9]{64}$/);e.object({playSessionId:q,expiresAt:e.iso.datetime()});const J=e.uuid();e.object({appId:J}),e.object({ok:e.literal(!0),ttlSeconds:e.int().gt(0)}),e.object({playSessionId:q,status:e.enum([`pending`,`active`,`ended`])});const Tt=e.uuid();e.object({playSessionId:q,userId:Tt}),e.object({status:e.enum([`pending`,`active`,`ended`])}),e.object({playSessionId:q}),e.object({status:e.enum([`ended`])}),e.object({playSessionId:q});const Et=e.object({appId:J,name:e.string(),logoUrl:e.string().nullable(),sessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});e.object({apps:e.array(Et),totalSessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});const Dt=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),appId:J,sessionCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)});e.object({from:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),to:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),buckets:e.array(Dt)}),e.object({appId:J,sessionCount:e.int().gte(0),uniquePlayerCount:e.int().gte(0),totalDurationSeconds:e.int().gte(0)}),e.object({followers:e.int().gte(0),following:e.int().gte(0),gamesPlayed:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0),reviewsLeft:e.int().gte(0),rewardsWon:e.int().gte(0),rewardsValueUsdCents:e.int().gte(0)});const Ot=e.object({date:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),rewardsWon:e.int().gte(0),valueUsdCents:e.int().gte(0)});e.object({from:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),to:e.string().regex(/^\d{4}-\d{2}-\d{2}$/),totalRewardsWon:e.int().gte(0),totalValueUsdCents:e.int().gte(0),buckets:e.array(Ot)});const kt=e.object({collectionId:e.string(),collectionAddress:e.string(),chain:e.string(),kind:e.enum([`erc721`,`erc1155`]),tokenId:e.string(),amount:e.string(),name:e.string().nullable(),imageAssetId:e.string().nullable(),bannerAssetId:e.string().nullable(),devMetadata:e.record(e.string(),e.unknown())});e.object({items:e.array(kt)}),e.object({mintRequestId:e.string(),txHash:e.string(),status:e.enum([`submitted`,`completed`]),mintedTokenId:e.string().nullable()}),e.object({collectionAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),chain:e.string().min(1),toWallet:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),toUserId:e.string().optional(),tokenId:e.string().regex(/^\d+$/).optional(),amount:e.string().regex(/^\d+$/).optional()});const At=e.object({requesterId:e.string().min(1),requesterName:e.string().min(1),requesterDisplayName:e.string().nullable(),requesterImage:e.url().nullable(),friendshipId:e.string().min(1)}),jt=e.object({accepterId:e.string().min(1),accepterName:e.string().min(1),accepterDisplayName:e.string().nullable(),accepterImage:e.url().nullable(),friendshipId:e.string().min(1)}),Mt=e.object({appId:e.uuid(),appName:e.string().min(1),scope:e.enum([`publish`,`changes`])}),Nt=e.object({appId:e.uuid(),appName:e.string().min(1),scope:e.enum([`publish`,`changes`]),notes:e.string().min(1).max(1e3)}),Pt=e.object({appId:e.uuid(),appName:e.string().min(1),appLogoUrl:e.url().nullable(),inviterId:e.string().min(1),inviterName:e.string().min(1),inviterDisplayName:e.string().nullable()}),Ft=e.object({appId:e.uuid(),appName:e.string().min(1),accepterId:e.string().min(1),accepterName:e.string().min(1),accepterDisplayName:e.string().nullable(),accepterImage:e.url().nullable()}),It=e.union([e.object({id:e.string().min(1),kind:e.enum([`friend_request`]),payload:At,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`friend_accepted`]),payload:jt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_page_approved`]),payload:Mt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_page_rejected`]),payload:Nt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_participant_invite`]),payload:Pt,read:e.boolean(),createdAt:e.iso.datetime()}),e.object({id:e.string().min(1),kind:e.enum([`app_participant_accepted`]),payload:Ft,read:e.boolean(),createdAt:e.iso.datetime()})]);e.object({notifications:e.array(It),unreadCount:e.int().gte(0)}),e.object({ok:e.literal(!0)}),e.object({read:e.boolean()});const Lt=e.enum([`online`,`offline`]),Rt=e.object({user:dt,friendshipId:e.string().min(1),acceptedAt:e.iso.datetime(),onlineStatus:Lt});e.object({friends:e.array(Rt)}),e.object({decision:e.enum([`accept`,`reject`])});const Y=e.object({provider:e.enum([`twitter`,`discord`,`github`]),subject:e.string().min(1),username:e.string().nullable(),name:e.string().nullable(),profilePictureUrl:e.url().nullable(),verifiedAt:e.iso.datetime().nullable()});e.object({accounts:e.array(Y)});const X=e.string().nullable(),Z=e.url().max(2048).nullable(),Q=e.object({studioName:e.string().min(1).max(80).nullable(),studioUrl:e.url().max(2048).nullable(),studioXHandle:X,githubUrl:Z,logoUrl:e.url().max(2048).nullable()}),zt=e.object({id:e.string().min(1),name:e.string().min(1),logoUrl:e.url().max(2048).nullable(),environment:e.enum([`development`,`production`])}),Bt=e.object({profile:Q,apps:e.array(zt)}).nullable(),Vt=e.object({followers:e.int().gte(0),following:e.int().gte(0)}),Ht=e.object({gamesPlayed:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0),reviewsLeft:e.int().gte(0),rewardsWon:e.int().gte(0),rewardsValueUsdCents:e.int().gte(0)}),Ut=e.object({appId:e.string().min(1),name:e.string().min(1),logoUrl:e.url().max(2048).nullable(),sessionCount:e.int().gte(0),totalPlaytimeSeconds:e.int().gte(0)}),Wt=e.object({appId:e.string().min(1),appName:e.string().min(1),appLogoUrl:e.url().max(2048).nullable(),rating:e.int().gte(1).lte(5),body:e.string(),createdAt:e.iso.datetime()}),Gt=e.object({isFollowing:e.boolean(),isFollowedBy:e.boolean(),friendship:e.enum([`none`,`pending_out`,`pending_in`,`accepted`]),friendshipId:e.string().min(1).nullable()}).nullable();e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),bio:e.string().nullable(),websiteUrl:e.url().max(2048).nullable(),image:e.url().nullable(),banner:a,createdAt:e.iso.datetime(),socials:e.array(Y),developer:Bt,counts:Vt,stats:Ht,topGames:e.array(Ut),recentReviews:e.array(Wt),relationship:Gt});const Kt=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),image:e.url().nullable(),socials:e.array(Y)});e.object({results:e.array(Kt)}),e.object({ok:e.literal(!0),friendshipId:e.string().min(1)});const qt=e.object({id:e.string().min(1),keyPrefix:e.string().min(1),scopes:e.array(e.enum([`developer:read`,`developer:apps`,`developer:pages`])),createdAt:e.iso.datetime(),expiresAt:e.iso.datetime().nullable(),lastUsedAt:e.iso.datetime().nullable(),revokedAt:e.iso.datetime().nullable()});e.object({key:qt,secret:e.string().min(1)}),e.object({scopes:e.array(e.enum([`developer:read`,`developer:apps`,`developer:pages`])).min(1),expiresAt:e.iso.datetime().nullish()}),e.object({keys:e.array(qt)}),e.object({ok:e.literal(!0)}),e.object({id:e.string().min(1)});const $=e.string().regex(/^[A-Za-z0-9 ._-]{1,40}$/),Jt=e.object({chain:e.string().min(1),custody:e.enum([`server`])});e.object({name:$,chains:e.array(Jt).optional()});const Yt=e.string().min(1).max(2048),Xt=e.enum([`eth`,`tron`]),Zt=e.array(Xt).min(1).max(2);e.object({name:$.optional(),logoUrl:e.url().max(2048).nullish(),testAccess:e.enum([`private`,`public`]).optional(),redirectUris:e.array(e.url().max(2048)).max(20).optional(),embedOrigins:e.array(Yt).max(20).optional(),acceptedCurrencies:Zt.optional(),paymentStatusWebhookUrl:e.url().max(2048).nullish(),paymentStatusWebhookUrlTest:e.url().max(2048).nullish()}),e.object({logoUrl:e.url().nullable()});const Qt=e.object({chain:e.string().min(1),token:e.string().min(1),tokenDecimals:e.int(),lockedWei:e.string(),unlockedWei:e.string(),walletBalanceWei:e.string().nullable()});e.object({appId:e.string().min(1),balances:e.array(Qt)}),e.object({appId:e.string().min(1),availableCents:e.int().gte(0),lockedCents:e.int().gte(0),totalCents:e.int().gte(0)});const $t=e.object({ts:e.iso.datetime(),sumCents:e.number(),paymentCount:e.int()});e.object({appId:e.string().min(1),range:e.string().min(1),bucketSecs:e.int(),windowSecs:e.int(),chain:e.string().nullable(),buckets:e.array($t)});const en=e.object({ts:e.iso.datetime(),sessionCount:e.int(),uniquePlayerCount:e.int(),totalDurationSeconds:e.int()});e.object({appId:e.string().min(1),range:e.string().min(1),bucketSecs:e.int(),windowSecs:e.int(),buckets:e.array(en)}),e.object({appId:e.string().min(1),earnedCents:e.int(),earningEventCount:e.int(),distinctPayers:e.int(),sessionCount:e.int(),uniquePlayerCount:e.int(),totalPlaytimeSeconds:e.int()});const tn=e.object({chain:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/),custody:e.enum([`server`]).nullable(),walletId:e.string().nullable(),autoSweepEnabled:e.boolean(),sweepThresholdCents:e.int().nullable()});e.object({appId:e.string().min(1),wallets:e.array(tn)}),e.object({appId:e.string().min(1),chain:e.string().min(1),autoSweepEnabled:e.boolean(),sweepThresholdCents:e.int().nullable()}),e.object({enabled:e.boolean(),thresholdCents:e.int().gt(0).nullish()}),e.object({appId:e.string().min(1),chain:e.string().min(1),custody:e.enum([`server`]),walletId:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({appId:e.string().min(1),chain:e.string().min(1),token:e.string().min(1),txHash:e.string().min(1),amountWei:e.string().min(1),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({appId:e.string().min(1),chain:e.string().min(1),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),transfers:e.array(e.object({token:e.string().min(1),txHash:e.string().min(1),amountWei:e.string().min(1)}))});const nn=e.object({id:e.string().min(1),clientId:e.string().min(1),environment:e.enum([`development`,`production`]),secretLast4:e.string().min(1),createdAt:e.iso.datetime(),lastUsedAt:e.iso.datetime().nullable()});e.object({key:nn,clientSecret:e.string().min(1)}),e.object({ok:e.literal(!0),status:e.enum([`pending`,`approved`])}),e.object({reason:e.string().min(1).max(500).optional()}),e.object({secret:e.string().regex(/^[a-f0-9]{64}$/),secretLast4:e.string().length(4)});const rn=e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable()});e.object({appeals:e.array(rn)});const an=e.object({paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),beneficiary:e.string().regex(/^0x[0-9a-fA-F]{40}$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),grossAmount:e.string().regex(/^\d+$/),creditedAmount:e.string().regex(/^\d+$/),vaultReleaseAt:e.iso.datetime(),signedAt:e.iso.datetime(),matured:e.boolean(),hasActiveAppeal:e.boolean()});e.object({deposits:e.array(an)}),e.object({appCount:e.int().gte(0),availableCents:e.int().gte(0),lockedCents:e.int().gte(0),totalCents:e.int().gte(0)});const on=e.object({userId:e.string().min(1),status:e.enum([`invited`,`accepted`,`revoked`]),name:e.string().nullable(),email:e.string().nullable(),image:e.url().nullable(),invitedAt:e.iso.datetime(),respondedAt:e.iso.datetime().nullable()});e.object({participants:e.array(on)}),e.object({identifier:e.string().min(1).max(80)});const sn=e.object({appId:e.string().min(1),appName:e.string().min(1),appLogoUrl:e.url().nullable(),status:e.enum([`invited`,`accepted`,`revoked`]),invitedAt:e.iso.datetime()});e.object({invites:e.array(sn)});const cn=e.object({id:e.string().min(1),displayName:e.string().nullable(),email:e.string().nullable()}).nullable(),ln=e.string().min(1).max(80).nullable(),un=e.string().min(10).max(1e3).nullable(),dn=e.object({policyVersion:e.string().min(1),policyAcceptedAt:e.iso.datetime(),logoUrl:e.url().max(2048).nullable(),email:e.email().nullable(),xHandle:X,teamName:ln,projectDescription:un}),fn=e.object({reason:e.string().min(1).max(500).optional()}),pn=e.object({id:e.string().min(1),userId:e.string().min(1),user:cn,kind:e.enum([`role`,`production`]),status:e.enum([`pending`,`approved`,`rejected`,`cancelled`]),appId:e.string().min(1).nullable(),payload:e.union([e.object({kind:e.enum([`role`]),data:dn}),e.object({kind:e.enum([`production`]),data:fn})]),reviewedBy:e.string().min(1).nullable(),reviewedAt:e.iso.datetime().nullable(),reviewNotes:e.string().nullable(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}).nullable(),mn=e.object({chain:e.string().min(1),address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),hn=e.object({id:e.string().min(1),name:$,logoUrl:e.url().max(2048).nullable(),environment:e.enum([`development`,`production`]),productionApprovedAt:e.iso.datetime().nullable(),testAccess:e.enum([`private`,`public`]),createdAt:e.iso.datetime(),redirectUris:e.array(e.url().max(2048)),embedOrigins:e.array(Yt),acceptedCurrencies:Zt,payoutAddresses:e.array(mn),keys:e.array(nn),pendingProductionRequestId:e.string().min(1).nullable(),paymentStatusWebhookUrl:e.url().max(2048).nullable(),paymentStatusWebhookSecretLast4:e.string().length(4).nullable(),paymentStatusWebhookUrlTest:e.url().max(2048).nullable(),paymentStatusWebhookSecretLast4Test:e.string().length(4).nullable()});e.object({roleStatus:e.enum([`none`,`pending`,`approved`,`rejected`,`cancelled`]),latestRequest:pn,profile:Q.nullable(),apps:e.array(hn)}),e.object({studioName:e.string().min(1).max(80).nullish(),studioUrl:e.url().max(2048).nullish(),studioXHandle:X.optional(),githubUrl:Z.optional(),logoUrl:e.url().max(2048).nullish()}),e.object({acceptPolicy:e.literal(!0),logoUrl:e.url().max(2048).optional(),email:e.email().optional(),teamName:ln.optional(),projectDescription:un.optional()}),e.object({appId:e.uuid(),slug:y.nullable(),status:e.enum([`draft`,`pending_review`,`published`,`hidden`]),categories:b,tagline:x.nullable(),bannerUrl:e.url().max(2048).nullable(),thumbnailUrl:e.url().max(2048).nullable(),thumbnailVideoUrl:e.url().max(2048).nullable(),playUrl:e.url().max(2048).nullable(),discordUrl:e.url().max(2048).nullable(),twitterUrl:e.url().max(2048).nullable(),redditUrl:e.url().max(2048).nullable(),telegramUrl:e.url().max(2048).nullable(),gallery:S,chapters:C,links:w,firstPublishedAt:e.iso.datetime().nullable(),reviewedAt:e.iso.datetime().nullable(),reviewNotes:e.string().nullable(),hiddenAt:e.iso.datetime().nullable(),hiddenReasonPublic:e.string().nullable(),pendingReview:e.boolean()}),e.object({slug:y.nullish(),categories:b.optional(),tagline:x.nullish(),bannerUrl:e.url().max(2048).nullish(),thumbnailUrl:e.url().max(2048).nullish(),thumbnailVideoUrl:e.url().max(2048).nullish(),playUrl:e.url().max(2048).nullish(),discordUrl:e.url().max(2048).nullish(),twitterUrl:e.url().max(2048).nullish(),redditUrl:e.url().max(2048).nullish(),telegramUrl:e.url().max(2048).nullish(),gallery:S.optional(),chapters:C.optional(),links:w.optional()}),e.object({url:e.url().max(2048)});const gn=e.object({playSessionId:e.string().min(1),userId:e.uuid(),appId:e.uuid(),status:e.enum([`pending`,`active`]),userHalfFresh:e.boolean(),gameHalfFresh:e.boolean(),active:e.boolean(),startedAt:e.iso.datetime(),activatedAt:e.iso.datetime().nullable(),lastSeenAt:e.iso.datetime().nullable()});e.object({players:e.array(gn),total:e.int().gte(0),liveCount:e.int().gte(0),generatedAt:e.iso.datetime()});const _n=e.object({id:e.string().min(1),email:e.email().nullable(),role:o,addedBy:e.string().min(1).nullable(),addedAt:e.iso.datetime(),lastAccessedAt:e.iso.datetime().nullable()});e.object({admins:e.array(_n)}),e.object({id:e.string()}),e.object({email:e.email(),role:o.optional()}),e.object({id:e.string(),role:o}),e.object({role:o});const vn=e.object({id:e.string().min(1),name:e.string().min(1),displayName:e.string().nullable(),email:e.email().nullable(),createdAt:e.iso.datetime(),bannedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable()});e.object({users:e.array(vn),total:e.int().gte(0),offset:e.int().gte(0),limit:e.int().gt(0)}),e.object({id:e.string(),banned:e.boolean()}),e.object({banned:e.boolean(),reason:e.string().min(1).max(280).optional()});const yn=e.object({id:e.string().min(1),actorId:e.string().min(1).nullable(),actorKind:e.enum([`user`,`system`,`service`]),action:e.string().min(1),targetType:e.string().min(1),targetId:e.string().min(1),purpose:e.string().min(1),legalBasis:e.enum([`consent`,`contract`,`legitimate-interest`,`legal-obligation`,`vital-interest`,`public-task`]),occurredAt:e.iso.datetime(),attributes:e.record(e.string(),e.unknown()),traceId:e.string().min(1).nullable()});e.object({rows:e.array(yn),total:e.int().gte(0),offset:e.int().gte(0),limit:e.int().gt(0)}),e.object({requests:e.array(pn)}),e.object({id:e.string().min(1),status:e.enum([`pending`,`approved`,`rejected`,`cancelled`])}),e.object({decision:e.enum([`approve`,`reject`]),notes:e.string().min(1).max(1e3).optional()});const bn=e.object({id:e.string().min(1),name:e.string(),environment:e.enum([`development`,`production`]),logoUrl:e.url().nullable(),productionApprovedAt:e.iso.datetime().nullable(),createdAt:e.iso.datetime()}),xn=e.object({userId:e.string().min(1),email:e.email(),displayName:e.string().nullable(),image:e.url().nullable(),studio:Q.nullable(),apps:e.array(bn),grantedAt:e.iso.datetime().nullable()});e.object({developers:e.array(xn)});const Sn=e.object({appId:e.uuid(),appName:e.string(),ownerDisplayName:e.string().nullable(),ownerImage:e.string().nullable(),ownerUserId:e.uuid(),ownerEmail:e.string().nullable(),appLogoUrl:e.string().nullable(),slug:e.string().nullable(),status:e.enum([`draft`,`pending_review`,`published`,`hidden`]),categories:b,tagline:e.string().nullable(),submittedAt:e.iso.datetime().nullable(),firstPublishedAt:e.iso.datetime().nullable(),hiddenAt:e.iso.datetime().nullable(),hiddenReasonInternal:e.string().nullable(),pendingChangesSubmittedAt:e.iso.datetime().nullable()});e.object({items:e.array(Sn)}),e.object({status:e.enum([`draft`,`pending_review`,`published`,`hidden`])}),e.object({reasonPublic:e.string().min(1).max(500),reasonInternal:e.string().max(2e3).optional()}),e.union([e.object({decision:e.enum([`approve`])}),e.object({decision:e.enum([`reject`]),notes:e.string().min(1).max(1e3)})]);const Cn=e.object({field:e.string(),label:e.string(),from:e.string(),to:e.string()});e.object({appId:e.uuid(),submittedAt:e.iso.datetime().nullable(),changes:e.array(Cn)}),e.object({purchaseFeeBps:e.int().gte(0).lte(1e4),stakeFeeBps:e.int().gte(0).lte(1e4),updatedAt:e.iso.datetime(),updatedBy:e.string().min(1).nullable()});const wn=e.object({chain:e.string().min(1),chainId:e.int().gte(0),to:e.string().regex(/^0x[0-9a-fA-F]{40}$/),calldataHex:e.string().regex(/^0x[0-9a-fA-F]*$/)}),Tn=e.object({target:e.enum([`purchase`]),envelope:wn});e.object({purchaseFeeBps:e.int().gte(0).lte(1e4),stakeFeeBps:e.int().gte(0).lte(1e4),updatedAt:e.iso.datetime(),updatedBy:e.string().min(1).nullable(),envelopes:e.array(Tn)}),e.object({purchaseFeeBps:e.int().gte(0).lte(1e4).optional(),stakeFeeBps:e.int().gte(0).lte(1e4).optional()}),e.object({appId:e.string().min(1),platformFeeBps:e.int().gte(0).lte(1e4).nullable(),rakeCapBps:e.int().gte(0).lte(3e3).nullable(),effectivePlatformFeeBps:e.int().gte(0).lte(1e4),effectiveRakeCapBps:e.int().gte(0).lte(3e3),updatedAt:e.iso.datetime().nullable(),updatedBy:e.string().min(1).nullable()}),e.object({platformFeeBps:e.int().gte(0).lte(1e4).nullish(),rakeCapBps:e.int().gte(0).lte(3e3).nullish()}),e.object({chain:e.string().min(1),vaultAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),action:e.enum([`add`,`remove`])}),e.object({chain:e.string().min(1),processorAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),newTreasury:e.string().regex(/^0x[0-9a-fA-F]{40}$/)});const En=e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),reason:e.string().min(1),flaggedBy:e.string().min(1),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()});e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),reason:e.string().min(1).max(2e3)}),e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),removed:e.literal(!0)}),e.object({chain:e.string().min(1),walletAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({entries:e.array(En)}),e.object({chain:e.string().min(1),target:e.enum([`router`,`credit_vault`,`platform_vault`]),newOperator:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({chain:e.string().min(1),target:e.enum([`router`,`credit_vault`,`platform_vault`]),action:e.enum([`pause`,`unpause`])}),e.object({chain:e.string().min(1),vaultAddress:e.string().regex(/^0x[0-9a-fA-F]{40}$/),lockSeconds:e.int().gte(0)}),e.object({chain:e.string().min(1),account:e.string().regex(/^0x[0-9a-fA-F]{40}$/),lockSeconds:e.int().gte(0)});const Dn=e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),status:e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable(),resolvedBy:e.string().nullable(),resolutionNotes:e.string().nullable()});e.object({appeals:e.array(Dn),nextCursorFiledAt:e.iso.datetime().nullable()});const On=e.enum([`pending_onchain`,`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`]),kn=e.enum([`purchase`,`pot`,`matured`]),An=e.object({source:kn,chain:e.string(),amount:e.string().regex(/^\d+$/),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),depositId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/).nullable(),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellantUserId:e.string().nullable(),respondent:e.string().regex(/^0x[0-9a-fA-F]{40}$/).nullable(),respondentUserId:e.string().nullable(),reason:e.string().nullable(),filedAt:e.iso.datetime(),resolvedAt:e.iso.datetime().nullable(),resolution:e.object({resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}).nullable(),refundClaimedAt:e.iso.datetime().nullable()}),jn=e.enum([`party`,`admin`,`system`]),Mn=e.object({id:e.string().min(1),senderUserId:e.string().nullable(),senderRole:jn,body:e.string().nullable(),attachments:e.array(H),sentAt:e.iso.datetime()});e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),threadId:e.string().nullable(),status:On,readOnly:e.boolean(),canResolve:e.boolean(),detail:An,messages:e.array(Mn)}),e.object({message:Mn}),e.object({body:e.string().min(1).max(4e3).optional(),attachmentIds:e.array(e.string().min(1)).max(3).optional()}),e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),resolutionId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),outcome:e.int().gte(0).lte(1),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/),status:e.enum([`resolved_refund`,`resolved_dismiss`])}),e.object({decision:e.enum([`refund`,`dismiss`]),notes:e.string().min(1).max(2e3).optional()}),e.object({appealId:e.string().regex(/^0x[0-9a-f]{32}$/),paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),chain:e.string().min(1),chainId:e.int().gt(0),vault:e.string().regex(/^0x[0-9a-fA-F]{40}$/),appellant:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),deadline:e.int().gte(0),signature:e.string().regex(/^0x[0-9a-fA-F]+$/)}),e.object({paymentId:e.string().regex(/^0x[0-9a-f]{32}$/),amount:e.string().regex(/^\d+$/),reason:e.string().min(1).max(2e3)}),e.object({legId:e.string().regex(/^0x[0-9a-f]{32}$/),reason:e.string().min(1).max(2e3)});const Nn=e.object({kind:e.enum([`direct`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/)}),Pn=e.object({kind:e.enum([`pull`]),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/)});e.discriminatedUnion(`kind`,[Nn.extend({kind:e.literal(`direct`)}),Pn.extend({kind:e.literal(`pull`)})]),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),recipientUserId:e.string().min(1).optional(),metadata:v.optional()}),e.object({distributionId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),closePot:e.boolean(),legs:e.array(e.object({recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`])}))}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),closePot:e.boolean().optional().default(!0),legs:e.array(e.object({recipient:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),recipientUserId:e.string().min(1).optional(),amount:e.string().regex(/^\d+$/),settlement:e.enum([`instant`,`locked`]).optional().default(`locked`)})).min(1).max(50),metadata:v.optional()}),e.object({potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/),txHash:e.string().regex(/^0x[0-9a-fA-F]{64}$/),blockNumber:e.string().regex(/^\d+$/)}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),potId:e.string().regex(/^0x[0-9a-fA-F]{32}$/)}),e.object({status:e.enum([`ok`])});const Fn=e.object({id:e.string(),purpose:e.string(),version:e.string(),grantedAt:e.iso.datetime(),withdrawnAt:e.iso.datetime().nullable()}),In=e.object({accountId:e.string(),providerId:e.string(),hasPassword:e.boolean(),scope:e.string().nullable(),createdAt:e.iso.datetime(),updatedAt:e.iso.datetime()}),Ln=e.object({id:e.string(),action:e.string(),targetType:e.string(),targetId:e.string(),purpose:e.string(),legalBasis:e.string(),occurredAt:e.iso.datetime(),traceId:e.string().nullable(),attributes:e.record(e.string(),e.unknown())}),Rn=e.object({id:e.string(),threadId:e.string(),contentMode:e.enum([`plaintext`,`e2e-encrypted`]),body:e.string().nullable(),envelope:e.unknown().optional(),note:e.string().nullable(),sentAt:e.iso.datetime(),editedAt:e.iso.datetime().nullable(),deletedAt:e.iso.datetime().nullable()});e.object({user:c,sessions:e.array(u),consents:e.array(Fn),accounts:e.array(In),auditEvents:e.array(Ln),messages:e.array(Rn),exportedAt:e.iso.datetime()}),e.object({name:t.optional(),image:e.string().min(1).max(2048).nullish()});const zn=e.object({purpose:e.string(),version:e.string(),grantedAt:e.iso.datetime(),withdrawnAt:e.iso.datetime().nullable()});e.object({consents:e.array(zn)});const Bn=e.string().regex(/^[a-z][a-z0-9-]{2,63}$/);e.object({purpose:Bn,version:e.string().min(1).max(64),granted:e.boolean()}),e.object({token:e.string().min(1),callbackURL:e.url().optional()}),e.object({response_type:e.enum([`code`]),client_id:p,redirect_uri:d,scope:f,state:m,code_challenge:te,code_challenge_method:e.enum([`S256`]),prompt:e.enum([`consent`]).optional()}),e.object({request:h}),e.object({client_id:e.string().min(1),return_uri:e.url()}),e.object({clientId:e.string().min(1)}),e.object({chain:e.string().min(1),token:e.string().regex(/^0x[0-9a-fA-F]{40}$/),amount:e.string().regex(/^\d+$/).optional(),usdCents:e.int().gte(0).nullish()}),e.void(),e.void(),e.void(),e.object({genre:e.enum(`adventure.battle_royale.board.cards.casino.casual.fighting.idle.mmo.moba.platformer.prediction.puzzle.racing.rhythm.roguelike.rpg.rts.sandbox.shooter.simulation.sports.strategy.survival.tools.tower_defense.visual_novel.other`.split(`.`)).optional(),q:e.string().min(1).max(200).optional(),before:e.iso.datetime().optional(),limit:e.int().gte(1).lte(48).optional().default(24)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({sort:k.optional(),limit:e.int().gte(1).lte(50).optional().default(10),offset:e.int().gte(0).nullish().default(0)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({slug:e.string().regex(/^[a-z0-9-]{3,40}$/)}),e.object({appId:e.uuid()}),e.object({sort:k.optional(),limit:e.int().gte(1).lte(50).optional().default(10),offset:e.int().gte(0).nullish().default(0)}),e.object({appId:e.uuid(),reviewId:e.uuid()}),e.object({appId:e.uuid(),reviewId:e.uuid()}),e.object({appId:e.uuid()}),e.object({id:e.uuid()}),e.object({status:j.optional(),limit:e.int().gte(1).lte(50).optional().default(20),offset:e.int().gte(0).nullish().default(0)}),e.object({id:e.uuid(),reportId:e.uuid()}),e.object({status:e.enum([`pending`,`completed`,`expired`,`all`]).optional().default(`completed`),limit:e.int().gte(1).lte(100).optional().default(20),before:e.iso.datetime().optional()}),e.object({kind:e.string().optional(),direction:e.enum([`outgoing`,`incoming`]).optional(),sort:e.enum([`newest`,`oldest`,`value_desc`,`value_asc`]).optional().default(`newest`),chain:e.string().min(1).optional(),limit:e.int().gte(1).lte(100).optional().default(20),cursor:e.string().min(1).optional(),before:e.iso.datetime().optional(),includeInactive:e.enum([`true`,`false`]).optional().default(`false`)}),e.object({groupId:e.string().min(1).max(128)}),e.object({chain:e.string().min(1).optional()}),e.object({before:e.iso.datetime().optional()}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({address:e.string().regex(/^0x[0-9a-fA-F]{40}$/)}),e.object({file:e.string()}),e.object({q:e.string().max(200).optional()}),e.union([gt,_t]),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({limit:e.int().gt(0).lte(100).optional(),before:e.iso.datetime().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1)}),e.object({id:e.string().min(1),msgId:e.string().min(1),emoji:B}),e.object({id:e.string().min(1),msgId:e.string().min(1),emoji:B}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({regenerate:e.boolean().optional()}),e.object({code:e.string().min(1).max(64)}),e.object({days:e.int().gt(0).lte(366).optional().default(30)}),e.object({appId:e.uuid()}),e.object({days:e.int().gt(0).lte(366).optional().default(30)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({handle:e.string().min(1)}),e.object({q:e.string().min(1).max(64),limit:e.int().gte(1).lte(50).optional().default(20)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({file:e.string()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({range:e.string().optional(),chain:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({range:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({kind:e.string().optional(),direction:e.enum([`outgoing`,`incoming`]).optional(),sort:e.enum([`newest`,`oldest`,`value_desc`,`value_asc`]).optional().default(`newest`),chain:e.string().min(1).optional(),limit:e.int().gte(1).lte(100).optional().default(20),cursor:e.string().min(1).optional(),before:e.iso.datetime().optional(),includeInactive:e.enum([`true`,`false`]).optional().default(`false`)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({token:e.string().regex(/^0x[0-9a-fA-F]{40}$/).optional()}),e.object({id:e.string().min(1),chain:e.string().min(1)}),e.object({id:e.string().min(1),env:e.enum([`development`,`production`])}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({chain:e.string().optional()}),e.object({chain:e.string().optional()}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1),userId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({file:e.string()}),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({bannerUrl:e.url()}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({thumbnailUrl:e.url()}),e.object({appId:e.string().min(1)}),e.void(),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({thumbnailVideoUrl:e.url()}),e.object({file:e.string()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({id:e.string().min(1)}),e.object({search:e.string().optional(),offset:e.int().gte(0).nullish(),limit:e.int().gt(0).lte(100).optional()}),e.object({id:e.string().min(1)}),e.object({action:e.string().optional(),actorId:e.string().optional(),targetType:e.string().optional(),targetId:e.string().optional(),offset:e.int().gte(0).nullish(),limit:e.int().gt(0).lte(100).optional()}),e.object({status:e.enum([`pending`,`approved`,`rejected`,`cancelled`]).optional(),kind:e.enum([`role`,`production`]).optional()}),e.object({id:e.string().min(1)}),e.object({status:e.union([e.enum([`draft`,`pending_review`,`published`,`hidden`]),e.enum([`all`]),e.enum([`pending_changes`])]).optional()}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({appId:e.string().min(1)}),e.object({processorId:e.string().min(1)}),e.object({chain:e.string().min(1).optional()}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({vaultAddress:e.string().min(1)}),e.object({status:e.array(e.enum([`open`,`resolved_refund`,`resolved_dismiss`,`cancelled`,`force_cancelled`])).optional(),chain:e.string().min(1).optional(),cursorFiledAt:e.iso.datetime().optional(),limit:e.int().gte(1).lte(100).optional()}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({file:e.string()}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({appealId:e.string().min(1)}),e.object({file:e.string()}),e.object({appealId:e.string().min(1)}),e.void(),e.void();const Vn=e.object({event:e.enum([`intent.completed`,`intent.denied`,`intent.expired`,`intent.txhash_indexed`]),deliveredAt:e.iso.datetime(),intent:ce});async function Hn(e){let t=e.signatureHeader;if(typeof t!=`string`||t===``)return{ok:!1,reason:`missing_signature`};let n=e.timestampHeader;if(typeof n!=`string`||n===``)return{ok:!1,reason:`missing_timestamp`};let r=Number(n);if(!Number.isFinite(r)||r<=0)return{ok:!1,reason:`invalid_timestamp`};let i=e.toleranceSeconds??300,a=Math.floor((e.now??Date.now())/1e3);if(Math.abs(a-r)>i)return{ok:!1,reason:`stale_timestamp`};if(!Wn(await Un(e.secret,`${n}.${e.rawBody}`),t))return{ok:!1,reason:`signature_mismatch`};let o;try{o=JSON.parse(e.rawBody)}catch{return{ok:!1,reason:`schema_mismatch`}}let s=Vn.safeParse(o);return s.success?{ok:!0,body:s.data}:{ok:!1,reason:`schema_mismatch`}}async function Un(e,t){let n=new TextEncoder,r=await crypto.subtle.importKey(`raw`,n.encode(e),{name:`HMAC`,hash:`SHA-256`},!1,[`sign`]),i=await crypto.subtle.sign(`HMAC`,r,n.encode(t)),a=new Uint8Array(i),o=``;for(let e of a)o+=e.toString(16).padStart(2,`0`);return o}function Wn(e,t){let n=e.toLowerCase(),r=t.toLowerCase();if(n.length!==r.length)return!1;let i=0;for(let e=0;e<n.length;e++)i|=n.charCodeAt(e)^r.charCodeAt(e);return i===0}function Gn(e){return async(t,n)=>{let r=await Kn(t,e.getRawBody),i=await Hn({secret:e.secret,rawBody:r,signatureHeader:qn(t.headers[`x-metatron-signature`]),timestampHeader:qn(t.headers[`x-metatron-timestamp`]),toleranceSeconds:e.toleranceSeconds});if(!i.ok){if(e.onInvalid!==void 0){await e.onInvalid(t,n,i);return}n.code(400).send({error:`invalid_webhook`,reason:i.reason});return}t.tronWebhook=i.body}}async function Kn(e,t){if(t!==void 0)return await t(e);if(typeof e.rawBody==`string`)return e.rawBody;if(e.rawBody instanceof Uint8Array)return new TextDecoder().decode(e.rawBody);throw TypeError("@metatrongg/sdk: fastify webhook preHandler needs a raw body; register @fastify/raw-body or pass `getRawBody`")}function qn(e){return e===void 0?null:typeof e==`string`?e:e[0]??null}export{Gn as createMetatronWebhookFastifyPreHandler};
|