@pafi-dev/issuer 0.5.4 → 0.5.6
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.cjs +8 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -63
- package/dist/index.d.ts +47 -63
- package/dist/index.js +2 -57
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest,
|
|
2
|
+
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey } from '@pafi-dev/core';
|
|
3
|
+
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Lifecycle of a minting request as tracked by the issuer's point ledger.
|
|
@@ -802,6 +803,12 @@ interface ApiConfigResponse {
|
|
|
802
803
|
}
|
|
803
804
|
interface ApiNonceResponse {
|
|
804
805
|
nonce: string;
|
|
806
|
+
/**
|
|
807
|
+
* Complete EIP-4361 message, ready to pass directly to `wallet.signMessage()`.
|
|
808
|
+
* Built by the controller using `createLoginMessage()` — requires the caller's
|
|
809
|
+
* `walletAddress`, so it cannot be constructed inside the handler itself.
|
|
810
|
+
*/
|
|
811
|
+
message?: string;
|
|
805
812
|
}
|
|
806
813
|
interface ApiLoginRequest {
|
|
807
814
|
message: string;
|
|
@@ -854,32 +861,46 @@ interface ApiUserResponse {
|
|
|
854
861
|
balance: bigint;
|
|
855
862
|
isMinter: boolean;
|
|
856
863
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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;
|
|
864
|
+
interface ApiRedeemRequest {
|
|
865
|
+
userAddress: Address;
|
|
866
|
+
/** PT amount to burn. */
|
|
867
|
+
amount: bigint;
|
|
868
|
+
/** ERC-4337 account nonce for the user's EOA. */
|
|
869
|
+
aaNonce: bigint;
|
|
870
|
+
}
|
|
871
|
+
interface ApiRedeemResponse {
|
|
872
|
+
/** Pending credit lock id — poll `/user` to track PENDING → CREDITED. */
|
|
879
873
|
lockId: string;
|
|
880
|
-
|
|
881
|
-
|
|
874
|
+
/** Unsigned UserOp — attach paymaster data + user signature, then submit. */
|
|
875
|
+
userOp: PartialUserOperation;
|
|
876
|
+
/** Seconds until the pending credit lock expires if the burn doesn't land. */
|
|
877
|
+
expiresInSeconds: number;
|
|
878
|
+
/** BurnRequest deadline (unix seconds) — FE can surface a countdown. */
|
|
879
|
+
signatureDeadline: bigint;
|
|
882
880
|
}
|
|
881
|
+
interface ApiTopUpRequest {
|
|
882
|
+
userAddress: Address;
|
|
883
|
+
/** Total points the voucher requires off-chain. */
|
|
884
|
+
requiredAmount: bigint;
|
|
885
|
+
/** ERC-4337 account nonce for the user's EOA. */
|
|
886
|
+
aaNonce: bigint;
|
|
887
|
+
}
|
|
888
|
+
type ApiTopUpResponse = {
|
|
889
|
+
/** Off-chain balance already covers the required amount — no burn needed. */
|
|
890
|
+
action: "NO_TOP_UP_NEEDED";
|
|
891
|
+
offChainBalance: bigint;
|
|
892
|
+
} | {
|
|
893
|
+
/** Combined off-chain + on-chain is still insufficient — cannot fulfill. */
|
|
894
|
+
action: "INSUFFICIENT_ONCHAIN";
|
|
895
|
+
offChainBalance: bigint;
|
|
896
|
+
onChainBalance: bigint;
|
|
897
|
+
shortfall: bigint;
|
|
898
|
+
} | {
|
|
899
|
+
/** Burn of `shortfall` PT initiated — FE submits the returned UserOp. */
|
|
900
|
+
action: "TOP_UP_STARTED";
|
|
901
|
+
shortfall: bigint;
|
|
902
|
+
redeem: ApiRedeemResponse;
|
|
903
|
+
};
|
|
883
904
|
interface ApiClaimRequest {
|
|
884
905
|
chainId: number;
|
|
885
906
|
pointTokenAddress: Address;
|
|
@@ -901,27 +922,6 @@ interface ApiClaimResponse {
|
|
|
901
922
|
/** Seconds until the off-chain lock expires if the UserOp is not submitted. */
|
|
902
923
|
expiresInSeconds: number;
|
|
903
924
|
}
|
|
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
925
|
type PoolsProvider = (request: ApiPoolsRequest) => Promise<ApiPoolsResponse>;
|
|
926
926
|
|
|
927
927
|
interface IssuerApiHandlersConfig {
|
|
@@ -1023,20 +1023,6 @@ declare class IssuerApiHandlers {
|
|
|
1023
1023
|
* balance.
|
|
1024
1024
|
*/
|
|
1025
1025
|
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
1026
|
/**
|
|
1041
1027
|
* `POST /claim`
|
|
1042
1028
|
*
|
|
@@ -1222,8 +1208,6 @@ declare class TopUpRedemptionHandler {
|
|
|
1222
1208
|
handle(request: TopUpRedemptionRequest): Promise<TopUpRedemptionResponse>;
|
|
1223
1209
|
}
|
|
1224
1210
|
|
|
1225
|
-
/** PAFI-hosted subgraph endpoint. Used as the default for all subgraph helpers. */
|
|
1226
|
-
declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v2";
|
|
1227
1211
|
/**
|
|
1228
1212
|
* Config for `createSubgraphPoolsProvider`.
|
|
1229
1213
|
*/
|
|
@@ -1587,4 +1571,4 @@ declare function createIssuerService(config: IssuerServiceConfig): IssuerService
|
|
|
1587
1571
|
/** SDK package version — bumped on every release */
|
|
1588
1572
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
1589
1573
|
|
|
1590
|
-
export { type
|
|
1574
|
+
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, 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,6 @@
|
|
|
1
1
|
import { Address, Hex, PublicClient, WalletClient } from 'viem';
|
|
2
|
-
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest,
|
|
2
|
+
import { PointTokenDomainConfig, PartialUserOperation, BurnRequest, PoolKey } from '@pafi-dev/core';
|
|
3
|
+
export { PAFI_SUBGRAPH_URL } from '@pafi-dev/core';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Lifecycle of a minting request as tracked by the issuer's point ledger.
|
|
@@ -802,6 +803,12 @@ interface ApiConfigResponse {
|
|
|
802
803
|
}
|
|
803
804
|
interface ApiNonceResponse {
|
|
804
805
|
nonce: string;
|
|
806
|
+
/**
|
|
807
|
+
* Complete EIP-4361 message, ready to pass directly to `wallet.signMessage()`.
|
|
808
|
+
* Built by the controller using `createLoginMessage()` — requires the caller's
|
|
809
|
+
* `walletAddress`, so it cannot be constructed inside the handler itself.
|
|
810
|
+
*/
|
|
811
|
+
message?: string;
|
|
805
812
|
}
|
|
806
813
|
interface ApiLoginRequest {
|
|
807
814
|
message: string;
|
|
@@ -854,32 +861,46 @@ interface ApiUserResponse {
|
|
|
854
861
|
balance: bigint;
|
|
855
862
|
isMinter: boolean;
|
|
856
863
|
}
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
/**
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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;
|
|
864
|
+
interface ApiRedeemRequest {
|
|
865
|
+
userAddress: Address;
|
|
866
|
+
/** PT amount to burn. */
|
|
867
|
+
amount: bigint;
|
|
868
|
+
/** ERC-4337 account nonce for the user's EOA. */
|
|
869
|
+
aaNonce: bigint;
|
|
870
|
+
}
|
|
871
|
+
interface ApiRedeemResponse {
|
|
872
|
+
/** Pending credit lock id — poll `/user` to track PENDING → CREDITED. */
|
|
879
873
|
lockId: string;
|
|
880
|
-
|
|
881
|
-
|
|
874
|
+
/** Unsigned UserOp — attach paymaster data + user signature, then submit. */
|
|
875
|
+
userOp: PartialUserOperation;
|
|
876
|
+
/** Seconds until the pending credit lock expires if the burn doesn't land. */
|
|
877
|
+
expiresInSeconds: number;
|
|
878
|
+
/** BurnRequest deadline (unix seconds) — FE can surface a countdown. */
|
|
879
|
+
signatureDeadline: bigint;
|
|
882
880
|
}
|
|
881
|
+
interface ApiTopUpRequest {
|
|
882
|
+
userAddress: Address;
|
|
883
|
+
/** Total points the voucher requires off-chain. */
|
|
884
|
+
requiredAmount: bigint;
|
|
885
|
+
/** ERC-4337 account nonce for the user's EOA. */
|
|
886
|
+
aaNonce: bigint;
|
|
887
|
+
}
|
|
888
|
+
type ApiTopUpResponse = {
|
|
889
|
+
/** Off-chain balance already covers the required amount — no burn needed. */
|
|
890
|
+
action: "NO_TOP_UP_NEEDED";
|
|
891
|
+
offChainBalance: bigint;
|
|
892
|
+
} | {
|
|
893
|
+
/** Combined off-chain + on-chain is still insufficient — cannot fulfill. */
|
|
894
|
+
action: "INSUFFICIENT_ONCHAIN";
|
|
895
|
+
offChainBalance: bigint;
|
|
896
|
+
onChainBalance: bigint;
|
|
897
|
+
shortfall: bigint;
|
|
898
|
+
} | {
|
|
899
|
+
/** Burn of `shortfall` PT initiated — FE submits the returned UserOp. */
|
|
900
|
+
action: "TOP_UP_STARTED";
|
|
901
|
+
shortfall: bigint;
|
|
902
|
+
redeem: ApiRedeemResponse;
|
|
903
|
+
};
|
|
883
904
|
interface ApiClaimRequest {
|
|
884
905
|
chainId: number;
|
|
885
906
|
pointTokenAddress: Address;
|
|
@@ -901,27 +922,6 @@ interface ApiClaimResponse {
|
|
|
901
922
|
/** Seconds until the off-chain lock expires if the UserOp is not submitted. */
|
|
902
923
|
expiresInSeconds: number;
|
|
903
924
|
}
|
|
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
925
|
type PoolsProvider = (request: ApiPoolsRequest) => Promise<ApiPoolsResponse>;
|
|
926
926
|
|
|
927
927
|
interface IssuerApiHandlersConfig {
|
|
@@ -1023,20 +1023,6 @@ declare class IssuerApiHandlers {
|
|
|
1023
1023
|
* balance.
|
|
1024
1024
|
*/
|
|
1025
1025
|
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
1026
|
/**
|
|
1041
1027
|
* `POST /claim`
|
|
1042
1028
|
*
|
|
@@ -1222,8 +1208,6 @@ declare class TopUpRedemptionHandler {
|
|
|
1222
1208
|
handle(request: TopUpRedemptionRequest): Promise<TopUpRedemptionResponse>;
|
|
1223
1209
|
}
|
|
1224
1210
|
|
|
1225
|
-
/** PAFI-hosted subgraph endpoint. Used as the default for all subgraph helpers. */
|
|
1226
|
-
declare const PAFI_SUBGRAPH_URL = "https://graph-base-mainnet.pacificfinance.org/subgraphs/name/pafi-subgraph-v2";
|
|
1227
1211
|
/**
|
|
1228
1212
|
* Config for `createSubgraphPoolsProvider`.
|
|
1229
1213
|
*/
|
|
@@ -1587,4 +1571,4 @@ declare function createIssuerService(config: IssuerServiceConfig): IssuerService
|
|
|
1587
1571
|
/** SDK package version — bumped on every release */
|
|
1588
1572
|
declare const PAFI_ISSUER_SDK_VERSION = "0.4.0";
|
|
1589
1573
|
|
|
1590
|
-
export { type
|
|
1574
|
+
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, 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
|
*
|
|
@@ -1499,7 +1444,7 @@ var TopUpRedemptionHandler = class {
|
|
|
1499
1444
|
|
|
1500
1445
|
// src/pools/subgraphPoolsProvider.ts
|
|
1501
1446
|
import { isAddress } from "viem";
|
|
1502
|
-
|
|
1447
|
+
import { PAFI_SUBGRAPH_URL } from "@pafi-dev/core";
|
|
1503
1448
|
var DEFAULT_CACHE_TTL_MS = 3e4;
|
|
1504
1449
|
var POOL_QUERY = `
|
|
1505
1450
|
query GetPoolForPointToken($id: ID!) {
|