@pafi-dev/issuer 0.5.3 → 0.5.5

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/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
2
- import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, ReceiverConsent, PathKey, PoolKey } from '@pafi-dev/core';
2
+ import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey } from '@pafi-dev/core';
3
3
 
4
4
  /**
5
5
  * Lifecycle of a minting request as tracked by the issuer's point ledger.
@@ -802,6 +802,12 @@ interface ApiConfigResponse {
802
802
  }
803
803
  interface ApiNonceResponse {
804
804
  nonce: string;
805
+ /**
806
+ * Complete EIP-4361 message, ready to pass directly to `wallet.signMessage()`.
807
+ * Built by the controller using `createLoginMessage()` — requires the caller's
808
+ * `walletAddress`, so it cannot be constructed inside the handler itself.
809
+ */
810
+ message?: string;
805
811
  }
806
812
  interface ApiLoginRequest {
807
813
  message: string;
@@ -854,32 +860,46 @@ interface ApiUserResponse {
854
860
  balance: bigint;
855
861
  isMinter: boolean;
856
862
  }
857
- /** @deprecated Since 0.3.0 — use `ApiClaimRequest` (mint-only) instead. Removed in 2.0. */
858
- interface ApiClaimAndSwapRequest {
859
- chainId: number;
860
- pointTokenAddress: Address;
861
- /**
862
- * EIP-712 domain for the point token. Frontends read this once (via
863
- * `PafiSDK.getDomain()` or a direct contract call) and include it on
864
- * every claim request so the backend doesn't need to re-read it.
865
- */
866
- domain: PointTokenDomainConfig;
867
- /** The full signed ReceiverConsent message. */
868
- receiverConsent: ReceiverConsent;
869
- /** Detached EIP-712 signature (`serialized` form from `@pafi/core`). */
870
- receiverSignature: Hex;
871
- /** Swap hop(s) from pointToken → USDT. */
872
- swapPath: PathKey[];
873
- /** Unix seconds. */
874
- swapDeadline: bigint;
875
- }
876
- /** @deprecated Since 0.3.0 — use `ApiClaimResponse` instead. Removed in 2.0. */
877
- interface ApiClaimAndSwapResponse {
878
- txHash: Hex;
863
+ interface ApiRedeemRequest {
864
+ userAddress: Address;
865
+ /** PT amount to burn. */
866
+ amount: bigint;
867
+ /** ERC-4337 account nonce for the user's EOA. */
868
+ aaNonce: bigint;
869
+ }
870
+ interface ApiRedeemResponse {
871
+ /** Pending credit lock id — poll `/user` to track PENDING → CREDITED. */
879
872
  lockId: string;
880
- blockNumber?: bigint;
881
- gasUsed?: bigint;
873
+ /** Unsigned UserOp — attach paymaster data + user signature, then submit. */
874
+ userOp: PartialUserOperation;
875
+ /** Seconds until the pending credit lock expires if the burn doesn't land. */
876
+ expiresInSeconds: number;
877
+ /** BurnRequest deadline (unix seconds) — FE can surface a countdown. */
878
+ signatureDeadline: bigint;
882
879
  }
880
+ interface ApiTopUpRequest {
881
+ userAddress: Address;
882
+ /** Total points the voucher requires off-chain. */
883
+ requiredAmount: bigint;
884
+ /** ERC-4337 account nonce for the user's EOA. */
885
+ aaNonce: bigint;
886
+ }
887
+ type ApiTopUpResponse = {
888
+ /** Off-chain balance already covers the required amount — no burn needed. */
889
+ action: "NO_TOP_UP_NEEDED";
890
+ offChainBalance: bigint;
891
+ } | {
892
+ /** Combined off-chain + on-chain is still insufficient — cannot fulfill. */
893
+ action: "INSUFFICIENT_ONCHAIN";
894
+ offChainBalance: bigint;
895
+ onChainBalance: bigint;
896
+ shortfall: bigint;
897
+ } | {
898
+ /** Burn of `shortfall` PT initiated — FE submits the returned UserOp. */
899
+ action: "TOP_UP_STARTED";
900
+ shortfall: bigint;
901
+ redeem: ApiRedeemResponse;
902
+ };
883
903
  interface ApiClaimRequest {
884
904
  chainId: number;
885
905
  pointTokenAddress: Address;
@@ -901,27 +921,6 @@ interface ApiClaimResponse {
901
921
  /** Seconds until the off-chain lock expires if the UserOp is not submitted. */
902
922
  expiresInSeconds: number;
903
923
  }
904
- interface ApiBuildConsentTypedDataRequest {
905
- chainId: number;
906
- pointTokenAddress: Address;
907
- receiverConsent: ReceiverConsent;
908
- }
909
- interface ApiBuildConsentTypedDataResponse {
910
- typedData: {
911
- domain: {
912
- name: string;
913
- version: string;
914
- chainId: number;
915
- verifyingContract: Address;
916
- };
917
- types: Record<string, {
918
- name: string;
919
- type: string;
920
- }[]>;
921
- primaryType: string;
922
- message: Record<string, unknown>;
923
- };
924
- }
925
924
  type PoolsProvider = (request: ApiPoolsRequest) => Promise<ApiPoolsResponse>;
926
925
 
927
926
  interface IssuerApiHandlersConfig {
@@ -1023,20 +1022,6 @@ declare class IssuerApiHandlers {
1023
1022
  * balance.
1024
1023
  */
1025
1024
  handleUser(userAddress: Address, request: ApiUserRequest): Promise<ApiUserResponse>;
1026
- /**
1027
- * `POST /build-consent-typed-data`
1028
- *
1029
- * Backend builds the full EIP-712 typed data payload for a
1030
- * ReceiverConsent message. The domain (name, version, chainId,
1031
- * verifyingContract) is read from the PointToken contract — mobile
1032
- * never needs to know or hardcode these values. Forward the
1033
- * response directly to `wallet.signTypedData()`.
1034
- *
1035
- * This ensures a single source of truth for domain + types, and
1036
- * makes contract upgrades (domain version bump) transparent to
1037
- * mobile apps — no app store review needed.
1038
- */
1039
- handleBuildConsentTypedData(userAddress: Address, request: ApiBuildConsentTypedDataRequest): Promise<ApiBuildConsentTypedDataResponse>;
1040
1025
  /**
1041
1026
  * `POST /claim`
1042
1027
  *
@@ -1587,4 +1572,4 @@ declare function createIssuerService(config: IssuerServiceConfig): IssuerService
1587
1572
  /** SDK package version — bumped on every release */
1588
1573
  declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
1589
1574
 
1590
- export { type ApiBuildConsentTypedDataRequest, type ApiBuildConsentTypedDataResponse, type ApiClaimAndSwapRequest, type ApiClaimAndSwapResponse, type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type IIndexerCursorStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerService, type IssuerServiceConfig, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintingStatus, NonceManager, PAFI_ISSUER_SDK_VERSION, PAFI_SUBGRAPH_URL, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, RelayError, type RelayErrorCode, RelayService, type RetryConfig, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider };
1575
+ export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type IIndexerCursorStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerService, type IssuerServiceConfig, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintingStatus, NonceManager, PAFI_ISSUER_SDK_VERSION, PAFI_SUBGRAPH_URL, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, RelayError, type RelayErrorCode, RelayService, type RetryConfig, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Address, Hex, PublicClient, WalletClient } from 'viem';
2
- import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, ReceiverConsent, PathKey, PoolKey } from '@pafi-dev/core';
2
+ import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey } from '@pafi-dev/core';
3
3
 
4
4
  /**
5
5
  * Lifecycle of a minting request as tracked by the issuer's point ledger.
@@ -802,6 +802,12 @@ interface ApiConfigResponse {
802
802
  }
803
803
  interface ApiNonceResponse {
804
804
  nonce: string;
805
+ /**
806
+ * Complete EIP-4361 message, ready to pass directly to `wallet.signMessage()`.
807
+ * Built by the controller using `createLoginMessage()` — requires the caller's
808
+ * `walletAddress`, so it cannot be constructed inside the handler itself.
809
+ */
810
+ message?: string;
805
811
  }
806
812
  interface ApiLoginRequest {
807
813
  message: string;
@@ -854,32 +860,46 @@ interface ApiUserResponse {
854
860
  balance: bigint;
855
861
  isMinter: boolean;
856
862
  }
857
- /** @deprecated Since 0.3.0 — use `ApiClaimRequest` (mint-only) instead. Removed in 2.0. */
858
- interface ApiClaimAndSwapRequest {
859
- chainId: number;
860
- pointTokenAddress: Address;
861
- /**
862
- * EIP-712 domain for the point token. Frontends read this once (via
863
- * `PafiSDK.getDomain()` or a direct contract call) and include it on
864
- * every claim request so the backend doesn't need to re-read it.
865
- */
866
- domain: PointTokenDomainConfig;
867
- /** The full signed ReceiverConsent message. */
868
- receiverConsent: ReceiverConsent;
869
- /** Detached EIP-712 signature (`serialized` form from `@pafi/core`). */
870
- receiverSignature: Hex;
871
- /** Swap hop(s) from pointToken → USDT. */
872
- swapPath: PathKey[];
873
- /** Unix seconds. */
874
- swapDeadline: bigint;
875
- }
876
- /** @deprecated Since 0.3.0 — use `ApiClaimResponse` instead. Removed in 2.0. */
877
- interface ApiClaimAndSwapResponse {
878
- txHash: Hex;
863
+ interface ApiRedeemRequest {
864
+ userAddress: Address;
865
+ /** PT amount to burn. */
866
+ amount: bigint;
867
+ /** ERC-4337 account nonce for the user's EOA. */
868
+ aaNonce: bigint;
869
+ }
870
+ interface ApiRedeemResponse {
871
+ /** Pending credit lock id — poll `/user` to track PENDING → CREDITED. */
879
872
  lockId: string;
880
- blockNumber?: bigint;
881
- gasUsed?: bigint;
873
+ /** Unsigned UserOp — attach paymaster data + user signature, then submit. */
874
+ userOp: PartialUserOperation;
875
+ /** Seconds until the pending credit lock expires if the burn doesn't land. */
876
+ expiresInSeconds: number;
877
+ /** BurnRequest deadline (unix seconds) — FE can surface a countdown. */
878
+ signatureDeadline: bigint;
882
879
  }
880
+ interface ApiTopUpRequest {
881
+ userAddress: Address;
882
+ /** Total points the voucher requires off-chain. */
883
+ requiredAmount: bigint;
884
+ /** ERC-4337 account nonce for the user's EOA. */
885
+ aaNonce: bigint;
886
+ }
887
+ type ApiTopUpResponse = {
888
+ /** Off-chain balance already covers the required amount — no burn needed. */
889
+ action: "NO_TOP_UP_NEEDED";
890
+ offChainBalance: bigint;
891
+ } | {
892
+ /** Combined off-chain + on-chain is still insufficient — cannot fulfill. */
893
+ action: "INSUFFICIENT_ONCHAIN";
894
+ offChainBalance: bigint;
895
+ onChainBalance: bigint;
896
+ shortfall: bigint;
897
+ } | {
898
+ /** Burn of `shortfall` PT initiated — FE submits the returned UserOp. */
899
+ action: "TOP_UP_STARTED";
900
+ shortfall: bigint;
901
+ redeem: ApiRedeemResponse;
902
+ };
883
903
  interface ApiClaimRequest {
884
904
  chainId: number;
885
905
  pointTokenAddress: Address;
@@ -901,27 +921,6 @@ interface ApiClaimResponse {
901
921
  /** Seconds until the off-chain lock expires if the UserOp is not submitted. */
902
922
  expiresInSeconds: number;
903
923
  }
904
- interface ApiBuildConsentTypedDataRequest {
905
- chainId: number;
906
- pointTokenAddress: Address;
907
- receiverConsent: ReceiverConsent;
908
- }
909
- interface ApiBuildConsentTypedDataResponse {
910
- typedData: {
911
- domain: {
912
- name: string;
913
- version: string;
914
- chainId: number;
915
- verifyingContract: Address;
916
- };
917
- types: Record<string, {
918
- name: string;
919
- type: string;
920
- }[]>;
921
- primaryType: string;
922
- message: Record<string, unknown>;
923
- };
924
- }
925
924
  type PoolsProvider = (request: ApiPoolsRequest) => Promise<ApiPoolsResponse>;
926
925
 
927
926
  interface IssuerApiHandlersConfig {
@@ -1023,20 +1022,6 @@ declare class IssuerApiHandlers {
1023
1022
  * balance.
1024
1023
  */
1025
1024
  handleUser(userAddress: Address, request: ApiUserRequest): Promise<ApiUserResponse>;
1026
- /**
1027
- * `POST /build-consent-typed-data`
1028
- *
1029
- * Backend builds the full EIP-712 typed data payload for a
1030
- * ReceiverConsent message. The domain (name, version, chainId,
1031
- * verifyingContract) is read from the PointToken contract — mobile
1032
- * never needs to know or hardcode these values. Forward the
1033
- * response directly to `wallet.signTypedData()`.
1034
- *
1035
- * This ensures a single source of truth for domain + types, and
1036
- * makes contract upgrades (domain version bump) transparent to
1037
- * mobile apps — no app store review needed.
1038
- */
1039
- handleBuildConsentTypedData(userAddress: Address, request: ApiBuildConsentTypedDataRequest): Promise<ApiBuildConsentTypedDataResponse>;
1040
1025
  /**
1041
1026
  * `POST /claim`
1042
1027
  *
@@ -1587,4 +1572,4 @@ declare function createIssuerService(config: IssuerServiceConfig): IssuerService
1587
1572
  /** SDK package version — bumped on every release */
1588
1573
  declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
1589
1574
 
1590
- export { type ApiBuildConsentTypedDataRequest, type ApiBuildConsentTypedDataResponse, type ApiClaimAndSwapRequest, type ApiClaimAndSwapResponse, type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type IIndexerCursorStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerService, type IssuerServiceConfig, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintingStatus, NonceManager, PAFI_ISSUER_SDK_VERSION, PAFI_SUBGRAPH_URL, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, RelayError, type RelayErrorCode, RelayService, type RetryConfig, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider };
1575
+ export { type ApiClaimRequest, type ApiClaimResponse, type ApiConfigResponse, type ApiGasFeeResponse, type ApiLoginRequest, type ApiLoginResponse, type ApiNonceResponse, type ApiPoolsRequest, type ApiPoolsResponse, type ApiRedeemRequest, type ApiRedeemResponse, type ApiTopUpRequest, type ApiTopUpResponse, type ApiUserRequest, type ApiUserResponse, type AuthContext, AuthError, type AuthErrorCode, AuthService, type AuthServiceConfig, BalanceAggregator, type BalanceAggregatorConfig, type BurnEvent, BurnIndexer, type BurnIndexerConfig, type CombinedBalance, DefaultPolicyEngine, type DefaultPolicyEngineOptions, FeeManager, type FeeManagerConfig, type IIndexerCursorStore, type IPointLedger, type IPolicyEngine, type ISessionStore, InMemoryCursorStore, IssuerApiHandlers, type IssuerApiHandlersConfig, type IssuerService, type IssuerServiceConfig, type LockedMintRequest, type LoginResult, MemorySessionStore, type MemorySessionStoreOptions, type MintEvent, type MintingStatus, NonceManager, PAFI_ISSUER_SDK_VERSION, PAFI_SUBGRAPH_URL, PTRedeemError, PTRedeemHandler, type PTRedeemHandlerConfig, type PTRedeemRequest, type PTRedeemResponse, PafiBackendClient, type PafiBackendConfig, PafiBackendError, type PafiBackendErrorCode, PointIndexer, type PointIndexerConfig, type PolicyDecision, type PolicyEvalRequest, type PoolsProvider, type PrepareBurnDirectParams, type PrepareBurnParams, type PrepareBurnWithSigParams, type PrepareMintParams, RelayError, type RelayErrorCode, RelayService, type RetryConfig, type Session, type SponsorshipRequest, type SponsorshipResponse, type SponsorshipTarget, type SponsorshipUserOp, type SubgraphNativeUsdtQuoterConfig, type SubgraphPoolsProviderConfig, TopUpRedemptionError, TopUpRedemptionHandler, type TopUpRedemptionHandlerConfig, type TopUpRedemptionRequest, type TopUpRedemptionResponse, authenticateRequest, createIssuerService, createSubgraphNativeUsdtQuoter, createSubgraphPoolsProvider };
package/dist/index.js CHANGED
@@ -983,8 +983,7 @@ import {
983
983
  getPointTokenBalance,
984
984
  getReceiverConsentNonce,
985
985
  getTokenName,
986
- isMinter,
987
- buildReceiverConsentTypedData
986
+ isMinter
988
987
  } from "@pafi-dev/core";
989
988
  var IssuerApiHandlers = class {
990
989
  authService;
@@ -1152,60 +1151,6 @@ var IssuerApiHandlers = class {
1152
1151
  isMinter: minter
1153
1152
  };
1154
1153
  }
1155
- /**
1156
- * `POST /build-consent-typed-data`
1157
- *
1158
- * Backend builds the full EIP-712 typed data payload for a
1159
- * ReceiverConsent message. The domain (name, version, chainId,
1160
- * verifyingContract) is read from the PointToken contract — mobile
1161
- * never needs to know or hardcode these values. Forward the
1162
- * response directly to `wallet.signTypedData()`.
1163
- *
1164
- * This ensures a single source of truth for domain + types, and
1165
- * makes contract upgrades (domain version bump) transparent to
1166
- * mobile apps — no app store review needed.
1167
- */
1168
- async handleBuildConsentTypedData(userAddress, request) {
1169
- if (request.chainId !== this.chainId) {
1170
- throw new Error(
1171
- `handleBuildConsentTypedData: unsupported chainId ${request.chainId}`
1172
- );
1173
- }
1174
- const pointToken = getAddress5(request.pointTokenAddress);
1175
- if (!this.supportedTokens.has(pointToken)) {
1176
- throw new Error(
1177
- `handleBuildConsentTypedData: unsupported pointToken ${pointToken}`
1178
- );
1179
- }
1180
- const consent = request.receiverConsent;
1181
- if (getAddress5(consent.originalReceiver) !== getAddress5(userAddress)) {
1182
- throw new Error(
1183
- "handleBuildConsentTypedData: receiverConsent.originalReceiver must match authenticated user"
1184
- );
1185
- }
1186
- if (consent.amount <= 0n) {
1187
- throw new Error("handleBuildConsentTypedData: amount must be positive");
1188
- }
1189
- const nowSecs = BigInt(Math.floor(Date.now() / 1e3));
1190
- if (consent.deadline <= nowSecs) {
1191
- throw new Error("handleBuildConsentTypedData: deadline is in the past");
1192
- }
1193
- const name = await getTokenName(this.provider, pointToken);
1194
- const domain = {
1195
- name,
1196
- verifyingContract: pointToken,
1197
- chainId: this.chainId
1198
- };
1199
- const typedData = buildReceiverConsentTypedData(domain, consent);
1200
- return {
1201
- typedData: {
1202
- domain: typedData.domain,
1203
- types: typedData.types,
1204
- primaryType: typedData.primaryType,
1205
- message: typedData.message
1206
- }
1207
- };
1208
- }
1209
1154
  /**
1210
1155
  * `POST /claim`
1211
1156
  *