@pafi-dev/issuer 0.1.0 → 0.1.2

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
@@ -927,6 +927,25 @@ interface ApiUserRequest {
927
927
  interface ApiUserResponse {
928
928
  mintRequestNonce: bigint;
929
929
  receiverConsentNonce: bigint;
930
+ /**
931
+ * Off-chain point balance from the issuer's ledger (excludes PENDING locks).
932
+ * This is what the user can claim into on-chain PT via `/claim`.
933
+ */
934
+ offChainBalance: bigint;
935
+ /**
936
+ * On-chain ERC-20 balance from `PointToken.balanceOf(user)`.
937
+ * Points the user has already claimed but hasn't swapped or redeemed.
938
+ */
939
+ onChainBalance: bigint;
940
+ /**
941
+ * Sum of off-chain + on-chain balance. FE renders this as a single
942
+ * "your points" number, per the unified-balance UX spec.
943
+ */
944
+ totalBalance: bigint;
945
+ /**
946
+ * @deprecated use `offChainBalance` instead. Kept for backward compatibility
947
+ * — will be removed in 0.2.0.
948
+ */
930
949
  balance: bigint;
931
950
  isMinter: boolean;
932
951
  }
package/dist/index.d.ts CHANGED
@@ -927,6 +927,25 @@ interface ApiUserRequest {
927
927
  interface ApiUserResponse {
928
928
  mintRequestNonce: bigint;
929
929
  receiverConsentNonce: bigint;
930
+ /**
931
+ * Off-chain point balance from the issuer's ledger (excludes PENDING locks).
932
+ * This is what the user can claim into on-chain PT via `/claim`.
933
+ */
934
+ offChainBalance: bigint;
935
+ /**
936
+ * On-chain ERC-20 balance from `PointToken.balanceOf(user)`.
937
+ * Points the user has already claimed but hasn't swapped or redeemed.
938
+ */
939
+ onChainBalance: bigint;
940
+ /**
941
+ * Sum of off-chain + on-chain balance. FE renders this as a single
942
+ * "your points" number, per the unified-balance UX spec.
943
+ */
944
+ totalBalance: bigint;
945
+ /**
946
+ * @deprecated use `offChainBalance` instead. Kept for backward compatibility
947
+ * — will be removed in 0.2.0.
948
+ */
930
949
  balance: bigint;
931
950
  isMinter: boolean;
932
951
  }
package/dist/index.js CHANGED
@@ -1158,6 +1158,7 @@ function pickMatchingLock(locks, amount) {
1158
1158
  import { getAddress as getAddress5 } from "viem";
1159
1159
  import {
1160
1160
  getMintRequestNonce,
1161
+ getPointTokenBalance,
1161
1162
  getReceiverConsentNonce,
1162
1163
  getTokenName,
1163
1164
  isMinter,
@@ -1280,16 +1281,21 @@ var IssuerApiHandlers = class {
1280
1281
  `handleUser: unsupported pointToken ${pointToken}`
1281
1282
  );
1282
1283
  }
1283
- const [mintRequestNonce, receiverConsentNonce, balance, minter] = await Promise.all([
1284
+ const [mintRequestNonce, receiverConsentNonce, offChainBalance, onChainBalance, minter] = await Promise.all([
1284
1285
  getMintRequestNonce(this.provider, pointToken, normalizedAuthed),
1285
1286
  getReceiverConsentNonce(this.provider, pointToken, normalizedAuthed),
1286
1287
  this.ledger.getBalance(normalizedAuthed),
1288
+ getPointTokenBalance(this.provider, pointToken, normalizedAuthed),
1287
1289
  isMinter(this.provider, pointToken, normalizedAuthed)
1288
1290
  ]);
1289
1291
  return {
1290
1292
  mintRequestNonce,
1291
1293
  receiverConsentNonce,
1292
- balance,
1294
+ offChainBalance,
1295
+ onChainBalance,
1296
+ totalBalance: offChainBalance + onChainBalance,
1297
+ balance: offChainBalance,
1298
+ // deprecated alias
1293
1299
  isMinter: minter
1294
1300
  };
1295
1301
  }