@pafi-dev/core 0.3.0-beta.0 → 0.3.0-beta.10
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.cjs +2 -6
- package/dist/abi/index.cjs.map +1 -1
- package/dist/abi/index.d.cts +1 -286
- package/dist/abi/index.d.ts +1 -286
- package/dist/abi/index.js +1 -5
- package/dist/{chunk-R4L66ZR5.js → chunk-73CQTNLB.js} +10 -1
- package/dist/chunk-73CQTNLB.js.map +1 -0
- package/dist/{chunk-5YH4D7QF.js → chunk-7UBO7DY5.js} +1 -1
- package/dist/{chunk-FGKLDKJK.cjs → chunk-ALCWYDVG.cjs} +1 -1
- package/dist/{chunk-FGKLDKJK.cjs.map → chunk-ALCWYDVG.cjs.map} +1 -1
- package/dist/{chunk-X3I5XWAR.cjs → chunk-CQCSQPWG.cjs} +2 -15
- package/dist/chunk-CQCSQPWG.cjs.map +1 -0
- package/dist/{chunk-CWP4PFOP.cjs → chunk-DMW67WBU.cjs} +11 -2
- package/dist/chunk-DMW67WBU.cjs.map +1 -0
- package/dist/{chunk-C4ZDYG4D.js → chunk-DUY7Z2AI.js} +48 -6
- package/dist/chunk-DUY7Z2AI.js.map +1 -0
- package/dist/chunk-EDR5SFJN.cjs +351 -0
- package/dist/chunk-EDR5SFJN.cjs.map +1 -0
- package/dist/{chunk-FIKTQR7H.js → chunk-I2P3TIP7.js} +2 -2
- package/dist/{chunk-BNTVOKYT.cjs → chunk-KJKDLD7N.cjs} +51 -9
- package/dist/chunk-KJKDLD7N.cjs.map +1 -0
- package/dist/{chunk-VQSRCMMK.js → chunk-QGO6X6LG.js} +2 -15
- package/dist/chunk-QGO6X6LG.js.map +1 -0
- package/dist/chunk-W23EJNYG.js +351 -0
- package/dist/chunk-W23EJNYG.js.map +1 -0
- package/dist/{chunk-CAE2BVKI.cjs → chunk-Z2V525IS.cjs} +6 -6
- package/dist/{chunk-CAE2BVKI.cjs.map → chunk-Z2V525IS.cjs.map} +1 -1
- package/dist/contract/index.cjs +2 -5
- package/dist/contract/index.cjs.map +1 -1
- package/dist/contract/index.d.cts +2 -4
- package/dist/contract/index.d.ts +2 -4
- package/dist/contract/index.js +1 -4
- package/dist/eip712/index.cjs +9 -3
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.d.cts +44 -2
- package/dist/eip712/index.d.ts +44 -2
- package/dist/eip712/index.js +8 -2
- package/dist/index-B06IJlHe.d.ts +244 -0
- package/dist/index-B7pGBych.d.cts +244 -0
- package/dist/index.cjs +365 -329
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +778 -459
- package/dist/index.d.ts +778 -459
- package/dist/index.js +383 -347
- package/dist/index.js.map +1 -1
- package/dist/quoting/index.cjs +3 -3
- package/dist/quoting/index.d.cts +1 -1
- package/dist/quoting/index.d.ts +1 -1
- package/dist/quoting/index.js +2 -2
- package/dist/swap/index.cjs +4 -3
- package/dist/swap/index.cjs.map +1 -1
- package/dist/swap/index.d.cts +3 -84
- package/dist/swap/index.d.ts +3 -84
- package/dist/swap/index.js +3 -2
- package/dist/{types-BDOnH5Le.d.ts → types-b5_Tokjl.d.cts} +8 -17
- package/dist/{types-BDOnH5Le.d.cts → types-b5_Tokjl.d.ts} +8 -17
- package/package.json +1 -1
- package/dist/chunk-27V32VNM.cjs +0 -370
- package/dist/chunk-27V32VNM.cjs.map +0 -1
- package/dist/chunk-4RYBJLF3.js +0 -370
- package/dist/chunk-4RYBJLF3.js.map +0 -1
- package/dist/chunk-5QJZT7VB.cjs +0 -46
- package/dist/chunk-5QJZT7VB.cjs.map +0 -1
- package/dist/chunk-6I6K43RQ.cjs +0 -149
- package/dist/chunk-6I6K43RQ.cjs.map +0 -1
- package/dist/chunk-BNTVOKYT.cjs.map +0 -1
- package/dist/chunk-C4ZDYG4D.js.map +0 -1
- package/dist/chunk-CWP4PFOP.cjs.map +0 -1
- package/dist/chunk-L74CZAVQ.cjs +0 -99
- package/dist/chunk-L74CZAVQ.cjs.map +0 -1
- package/dist/chunk-P56TUGTS.js +0 -46
- package/dist/chunk-P56TUGTS.js.map +0 -1
- package/dist/chunk-R4L66ZR5.js.map +0 -1
- package/dist/chunk-UU72CX7E.js +0 -149
- package/dist/chunk-UU72CX7E.js.map +0 -1
- package/dist/chunk-VQSRCMMK.js.map +0 -1
- package/dist/chunk-X3I5XWAR.cjs.map +0 -1
- package/dist/chunk-X4IXUTTD.js +0 -99
- package/dist/chunk-X4IXUTTD.js.map +0 -1
- package/dist/relay/index.cjs +0 -19
- package/dist/relay/index.cjs.map +0 -1
- package/dist/relay/index.d.cts +0 -75
- package/dist/relay/index.d.ts +0 -75
- package/dist/relay/index.js +0 -19
- package/dist/relay/index.js.map +0 -1
- /package/dist/{chunk-5YH4D7QF.js.map → chunk-7UBO7DY5.js.map} +0 -0
- /package/dist/{chunk-FIKTQR7H.js.map → chunk-I2P3TIP7.js.map} +0 -0
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkALCWYDVGcjs = require('./chunk-ALCWYDVG.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -17,8 +17,7 @@ var _chunkGWLEEXM4cjs = require('./chunk-GWLEEXM4.cjs');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
var _chunkX3I5XWARcjs = require('./chunk-X3I5XWAR.cjs');
|
|
20
|
+
var _chunkCQCSQPWGcjs = require('./chunk-CQCSQPWG.cjs');
|
|
22
21
|
|
|
23
22
|
|
|
24
23
|
|
|
@@ -32,7 +31,10 @@ var _chunkS2XRFFP3cjs = require('./chunk-S2XRFFP3.cjs');
|
|
|
32
31
|
|
|
33
32
|
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
var _chunkKJKDLD7Ncjs = require('./chunk-KJKDLD7N.cjs');
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
|
|
@@ -40,7 +42,7 @@ var _chunkBNTVOKYTcjs = require('./chunk-BNTVOKYT.cjs');
|
|
|
40
42
|
|
|
41
43
|
|
|
42
44
|
|
|
43
|
-
var
|
|
45
|
+
var _chunkZ2V525IScjs = require('./chunk-Z2V525IS.cjs');
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
var _chunkCL3QSI4Ocjs = require('./chunk-CL3QSI4O.cjs');
|
|
@@ -53,18 +55,16 @@ var _chunkCL3QSI4Ocjs = require('./chunk-CL3QSI4O.cjs');
|
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
|
|
56
|
-
var _chunkCWP4PFOPcjs = require('./chunk-CWP4PFOP.cjs');
|
|
57
58
|
|
|
59
|
+
var _chunkDMW67WBUcjs = require('./chunk-DMW67WBU.cjs');
|
|
58
60
|
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
|
|
64
|
-
var _chunkL74CZAVQcjs = require('./chunk-L74CZAVQ.cjs');
|
|
65
66
|
|
|
66
67
|
|
|
67
|
-
var _chunk27V32VNMcjs = require('./chunk-27V32VNM.cjs');
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
|
|
@@ -77,115 +77,165 @@ var _chunk27V32VNMcjs = require('./chunk-27V32VNM.cjs');
|
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
|
|
80
|
-
var _chunk6I6K43RQcjs = require('./chunk-6I6K43RQ.cjs');
|
|
81
80
|
|
|
82
81
|
|
|
83
82
|
|
|
84
83
|
|
|
85
|
-
var _chunkIPXARZ6Fcjs = require('./chunk-IPXARZ6F.cjs');
|
|
86
84
|
|
|
87
85
|
|
|
86
|
+
var _chunkEDR5SFJNcjs = require('./chunk-EDR5SFJN.cjs');
|
|
88
87
|
|
|
89
88
|
|
|
90
89
|
|
|
91
90
|
|
|
92
|
-
var
|
|
91
|
+
var _chunkIPXARZ6Fcjs = require('./chunk-IPXARZ6F.cjs');
|
|
93
92
|
|
|
94
93
|
// src/index.ts
|
|
95
94
|
var _viem = require('viem');
|
|
96
95
|
|
|
97
|
-
// src/
|
|
98
|
-
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
99
|
-
var ZERO_VALUE = 0n;
|
|
100
|
-
|
|
101
|
-
// src/userop/operations.ts
|
|
96
|
+
// src/perp/buildPerpDepositWithGasDeduction.ts
|
|
102
97
|
|
|
103
|
-
var ERC20_BURNABLE_ABI = _viem.parseAbi.call(void 0, ["function burn(uint256 amount)"]);
|
|
104
|
-
function erc20TransferOp(token, to, amount) {
|
|
105
|
-
return {
|
|
106
|
-
target: token,
|
|
107
|
-
value: 0n,
|
|
108
|
-
data: _viem.encodeFunctionData.call(void 0, {
|
|
109
|
-
abi: _viem.erc20Abi,
|
|
110
|
-
functionName: "transfer",
|
|
111
|
-
args: [to, amount]
|
|
112
|
-
})
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
function erc20ApproveOp(token, spender, amount) {
|
|
116
|
-
return {
|
|
117
|
-
target: token,
|
|
118
|
-
value: 0n,
|
|
119
|
-
data: _viem.encodeFunctionData.call(void 0, {
|
|
120
|
-
abi: _viem.erc20Abi,
|
|
121
|
-
functionName: "approve",
|
|
122
|
-
args: [spender, amount]
|
|
123
|
-
})
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function erc20BurnOp(token, amount) {
|
|
127
|
-
return {
|
|
128
|
-
target: token,
|
|
129
|
-
value: 0n,
|
|
130
|
-
data: _viem.encodeFunctionData.call(void 0, {
|
|
131
|
-
abi: ERC20_BURNABLE_ABI,
|
|
132
|
-
functionName: "burn",
|
|
133
|
-
args: [amount]
|
|
134
|
-
})
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
function rawCallOp(target, data, value = 0n) {
|
|
138
|
-
return { target, value, data };
|
|
139
|
-
}
|
|
140
98
|
|
|
141
|
-
// src/
|
|
99
|
+
// src/contracts/real/orderlyVault.ts
|
|
142
100
|
|
|
143
|
-
var
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
101
|
+
var ORDERLY_VAULT_BASE_MAINNET = "0xDe5cE5DD048596e46Ff671b13317aCC3C5B59b01";
|
|
102
|
+
var ORDERLY_VAULT_ADDRESSES = {
|
|
103
|
+
8453: ORDERLY_VAULT_BASE_MAINNET
|
|
104
|
+
};
|
|
105
|
+
var BROKER_HASHES = {
|
|
106
|
+
/** Default partner broker on Base — most commonly whitelisted. */
|
|
107
|
+
woofi_pro: _viem.keccak256.call(void 0, _viem.encodePacked.call(void 0, ["string"], ["woofi_pro"])),
|
|
108
|
+
/** Orderly's own white-label broker. */
|
|
109
|
+
orderly: _viem.keccak256.call(void 0, _viem.encodePacked.call(void 0, ["string"], ["orderly"])),
|
|
110
|
+
/** LogX. */
|
|
111
|
+
logx: _viem.keccak256.call(void 0, _viem.encodePacked.call(void 0, ["string"], ["logx"]))
|
|
112
|
+
};
|
|
113
|
+
var TOKEN_HASHES = {
|
|
114
|
+
USDC: _viem.keccak256.call(void 0, _viem.encodePacked.call(void 0, ["string"], ["USDC"]))
|
|
115
|
+
};
|
|
116
|
+
function computeAccountId(user, brokerHash) {
|
|
117
|
+
return _viem.keccak256.call(void 0,
|
|
118
|
+
_viem.encodeAbiParameters.call(void 0,
|
|
119
|
+
[
|
|
120
|
+
{ type: "address" },
|
|
121
|
+
{ type: "bytes32" }
|
|
122
|
+
],
|
|
123
|
+
[user, brokerHash]
|
|
124
|
+
)
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
var ORDERLY_VAULT_ABI = [
|
|
128
|
+
// Deposit USDC into Orderly perp account. Emits LayerZero message
|
|
129
|
+
// to the Orderly chain. `msg.value` MUST equal `getDepositFee(...)`.
|
|
130
|
+
{
|
|
131
|
+
type: "function",
|
|
132
|
+
name: "deposit",
|
|
133
|
+
stateMutability: "payable",
|
|
134
|
+
inputs: [
|
|
135
|
+
{
|
|
136
|
+
name: "data",
|
|
137
|
+
type: "tuple",
|
|
138
|
+
components: [
|
|
139
|
+
{ name: "accountId", type: "bytes32" },
|
|
140
|
+
{ name: "brokerHash", type: "bytes32" },
|
|
141
|
+
{ name: "tokenHash", type: "bytes32" },
|
|
142
|
+
{ name: "tokenAmount", type: "uint128" }
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
outputs: []
|
|
147
|
+
},
|
|
148
|
+
// Quote the LayerZero fee for a deposit message. Pass the same
|
|
149
|
+
// VaultDepositFE struct you intend to send.
|
|
150
|
+
{
|
|
151
|
+
type: "function",
|
|
152
|
+
name: "getDepositFee",
|
|
153
|
+
stateMutability: "view",
|
|
154
|
+
inputs: [
|
|
155
|
+
{ name: "user", type: "address" },
|
|
156
|
+
{
|
|
157
|
+
name: "data",
|
|
158
|
+
type: "tuple",
|
|
159
|
+
components: [
|
|
160
|
+
{ name: "accountId", type: "bytes32" },
|
|
161
|
+
{ name: "brokerHash", type: "bytes32" },
|
|
162
|
+
{ name: "tokenHash", type: "bytes32" },
|
|
163
|
+
{ name: "tokenAmount", type: "uint128" }
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
],
|
|
167
|
+
outputs: [{ name: "", type: "uint256" }]
|
|
168
|
+
},
|
|
169
|
+
// Pre-flight check — is this brokerId whitelisted on this Vault?
|
|
170
|
+
{
|
|
171
|
+
type: "function",
|
|
172
|
+
name: "getAllowedBroker",
|
|
173
|
+
stateMutability: "view",
|
|
174
|
+
inputs: [{ name: "brokerHash", type: "bytes32" }],
|
|
175
|
+
outputs: [{ name: "", type: "bool" }]
|
|
176
|
+
},
|
|
177
|
+
// Pre-flight check — what ERC-20 address does this token symbol
|
|
178
|
+
// resolve to on this Vault?
|
|
179
|
+
{
|
|
180
|
+
type: "function",
|
|
181
|
+
name: "getAllowedToken",
|
|
182
|
+
stateMutability: "view",
|
|
183
|
+
inputs: [{ name: "tokenHash", type: "bytes32" }],
|
|
184
|
+
outputs: [{ name: "", type: "address" }]
|
|
185
|
+
}
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
// src/perp/buildPerpDepositWithGasDeduction.ts
|
|
189
|
+
function buildPerpDepositWithGasDeduction(params) {
|
|
190
|
+
if (params.amount <= 0n) {
|
|
191
|
+
throw new Error("buildPerpDepositWithGasDeduction: amount must be positive");
|
|
192
|
+
}
|
|
193
|
+
if (params.layerZeroFee < 0n) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
"buildPerpDepositWithGasDeduction: layerZeroFee cannot be negative"
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
if (params.depositData.tokenAmount !== params.amount) {
|
|
199
|
+
throw new Error(
|
|
200
|
+
`buildPerpDepositWithGasDeduction: depositData.tokenAmount (${params.depositData.tokenAmount}) must equal amount (${params.amount})`
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
const vault = _nullishCoalesce(params.vaultAddress, () => ( ORDERLY_VAULT_ADDRESSES[params.chainId]));
|
|
204
|
+
if (!vault) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
`buildPerpDepositWithGasDeduction: no Orderly Vault address for chainId ${params.chainId}`
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
const depositCallData = _viem.encodeFunctionData.call(void 0, {
|
|
210
|
+
abi: ORDERLY_VAULT_ABI,
|
|
211
|
+
functionName: "deposit",
|
|
212
|
+
args: [params.depositData]
|
|
213
|
+
});
|
|
214
|
+
const operations = [
|
|
215
|
+
_chunkEDR5SFJNcjs.erc20ApproveOp.call(void 0, params.usdcAddress, vault, params.amount),
|
|
216
|
+
{
|
|
217
|
+
..._chunkEDR5SFJNcjs.rawCallOp.call(void 0, vault, depositCallData),
|
|
218
|
+
// BatchExecutor passes `value` from the inner call along; this
|
|
219
|
+
// becomes the LayerZero fee. The aggregated `msg.value` for the
|
|
220
|
+
// top-level UserOp must equal the sum of inner `value`s.
|
|
221
|
+
value: params.layerZeroFee
|
|
222
|
+
}
|
|
223
|
+
];
|
|
224
|
+
return _chunkEDR5SFJNcjs.buildPartialUserOperation.call(void 0, {
|
|
225
|
+
sender: params.userAddress,
|
|
226
|
+
nonce: params.aaNonce,
|
|
227
|
+
operations,
|
|
228
|
+
gasLimits: {
|
|
229
|
+
callGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _ => _.gasLimits, 'optionalAccess', _2 => _2.callGasLimit]), () => ( 800000n)),
|
|
230
|
+
verificationGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _3 => _3.gasLimits, 'optionalAccess', _4 => _4.verificationGasLimit]), () => ( 150000n)),
|
|
231
|
+
preVerificationGas: _nullishCoalesce(_optionalChain([params, 'access', _5 => _5.gasLimits, 'optionalAccess', _6 => _6.preVerificationGas]), () => ( 50000n))
|
|
232
|
+
}
|
|
160
233
|
});
|
|
161
234
|
}
|
|
162
235
|
|
|
163
|
-
// src/userop/
|
|
164
|
-
var
|
|
165
|
-
var
|
|
166
|
-
var DEFAULT_PRE_VERIFICATION_GAS = 50000n;
|
|
167
|
-
function buildPartialUserOperation(params) {
|
|
168
|
-
return {
|
|
169
|
-
sender: params.sender,
|
|
170
|
-
nonce: params.nonce,
|
|
171
|
-
callData: encodeBatchExecute(params.operations),
|
|
172
|
-
callGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _ => _.gasLimits, 'optionalAccess', _2 => _2.callGasLimit]), () => ( DEFAULT_CALL_GAS_LIMIT)),
|
|
173
|
-
verificationGasLimit: _nullishCoalesce(_optionalChain([params, 'access', _3 => _3.gasLimits, 'optionalAccess', _4 => _4.verificationGasLimit]), () => ( DEFAULT_VERIFICATION_GAS_LIMIT)),
|
|
174
|
-
preVerificationGas: _nullishCoalesce(_optionalChain([params, 'access', _5 => _5.gasLimits, 'optionalAccess', _6 => _6.preVerificationGas]), () => ( DEFAULT_PRE_VERIFICATION_GAS)),
|
|
175
|
-
maxFeePerGas: _nullishCoalesce(_optionalChain([params, 'access', _7 => _7.feeOverrides, 'optionalAccess', _8 => _8.maxFeePerGas]), () => ( 0n)),
|
|
176
|
-
maxPriorityFeePerGas: _nullishCoalesce(_optionalChain([params, 'access', _9 => _9.feeOverrides, 'optionalAccess', _10 => _10.maxPriorityFeePerGas]), () => ( 0n))
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
function assembleUserOperation(partial, paymaster, signature) {
|
|
180
|
-
return {
|
|
181
|
-
...partial,
|
|
182
|
-
paymaster: paymaster.paymaster,
|
|
183
|
-
paymasterData: paymaster.paymasterData,
|
|
184
|
-
paymasterVerificationGasLimit: paymaster.paymasterVerificationGasLimit,
|
|
185
|
-
paymasterPostOpGasLimit: paymaster.paymasterPostOpGasLimit,
|
|
186
|
-
signature
|
|
187
|
-
};
|
|
188
|
-
}
|
|
236
|
+
// src/userop/types.ts
|
|
237
|
+
var ENTRY_POINT_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
|
|
238
|
+
var ZERO_VALUE = 0n;
|
|
189
239
|
|
|
190
240
|
// src/paymaster/config.ts
|
|
191
241
|
var _config = null;
|
|
@@ -230,174 +280,223 @@ async function checkEthAndBranch(params) {
|
|
|
230
280
|
return balance >= required ? "normal" : "paymaster";
|
|
231
281
|
}
|
|
232
282
|
|
|
233
|
-
// src/contracts/
|
|
234
|
-
|
|
235
|
-
var
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
"function
|
|
239
|
-
|
|
283
|
+
// src/contracts/real/pointToken.ts
|
|
284
|
+
|
|
285
|
+
var POINT_TOKEN_ABI = _viem.parseAbi.call(void 0, [
|
|
286
|
+
// --- Mint paths ---
|
|
287
|
+
"function mint(address to, uint256 amount) external",
|
|
288
|
+
"function mint(address to, uint256 amount, uint256 deadline, bytes minterSig) external",
|
|
289
|
+
// --- Burn paths ---
|
|
290
|
+
"function burn(address from, uint256 amount) external",
|
|
291
|
+
"function burn(address from, uint256 amount, uint256 deadline, bytes burnerSig) external",
|
|
292
|
+
// --- Authorization reads ---
|
|
293
|
+
"function minters(address account) external view returns (bool)",
|
|
294
|
+
"function burners(address account) external view returns (bool)",
|
|
295
|
+
// --- Authorization writes (owner-only; used by provisioning scripts) ---
|
|
296
|
+
"function addMinter(address minter) external",
|
|
297
|
+
"function removeMinter(address minter) external",
|
|
298
|
+
"function addBurner(address burner) external",
|
|
299
|
+
"function removeBurner(address burner) external",
|
|
300
|
+
// --- Nonces (sig-gated paths) ---
|
|
301
|
+
"function mintRequestNonces(address receiver) external view returns (uint256)",
|
|
302
|
+
"function burnRequestNonces(address from) external view returns (uint256)",
|
|
303
|
+
// --- Oracle ---
|
|
304
|
+
"function mintingOracle() external view returns (address)",
|
|
305
|
+
"function setMintingOracle(address _mintingOracle) external",
|
|
306
|
+
// --- Issuer ---
|
|
307
|
+
"function issuer() external view returns (address)",
|
|
308
|
+
// --- Standard ERC-20 reads ---
|
|
309
|
+
"function balanceOf(address account) external view returns (uint256)",
|
|
310
|
+
"function totalSupply() external view returns (uint256)",
|
|
311
|
+
"function name() external view returns (string)",
|
|
312
|
+
"function symbol() external view returns (string)",
|
|
313
|
+
"function decimals() external view returns (uint8)",
|
|
314
|
+
// --- EIP-712 domain (for off-chain sig verification) ---
|
|
315
|
+
"function DOMAIN_SEPARATOR() external view returns (bytes32)",
|
|
316
|
+
"function eip712Domain() external view returns (bytes1 fields, string name, string version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] extensions)",
|
|
317
|
+
// --- Events ---
|
|
318
|
+
// PointIndexer filters Transfer(from=0x0) for mints
|
|
319
|
+
// BurnIndexer filters Transfer(to=0x0) for burns
|
|
320
|
+
"event Transfer(address indexed from, address indexed to, uint256 value)",
|
|
321
|
+
"event MinterAdded(address indexed minter)",
|
|
322
|
+
"event MinterRemoved(address indexed minter)",
|
|
323
|
+
"event BurnerAdded(address indexed burner)",
|
|
324
|
+
"event BurnerRemoved(address indexed burner)",
|
|
325
|
+
"event MintingOracleUpdated(address indexed mintingOracle)"
|
|
240
326
|
]);
|
|
241
|
-
var MOCK_RELAYER_V2_MINT_SELECTOR = "0xMOCKED__";
|
|
242
|
-
|
|
243
|
-
// src/contracts/mocks/pointTokenV2.mock.ts
|
|
244
|
-
|
|
245
|
-
var MOCK_POINT_TOKEN_V2_ABI = _viem.parseAbi.call(void 0, [
|
|
246
|
-
// Variant A
|
|
247
|
-
"function burn(uint256 amount) external",
|
|
248
|
-
// Variant B
|
|
249
|
-
"function burnWithSig((address user, address pointToken, uint256 amount, uint256 nonce, uint256 deadline) consent, (uint8 v, bytes32 r, bytes32 s) sig) external",
|
|
250
|
-
// Standard reads we always need
|
|
251
|
-
"function balanceOf(address user) external view returns (uint256)",
|
|
252
|
-
"function burnNonce(address user) external view returns (uint256)",
|
|
253
|
-
// ERC-20 Transfer event (inherited) — BurnIndexer filters `to = 0x0`
|
|
254
|
-
"event Transfer(address indexed from, address indexed to, uint256 value)"
|
|
255
|
-
]);
|
|
256
|
-
|
|
257
|
-
// src/contracts/mocks/batchExecutor.mock.ts
|
|
258
|
-
var MOCK_BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = "0x000000000000000000000000000000000000DE01";
|
|
259
|
-
var MOCK_BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = "0x000000000000000000000000000000000000DE02";
|
|
260
327
|
|
|
261
|
-
// src/contracts/
|
|
262
|
-
var
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
//
|
|
275
|
-
//
|
|
328
|
+
// src/contracts/real/batchExecutor.ts
|
|
329
|
+
var BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = "0x000000000000000000000000000000000000DE01";
|
|
330
|
+
var BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = "0x7702cb554e6bFb442cb743A7dF23154544a7176C";
|
|
331
|
+
|
|
332
|
+
// src/contracts/real/addresses.ts
|
|
333
|
+
var PLACEHOLDER_DEAD = (suffix) => `0x000000000000000000000000000000000000${suffix.toLowerCase().padStart(4, "0")}`;
|
|
334
|
+
var CONTRACT_ADDRESSES = {
|
|
335
|
+
// Base mainnet — SC-delivered (2026-04-21, 2026-04-22)
|
|
336
|
+
// registry: IssuerRegistry 0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31
|
|
337
|
+
// factory: PointTokenFactory 0x36c0BAb2faBE45EfA6d13001143e43A266Af673B
|
|
338
|
+
// oracle: MintingOracle 0xD85165939C700E51c8a45099316C6482634C2Ab9
|
|
339
|
+
// tokenImpl: PointToken (impl) 0x2e6FB1B0C1A51abb83eC974890126a64eC02E995
|
|
340
|
+
// mockUsdt: MockERC20 0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd
|
|
341
|
+
// POINT: PointToken instance 0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e
|
|
342
|
+
// batchExecutor: Coinbase SW v2 0x7702cb554e6bFb442cb743A7dF23154544a7176C
|
|
343
|
+
// pafiHook: PAFIHook (V4, 10%) 0x870cAF9882d3160602AaC1769C2B264A2d8EC044
|
|
276
344
|
8453: {
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
345
|
+
pointToken: "0x7d25E7156E51F865D522fd3ef257a6B5DD41b97e",
|
|
346
|
+
batchExecutor: "0x7702cb554e6bFb442cb743A7dF23154544a7176C",
|
|
347
|
+
usdt: "0x5d313485Ba59C3bb91e1A9C0C11782F0b83d5dcd",
|
|
348
|
+
issuerRegistry: "0xda2D3338CF70F462Ac175F5f2edfa45660CA4f31",
|
|
349
|
+
mintingOracle: "0xD85165939C700E51c8a45099316C6482634C2Ab9",
|
|
350
|
+
pafiHook: "0x870cAF9882d3160602AaC1769C2B264A2d8EC044"
|
|
351
|
+
},
|
|
352
|
+
// Base Sepolia — not in active use; placeholders kept so the map
|
|
353
|
+
// compiles for tooling that enumerates chains.
|
|
354
|
+
84532: {
|
|
355
|
+
pointToken: PLACEHOLDER_DEAD("dead"),
|
|
356
|
+
batchExecutor: PLACEHOLDER_DEAD("de01"),
|
|
357
|
+
usdt: PLACEHOLDER_DEAD("dead"),
|
|
358
|
+
issuerRegistry: PLACEHOLDER_DEAD("dead"),
|
|
359
|
+
mintingOracle: PLACEHOLDER_DEAD("dead"),
|
|
360
|
+
pafiHook: PLACEHOLDER_DEAD("dead")
|
|
283
361
|
}
|
|
284
362
|
};
|
|
285
|
-
|
|
286
|
-
|
|
363
|
+
var POINT_TOKEN_FACTORY_ADDRESSES = {
|
|
364
|
+
8453: "0x36c0BAb2faBE45EfA6d13001143e43A266Af673B",
|
|
365
|
+
84532: PLACEHOLDER_DEAD("dead")
|
|
366
|
+
};
|
|
367
|
+
var POINT_TOKEN_IMPL_ADDRESSES = {
|
|
368
|
+
8453: "0x2e6FB1B0C1A51abb83eC974890126a64eC02E995",
|
|
369
|
+
84532: PLACEHOLDER_DEAD("dead")
|
|
370
|
+
};
|
|
371
|
+
function getContractAddresses(chainId) {
|
|
372
|
+
const addrs = CONTRACT_ADDRESSES[chainId];
|
|
287
373
|
if (!addrs) {
|
|
288
374
|
throw new Error(
|
|
289
|
-
`
|
|
375
|
+
`getContractAddresses: no addresses for chainId ${chainId}. Supported: ${Object.keys(CONTRACT_ADDRESSES).join(", ")}`
|
|
290
376
|
);
|
|
291
377
|
}
|
|
292
378
|
return addrs;
|
|
293
379
|
}
|
|
294
380
|
|
|
295
|
-
// src/
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
]
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
381
|
+
// src/web-handoff/webPopup.ts
|
|
382
|
+
var DEFAULT_WIDTH = 900;
|
|
383
|
+
var DEFAULT_HEIGHT = 700;
|
|
384
|
+
var DEFAULT_NAME = "pafi-web";
|
|
385
|
+
function openWebPopup(url, options = {}) {
|
|
386
|
+
if (typeof window === "undefined" || typeof window.open !== "function") {
|
|
387
|
+
throw new Error(
|
|
388
|
+
"openWebPopup: `window.open` is not available in this runtime. Register a platform adapter via setPafiWebModalAdapter() instead."
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
const width = _nullishCoalesce(options.width, () => ( DEFAULT_WIDTH));
|
|
392
|
+
const height = _nullishCoalesce(options.height, () => ( DEFAULT_HEIGHT));
|
|
393
|
+
const name = _nullishCoalesce(options.windowName, () => ( DEFAULT_NAME));
|
|
394
|
+
const screenW = _nullishCoalesce(_optionalChain([window, 'access', _7 => _7.screen, 'optionalAccess', _8 => _8.availWidth]), () => ( window.innerWidth));
|
|
395
|
+
const screenH = _nullishCoalesce(_optionalChain([window, 'access', _9 => _9.screen, 'optionalAccess', _10 => _10.availHeight]), () => ( window.innerHeight));
|
|
396
|
+
const left = Math.max(0, Math.floor((screenW - width) / 2));
|
|
397
|
+
const top = Math.max(0, Math.floor((screenH - height) / 2));
|
|
398
|
+
const features = [
|
|
399
|
+
`width=${width}`,
|
|
400
|
+
`height=${height}`,
|
|
401
|
+
`left=${left}`,
|
|
402
|
+
`top=${top}`,
|
|
403
|
+
"resizable=yes",
|
|
404
|
+
"scrollbars=yes",
|
|
405
|
+
"noopener=no"
|
|
406
|
+
// we need opener.postMessage to work
|
|
407
|
+
].join(",");
|
|
408
|
+
const popup = window.open(url, name, features);
|
|
409
|
+
if (!popup) {
|
|
410
|
+
throw new Error(
|
|
411
|
+
"openWebPopup: popup was blocked. Ensure this call runs inside a user gesture (click handler)."
|
|
412
|
+
);
|
|
413
|
+
}
|
|
414
|
+
let closed = false;
|
|
415
|
+
let pollId = null;
|
|
416
|
+
let messageListener = null;
|
|
417
|
+
const dispose = () => {
|
|
418
|
+
if (closed) return;
|
|
419
|
+
closed = true;
|
|
420
|
+
if (pollId !== null) {
|
|
421
|
+
clearInterval(pollId);
|
|
422
|
+
pollId = null;
|
|
423
|
+
}
|
|
424
|
+
if (messageListener) {
|
|
425
|
+
window.removeEventListener("message", messageListener);
|
|
426
|
+
messageListener = null;
|
|
427
|
+
}
|
|
428
|
+
_optionalChain([options, 'access', _11 => _11.onClose, 'optionalCall', _12 => _12()]);
|
|
333
429
|
};
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
430
|
+
pollId = setInterval(() => {
|
|
431
|
+
if (popup.closed) {
|
|
432
|
+
dispose();
|
|
433
|
+
}
|
|
434
|
+
}, 500);
|
|
435
|
+
if (options.onMessage) {
|
|
436
|
+
const allowed = _nullishCoalesce(options.allowedOrigins, () => ( []));
|
|
437
|
+
const onMessage = options.onMessage;
|
|
438
|
+
messageListener = (event) => {
|
|
439
|
+
if (event.source !== popup) return;
|
|
440
|
+
if (!allowed.includes(event.origin)) return;
|
|
441
|
+
onMessage(event.data, event.origin);
|
|
442
|
+
};
|
|
443
|
+
window.addEventListener("message", messageListener);
|
|
444
|
+
}
|
|
344
445
|
return {
|
|
345
|
-
|
|
346
|
-
|
|
446
|
+
get isOpen() {
|
|
447
|
+
return !closed && !popup.closed;
|
|
448
|
+
},
|
|
449
|
+
close() {
|
|
450
|
+
if (closed) return;
|
|
451
|
+
try {
|
|
452
|
+
popup.close();
|
|
453
|
+
} catch (e) {
|
|
454
|
+
}
|
|
455
|
+
dispose();
|
|
456
|
+
},
|
|
457
|
+
focus() {
|
|
458
|
+
if (closed || popup.closed) return;
|
|
459
|
+
try {
|
|
460
|
+
popup.focus();
|
|
461
|
+
} catch (e2) {
|
|
462
|
+
}
|
|
463
|
+
},
|
|
464
|
+
postMessage(data) {
|
|
465
|
+
if (closed || popup.closed) return;
|
|
466
|
+
try {
|
|
467
|
+
popup.postMessage(data, "*");
|
|
468
|
+
} catch (e3) {
|
|
469
|
+
}
|
|
470
|
+
}
|
|
347
471
|
};
|
|
348
472
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
var MOCK_BURN_CONSENT_TYPES = {
|
|
356
|
-
BurnConsent: [
|
|
357
|
-
{ name: "user", type: "address" },
|
|
358
|
-
{ name: "pointToken", type: "address" },
|
|
359
|
-
{ name: "amount", type: "uint256" },
|
|
360
|
-
{ name: "nonce", type: "uint256" },
|
|
361
|
-
{ name: "deadline", type: "uint256" }
|
|
362
|
-
]
|
|
473
|
+
var webPopupAdapter = {
|
|
474
|
+
open(url, options) {
|
|
475
|
+
return openWebPopup(url, options);
|
|
476
|
+
}
|
|
363
477
|
};
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
message
|
|
370
|
-
};
|
|
478
|
+
|
|
479
|
+
// src/web-handoff/index.ts
|
|
480
|
+
var registeredAdapter = null;
|
|
481
|
+
function setPafiWebModalAdapter(adapter) {
|
|
482
|
+
registeredAdapter = adapter;
|
|
371
483
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
account: walletClient.account,
|
|
375
|
-
domain: _chunkBNTVOKYTcjs.buildDomain.call(void 0, domain),
|
|
376
|
-
types: MOCK_BURN_CONSENT_TYPES,
|
|
377
|
-
primaryType: "BurnConsent",
|
|
378
|
-
message
|
|
379
|
-
});
|
|
380
|
-
const { v, r, s } = _viem.parseSignature.call(void 0, serialized);
|
|
381
|
-
return {
|
|
382
|
-
v: Number(v),
|
|
383
|
-
r,
|
|
384
|
-
s,
|
|
385
|
-
serialized
|
|
386
|
-
};
|
|
484
|
+
function getPafiWebModalAdapter() {
|
|
485
|
+
return registeredAdapter;
|
|
387
486
|
}
|
|
388
|
-
async function
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
487
|
+
async function openPafiWebModal(url, options = {}) {
|
|
488
|
+
if (!url || typeof url !== "string") {
|
|
489
|
+
throw new Error("openPafiWebModal: `url` is required");
|
|
490
|
+
}
|
|
491
|
+
if (registeredAdapter) {
|
|
492
|
+
return Promise.resolve(registeredAdapter.open(url, options));
|
|
493
|
+
}
|
|
494
|
+
if (typeof window !== "undefined" && typeof window.open === "function") {
|
|
495
|
+
return openWebPopup(url, options);
|
|
496
|
+
}
|
|
497
|
+
throw new Error(
|
|
498
|
+
"openPafiWebModal: no adapter registered and `window.open` is unavailable. Call `setPafiWebModalAdapter()` with a platform-specific adapter (e.g. SFSafariViewController on iOS) during app boot."
|
|
499
|
+
);
|
|
401
500
|
}
|
|
402
501
|
|
|
403
502
|
// src/index.ts
|
|
@@ -406,10 +505,8 @@ var PafiSDK = class {
|
|
|
406
505
|
|
|
407
506
|
|
|
408
507
|
|
|
409
|
-
|
|
410
508
|
constructor(config) {
|
|
411
509
|
this._pointTokenAddress = config.pointTokenAddress;
|
|
412
|
-
this._relayContractAddress = config.relayContractAddress;
|
|
413
510
|
this._signer = config.signer;
|
|
414
511
|
this._chainId = config.chainId;
|
|
415
512
|
if (config.provider) {
|
|
@@ -426,9 +523,6 @@ var PafiSDK = class {
|
|
|
426
523
|
setPointTokenAddress(address) {
|
|
427
524
|
this._pointTokenAddress = address;
|
|
428
525
|
}
|
|
429
|
-
setRelayContractAddress(address) {
|
|
430
|
-
this._relayContractAddress = address;
|
|
431
|
-
}
|
|
432
526
|
setSigner(signer) {
|
|
433
527
|
this._signer = signer;
|
|
434
528
|
}
|
|
@@ -440,25 +534,25 @@ var PafiSDK = class {
|
|
|
440
534
|
// -------------------------------------------------------------------------
|
|
441
535
|
requirePointToken() {
|
|
442
536
|
if (!this._pointTokenAddress) {
|
|
443
|
-
throw new (0,
|
|
537
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("pointTokenAddress not set");
|
|
444
538
|
}
|
|
445
539
|
return this._pointTokenAddress;
|
|
446
540
|
}
|
|
447
541
|
requireProvider() {
|
|
448
542
|
if (!this._provider) {
|
|
449
|
-
throw new (0,
|
|
543
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("provider not set");
|
|
450
544
|
}
|
|
451
545
|
return this._provider;
|
|
452
546
|
}
|
|
453
547
|
requireSigner() {
|
|
454
548
|
if (!this._signer) {
|
|
455
|
-
throw new (0,
|
|
549
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer not set");
|
|
456
550
|
}
|
|
457
551
|
return this._signer;
|
|
458
552
|
}
|
|
459
553
|
requireChainId() {
|
|
460
554
|
if (this._chainId === void 0) {
|
|
461
|
-
throw new (0,
|
|
555
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("chainId not set");
|
|
462
556
|
}
|
|
463
557
|
return this._chainId;
|
|
464
558
|
}
|
|
@@ -469,71 +563,54 @@ var PafiSDK = class {
|
|
|
469
563
|
const provider = this.requireProvider();
|
|
470
564
|
const pointToken = this.requirePointToken();
|
|
471
565
|
const chainId = this.requireChainId();
|
|
472
|
-
const name = await
|
|
566
|
+
const name = await _chunkCQCSQPWGcjs.getTokenName.call(void 0, provider, pointToken);
|
|
473
567
|
return { name, verifyingContract: pointToken, chainId };
|
|
474
568
|
}
|
|
475
569
|
// -------------------------------------------------------------------------
|
|
476
570
|
// EIP-712 — delegates to pure functions
|
|
477
571
|
// -------------------------------------------------------------------------
|
|
478
|
-
/**
|
|
479
|
-
* Build the EIP-712 typed data for a MintRequest.
|
|
480
|
-
* Pass the result to any external signer (Privy, WalletConnect, etc.).
|
|
481
|
-
*/
|
|
482
572
|
async buildMintRequestTypedData(message) {
|
|
483
573
|
const domain = await this.getDomain();
|
|
484
|
-
return
|
|
574
|
+
return _chunkKJKDLD7Ncjs.buildMintRequestTypedData.call(void 0, domain, message);
|
|
485
575
|
}
|
|
486
|
-
/**
|
|
487
|
-
* Build the EIP-712 typed data for a ReceiverConsent.
|
|
488
|
-
* Pass the result to any external signer (Privy, WalletConnect, etc.).
|
|
489
|
-
*/
|
|
490
576
|
async buildReceiverConsentTypedData(message) {
|
|
491
577
|
const domain = await this.getDomain();
|
|
492
|
-
return
|
|
578
|
+
return _chunkKJKDLD7Ncjs.buildReceiverConsentTypedData.call(void 0, domain, message);
|
|
493
579
|
}
|
|
494
580
|
async signMintRequest(message) {
|
|
495
581
|
const domain = await this.getDomain();
|
|
496
|
-
return
|
|
582
|
+
return _chunkKJKDLD7Ncjs.signMintRequest.call(void 0, this.requireSigner(), domain, message);
|
|
497
583
|
}
|
|
498
584
|
async verifyMintRequest(message, signature, expectedMinter) {
|
|
499
585
|
const domain = await this.getDomain();
|
|
500
|
-
return
|
|
586
|
+
return _chunkKJKDLD7Ncjs.verifyMintRequest.call(void 0, domain, message, signature, expectedMinter);
|
|
501
587
|
}
|
|
502
588
|
async signReceiverConsent(message) {
|
|
503
589
|
const domain = await this.getDomain();
|
|
504
|
-
return
|
|
590
|
+
return _chunkKJKDLD7Ncjs.signReceiverConsent.call(void 0, this.requireSigner(), domain, message);
|
|
505
591
|
}
|
|
506
592
|
async verifyReceiverConsent(message, signature, expectedReceiver) {
|
|
507
593
|
const domain = await this.getDomain();
|
|
508
|
-
return
|
|
594
|
+
return _chunkKJKDLD7Ncjs.verifyReceiverConsent.call(void 0, domain, message, signature, expectedReceiver);
|
|
509
595
|
}
|
|
510
596
|
// -------------------------------------------------------------------------
|
|
511
597
|
// Contract reads
|
|
512
598
|
// -------------------------------------------------------------------------
|
|
513
599
|
async getMintRequestNonce(receiver) {
|
|
514
|
-
return
|
|
600
|
+
return _chunkCQCSQPWGcjs.getMintRequestNonce.call(void 0,
|
|
515
601
|
this.requireProvider(),
|
|
516
602
|
this.requirePointToken(),
|
|
517
603
|
receiver
|
|
518
604
|
);
|
|
519
605
|
}
|
|
520
606
|
async getReceiverConsentNonce(receiver) {
|
|
521
|
-
return
|
|
607
|
+
return _chunkCQCSQPWGcjs.getReceiverConsentNonce.call(void 0,
|
|
522
608
|
this.requireProvider(),
|
|
523
609
|
this.requirePointToken(),
|
|
524
610
|
receiver
|
|
525
611
|
);
|
|
526
612
|
}
|
|
527
613
|
// -------------------------------------------------------------------------
|
|
528
|
-
// Relay calldata — delegates to pure functions
|
|
529
|
-
// -------------------------------------------------------------------------
|
|
530
|
-
encodeMintAndSwap(mint, swap) {
|
|
531
|
-
return _chunkL74CZAVQcjs.encodeMintAndSwap.call(void 0, mint, swap);
|
|
532
|
-
}
|
|
533
|
-
decodeMintAndSwap(calldata) {
|
|
534
|
-
return _chunkL74CZAVQcjs.decodeMintAndSwap.call(void 0, calldata);
|
|
535
|
-
}
|
|
536
|
-
// -------------------------------------------------------------------------
|
|
537
614
|
// Quoting — delegates to pure functions
|
|
538
615
|
// -------------------------------------------------------------------------
|
|
539
616
|
/**
|
|
@@ -542,7 +619,7 @@ var PafiSDK = class {
|
|
|
542
619
|
* paths, and quotes via a single multicall RPC call.
|
|
543
620
|
*/
|
|
544
621
|
async findBestQuote(tokenIn, tokenOut, exactAmount, pools = [], quoterAddress, maxHops) {
|
|
545
|
-
return
|
|
622
|
+
return _chunkZ2V525IScjs.findBestQuote.call(void 0,
|
|
546
623
|
this.requireProvider(),
|
|
547
624
|
this.requireChainId(),
|
|
548
625
|
tokenIn,
|
|
@@ -561,43 +638,11 @@ var PafiSDK = class {
|
|
|
561
638
|
* The caller provides `minAmountOut` after applying their own slippage.
|
|
562
639
|
*/
|
|
563
640
|
buildSwapFromQuote(params) {
|
|
564
|
-
return
|
|
565
|
-
}
|
|
566
|
-
/**
|
|
567
|
-
* Build Relay SwapParams + extData from a quote result.
|
|
568
|
-
* Returns ready-to-use args for `Relay.mintAndSwap`.
|
|
569
|
-
*/
|
|
570
|
-
buildRelaySwapParams(params) {
|
|
571
|
-
return _chunkL74CZAVQcjs.buildRelaySwapParams.call(void 0, params);
|
|
572
|
-
}
|
|
573
|
-
/**
|
|
574
|
-
* Encode extData for ReceiverConsent and MintParams.
|
|
575
|
-
* extData = abi.encode(minAmountOut, feeInUsdt)
|
|
576
|
-
*/
|
|
577
|
-
encodeExtData(minAmountOut, feeInUsdt) {
|
|
578
|
-
return _chunkL74CZAVQcjs.encodeExtData.call(void 0, minAmountOut, feeInUsdt);
|
|
641
|
+
return _chunkEDR5SFJNcjs.buildSwapFromQuote.call(void 0, params);
|
|
579
642
|
}
|
|
580
643
|
// -------------------------------------------------------------------------
|
|
581
644
|
// Simulation — dry-run via eth_call (no gas spent)
|
|
582
645
|
// -------------------------------------------------------------------------
|
|
583
|
-
/**
|
|
584
|
-
* Simulate a Relay.mintAndSwap call. Catches reverts (bad signatures,
|
|
585
|
-
* expired deadlines, insufficient mint cap, pool errors) before submitting.
|
|
586
|
-
*
|
|
587
|
-
* @param relayAddress - Relay contract address
|
|
588
|
-
* @param mint - MintParams with real signatures
|
|
589
|
-
* @param swap - SwapParams (path + deadline)
|
|
590
|
-
* @param from - Relayer address that will submit the tx
|
|
591
|
-
*/
|
|
592
|
-
async simulateMintAndSwap(relayAddress, mint, swap, from) {
|
|
593
|
-
return _chunkL74CZAVQcjs.simulateMintAndSwap.call(void 0,
|
|
594
|
-
this.requireProvider(),
|
|
595
|
-
relayAddress,
|
|
596
|
-
mint,
|
|
597
|
-
swap,
|
|
598
|
-
from
|
|
599
|
-
);
|
|
600
|
-
}
|
|
601
646
|
/**
|
|
602
647
|
* Simulate a UniversalRouter.execute swap call. Catches reverts (bad
|
|
603
648
|
* approvals, insufficient balance, pool errors) before submitting.
|
|
@@ -609,7 +654,7 @@ var PafiSDK = class {
|
|
|
609
654
|
* @param from - Address that will execute the swap
|
|
610
655
|
*/
|
|
611
656
|
async simulateSwap(routerAddress, commands, inputs, deadline, from) {
|
|
612
|
-
return
|
|
657
|
+
return _chunkEDR5SFJNcjs.simulateSwap.call(void 0,
|
|
613
658
|
this.requireProvider(),
|
|
614
659
|
routerAddress,
|
|
615
660
|
commands,
|
|
@@ -620,23 +665,13 @@ var PafiSDK = class {
|
|
|
620
665
|
}
|
|
621
666
|
// -------------------------------------------------------------------------
|
|
622
667
|
// Auth — EIP-4361 login helpers (offline, stateless)
|
|
623
|
-
//
|
|
624
|
-
// These are convenience wrappers around the pure functions in
|
|
625
|
-
// `./auth/loginMessage.ts`. They do NOT hit the network — the caller is
|
|
626
|
-
// responsible for fetching the nonce, POSTing the signed message, and
|
|
627
|
-
// storing the JWT returned by the issuer backend.
|
|
628
668
|
// -------------------------------------------------------------------------
|
|
629
|
-
/**
|
|
630
|
-
* Build an EIP-4361 login message for the current signer + chain. The
|
|
631
|
-
* caller supplies the issuer-specific fields (domain, nonce, uri); the SDK
|
|
632
|
-
* fills in the wallet address and chain id from its own config.
|
|
633
|
-
*/
|
|
634
669
|
async createLoginMessage(params) {
|
|
635
670
|
const signer = this.requireSigner();
|
|
636
671
|
const chainId = this.requireChainId();
|
|
637
672
|
const account = signer.account;
|
|
638
673
|
if (!account) {
|
|
639
|
-
throw new (0,
|
|
674
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer has no account attached");
|
|
640
675
|
}
|
|
641
676
|
return _chunkGWLEEXM4cjs.createLoginMessage.call(void 0, { ...params, address: account.address, chainId });
|
|
642
677
|
}
|
|
@@ -645,7 +680,7 @@ var PafiSDK = class {
|
|
|
645
680
|
const signer = this.requireSigner();
|
|
646
681
|
const account = signer.account;
|
|
647
682
|
if (!account) {
|
|
648
|
-
throw new (0,
|
|
683
|
+
throw new (0, _chunkEDR5SFJNcjs.ConfigurationError)("signer has no account attached");
|
|
649
684
|
}
|
|
650
685
|
return signer.signMessage({ account, message });
|
|
651
686
|
}
|
|
@@ -748,5 +783,6 @@ var PafiSDK = class {
|
|
|
748
783
|
|
|
749
784
|
|
|
750
785
|
|
|
751
|
-
|
|
786
|
+
|
|
787
|
+
exports.ApiError = _chunkEDR5SFJNcjs.ApiError; exports.BATCH_EXECUTOR_ABI = _chunkEDR5SFJNcjs.BATCH_EXECUTOR_ABI; exports.BATCH_EXECUTOR_ADDRESS_BASE_MAINNET = BATCH_EXECUTOR_ADDRESS_BASE_MAINNET; exports.BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA = BATCH_EXECUTOR_ADDRESS_BASE_SEPOLIA; exports.BROKER_HASHES = BROKER_HASHES; exports.COMMON_POOLS = _chunkDMW67WBUcjs.COMMON_POOLS; exports.COMMON_TOKENS = _chunkDMW67WBUcjs.COMMON_TOKENS; exports.CONTRACT_ADDRESSES = CONTRACT_ADDRESSES; exports.ConfigurationError = _chunkEDR5SFJNcjs.ConfigurationError; exports.ENTRY_POINT_V07 = ENTRY_POINT_V07; exports.ORDERLY_VAULT_ABI = ORDERLY_VAULT_ABI; exports.ORDERLY_VAULT_ADDRESSES = ORDERLY_VAULT_ADDRESSES; exports.ORDERLY_VAULT_BASE_MAINNET = ORDERLY_VAULT_BASE_MAINNET; exports.POINT_TOKEN_FACTORY_ADDRESSES = POINT_TOKEN_FACTORY_ADDRESSES; exports.POINT_TOKEN_IMPL_ADDRESSES = POINT_TOKEN_IMPL_ADDRESSES; exports.POINT_TOKEN_POOLS = _chunkDMW67WBUcjs.POINT_TOKEN_POOLS; exports.POINT_TOKEN_V2_ABI = POINT_TOKEN_ABI; exports.PafiSDK = PafiSDK; exports.PafiSDKError = _chunkEDR5SFJNcjs.PafiSDKError; exports.SETTLE_ALL = _chunkEDR5SFJNcjs.SETTLE_ALL; exports.SUPPORTED_CHAINS = _chunkDMW67WBUcjs.SUPPORTED_CHAINS; exports.SWAP_EXACT_IN = _chunkEDR5SFJNcjs.SWAP_EXACT_IN; exports.SigningError = _chunkEDR5SFJNcjs.SigningError; exports.SimulationError = _chunkEDR5SFJNcjs.SimulationError; exports.TAKE_ALL = _chunkEDR5SFJNcjs.TAKE_ALL; exports.TOKEN_HASHES = TOKEN_HASHES; exports.UNIVERSAL_ROUTER_ADDRESSES = _chunkDMW67WBUcjs.UNIVERSAL_ROUTER_ADDRESSES; exports.V4_QUOTER_ADDRESSES = _chunkDMW67WBUcjs.V4_QUOTER_ADDRESSES; exports.V4_SWAP = _chunkEDR5SFJNcjs.V4_SWAP; exports.ZERO_VALUE = ZERO_VALUE; exports._resetPaymasterConfigForTests = _resetPaymasterConfigForTests; exports.assembleUserOperation = _chunkEDR5SFJNcjs.assembleUserOperation; exports.buildAllPaths = _chunkZ2V525IScjs.buildAllPaths; exports.buildBurnRequestTypedData = _chunkKJKDLD7Ncjs.buildBurnRequestTypedData; exports.buildDomain = _chunkKJKDLD7Ncjs.buildDomain; exports.buildErc20ApprovalCalldata = _chunkEDR5SFJNcjs.buildErc20ApprovalCalldata; exports.buildMintRequestTypedData = _chunkKJKDLD7Ncjs.buildMintRequestTypedData; exports.buildPartialUserOperation = _chunkEDR5SFJNcjs.buildPartialUserOperation; exports.buildPermit2ApprovalCalldata = _chunkEDR5SFJNcjs.buildPermit2ApprovalCalldata; exports.buildPerpDepositWithGasDeduction = buildPerpDepositWithGasDeduction; exports.buildReceiverConsentTypedData = _chunkKJKDLD7Ncjs.buildReceiverConsentTypedData; exports.buildSwapFromQuote = _chunkEDR5SFJNcjs.buildSwapFromQuote; exports.buildSwapWithGasDeduction = _chunkEDR5SFJNcjs.buildSwapWithGasDeduction; exports.buildUniversalRouterExecuteArgs = _chunkEDR5SFJNcjs.buildUniversalRouterExecuteArgs; exports.buildV4SwapInput = _chunkEDR5SFJNcjs.buildV4SwapInput; exports.burnRequestTypes = _chunkDMW67WBUcjs.burnRequestTypes; exports.checkAllowance = _chunkEDR5SFJNcjs.checkAllowance; exports.checkEthAndBranch = checkEthAndBranch; exports.combineRoutes = _chunkZ2V525IScjs.combineRoutes; exports.computeAccountId = computeAccountId; exports.createLoginMessage = _chunkGWLEEXM4cjs.createLoginMessage; exports.encodeBatchExecute = _chunkEDR5SFJNcjs.encodeBatchExecute; exports.erc20Abi = _chunkIPXARZ6Fcjs.erc20Abi; exports.erc20ApproveOp = _chunkEDR5SFJNcjs.erc20ApproveOp; exports.erc20BurnOp = _chunkEDR5SFJNcjs.erc20BurnOp; exports.erc20TransferOp = _chunkEDR5SFJNcjs.erc20TransferOp; exports.findBestQuote = _chunkZ2V525IScjs.findBestQuote; exports.getContractAddresses = getContractAddresses; exports.getIssuer = _chunkCQCSQPWGcjs.getIssuer2; exports.getMintRequestNonce = _chunkCQCSQPWGcjs.getMintRequestNonce; exports.getPafiWebModalAdapter = getPafiWebModalAdapter; exports.getPaymasterConfig = getPaymasterConfig; exports.getPointTokenBalance = _chunkCQCSQPWGcjs.getPointTokenBalance; exports.getPointTokenIssuer = _chunkCQCSQPWGcjs.getPointTokenIssuer; exports.getPointTokenIssuerAddress = _chunkCQCSQPWGcjs.getIssuer; exports.getReceiverConsentNonce = _chunkCQCSQPWGcjs.getReceiverConsentNonce; exports.getTokenName = _chunkCQCSQPWGcjs.getTokenName; exports.isActiveIssuer = _chunkCQCSQPWGcjs.isActiveIssuer; exports.isMinter = _chunkCQCSQPWGcjs.isMinter; exports.isPaymasterConfigured = isPaymasterConfigured; exports.issuerRegistryAbi = _chunkS2XRFFP3cjs.issuerRegistryAbi; exports.mintRequestTypes = _chunkDMW67WBUcjs.mintRequestTypes; exports.mintingOracleAbi = _chunkS2XRFFP3cjs.mintingOracleAbi; exports.openPafiWebModal = openPafiWebModal; exports.openWebPopup = openWebPopup; exports.parseLoginMessage = _chunkGWLEEXM4cjs.parseLoginMessage; exports.permit2Abi = _chunkIPXARZ6Fcjs.permit2Abi; exports.pointTokenAbi = _chunkS2XRFFP3cjs.pointTokenAbi; exports.pointTokenFactoryAbi = _chunkALCWYDVGcjs.pointTokenFactoryAbi; exports.quoteBestRoute = _chunkZ2V525IScjs.quoteBestRoute; exports.quoteExactInput = _chunkZ2V525IScjs.quoteExactInput; exports.quoteExactInputSingle = _chunkZ2V525IScjs.quoteExactInputSingle; exports.rawCallOp = _chunkEDR5SFJNcjs.rawCallOp; exports.receiverConsentTypes = _chunkDMW67WBUcjs.receiverConsentTypes; exports.setPafiWebModalAdapter = setPafiWebModalAdapter; exports.setPaymasterConfig = setPaymasterConfig; exports.signBurnRequest = _chunkKJKDLD7Ncjs.signBurnRequest; exports.signMintRequest = _chunkKJKDLD7Ncjs.signMintRequest; exports.signReceiverConsent = _chunkKJKDLD7Ncjs.signReceiverConsent; exports.simulateSwap = _chunkEDR5SFJNcjs.simulateSwap; exports.universalRouterAbi = _chunkIPXARZ6Fcjs.universalRouterAbi; exports.v4QuoterAbi = _chunkCL3QSI4Ocjs.v4QuoterAbi; exports.verifyBurnRequest = _chunkKJKDLD7Ncjs.verifyBurnRequest; exports.verifyLoginMessage = _chunkGWLEEXM4cjs.verifyLoginMessage; exports.verifyMintCap = _chunkCQCSQPWGcjs.verifyMintCap; exports.verifyMintRequest = _chunkKJKDLD7Ncjs.verifyMintRequest; exports.verifyReceiverConsent = _chunkKJKDLD7Ncjs.verifyReceiverConsent; exports.webPopupAdapter = webPopupAdapter;
|
|
752
788
|
//# sourceMappingURL=index.cjs.map
|