@pafi-dev/issuer 0.12.2 → 0.12.4
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 +29 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +32 -22
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -3294,15 +3294,24 @@ interface IssuerRegistryRecord {
|
|
|
3294
3294
|
signerAddress: Address;
|
|
3295
3295
|
name: string;
|
|
3296
3296
|
symbol: string;
|
|
3297
|
-
declaredTotalSupply: bigint;
|
|
3298
|
-
capBasisPoints: number;
|
|
3299
3297
|
active: boolean;
|
|
3300
3298
|
pointToken: Address;
|
|
3301
3299
|
mintingOracle: Address;
|
|
3302
3300
|
}
|
|
3301
|
+
/**
|
|
3302
|
+
* v1.6 — per-token cap config read from `MintingOracle.tokenCaps()`.
|
|
3303
|
+
* Caps moved off the issuer record so a single issuer can run many
|
|
3304
|
+
* PointTokens with different supply policies.
|
|
3305
|
+
*/
|
|
3306
|
+
interface TokenCapRecord {
|
|
3307
|
+
declaredTotalSupply: bigint;
|
|
3308
|
+
capBasisPoints: number;
|
|
3309
|
+
}
|
|
3303
3310
|
interface PreValidateMintResult {
|
|
3304
3311
|
/** Registry record read at pre-validation time. */
|
|
3305
3312
|
issuer: IssuerRegistryRecord;
|
|
3313
|
+
/** Per-token cap config from MintingOracle. */
|
|
3314
|
+
tokenCap: TokenCapRecord;
|
|
3306
3315
|
/** Current on-chain PointToken.totalSupply(). */
|
|
3307
3316
|
totalSupply: bigint;
|
|
3308
3317
|
/** declaredTotalSupply × capBasisPoints / 10000. */
|
package/dist/index.d.ts
CHANGED
|
@@ -3294,15 +3294,24 @@ interface IssuerRegistryRecord {
|
|
|
3294
3294
|
signerAddress: Address;
|
|
3295
3295
|
name: string;
|
|
3296
3296
|
symbol: string;
|
|
3297
|
-
declaredTotalSupply: bigint;
|
|
3298
|
-
capBasisPoints: number;
|
|
3299
3297
|
active: boolean;
|
|
3300
3298
|
pointToken: Address;
|
|
3301
3299
|
mintingOracle: Address;
|
|
3302
3300
|
}
|
|
3301
|
+
/**
|
|
3302
|
+
* v1.6 — per-token cap config read from `MintingOracle.tokenCaps()`.
|
|
3303
|
+
* Caps moved off the issuer record so a single issuer can run many
|
|
3304
|
+
* PointTokens with different supply policies.
|
|
3305
|
+
*/
|
|
3306
|
+
interface TokenCapRecord {
|
|
3307
|
+
declaredTotalSupply: bigint;
|
|
3308
|
+
capBasisPoints: number;
|
|
3309
|
+
}
|
|
3303
3310
|
interface PreValidateMintResult {
|
|
3304
3311
|
/** Registry record read at pre-validation time. */
|
|
3305
3312
|
issuer: IssuerRegistryRecord;
|
|
3313
|
+
/** Per-token cap config from MintingOracle. */
|
|
3314
|
+
tokenCap: TokenCapRecord;
|
|
3306
3315
|
/** Current on-chain PointToken.totalSupply(). */
|
|
3307
3316
|
totalSupply: bigint;
|
|
3308
3317
|
/** declaredTotalSupply × capBasisPoints / 10000. */
|
package/dist/index.js
CHANGED
|
@@ -4348,8 +4348,9 @@ function createIssuerService(config) {
|
|
|
4348
4348
|
import { getAddress as getAddress12 } from "viem";
|
|
4349
4349
|
import {
|
|
4350
4350
|
POINT_TOKEN_V2_ABI as POINT_TOKEN_V2_ABI3,
|
|
4351
|
-
|
|
4352
|
-
getContractAddresses as getContractAddresses8
|
|
4351
|
+
issuerRegistryAbi,
|
|
4352
|
+
getContractAddresses as getContractAddresses8,
|
|
4353
|
+
getTokenCap
|
|
4353
4354
|
} from "@pafi-dev/core";
|
|
4354
4355
|
var ISSUER_RECORD_TTL_MS = 3e4;
|
|
4355
4356
|
var IssuerStateValidator = class _IssuerStateValidator {
|
|
@@ -4474,33 +4475,42 @@ var IssuerStateValidator = class _IssuerStateValidator {
|
|
|
4474
4475
|
}
|
|
4475
4476
|
async fetchIssuerState(tokenAddr) {
|
|
4476
4477
|
const issuerAddr = await this.getIssuerAddressForPointToken(tokenAddr);
|
|
4477
|
-
const
|
|
4478
|
-
this.
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
4483
|
-
|
|
4478
|
+
const issuerStruct = await this.provider.readContract({
|
|
4479
|
+
address: this.registryAddress,
|
|
4480
|
+
abi: issuerRegistryAbi,
|
|
4481
|
+
functionName: "getIssuer",
|
|
4482
|
+
args: [issuerAddr]
|
|
4483
|
+
});
|
|
4484
|
+
const issuer = {
|
|
4485
|
+
issuerAddress: issuerStruct.issuerAddress,
|
|
4486
|
+
signerAddress: issuerStruct.signerAddress,
|
|
4487
|
+
name: issuerStruct.name,
|
|
4488
|
+
symbol: issuerStruct.symbol,
|
|
4489
|
+
active: issuerStruct.active,
|
|
4490
|
+
pointToken: issuerStruct.pointToken,
|
|
4491
|
+
mintingOracle: issuerStruct.mintingOracle
|
|
4492
|
+
};
|
|
4493
|
+
const [tokenCap, totalSupply] = await Promise.all([
|
|
4494
|
+
getTokenCap(this.provider, issuer.mintingOracle, tokenAddr),
|
|
4484
4495
|
this.provider.readContract({
|
|
4485
4496
|
address: tokenAddr,
|
|
4486
4497
|
abi: POINT_TOKEN_V2_ABI3,
|
|
4487
4498
|
functionName: "totalSupply"
|
|
4488
4499
|
})
|
|
4489
4500
|
]);
|
|
4490
|
-
const
|
|
4491
|
-
|
|
4492
|
-
|
|
4493
|
-
name: issuerTuple[2],
|
|
4494
|
-
symbol: issuerTuple[3],
|
|
4495
|
-
declaredTotalSupply: issuerTuple[4],
|
|
4496
|
-
capBasisPoints: issuerTuple[5],
|
|
4497
|
-
active: issuerTuple[6],
|
|
4498
|
-
pointToken: issuerTuple[7],
|
|
4499
|
-
mintingOracle: issuerTuple[8]
|
|
4501
|
+
const tokenCapRecord = {
|
|
4502
|
+
declaredTotalSupply: tokenCap.declaredTotalSupply,
|
|
4503
|
+
capBasisPoints: tokenCap.capBasisPoints
|
|
4500
4504
|
};
|
|
4501
|
-
const hardCap =
|
|
4505
|
+
const hardCap = tokenCapRecord.declaredTotalSupply * BigInt(tokenCapRecord.capBasisPoints) / 10000n;
|
|
4502
4506
|
const remaining = hardCap > totalSupply ? hardCap - totalSupply : 0n;
|
|
4503
|
-
return {
|
|
4507
|
+
return {
|
|
4508
|
+
issuer,
|
|
4509
|
+
tokenCap: tokenCapRecord,
|
|
4510
|
+
totalSupply,
|
|
4511
|
+
hardCap,
|
|
4512
|
+
remaining
|
|
4513
|
+
};
|
|
4504
4514
|
}
|
|
4505
4515
|
};
|
|
4506
4516
|
|
|
@@ -4541,7 +4551,7 @@ var MemoryRedemptionHistoryStore = class {
|
|
|
4541
4551
|
};
|
|
4542
4552
|
|
|
4543
4553
|
// src/index.ts
|
|
4544
|
-
var PAFI_ISSUER_SDK_VERSION = true ? "0.12.
|
|
4554
|
+
var PAFI_ISSUER_SDK_VERSION = true ? "0.12.3" : "dev";
|
|
4545
4555
|
export {
|
|
4546
4556
|
AdapterMisconfiguredError,
|
|
4547
4557
|
AuthError,
|