@dcentralab/d402-client 0.3.15 → 0.3.16
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.mts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +20 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -52
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1181,19 +1181,6 @@ var sepolia_default = {
|
|
|
1181
1181
|
stateMutability: "view",
|
|
1182
1182
|
type: "function"
|
|
1183
1183
|
},
|
|
1184
|
-
{
|
|
1185
|
-
inputs: [],
|
|
1186
|
-
name: "MAX_REQUEST_PATH_LENGTH",
|
|
1187
|
-
outputs: [
|
|
1188
|
-
{
|
|
1189
|
-
internalType: "uint256",
|
|
1190
|
-
name: "",
|
|
1191
|
-
type: "uint256"
|
|
1192
|
-
}
|
|
1193
|
-
],
|
|
1194
|
-
stateMutability: "view",
|
|
1195
|
-
type: "function"
|
|
1196
|
-
},
|
|
1197
1184
|
{
|
|
1198
1185
|
inputs: [],
|
|
1199
1186
|
name: "PROVIDER_ATTESTATION_TYPEHASH",
|
|
@@ -1506,11 +1493,6 @@ var sepolia_default = {
|
|
|
1506
1493
|
name: "deadline",
|
|
1507
1494
|
type: "uint256"
|
|
1508
1495
|
},
|
|
1509
|
-
{
|
|
1510
|
-
internalType: "string",
|
|
1511
|
-
name: "requestPath",
|
|
1512
|
-
type: "string"
|
|
1513
|
-
},
|
|
1514
1496
|
{
|
|
1515
1497
|
internalType: "bytes",
|
|
1516
1498
|
name: "signature",
|
|
@@ -1602,11 +1584,6 @@ var sepolia_default = {
|
|
|
1602
1584
|
name: "deadline",
|
|
1603
1585
|
type: "uint256"
|
|
1604
1586
|
},
|
|
1605
|
-
{
|
|
1606
|
-
internalType: "string",
|
|
1607
|
-
name: "requestPath",
|
|
1608
|
-
type: "string"
|
|
1609
|
-
},
|
|
1610
1587
|
{
|
|
1611
1588
|
internalType: "bytes",
|
|
1612
1589
|
name: "signature",
|
|
@@ -1751,11 +1728,6 @@ var sepolia_default = {
|
|
|
1751
1728
|
name: "deadline",
|
|
1752
1729
|
type: "uint256"
|
|
1753
1730
|
},
|
|
1754
|
-
{
|
|
1755
|
-
internalType: "string",
|
|
1756
|
-
name: "requestPath",
|
|
1757
|
-
type: "string"
|
|
1758
|
-
},
|
|
1759
1731
|
{
|
|
1760
1732
|
internalType: "bytes",
|
|
1761
1733
|
name: "signature",
|
|
@@ -1776,14 +1748,14 @@ var sepolia_default = {
|
|
|
1776
1748
|
{
|
|
1777
1749
|
inputs: [
|
|
1778
1750
|
{
|
|
1779
|
-
internalType: "
|
|
1780
|
-
name: "
|
|
1781
|
-
type: "
|
|
1751
|
+
internalType: "bytes32",
|
|
1752
|
+
name: "consumerSignatureHash",
|
|
1753
|
+
type: "bytes32"
|
|
1782
1754
|
},
|
|
1783
1755
|
{
|
|
1784
|
-
internalType: "
|
|
1756
|
+
internalType: "bytes32",
|
|
1785
1757
|
name: "outputHash",
|
|
1786
|
-
type: "
|
|
1758
|
+
type: "bytes32"
|
|
1787
1759
|
},
|
|
1788
1760
|
{
|
|
1789
1761
|
internalType: "uint256",
|
|
@@ -1842,24 +1814,6 @@ var sepolia_default = {
|
|
|
1842
1814
|
stateMutability: "nonpayable",
|
|
1843
1815
|
type: "function"
|
|
1844
1816
|
},
|
|
1845
|
-
{
|
|
1846
|
-
inputs: [
|
|
1847
|
-
{
|
|
1848
|
-
internalType: "uint256",
|
|
1849
|
-
name: "epoch",
|
|
1850
|
-
type: "uint256"
|
|
1851
|
-
},
|
|
1852
|
-
{
|
|
1853
|
-
internalType: "address",
|
|
1854
|
-
name: "token",
|
|
1855
|
-
type: "address"
|
|
1856
|
-
}
|
|
1857
|
-
],
|
|
1858
|
-
name: "withdrawEpochFromSettlement",
|
|
1859
|
-
outputs: [],
|
|
1860
|
-
stateMutability: "nonpayable",
|
|
1861
|
-
type: "function"
|
|
1862
|
-
},
|
|
1863
1817
|
{
|
|
1864
1818
|
inputs: [],
|
|
1865
1819
|
name: "withdrawalLockupPeriod",
|
|
@@ -10675,6 +10629,20 @@ async function getWalletEIP712Domain(params) {
|
|
|
10675
10629
|
};
|
|
10676
10630
|
}
|
|
10677
10631
|
}
|
|
10632
|
+
async function validateConsumerSignature(params) {
|
|
10633
|
+
const { publicClient, walletAddress, tokenAddress, amount, providerAddress, deadline, signature, network = "sepolia" } = params;
|
|
10634
|
+
const walletAbi = getContractAbi("IATPWallet" /* IATP_WALLET */, network);
|
|
10635
|
+
if (!walletAbi) {
|
|
10636
|
+
throw new Error(`IATPWallet ABI not found for network: ${network}`);
|
|
10637
|
+
}
|
|
10638
|
+
const isValid = await publicClient.readContract({
|
|
10639
|
+
address: walletAddress,
|
|
10640
|
+
abi: walletAbi,
|
|
10641
|
+
functionName: "validateConsumerSignature",
|
|
10642
|
+
args: [tokenAddress, amount, providerAddress, deadline, signature]
|
|
10643
|
+
});
|
|
10644
|
+
return isValid;
|
|
10645
|
+
}
|
|
10678
10646
|
|
|
10679
10647
|
// src/wallet/withdrawals.ts
|
|
10680
10648
|
async function getWithdrawalRequest(params) {
|
|
@@ -11144,6 +11112,6 @@ async function withdrawAllAvailableEpochs(params) {
|
|
|
11144
11112
|
init_utils();
|
|
11145
11113
|
init_errors();
|
|
11146
11114
|
|
|
11147
|
-
export { ContractName, D402Client, Invalid402ResponseError, MissingRequestConfigError, PaymentAlreadyAttemptedError, PaymentAmountExceededError, PaymentError, PaymentVerificationError, UnsupportedNetworkError, UnsupportedSchemeError, buildMcpHeaders, buildToolCallPayload, createIATPWallet, createPaymentSelector, decodePayment, decodePaymentResponse, encodePayment, executeWithdrawal, extractToolResult, findMatchingPaymentRequirement, formatMoney, generateNonce, getAvailableBalance, getChain, getChainId, getContractAbi, getContractAddress, getContractConfig, getCurrentTimestamp, getLockedBalanceForProvider, getUnlockedBalanceForProvider, getUsdcAddress, getWalletEIP712Domain, getWalletInfo, getWalletsByOwner, getWithdrawalRequest, initMcpSession, isValidAddress, normalizeAddress, parseAllPaymentRequirements, parseMcpResponse, parseMoney, parsePaymentRequirement, requestWithdrawal, selectPaymentRequirement, signD402Payment, sortPaymentRequirements, usdToUsdc, withdrawAllAvailableEpochs, withdrawAllFromSettlement };
|
|
11115
|
+
export { ContractName, D402Client, Invalid402ResponseError, MissingRequestConfigError, PaymentAlreadyAttemptedError, PaymentAmountExceededError, PaymentError, PaymentVerificationError, UnsupportedNetworkError, UnsupportedSchemeError, buildMcpHeaders, buildToolCallPayload, createIATPWallet, createPaymentSelector, decodePayment, decodePaymentResponse, encodePayment, executeWithdrawal, extractToolResult, findMatchingPaymentRequirement, formatMoney, generateNonce, getAvailableBalance, getChain, getChainId, getContractAbi, getContractAddress, getContractConfig, getCurrentTimestamp, getLockedBalanceForProvider, getUnlockedBalanceForProvider, getUsdcAddress, getWalletEIP712Domain, getWalletInfo, getWalletsByOwner, getWithdrawalRequest, initMcpSession, isValidAddress, normalizeAddress, parseAllPaymentRequirements, parseMcpResponse, parseMoney, parsePaymentRequirement, requestWithdrawal, selectPaymentRequirement, signD402Payment, sortPaymentRequirements, usdToUsdc, validateConsumerSignature, withdrawAllAvailableEpochs, withdrawAllFromSettlement };
|
|
11148
11116
|
//# sourceMappingURL=index.mjs.map
|
|
11149
11117
|
//# sourceMappingURL=index.mjs.map
|