@pafi-dev/core 0.5.4 → 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/abi/index.d.cts +2194 -0
- package/dist/abi/index.d.ts +2194 -0
- package/dist/auth/index.d.cts +151 -0
- package/dist/auth/index.d.ts +151 -0
- package/dist/{chunk-HZTR4RHR.js → chunk-GFJDSSDW.js} +47 -1
- package/dist/chunk-GFJDSSDW.js.map +1 -0
- package/dist/chunk-OQIQXDHW.cjs +171 -0
- package/dist/chunk-OQIQXDHW.cjs.map +1 -0
- package/dist/contract/index.cjs +2 -2
- package/dist/contract/index.d.cts +22 -0
- package/dist/contract/index.d.ts +22 -0
- package/dist/contract/index.js +1 -1
- package/dist/eip712/index.d.cts +125 -0
- package/dist/eip712/index.d.ts +125 -0
- package/dist/index-BEx-Q1bW.d.cts +227 -0
- package/dist/index-r4xCdQO7.d.ts +227 -0
- package/dist/index.cjs +6 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1646 -0
- package/dist/index.d.ts +1646 -0
- package/dist/index.js +2 -46
- package/dist/index.js.map +1 -1
- package/dist/quoting/index.d.cts +59 -0
- package/dist/quoting/index.d.ts +59 -0
- package/dist/swap/index.d.cts +3 -0
- package/dist/swap/index.d.ts +3 -0
- package/dist/types-b5_Tokjl.d.cts +89 -0
- package/dist/types-b5_Tokjl.d.ts +89 -0
- package/package.json +1 -1
- package/dist/chunk-G6IUSI5S.cjs +0 -125
- package/dist/chunk-G6IUSI5S.cjs.map +0 -1
- package/dist/chunk-HZTR4RHR.js.map +0 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Address, Hex, WalletClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for building an EIP-4361 (Sign-In with Ethereum) login message.
|
|
5
|
+
*
|
|
6
|
+
* The message format follows https://eips.ethereum.org/EIPS/eip-4361 with
|
|
7
|
+
* the fields the issuer backend needs to verify a wallet-based login.
|
|
8
|
+
*/
|
|
9
|
+
interface LoginMessageParams {
|
|
10
|
+
/** Origin domain that is requesting the signature, e.g. "app.example.com" */
|
|
11
|
+
domain: string;
|
|
12
|
+
/** Wallet address performing the login */
|
|
13
|
+
address: Address;
|
|
14
|
+
/** Target chain id */
|
|
15
|
+
chainId: number;
|
|
16
|
+
/** Server-issued nonce (must be consumed once on the backend) */
|
|
17
|
+
nonce: string;
|
|
18
|
+
/** Resource URI that is requesting the signature, e.g. "https://app.example.com" */
|
|
19
|
+
uri: string;
|
|
20
|
+
/** Optional human-readable statement shown to the user */
|
|
21
|
+
statement?: string;
|
|
22
|
+
/** Optional version field (defaults to "1") */
|
|
23
|
+
version?: string;
|
|
24
|
+
/** Optional issued-at timestamp (defaults to now) */
|
|
25
|
+
issuedAt?: Date;
|
|
26
|
+
/** Optional expiration time after which the message must be rejected */
|
|
27
|
+
expirationTime?: Date;
|
|
28
|
+
/** Optional not-before time before which the message must be rejected */
|
|
29
|
+
notBefore?: Date;
|
|
30
|
+
/** Optional opaque request id used for correlation */
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
interface VerifyLoginResult {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
address: Address;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Build an EIP-4361 login message string.
|
|
40
|
+
*
|
|
41
|
+
* The output is a deterministic plain-text message that the wallet signs via
|
|
42
|
+
* `personal_sign`. The same message can be parsed back with
|
|
43
|
+
* {@link parseLoginMessage} and verified with {@link verifyLoginMessage}.
|
|
44
|
+
*/
|
|
45
|
+
declare function createLoginMessage(params: LoginMessageParams): string;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a login message string built by {@link createLoginMessage} back into
|
|
48
|
+
* its structured fields. Throws if the message does not match the expected
|
|
49
|
+
* EIP-4361 layout.
|
|
50
|
+
*/
|
|
51
|
+
declare function parseLoginMessage(message: string): LoginMessageParams;
|
|
52
|
+
/**
|
|
53
|
+
* Verify that a login message was signed by the address embedded in the
|
|
54
|
+
* message. Returns `{ valid, address }` where `address` is the recovered
|
|
55
|
+
* signer (checksummed). Does NOT check expiration / not-before / nonce
|
|
56
|
+
* consumption — those are the AuthService's responsibility.
|
|
57
|
+
*/
|
|
58
|
+
declare function verifyLoginMessage(message: string, signature: Hex): Promise<VerifyLoginResult>;
|
|
59
|
+
|
|
60
|
+
declare const SPONSOR_AUTH_DOMAIN_NAME = "PafiSponsorAuth";
|
|
61
|
+
declare const SPONSOR_AUTH_TYPES: {
|
|
62
|
+
readonly SponsorAuth: readonly [{
|
|
63
|
+
readonly name: "chainId";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "sender";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "callDataHash";
|
|
70
|
+
readonly type: "bytes32";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "nonce";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "expiresAt";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "scenario";
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "issuerId";
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
}];
|
|
84
|
+
};
|
|
85
|
+
interface SponsorAuthPayload {
|
|
86
|
+
chainId: number;
|
|
87
|
+
sender: Address;
|
|
88
|
+
callDataHash: Hex;
|
|
89
|
+
nonce: bigint;
|
|
90
|
+
expiresAt: number;
|
|
91
|
+
scenario: string;
|
|
92
|
+
issuerId: string;
|
|
93
|
+
}
|
|
94
|
+
interface SponsorAuthVerifyResult {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
recoveredAddress?: Address;
|
|
97
|
+
reason?: "EXPIRED" | "INVALID_SIGNER" | "INVALID_SIGNATURE_FORMAT";
|
|
98
|
+
}
|
|
99
|
+
declare function buildSponsorAuthDomain(chainId: number): {
|
|
100
|
+
name: string;
|
|
101
|
+
version: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
verifyingContract: Address;
|
|
104
|
+
};
|
|
105
|
+
declare function buildSponsorAuthTypedData(payload: SponsorAuthPayload): {
|
|
106
|
+
domain: {
|
|
107
|
+
name: string;
|
|
108
|
+
version: string;
|
|
109
|
+
chainId: number;
|
|
110
|
+
verifyingContract: Address;
|
|
111
|
+
};
|
|
112
|
+
types: {
|
|
113
|
+
readonly SponsorAuth: readonly [{
|
|
114
|
+
readonly name: "chainId";
|
|
115
|
+
readonly type: "uint256";
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "sender";
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "callDataHash";
|
|
121
|
+
readonly type: "bytes32";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "nonce";
|
|
124
|
+
readonly type: "uint256";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "expiresAt";
|
|
127
|
+
readonly type: "uint256";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "scenario";
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "issuerId";
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
136
|
+
primaryType: "SponsorAuth";
|
|
137
|
+
message: {
|
|
138
|
+
chainId: bigint;
|
|
139
|
+
sender: `0x${string}`;
|
|
140
|
+
callDataHash: `0x${string}`;
|
|
141
|
+
nonce: bigint;
|
|
142
|
+
expiresAt: bigint;
|
|
143
|
+
scenario: string;
|
|
144
|
+
issuerId: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
declare function computeCallDataHash(callData: Hex): Hex;
|
|
148
|
+
declare function signSponsorAuth(wallet: WalletClient, payload: SponsorAuthPayload): Promise<Hex>;
|
|
149
|
+
declare function verifySponsorAuth(payload: SponsorAuthPayload, signature: Hex, expectedSigner: Address): Promise<SponsorAuthVerifyResult>;
|
|
150
|
+
|
|
151
|
+
export { type LoginMessageParams, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, type SponsorAuthPayload, type SponsorAuthVerifyResult, type VerifyLoginResult, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Address, Hex, WalletClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Parameters for building an EIP-4361 (Sign-In with Ethereum) login message.
|
|
5
|
+
*
|
|
6
|
+
* The message format follows https://eips.ethereum.org/EIPS/eip-4361 with
|
|
7
|
+
* the fields the issuer backend needs to verify a wallet-based login.
|
|
8
|
+
*/
|
|
9
|
+
interface LoginMessageParams {
|
|
10
|
+
/** Origin domain that is requesting the signature, e.g. "app.example.com" */
|
|
11
|
+
domain: string;
|
|
12
|
+
/** Wallet address performing the login */
|
|
13
|
+
address: Address;
|
|
14
|
+
/** Target chain id */
|
|
15
|
+
chainId: number;
|
|
16
|
+
/** Server-issued nonce (must be consumed once on the backend) */
|
|
17
|
+
nonce: string;
|
|
18
|
+
/** Resource URI that is requesting the signature, e.g. "https://app.example.com" */
|
|
19
|
+
uri: string;
|
|
20
|
+
/** Optional human-readable statement shown to the user */
|
|
21
|
+
statement?: string;
|
|
22
|
+
/** Optional version field (defaults to "1") */
|
|
23
|
+
version?: string;
|
|
24
|
+
/** Optional issued-at timestamp (defaults to now) */
|
|
25
|
+
issuedAt?: Date;
|
|
26
|
+
/** Optional expiration time after which the message must be rejected */
|
|
27
|
+
expirationTime?: Date;
|
|
28
|
+
/** Optional not-before time before which the message must be rejected */
|
|
29
|
+
notBefore?: Date;
|
|
30
|
+
/** Optional opaque request id used for correlation */
|
|
31
|
+
requestId?: string;
|
|
32
|
+
}
|
|
33
|
+
interface VerifyLoginResult {
|
|
34
|
+
valid: boolean;
|
|
35
|
+
address: Address;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Build an EIP-4361 login message string.
|
|
40
|
+
*
|
|
41
|
+
* The output is a deterministic plain-text message that the wallet signs via
|
|
42
|
+
* `personal_sign`. The same message can be parsed back with
|
|
43
|
+
* {@link parseLoginMessage} and verified with {@link verifyLoginMessage}.
|
|
44
|
+
*/
|
|
45
|
+
declare function createLoginMessage(params: LoginMessageParams): string;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a login message string built by {@link createLoginMessage} back into
|
|
48
|
+
* its structured fields. Throws if the message does not match the expected
|
|
49
|
+
* EIP-4361 layout.
|
|
50
|
+
*/
|
|
51
|
+
declare function parseLoginMessage(message: string): LoginMessageParams;
|
|
52
|
+
/**
|
|
53
|
+
* Verify that a login message was signed by the address embedded in the
|
|
54
|
+
* message. Returns `{ valid, address }` where `address` is the recovered
|
|
55
|
+
* signer (checksummed). Does NOT check expiration / not-before / nonce
|
|
56
|
+
* consumption — those are the AuthService's responsibility.
|
|
57
|
+
*/
|
|
58
|
+
declare function verifyLoginMessage(message: string, signature: Hex): Promise<VerifyLoginResult>;
|
|
59
|
+
|
|
60
|
+
declare const SPONSOR_AUTH_DOMAIN_NAME = "PafiSponsorAuth";
|
|
61
|
+
declare const SPONSOR_AUTH_TYPES: {
|
|
62
|
+
readonly SponsorAuth: readonly [{
|
|
63
|
+
readonly name: "chainId";
|
|
64
|
+
readonly type: "uint256";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "sender";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}, {
|
|
69
|
+
readonly name: "callDataHash";
|
|
70
|
+
readonly type: "bytes32";
|
|
71
|
+
}, {
|
|
72
|
+
readonly name: "nonce";
|
|
73
|
+
readonly type: "uint256";
|
|
74
|
+
}, {
|
|
75
|
+
readonly name: "expiresAt";
|
|
76
|
+
readonly type: "uint256";
|
|
77
|
+
}, {
|
|
78
|
+
readonly name: "scenario";
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
}, {
|
|
81
|
+
readonly name: "issuerId";
|
|
82
|
+
readonly type: "string";
|
|
83
|
+
}];
|
|
84
|
+
};
|
|
85
|
+
interface SponsorAuthPayload {
|
|
86
|
+
chainId: number;
|
|
87
|
+
sender: Address;
|
|
88
|
+
callDataHash: Hex;
|
|
89
|
+
nonce: bigint;
|
|
90
|
+
expiresAt: number;
|
|
91
|
+
scenario: string;
|
|
92
|
+
issuerId: string;
|
|
93
|
+
}
|
|
94
|
+
interface SponsorAuthVerifyResult {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
recoveredAddress?: Address;
|
|
97
|
+
reason?: "EXPIRED" | "INVALID_SIGNER" | "INVALID_SIGNATURE_FORMAT";
|
|
98
|
+
}
|
|
99
|
+
declare function buildSponsorAuthDomain(chainId: number): {
|
|
100
|
+
name: string;
|
|
101
|
+
version: string;
|
|
102
|
+
chainId: number;
|
|
103
|
+
verifyingContract: Address;
|
|
104
|
+
};
|
|
105
|
+
declare function buildSponsorAuthTypedData(payload: SponsorAuthPayload): {
|
|
106
|
+
domain: {
|
|
107
|
+
name: string;
|
|
108
|
+
version: string;
|
|
109
|
+
chainId: number;
|
|
110
|
+
verifyingContract: Address;
|
|
111
|
+
};
|
|
112
|
+
types: {
|
|
113
|
+
readonly SponsorAuth: readonly [{
|
|
114
|
+
readonly name: "chainId";
|
|
115
|
+
readonly type: "uint256";
|
|
116
|
+
}, {
|
|
117
|
+
readonly name: "sender";
|
|
118
|
+
readonly type: "address";
|
|
119
|
+
}, {
|
|
120
|
+
readonly name: "callDataHash";
|
|
121
|
+
readonly type: "bytes32";
|
|
122
|
+
}, {
|
|
123
|
+
readonly name: "nonce";
|
|
124
|
+
readonly type: "uint256";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "expiresAt";
|
|
127
|
+
readonly type: "uint256";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "scenario";
|
|
130
|
+
readonly type: "string";
|
|
131
|
+
}, {
|
|
132
|
+
readonly name: "issuerId";
|
|
133
|
+
readonly type: "string";
|
|
134
|
+
}];
|
|
135
|
+
};
|
|
136
|
+
primaryType: "SponsorAuth";
|
|
137
|
+
message: {
|
|
138
|
+
chainId: bigint;
|
|
139
|
+
sender: `0x${string}`;
|
|
140
|
+
callDataHash: `0x${string}`;
|
|
141
|
+
nonce: bigint;
|
|
142
|
+
expiresAt: bigint;
|
|
143
|
+
scenario: string;
|
|
144
|
+
issuerId: string;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
declare function computeCallDataHash(callData: Hex): Hex;
|
|
148
|
+
declare function signSponsorAuth(wallet: WalletClient, payload: SponsorAuthPayload): Promise<Hex>;
|
|
149
|
+
declare function verifySponsorAuth(payload: SponsorAuthPayload, signature: Hex, expectedSigner: Address): Promise<SponsorAuthVerifyResult>;
|
|
150
|
+
|
|
151
|
+
export { type LoginMessageParams, SPONSOR_AUTH_DOMAIN_NAME, SPONSOR_AUTH_TYPES, type SponsorAuthPayload, type SponsorAuthVerifyResult, type VerifyLoginResult, buildSponsorAuthDomain, buildSponsorAuthTypedData, computeCallDataHash, createLoginMessage, parseLoginMessage, signSponsorAuth, verifyLoginMessage, verifySponsorAuth };
|
|
@@ -4,6 +4,51 @@ import {
|
|
|
4
4
|
pointTokenAbi
|
|
5
5
|
} from "./chunk-FXNG4G22.js";
|
|
6
6
|
|
|
7
|
+
// src/contracts/real/pointToken.ts
|
|
8
|
+
import { parseAbi } from "viem";
|
|
9
|
+
var POINT_TOKEN_ABI = parseAbi([
|
|
10
|
+
// --- Mint paths ---
|
|
11
|
+
"function mint(address to, uint256 amount) external",
|
|
12
|
+
"function mint(address to, uint256 amount, uint256 deadline, bytes minterSig) external",
|
|
13
|
+
// --- Burn paths ---
|
|
14
|
+
"function burn(address from, uint256 amount) external",
|
|
15
|
+
"function burn(address from, uint256 amount, uint256 deadline, bytes burnerSig) external",
|
|
16
|
+
// --- Authorization reads ---
|
|
17
|
+
"function minters(address account) external view returns (bool)",
|
|
18
|
+
"function burners(address account) external view returns (bool)",
|
|
19
|
+
// --- Authorization writes (owner-only; used by provisioning scripts) ---
|
|
20
|
+
"function addMinter(address minter) external",
|
|
21
|
+
"function removeMinter(address minter) external",
|
|
22
|
+
"function addBurner(address burner) external",
|
|
23
|
+
"function removeBurner(address burner) external",
|
|
24
|
+
// --- Nonces (sig-gated paths) ---
|
|
25
|
+
"function mintRequestNonces(address receiver) external view returns (uint256)",
|
|
26
|
+
"function burnRequestNonces(address from) external view returns (uint256)",
|
|
27
|
+
// --- Oracle ---
|
|
28
|
+
"function mintingOracle() external view returns (address)",
|
|
29
|
+
"function setMintingOracle(address _mintingOracle) external",
|
|
30
|
+
// --- Issuer ---
|
|
31
|
+
"function issuer() external view returns (address)",
|
|
32
|
+
// --- Standard ERC-20 reads ---
|
|
33
|
+
"function balanceOf(address account) external view returns (uint256)",
|
|
34
|
+
"function totalSupply() external view returns (uint256)",
|
|
35
|
+
"function name() external view returns (string)",
|
|
36
|
+
"function symbol() external view returns (string)",
|
|
37
|
+
"function decimals() external view returns (uint8)",
|
|
38
|
+
// --- EIP-712 domain (for off-chain sig verification) ---
|
|
39
|
+
"function DOMAIN_SEPARATOR() external view returns (bytes32)",
|
|
40
|
+
"function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)",
|
|
41
|
+
// --- Events ---
|
|
42
|
+
// PointIndexer filters Transfer(from=0x0) for mints
|
|
43
|
+
// BurnIndexer filters Transfer(to=0x0) for burns
|
|
44
|
+
"event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
45
|
+
"event MinterAdded(address indexed minter)",
|
|
46
|
+
"event MinterRemoved(address indexed minter)",
|
|
47
|
+
"event BurnerAdded(address indexed burner)",
|
|
48
|
+
"event BurnerRemoved(address indexed burner)",
|
|
49
|
+
"event MintingOracleUpdated(address indexed mintingOracle)"
|
|
50
|
+
]);
|
|
51
|
+
|
|
7
52
|
// src/contract/pointToken.ts
|
|
8
53
|
async function getMintRequestNonce(client, pointToken, receiver) {
|
|
9
54
|
return client.readContract({
|
|
@@ -111,6 +156,7 @@ async function getPointTokenIssuer(client, oracleAddress, pointToken) {
|
|
|
111
156
|
}
|
|
112
157
|
|
|
113
158
|
export {
|
|
159
|
+
POINT_TOKEN_ABI,
|
|
114
160
|
getMintRequestNonce,
|
|
115
161
|
getReceiverConsentNonce,
|
|
116
162
|
isMinter,
|
|
@@ -122,4 +168,4 @@ export {
|
|
|
122
168
|
verifyMintCap,
|
|
123
169
|
getPointTokenIssuer
|
|
124
170
|
};
|
|
125
|
-
//# sourceMappingURL=chunk-
|
|
171
|
+
//# sourceMappingURL=chunk-GFJDSSDW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/contracts/real/pointToken.ts","../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/contract/mintingOracle.ts"],"sourcesContent":["import { parseAbi } from \"viem\";\n\n/**\n * Real `PointToken` ABI — matches the contract deployed on Base mainnet\n * (POINT at `0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e`). Sourced from\n * the Solidity contract shipped by the SC team 2026-04-21.\n *\n * ## Mint — two paths\n *\n * Path 1 — Direct (whitelisted minter):\n * mint(address to, uint256 amount)\n * - msg.sender must be in minters[]\n * - Used by off-chain services that hold a minter key\n *\n * Path 2 — Sig-gated (gasless, v1.4 sponsored flow):\n * mint(address to, uint256 amount, uint256 deadline, bytes minterSig)\n * - msg.sender MUST equal `to` (the receiver)\n * - minterSig is an EIP-712 MintRequest signature from a whitelisted minter\n * - Consumes `mintRequestNonces[to]`\n * - This is the path v1.4 uses: issuer backend signs, user submits\n * via EIP-7702 + Coinbase Paymaster\n *\n * ## Burn — mirror structure\n *\n * Path 1: burn(address from, uint256 amount) — whitelisted burner\n * Path 2: burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n * — msg.sender must equal `from`, burnerSig from whitelisted burner,\n * consumes `burnRequestNonces[from]`\n *\n * Either burn path emits `Transfer(from → 0x0)` so BurnIndexer semantics\n * don't depend on which path was taken.\n *\n * ## EIP-712 type hashes (from contract source)\n *\n * MintRequest(address to,uint256 amount,uint256 nonce,uint256 deadline)\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Domain: EIP-712 standard — name = ERC-20 token name, version = \"1\",\n * chainId, verifyingContract = this PointToken address.\n */\nexport const POINT_TOKEN_ABI = parseAbi([\n // --- Mint paths ---\n \"function mint(address to, uint256 amount) external\",\n \"function mint(address to, uint256 amount, uint256 deadline, bytes minterSig) external\",\n\n // --- Burn paths ---\n \"function burn(address from, uint256 amount) external\",\n \"function burn(address from, uint256 amount, uint256 deadline, bytes burnerSig) external\",\n\n // --- Authorization reads ---\n \"function minters(address account) external view returns (bool)\",\n \"function burners(address account) external view returns (bool)\",\n\n // --- Authorization writes (owner-only; used by provisioning scripts) ---\n \"function addMinter(address minter) external\",\n \"function removeMinter(address minter) external\",\n \"function addBurner(address burner) external\",\n \"function removeBurner(address burner) external\",\n\n // --- Nonces (sig-gated paths) ---\n \"function mintRequestNonces(address receiver) external view returns (uint256)\",\n \"function burnRequestNonces(address from) external view returns (uint256)\",\n\n // --- Oracle ---\n \"function mintingOracle() external view returns (address)\",\n \"function setMintingOracle(address _mintingOracle) external\",\n\n // --- Issuer ---\n \"function issuer() external view returns (address)\",\n\n // --- Standard ERC-20 reads ---\n \"function balanceOf(address account) external view returns (uint256)\",\n \"function totalSupply() external view returns (uint256)\",\n \"function name() external view returns (string)\",\n \"function symbol() external view returns (string)\",\n \"function decimals() external view returns (uint8)\",\n\n // --- EIP-712 domain (for off-chain sig verification) ---\n \"function DOMAIN_SEPARATOR() external view returns (bytes32)\",\n \"function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)\",\n\n // --- Events ---\n // PointIndexer filters Transfer(from=0x0) for mints\n // BurnIndexer filters Transfer(to=0x0) for burns\n \"event Transfer(address indexed from, address indexed to, uint256 value)\",\n \"event MinterAdded(address indexed minter)\",\n \"event MinterRemoved(address indexed minter)\",\n \"event BurnerAdded(address indexed burner)\",\n \"event BurnerRemoved(address indexed burner)\",\n \"event MintingOracleUpdated(address indexed mintingOracle)\",\n] as const);\n","import type { Address, PublicClient } from \"viem\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\nimport { POINT_TOKEN_ABI as POINT_TOKEN_REAL_ABI } from \"../contracts/real/pointToken\";\n\nexport async function getMintRequestNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"mintRequestNonces\",\n args: [receiver],\n });\n}\n\nexport async function getReceiverConsentNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"receiverConsentNonces\",\n args: [receiver],\n });\n}\n\nexport async function isMinter(\n client: PublicClient,\n pointToken: Address,\n account: Address,\n): Promise<boolean> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"minters\",\n args: [account],\n });\n}\n\nexport async function getTokenName(\n client: PublicClient,\n pointToken: Address,\n): Promise<string> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"name\",\n });\n}\n\nexport async function getIssuer(\n client: PublicClient,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"issuer\",\n });\n}\n\n/**\n * Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal\n * base units. Use alongside the issuer's off-chain ledger balance to render\n * a combined \"total balance\" in the app UI.\n */\nexport async function getPointTokenBalance(\n client: PublicClient,\n pointToken: Address,\n holder: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"balanceOf\",\n args: [holder],\n });\n}\n\nexport async function getBurnRequestNonce(\n client: PublicClient,\n pointToken: Address,\n from: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: POINT_TOKEN_REAL_ABI,\n functionName: \"burnRequestNonces\",\n args: [from],\n }) as Promise<bigint>;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { issuerRegistryAbi } from \"../abi/issuerRegistry\";\nimport type { Issuer } from \"../types\";\n\nexport async function getIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<Issuer> {\n const result = await client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"getIssuer\",\n args: [issuer],\n });\n\n const [\n issuerAddress,\n signerAddress,\n name,\n symbol,\n declaredTotalSupply,\n capBasisPoints,\n active,\n pointToken,\n mintingOracle,\n ] = result;\n\n return {\n issuerAddress,\n signerAddress,\n name,\n symbol,\n declaredTotalSupply,\n capBasisPoints,\n active,\n pointToken,\n mintingOracle,\n };\n}\n\nexport async function isActiveIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<boolean> {\n return client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"isActiveIssuer\",\n args: [issuer],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\n\nexport async function verifyMintCap(\n client: PublicClient,\n oracleAddress: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMintCap\",\n args: [issuer, amount],\n });\n}\n\nexport async function getPointTokenIssuer(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"pointTokenToIssuer\",\n args: [pointToken],\n });\n}\n"],"mappings":";;;;;;;AAAA,SAAS,gBAAgB;AAwClB,IAAM,kBAAkB,SAAS;AAAA;AAAA,EAEtC;AAAA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L,cAAc;AAAA,IACd,MAAM,CAAC,MAAM;AAAA,EACf,CAAC;AACH;;;AC7EA,eAAsBA,WACpB,QACA,iBACA,QACiB;AACjB,QAAM,SAAS,MAAM,OAAO,aAAa;AAAA,IACvC,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,MAAM;AAAA,EACf,CAAC;AAED,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AAEJ,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,eAAsB,eACpB,QACA,iBACA,QACkB;AAClB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,MAAM;AAAA,EACf,CAAC;AACH;;;ACjDA,eAAsB,cACpB,QACA,eACA,QACA,QACe;AACf,QAAM,OAAO,aAAa;AAAA,IACxB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,QAAQ,MAAM;AAAA,EACvB,CAAC;AACH;AAEA,eAAsB,oBACpB,QACA,eACA,YACkB;AAClB,SAAO,OAAO,aAAa;AAAA,IACzB,SAAS;AAAA,IACT,KAAK;AAAA,IACL,cAAc;AAAA,IACd,MAAM,CAAC,UAAU;AAAA,EACnB,CAAC;AACH;","names":["getIssuer"]}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkS2XRFFP3cjs = require('./chunk-S2XRFFP3.cjs');
|
|
6
|
+
|
|
7
|
+
// src/contracts/real/pointToken.ts
|
|
8
|
+
var _viem = require('viem');
|
|
9
|
+
var POINT_TOKEN_ABI = _viem.parseAbi.call(void 0, [
|
|
10
|
+
// --- Mint paths ---
|
|
11
|
+
"function mint(address to, uint256 amount) external",
|
|
12
|
+
"function mint(address to, uint256 amount, uint256 deadline, bytes minterSig) external",
|
|
13
|
+
// --- Burn paths ---
|
|
14
|
+
"function burn(address from, uint256 amount) external",
|
|
15
|
+
"function burn(address from, uint256 amount, uint256 deadline, bytes burnerSig) external",
|
|
16
|
+
// --- Authorization reads ---
|
|
17
|
+
"function minters(address account) external view returns (bool)",
|
|
18
|
+
"function burners(address account) external view returns (bool)",
|
|
19
|
+
// --- Authorization writes (owner-only; used by provisioning scripts) ---
|
|
20
|
+
"function addMinter(address minter) external",
|
|
21
|
+
"function removeMinter(address minter) external",
|
|
22
|
+
"function addBurner(address burner) external",
|
|
23
|
+
"function removeBurner(address burner) external",
|
|
24
|
+
// --- Nonces (sig-gated paths) ---
|
|
25
|
+
"function mintRequestNonces(address receiver) external view returns (uint256)",
|
|
26
|
+
"function burnRequestNonces(address from) external view returns (uint256)",
|
|
27
|
+
// --- Oracle ---
|
|
28
|
+
"function mintingOracle() external view returns (address)",
|
|
29
|
+
"function setMintingOracle(address _mintingOracle) external",
|
|
30
|
+
// --- Issuer ---
|
|
31
|
+
"function issuer() external view returns (address)",
|
|
32
|
+
// --- Standard ERC-20 reads ---
|
|
33
|
+
"function balanceOf(address account) external view returns (uint256)",
|
|
34
|
+
"function totalSupply() external view returns (uint256)",
|
|
35
|
+
"function name() external view returns (string)",
|
|
36
|
+
"function symbol() external view returns (string)",
|
|
37
|
+
"function decimals() external view returns (uint8)",
|
|
38
|
+
// --- EIP-712 domain (for off-chain sig verification) ---
|
|
39
|
+
"function DOMAIN_SEPARATOR() external view returns (bytes32)",
|
|
40
|
+
"function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)",
|
|
41
|
+
// --- Events ---
|
|
42
|
+
// PointIndexer filters Transfer(from=0x0) for mints
|
|
43
|
+
// BurnIndexer filters Transfer(to=0x0) for burns
|
|
44
|
+
"event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
45
|
+
"event MinterAdded(address indexed minter)",
|
|
46
|
+
"event MinterRemoved(address indexed minter)",
|
|
47
|
+
"event BurnerAdded(address indexed burner)",
|
|
48
|
+
"event BurnerRemoved(address indexed burner)",
|
|
49
|
+
"event MintingOracleUpdated(address indexed mintingOracle)"
|
|
50
|
+
]);
|
|
51
|
+
|
|
52
|
+
// src/contract/pointToken.ts
|
|
53
|
+
async function getMintRequestNonce(client, pointToken, receiver) {
|
|
54
|
+
return client.readContract({
|
|
55
|
+
address: pointToken,
|
|
56
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
57
|
+
functionName: "mintRequestNonces",
|
|
58
|
+
args: [receiver]
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function getReceiverConsentNonce(client, pointToken, receiver) {
|
|
62
|
+
return client.readContract({
|
|
63
|
+
address: pointToken,
|
|
64
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
65
|
+
functionName: "receiverConsentNonces",
|
|
66
|
+
args: [receiver]
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async function isMinter(client, pointToken, account) {
|
|
70
|
+
return client.readContract({
|
|
71
|
+
address: pointToken,
|
|
72
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
73
|
+
functionName: "minters",
|
|
74
|
+
args: [account]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
async function getTokenName(client, pointToken) {
|
|
78
|
+
return client.readContract({
|
|
79
|
+
address: pointToken,
|
|
80
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
81
|
+
functionName: "name"
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
async function getIssuer(client, pointToken) {
|
|
85
|
+
return client.readContract({
|
|
86
|
+
address: pointToken,
|
|
87
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
88
|
+
functionName: "issuer"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
async function getPointTokenBalance(client, pointToken, holder) {
|
|
92
|
+
return client.readContract({
|
|
93
|
+
address: pointToken,
|
|
94
|
+
abi: _chunkS2XRFFP3cjs.pointTokenAbi,
|
|
95
|
+
functionName: "balanceOf",
|
|
96
|
+
args: [holder]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/contract/issuerRegistry.ts
|
|
101
|
+
async function getIssuer2(client, registryAddress, issuer) {
|
|
102
|
+
const result = await client.readContract({
|
|
103
|
+
address: registryAddress,
|
|
104
|
+
abi: _chunkS2XRFFP3cjs.issuerRegistryAbi,
|
|
105
|
+
functionName: "getIssuer",
|
|
106
|
+
args: [issuer]
|
|
107
|
+
});
|
|
108
|
+
const [
|
|
109
|
+
issuerAddress,
|
|
110
|
+
signerAddress,
|
|
111
|
+
name,
|
|
112
|
+
symbol,
|
|
113
|
+
declaredTotalSupply,
|
|
114
|
+
capBasisPoints,
|
|
115
|
+
active,
|
|
116
|
+
pointToken,
|
|
117
|
+
mintingOracle
|
|
118
|
+
] = result;
|
|
119
|
+
return {
|
|
120
|
+
issuerAddress,
|
|
121
|
+
signerAddress,
|
|
122
|
+
name,
|
|
123
|
+
symbol,
|
|
124
|
+
declaredTotalSupply,
|
|
125
|
+
capBasisPoints,
|
|
126
|
+
active,
|
|
127
|
+
pointToken,
|
|
128
|
+
mintingOracle
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
async function isActiveIssuer(client, registryAddress, issuer) {
|
|
132
|
+
return client.readContract({
|
|
133
|
+
address: registryAddress,
|
|
134
|
+
abi: _chunkS2XRFFP3cjs.issuerRegistryAbi,
|
|
135
|
+
functionName: "isActiveIssuer",
|
|
136
|
+
args: [issuer]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// src/contract/mintingOracle.ts
|
|
141
|
+
async function verifyMintCap(client, oracleAddress, issuer, amount) {
|
|
142
|
+
await client.readContract({
|
|
143
|
+
address: oracleAddress,
|
|
144
|
+
abi: _chunkS2XRFFP3cjs.mintingOracleAbi,
|
|
145
|
+
functionName: "verifyMintCap",
|
|
146
|
+
args: [issuer, amount]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
async function getPointTokenIssuer(client, oracleAddress, pointToken) {
|
|
150
|
+
return client.readContract({
|
|
151
|
+
address: oracleAddress,
|
|
152
|
+
abi: _chunkS2XRFFP3cjs.mintingOracleAbi,
|
|
153
|
+
functionName: "pointTokenToIssuer",
|
|
154
|
+
args: [pointToken]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
exports.POINT_TOKEN_ABI = POINT_TOKEN_ABI; exports.getMintRequestNonce = getMintRequestNonce; exports.getReceiverConsentNonce = getReceiverConsentNonce; exports.isMinter = isMinter; exports.getTokenName = getTokenName; exports.getIssuer = getIssuer; exports.getPointTokenBalance = getPointTokenBalance; exports.getIssuer2 = getIssuer2; exports.isActiveIssuer = isActiveIssuer; exports.verifyMintCap = verifyMintCap; exports.getPointTokenIssuer = getPointTokenIssuer;
|
|
171
|
+
//# sourceMappingURL=chunk-OQIQXDHW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/phitran/Pacific-Finance/pafi-backend/pafi-sdk/packages/core/dist/chunk-OQIQXDHW.cjs","../src/contracts/real/pointToken.ts","../src/contract/pointToken.ts","../src/contract/issuerRegistry.ts","../src/contract/mintingOracle.ts"],"names":["getIssuer"],"mappings":"AAAA;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACNA,4BAAyB;AAwClB,IAAM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afi-sdk/packages/core/dist/chunk-OQIQXDHW.cjs","sourcesContent":[null,"import { parseAbi } from \"viem\";\n\n/**\n * Real `PointToken` ABI — matches the contract deployed on Base mainnet\n * (POINT at `0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e`). Sourced from\n * the Solidity contract shipped by the SC team 2026-04-21.\n *\n * ## Mint — two paths\n *\n * Path 1 — Direct (whitelisted minter):\n * mint(address to, uint256 amount)\n * - msg.sender must be in minters[]\n * - Used by off-chain services that hold a minter key\n *\n * Path 2 — Sig-gated (gasless, v1.4 sponsored flow):\n * mint(address to, uint256 amount, uint256 deadline, bytes minterSig)\n * - msg.sender MUST equal `to` (the receiver)\n * - minterSig is an EIP-712 MintRequest signature from a whitelisted minter\n * - Consumes `mintRequestNonces[to]`\n * - This is the path v1.4 uses: issuer backend signs, user submits\n * via EIP-7702 + Coinbase Paymaster\n *\n * ## Burn — mirror structure\n *\n * Path 1: burn(address from, uint256 amount) — whitelisted burner\n * Path 2: burn(address from, uint256 amount, uint256 deadline, bytes burnerSig)\n * — msg.sender must equal `from`, burnerSig from whitelisted burner,\n * consumes `burnRequestNonces[from]`\n *\n * Either burn path emits `Transfer(from → 0x0)` so BurnIndexer semantics\n * don't depend on which path was taken.\n *\n * ## EIP-712 type hashes (from contract source)\n *\n * MintRequest(address to,uint256 amount,uint256 nonce,uint256 deadline)\n * BurnRequest(address from,uint256 amount,uint256 nonce,uint256 deadline)\n *\n * Domain: EIP-712 standard — name = ERC-20 token name, version = \"1\",\n * chainId, verifyingContract = this PointToken address.\n */\nexport const POINT_TOKEN_ABI = parseAbi([\n // --- Mint paths ---\n \"function mint(address to, uint256 amount) external\",\n \"function mint(address to, uint256 amount, uint256 deadline, bytes minterSig) external\",\n\n // --- Burn paths ---\n \"function burn(address from, uint256 amount) external\",\n \"function burn(address from, uint256 amount, uint256 deadline, bytes burnerSig) external\",\n\n // --- Authorization reads ---\n \"function minters(address account) external view returns (bool)\",\n \"function burners(address account) external view returns (bool)\",\n\n // --- Authorization writes (owner-only; used by provisioning scripts) ---\n \"function addMinter(address minter) external\",\n \"function removeMinter(address minter) external\",\n \"function addBurner(address burner) external\",\n \"function removeBurner(address burner) external\",\n\n // --- Nonces (sig-gated paths) ---\n \"function mintRequestNonces(address receiver) external view returns (uint256)\",\n \"function burnRequestNonces(address from) external view returns (uint256)\",\n\n // --- Oracle ---\n \"function mintingOracle() external view returns (address)\",\n \"function setMintingOracle(address _mintingOracle) external\",\n\n // --- Issuer ---\n \"function issuer() external view returns (address)\",\n\n // --- Standard ERC-20 reads ---\n \"function balanceOf(address account) external view returns (uint256)\",\n \"function totalSupply() external view returns (uint256)\",\n \"function name() external view returns (string)\",\n \"function symbol() external view returns (string)\",\n \"function decimals() external view returns (uint8)\",\n\n // --- EIP-712 domain (for off-chain sig verification) ---\n \"function DOMAIN_SEPARATOR() external view returns (bytes32)\",\n \"function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)\",\n\n // --- Events ---\n // PointIndexer filters Transfer(from=0x0) for mints\n // BurnIndexer filters Transfer(to=0x0) for burns\n \"event Transfer(address indexed from, address indexed to, uint256 value)\",\n \"event MinterAdded(address indexed minter)\",\n \"event MinterRemoved(address indexed minter)\",\n \"event BurnerAdded(address indexed burner)\",\n \"event BurnerRemoved(address indexed burner)\",\n \"event MintingOracleUpdated(address indexed mintingOracle)\",\n] as const);\n","import type { Address, PublicClient } from \"viem\";\nimport { pointTokenAbi } from \"../abi/pointToken\";\nimport { POINT_TOKEN_ABI as POINT_TOKEN_REAL_ABI } from \"../contracts/real/pointToken\";\n\nexport async function getMintRequestNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"mintRequestNonces\",\n args: [receiver],\n });\n}\n\nexport async function getReceiverConsentNonce(\n client: PublicClient,\n pointToken: Address,\n receiver: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"receiverConsentNonces\",\n args: [receiver],\n });\n}\n\nexport async function isMinter(\n client: PublicClient,\n pointToken: Address,\n account: Address,\n): Promise<boolean> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"minters\",\n args: [account],\n });\n}\n\nexport async function getTokenName(\n client: PublicClient,\n pointToken: Address,\n): Promise<string> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"name\",\n });\n}\n\nexport async function getIssuer(\n client: PublicClient,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"issuer\",\n });\n}\n\n/**\n * Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal\n * base units. Use alongside the issuer's off-chain ledger balance to render\n * a combined \"total balance\" in the app UI.\n */\nexport async function getPointTokenBalance(\n client: PublicClient,\n pointToken: Address,\n holder: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: pointTokenAbi,\n functionName: \"balanceOf\",\n args: [holder],\n });\n}\n\nexport async function getBurnRequestNonce(\n client: PublicClient,\n pointToken: Address,\n from: Address,\n): Promise<bigint> {\n return client.readContract({\n address: pointToken,\n abi: POINT_TOKEN_REAL_ABI,\n functionName: \"burnRequestNonces\",\n args: [from],\n }) as Promise<bigint>;\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { issuerRegistryAbi } from \"../abi/issuerRegistry\";\nimport type { Issuer } from \"../types\";\n\nexport async function getIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<Issuer> {\n const result = await client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"getIssuer\",\n args: [issuer],\n });\n\n const [\n issuerAddress,\n signerAddress,\n name,\n symbol,\n declaredTotalSupply,\n capBasisPoints,\n active,\n pointToken,\n mintingOracle,\n ] = result;\n\n return {\n issuerAddress,\n signerAddress,\n name,\n symbol,\n declaredTotalSupply,\n capBasisPoints,\n active,\n pointToken,\n mintingOracle,\n };\n}\n\nexport async function isActiveIssuer(\n client: PublicClient,\n registryAddress: Address,\n issuer: Address,\n): Promise<boolean> {\n return client.readContract({\n address: registryAddress,\n abi: issuerRegistryAbi,\n functionName: \"isActiveIssuer\",\n args: [issuer],\n });\n}\n","import type { Address, PublicClient } from \"viem\";\nimport { mintingOracleAbi } from \"../abi/mintingOracle\";\n\nexport async function verifyMintCap(\n client: PublicClient,\n oracleAddress: Address,\n issuer: Address,\n amount: bigint,\n): Promise<void> {\n await client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"verifyMintCap\",\n args: [issuer, amount],\n });\n}\n\nexport async function getPointTokenIssuer(\n client: PublicClient,\n oracleAddress: Address,\n pointToken: Address,\n): Promise<Address> {\n return client.readContract({\n address: oracleAddress,\n abi: mintingOracleAbi,\n functionName: \"pointTokenToIssuer\",\n args: [pointToken],\n });\n}\n"]}
|
package/dist/contract/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkOQIQXDHWcjs = require('../chunk-OQIQXDHW.cjs');
|
|
13
13
|
require('../chunk-S2XRFFP3.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
@@ -22,5 +22,5 @@ require('../chunk-S2XRFFP3.cjs');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
exports.getIssuer =
|
|
25
|
+
exports.getIssuer = _chunkOQIQXDHWcjs.getIssuer2; exports.getMintRequestNonce = _chunkOQIQXDHWcjs.getMintRequestNonce; exports.getPointTokenBalance = _chunkOQIQXDHWcjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkOQIQXDHWcjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkOQIQXDHWcjs.getIssuer; exports.getReceiverConsentNonce = _chunkOQIQXDHWcjs.getReceiverConsentNonce; exports.getTokenName = _chunkOQIQXDHWcjs.getTokenName; exports.isActiveIssuer = _chunkOQIQXDHWcjs.isActiveIssuer; exports.isMinter = _chunkOQIQXDHWcjs.isMinter; exports.verifyMintCap = _chunkOQIQXDHWcjs.verifyMintCap;
|
|
26
26
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PublicClient, Address } from 'viem';
|
|
2
|
+
import { I as Issuer } from '../types-b5_Tokjl.cjs';
|
|
3
|
+
|
|
4
|
+
declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
|
|
5
|
+
declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
|
|
6
|
+
declare function isMinter(client: PublicClient, pointToken: Address, account: Address): Promise<boolean>;
|
|
7
|
+
declare function getTokenName(client: PublicClient, pointToken: Address): Promise<string>;
|
|
8
|
+
declare function getIssuer$1(client: PublicClient, pointToken: Address): Promise<Address>;
|
|
9
|
+
/**
|
|
10
|
+
* Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal
|
|
11
|
+
* base units. Use alongside the issuer's off-chain ledger balance to render
|
|
12
|
+
* a combined "total balance" in the app UI.
|
|
13
|
+
*/
|
|
14
|
+
declare function getPointTokenBalance(client: PublicClient, pointToken: Address, holder: Address): Promise<bigint>;
|
|
15
|
+
|
|
16
|
+
declare function getIssuer(client: PublicClient, registryAddress: Address, issuer: Address): Promise<Issuer>;
|
|
17
|
+
declare function isActiveIssuer(client: PublicClient, registryAddress: Address, issuer: Address): Promise<boolean>;
|
|
18
|
+
|
|
19
|
+
declare function verifyMintCap(client: PublicClient, oracleAddress: Address, issuer: Address, amount: bigint): Promise<void>;
|
|
20
|
+
declare function getPointTokenIssuer(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<Address>;
|
|
21
|
+
|
|
22
|
+
export { getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, verifyMintCap };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PublicClient, Address } from 'viem';
|
|
2
|
+
import { I as Issuer } from '../types-b5_Tokjl.js';
|
|
3
|
+
|
|
4
|
+
declare function getMintRequestNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
|
|
5
|
+
declare function getReceiverConsentNonce(client: PublicClient, pointToken: Address, receiver: Address): Promise<bigint>;
|
|
6
|
+
declare function isMinter(client: PublicClient, pointToken: Address, account: Address): Promise<boolean>;
|
|
7
|
+
declare function getTokenName(client: PublicClient, pointToken: Address): Promise<string>;
|
|
8
|
+
declare function getIssuer$1(client: PublicClient, pointToken: Address): Promise<Address>;
|
|
9
|
+
/**
|
|
10
|
+
* Read the ERC-20 on-chain balance for `holder`. Returned in raw 18-decimal
|
|
11
|
+
* base units. Use alongside the issuer's off-chain ledger balance to render
|
|
12
|
+
* a combined "total balance" in the app UI.
|
|
13
|
+
*/
|
|
14
|
+
declare function getPointTokenBalance(client: PublicClient, pointToken: Address, holder: Address): Promise<bigint>;
|
|
15
|
+
|
|
16
|
+
declare function getIssuer(client: PublicClient, registryAddress: Address, issuer: Address): Promise<Issuer>;
|
|
17
|
+
declare function isActiveIssuer(client: PublicClient, registryAddress: Address, issuer: Address): Promise<boolean>;
|
|
18
|
+
|
|
19
|
+
declare function verifyMintCap(client: PublicClient, oracleAddress: Address, issuer: Address, amount: bigint): Promise<void>;
|
|
20
|
+
declare function getPointTokenIssuer(client: PublicClient, oracleAddress: Address, pointToken: Address): Promise<Address>;
|
|
21
|
+
|
|
22
|
+
export { getIssuer, getMintRequestNonce, getPointTokenBalance, getPointTokenIssuer, getIssuer$1 as getPointTokenIssuerAddress, getReceiverConsentNonce, getTokenName, isActiveIssuer, isMinter, verifyMintCap };
|