@dcentralab/d402-client 0.3.18 → 0.4.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/LICENSE +22 -0
- package/dist/index.d.mts +20 -18
- package/dist/index.d.ts +20 -18
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -11
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Traia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/dist/index.d.mts
CHANGED
|
@@ -56,6 +56,8 @@ interface PaymentAuthorization {
|
|
|
56
56
|
validBefore: string;
|
|
57
57
|
/** Unique nonce */
|
|
58
58
|
nonce: `0x${string}`;
|
|
59
|
+
/** Request path (resource being paid for) */
|
|
60
|
+
requestPath?: string;
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
63
|
* Signed payment ready to send
|
|
@@ -593,7 +595,7 @@ declare function decodePaymentResponse(header: string): {
|
|
|
593
595
|
/**
|
|
594
596
|
* Supported blockchain networks (where IATP contracts are deployed)
|
|
595
597
|
*/
|
|
596
|
-
type SupportedNetwork = 'sepolia' | '
|
|
598
|
+
type SupportedNetwork = 'sepolia' | 'arbitrum_one';
|
|
597
599
|
/**
|
|
598
600
|
* EIP-712 domain for signature verification
|
|
599
601
|
*/
|
|
@@ -655,7 +657,7 @@ interface WithdrawalRequest {
|
|
|
655
657
|
*
|
|
656
658
|
* @param params - Creation parameters
|
|
657
659
|
* @param params.ownerAccount - Owner's account (will own the wallet)
|
|
658
|
-
* @param params.network - Network to deploy on: "sepolia" | "
|
|
660
|
+
* @param params.network - Network to deploy on: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
659
661
|
* @param params.rpcUrl - Custom RPC URL (optional)
|
|
660
662
|
* @returns Wallet creation result with addresses and keys
|
|
661
663
|
*
|
|
@@ -695,7 +697,7 @@ declare function createIATPWallet(params: {
|
|
|
695
697
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
696
698
|
* @param params.walletAddress - IATPWallet contract address
|
|
697
699
|
* @param params.tokenAddress - Token contract address (e.g., USDC)
|
|
698
|
-
* @param params.network - Network to query: "sepolia" | "
|
|
700
|
+
* @param params.network - Network to query: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
699
701
|
* @returns Available balance in token's base units (wei)
|
|
700
702
|
*
|
|
701
703
|
* @example
|
|
@@ -730,7 +732,7 @@ declare function getAvailableBalance(params: {
|
|
|
730
732
|
*
|
|
731
733
|
* @param params - Query parameters
|
|
732
734
|
* @param params.ownerAddress - User's wallet address (from MetaMask)
|
|
733
|
-
* @param params.network - Network to query: "sepolia" | "
|
|
735
|
+
* @param params.network - Network to query: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
734
736
|
* @param params.rpcUrl - Custom RPC URL (optional)
|
|
735
737
|
* @returns Array of IATPWallet contract addresses (empty if user has no wallets)
|
|
736
738
|
*
|
|
@@ -812,7 +814,7 @@ declare function getWalletEIP712Domain(params: {
|
|
|
812
814
|
* @param params.providerAddress - Provider's address
|
|
813
815
|
* @param params.deadline - Signature deadline (unix timestamp)
|
|
814
816
|
* @param params.signature - The signed payment signature bytes
|
|
815
|
-
* @param params.network - Network: "sepolia" | "
|
|
817
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
816
818
|
* @returns true if the signature is valid, false otherwise
|
|
817
819
|
*/
|
|
818
820
|
declare function validateConsumerSignature(params: {
|
|
@@ -840,7 +842,7 @@ declare function validateConsumerSignature(params: {
|
|
|
840
842
|
* @param params.publicClient - Viem PublicClient
|
|
841
843
|
* @param params.walletAddress - IATPWallet contract address
|
|
842
844
|
* @param params.tokenAddress - Token contract address
|
|
843
|
-
* @param params.network - Network: "sepolia" | "
|
|
845
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
844
846
|
* @returns Withdrawal request details or null if no request exists
|
|
845
847
|
*
|
|
846
848
|
* @example
|
|
@@ -887,7 +889,7 @@ declare function getWithdrawalRequest(params: {
|
|
|
887
889
|
* @param params.tokenAddress - Token contract address
|
|
888
890
|
* @param params.amount - Amount in token's base units (wei)
|
|
889
891
|
* @param params.account - Account to sign transaction (operator)
|
|
890
|
-
* @param params.network - Network: "sepolia" | "
|
|
892
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
891
893
|
* @returns Transaction hash
|
|
892
894
|
*
|
|
893
895
|
* @example
|
|
@@ -926,7 +928,7 @@ declare function requestWithdrawal(params: {
|
|
|
926
928
|
* @param params.walletAddress - IATPWallet contract address
|
|
927
929
|
* @param params.tokenAddress - Token contract address
|
|
928
930
|
* @param params.account - Account to sign transaction (operator)
|
|
929
|
-
* @param params.network - Network: "sepolia" | "
|
|
931
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
930
932
|
* @returns Transaction hash
|
|
931
933
|
*
|
|
932
934
|
* @example
|
|
@@ -962,7 +964,7 @@ declare function executeWithdrawal(params: {
|
|
|
962
964
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
963
965
|
* @param params.tokenAddress - Token contract address to withdraw
|
|
964
966
|
* @param params.sendToOwner - If true, sends funds to owner; if false, keeps in wallet (default: true)
|
|
965
|
-
* @param params.network - Network: "sepolia" | "
|
|
967
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
966
968
|
* @returns Transaction hash
|
|
967
969
|
*
|
|
968
970
|
* @example
|
|
@@ -1105,7 +1107,7 @@ declare function extractToolResult(response: ParsedMcpResponse): unknown;
|
|
|
1105
1107
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1106
1108
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1107
1109
|
* @param params.tokenAddress - Token contract address
|
|
1108
|
-
* @param params.network - Network: "sepolia" | "
|
|
1110
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1109
1111
|
* @returns Locked balance in base units (wei)
|
|
1110
1112
|
*
|
|
1111
1113
|
* @example
|
|
@@ -1138,7 +1140,7 @@ declare function getLockedBalanceForProvider(params: {
|
|
|
1138
1140
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1139
1141
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1140
1142
|
* @param params.tokenAddress - Token contract address
|
|
1141
|
-
* @param params.network - Network: "sepolia" | "
|
|
1143
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1142
1144
|
* @returns Unlocked balance in base units (wei)
|
|
1143
1145
|
*
|
|
1144
1146
|
* @example
|
|
@@ -1168,7 +1170,7 @@ declare function getUnlockedBalanceForProvider(params: {
|
|
|
1168
1170
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1169
1171
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1170
1172
|
* @param params.tokenAddress - Token contract address
|
|
1171
|
-
* @param params.network - Network: "sepolia" | "
|
|
1173
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1172
1174
|
* @returns Total dispute amount in progress in base units (wei)
|
|
1173
1175
|
*/
|
|
1174
1176
|
declare function getProviderTotalDisputeInProgress(params: {
|
|
@@ -1195,7 +1197,7 @@ declare function getProviderTotalDisputeInProgress(params: {
|
|
|
1195
1197
|
* @param params.walletClient - Viem WalletClient (from wagmi useWalletClient)
|
|
1196
1198
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1197
1199
|
* @param params.tokenAddress - Token contract address to withdraw
|
|
1198
|
-
* @param params.network - Network: "sepolia" | "
|
|
1200
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1199
1201
|
* @returns Transaction hash
|
|
1200
1202
|
*
|
|
1201
1203
|
* @example
|
|
@@ -1239,7 +1241,7 @@ declare enum ContractName {
|
|
|
1239
1241
|
* Get contract address for a given network.
|
|
1240
1242
|
*
|
|
1241
1243
|
* @param contractName - Name of the contract (use ContractName enum)
|
|
1242
|
-
* @param network - Network: "sepolia" | "
|
|
1244
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1243
1245
|
* @returns Contract address as hex string, or null if not found
|
|
1244
1246
|
*
|
|
1245
1247
|
* @example
|
|
@@ -1253,7 +1255,7 @@ declare function getContractAddress(contractName: string | ContractName, network
|
|
|
1253
1255
|
* Get contract ABI for a given network.
|
|
1254
1256
|
*
|
|
1255
1257
|
* @param contractName - Name of the contract (use ContractName enum)
|
|
1256
|
-
* @param network - Network: "sepolia" | "
|
|
1258
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1257
1259
|
* @returns Contract ABI as array of objects, or null if not found
|
|
1258
1260
|
*
|
|
1259
1261
|
* @example
|
|
@@ -1267,7 +1269,7 @@ declare function getContractAbi(contractName: string | ContractName, network?: S
|
|
|
1267
1269
|
* Get contract configuration (address and ABI) for a network.
|
|
1268
1270
|
*
|
|
1269
1271
|
* @param contractName - Name of the contract
|
|
1270
|
-
* @param network - Network: "sepolia" | "
|
|
1272
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1271
1273
|
* @returns Object with address and abi, or null if not found
|
|
1272
1274
|
*
|
|
1273
1275
|
* @example
|
|
@@ -1296,7 +1298,7 @@ declare function getContractConfig(contractName: string | ContractName, network?
|
|
|
1296
1298
|
*
|
|
1297
1299
|
* @example
|
|
1298
1300
|
* ```ts
|
|
1299
|
-
* const chain = getChain('
|
|
1301
|
+
* const chain = getChain('arbitrum_one')
|
|
1300
1302
|
* console.log(chain.id) // 42161
|
|
1301
1303
|
* ```
|
|
1302
1304
|
*/
|
|
@@ -1340,7 +1342,7 @@ declare function getUsdcAddress(network: SupportedNetwork): `0x${string}`;
|
|
|
1340
1342
|
* from external APIs. It supports many networks that may appear in 402 responses,
|
|
1341
1343
|
* even if IATP contracts are not deployed on those networks.
|
|
1342
1344
|
*
|
|
1343
|
-
* Note: IATP contracts are deployed on Sepolia and Arbitrum. This function can also
|
|
1345
|
+
* Note: IATP contracts are deployed on Sepolia and Arbitrum One. This function can also
|
|
1344
1346
|
* handle 402 responses from APIs that might reference other networks by chain ID.
|
|
1345
1347
|
*
|
|
1346
1348
|
* @param network - Network name or chain ID as string
|
package/dist/index.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ interface PaymentAuthorization {
|
|
|
56
56
|
validBefore: string;
|
|
57
57
|
/** Unique nonce */
|
|
58
58
|
nonce: `0x${string}`;
|
|
59
|
+
/** Request path (resource being paid for) */
|
|
60
|
+
requestPath?: string;
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
61
63
|
* Signed payment ready to send
|
|
@@ -593,7 +595,7 @@ declare function decodePaymentResponse(header: string): {
|
|
|
593
595
|
/**
|
|
594
596
|
* Supported blockchain networks (where IATP contracts are deployed)
|
|
595
597
|
*/
|
|
596
|
-
type SupportedNetwork = 'sepolia' | '
|
|
598
|
+
type SupportedNetwork = 'sepolia' | 'arbitrum_one';
|
|
597
599
|
/**
|
|
598
600
|
* EIP-712 domain for signature verification
|
|
599
601
|
*/
|
|
@@ -655,7 +657,7 @@ interface WithdrawalRequest {
|
|
|
655
657
|
*
|
|
656
658
|
* @param params - Creation parameters
|
|
657
659
|
* @param params.ownerAccount - Owner's account (will own the wallet)
|
|
658
|
-
* @param params.network - Network to deploy on: "sepolia" | "
|
|
660
|
+
* @param params.network - Network to deploy on: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
659
661
|
* @param params.rpcUrl - Custom RPC URL (optional)
|
|
660
662
|
* @returns Wallet creation result with addresses and keys
|
|
661
663
|
*
|
|
@@ -695,7 +697,7 @@ declare function createIATPWallet(params: {
|
|
|
695
697
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
696
698
|
* @param params.walletAddress - IATPWallet contract address
|
|
697
699
|
* @param params.tokenAddress - Token contract address (e.g., USDC)
|
|
698
|
-
* @param params.network - Network to query: "sepolia" | "
|
|
700
|
+
* @param params.network - Network to query: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
699
701
|
* @returns Available balance in token's base units (wei)
|
|
700
702
|
*
|
|
701
703
|
* @example
|
|
@@ -730,7 +732,7 @@ declare function getAvailableBalance(params: {
|
|
|
730
732
|
*
|
|
731
733
|
* @param params - Query parameters
|
|
732
734
|
* @param params.ownerAddress - User's wallet address (from MetaMask)
|
|
733
|
-
* @param params.network - Network to query: "sepolia" | "
|
|
735
|
+
* @param params.network - Network to query: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
734
736
|
* @param params.rpcUrl - Custom RPC URL (optional)
|
|
735
737
|
* @returns Array of IATPWallet contract addresses (empty if user has no wallets)
|
|
736
738
|
*
|
|
@@ -812,7 +814,7 @@ declare function getWalletEIP712Domain(params: {
|
|
|
812
814
|
* @param params.providerAddress - Provider's address
|
|
813
815
|
* @param params.deadline - Signature deadline (unix timestamp)
|
|
814
816
|
* @param params.signature - The signed payment signature bytes
|
|
815
|
-
* @param params.network - Network: "sepolia" | "
|
|
817
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
816
818
|
* @returns true if the signature is valid, false otherwise
|
|
817
819
|
*/
|
|
818
820
|
declare function validateConsumerSignature(params: {
|
|
@@ -840,7 +842,7 @@ declare function validateConsumerSignature(params: {
|
|
|
840
842
|
* @param params.publicClient - Viem PublicClient
|
|
841
843
|
* @param params.walletAddress - IATPWallet contract address
|
|
842
844
|
* @param params.tokenAddress - Token contract address
|
|
843
|
-
* @param params.network - Network: "sepolia" | "
|
|
845
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
844
846
|
* @returns Withdrawal request details or null if no request exists
|
|
845
847
|
*
|
|
846
848
|
* @example
|
|
@@ -887,7 +889,7 @@ declare function getWithdrawalRequest(params: {
|
|
|
887
889
|
* @param params.tokenAddress - Token contract address
|
|
888
890
|
* @param params.amount - Amount in token's base units (wei)
|
|
889
891
|
* @param params.account - Account to sign transaction (operator)
|
|
890
|
-
* @param params.network - Network: "sepolia" | "
|
|
892
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
891
893
|
* @returns Transaction hash
|
|
892
894
|
*
|
|
893
895
|
* @example
|
|
@@ -926,7 +928,7 @@ declare function requestWithdrawal(params: {
|
|
|
926
928
|
* @param params.walletAddress - IATPWallet contract address
|
|
927
929
|
* @param params.tokenAddress - Token contract address
|
|
928
930
|
* @param params.account - Account to sign transaction (operator)
|
|
929
|
-
* @param params.network - Network: "sepolia" | "
|
|
931
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
930
932
|
* @returns Transaction hash
|
|
931
933
|
*
|
|
932
934
|
* @example
|
|
@@ -962,7 +964,7 @@ declare function executeWithdrawal(params: {
|
|
|
962
964
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
963
965
|
* @param params.tokenAddress - Token contract address to withdraw
|
|
964
966
|
* @param params.sendToOwner - If true, sends funds to owner; if false, keeps in wallet (default: true)
|
|
965
|
-
* @param params.network - Network: "sepolia" | "
|
|
967
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
966
968
|
* @returns Transaction hash
|
|
967
969
|
*
|
|
968
970
|
* @example
|
|
@@ -1105,7 +1107,7 @@ declare function extractToolResult(response: ParsedMcpResponse): unknown;
|
|
|
1105
1107
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1106
1108
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1107
1109
|
* @param params.tokenAddress - Token contract address
|
|
1108
|
-
* @param params.network - Network: "sepolia" | "
|
|
1110
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1109
1111
|
* @returns Locked balance in base units (wei)
|
|
1110
1112
|
*
|
|
1111
1113
|
* @example
|
|
@@ -1138,7 +1140,7 @@ declare function getLockedBalanceForProvider(params: {
|
|
|
1138
1140
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1139
1141
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1140
1142
|
* @param params.tokenAddress - Token contract address
|
|
1141
|
-
* @param params.network - Network: "sepolia" | "
|
|
1143
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1142
1144
|
* @returns Unlocked balance in base units (wei)
|
|
1143
1145
|
*
|
|
1144
1146
|
* @example
|
|
@@ -1168,7 +1170,7 @@ declare function getUnlockedBalanceForProvider(params: {
|
|
|
1168
1170
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1169
1171
|
* @param params.providerAddress - Provider (utility agent) IATPWallet address
|
|
1170
1172
|
* @param params.tokenAddress - Token contract address
|
|
1171
|
-
* @param params.network - Network: "sepolia" | "
|
|
1173
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1172
1174
|
* @returns Total dispute amount in progress in base units (wei)
|
|
1173
1175
|
*/
|
|
1174
1176
|
declare function getProviderTotalDisputeInProgress(params: {
|
|
@@ -1195,7 +1197,7 @@ declare function getProviderTotalDisputeInProgress(params: {
|
|
|
1195
1197
|
* @param params.walletClient - Viem WalletClient (from wagmi useWalletClient)
|
|
1196
1198
|
* @param params.publicClient - Viem PublicClient (from wagmi usePublicClient)
|
|
1197
1199
|
* @param params.tokenAddress - Token contract address to withdraw
|
|
1198
|
-
* @param params.network - Network: "sepolia" | "
|
|
1200
|
+
* @param params.network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1199
1201
|
* @returns Transaction hash
|
|
1200
1202
|
*
|
|
1201
1203
|
* @example
|
|
@@ -1239,7 +1241,7 @@ declare enum ContractName {
|
|
|
1239
1241
|
* Get contract address for a given network.
|
|
1240
1242
|
*
|
|
1241
1243
|
* @param contractName - Name of the contract (use ContractName enum)
|
|
1242
|
-
* @param network - Network: "sepolia" | "
|
|
1244
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1243
1245
|
* @returns Contract address as hex string, or null if not found
|
|
1244
1246
|
*
|
|
1245
1247
|
* @example
|
|
@@ -1253,7 +1255,7 @@ declare function getContractAddress(contractName: string | ContractName, network
|
|
|
1253
1255
|
* Get contract ABI for a given network.
|
|
1254
1256
|
*
|
|
1255
1257
|
* @param contractName - Name of the contract (use ContractName enum)
|
|
1256
|
-
* @param network - Network: "sepolia" | "
|
|
1258
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1257
1259
|
* @returns Contract ABI as array of objects, or null if not found
|
|
1258
1260
|
*
|
|
1259
1261
|
* @example
|
|
@@ -1267,7 +1269,7 @@ declare function getContractAbi(contractName: string | ContractName, network?: S
|
|
|
1267
1269
|
* Get contract configuration (address and ABI) for a network.
|
|
1268
1270
|
*
|
|
1269
1271
|
* @param contractName - Name of the contract
|
|
1270
|
-
* @param network - Network: "sepolia" | "
|
|
1272
|
+
* @param network - Network: "sepolia" | "arbitrum_one" (default: "sepolia")
|
|
1271
1273
|
* @returns Object with address and abi, or null if not found
|
|
1272
1274
|
*
|
|
1273
1275
|
* @example
|
|
@@ -1296,7 +1298,7 @@ declare function getContractConfig(contractName: string | ContractName, network?
|
|
|
1296
1298
|
*
|
|
1297
1299
|
* @example
|
|
1298
1300
|
* ```ts
|
|
1299
|
-
* const chain = getChain('
|
|
1301
|
+
* const chain = getChain('arbitrum_one')
|
|
1300
1302
|
* console.log(chain.id) // 42161
|
|
1301
1303
|
* ```
|
|
1302
1304
|
*/
|
|
@@ -1340,7 +1342,7 @@ declare function getUsdcAddress(network: SupportedNetwork): `0x${string}`;
|
|
|
1340
1342
|
* from external APIs. It supports many networks that may appear in 402 responses,
|
|
1341
1343
|
* even if IATP contracts are not deployed on those networks.
|
|
1342
1344
|
*
|
|
1343
|
-
* Note: IATP contracts are deployed on Sepolia and Arbitrum. This function can also
|
|
1345
|
+
* Note: IATP contracts are deployed on Sepolia and Arbitrum One. This function can also
|
|
1344
1346
|
* handle 402 responses from APIs that might reference other networks by chain ID.
|
|
1345
1347
|
*
|
|
1346
1348
|
* @param network - Network name or chain ID as string
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var init_constants = __esm({
|
|
|
89
89
|
"src/core/constants.ts"() {
|
|
90
90
|
TOKEN_ADDRESSES = {
|
|
91
91
|
sepolia: "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",
|
|
92
|
-
|
|
92
|
+
arbitrum_one: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
|
|
93
93
|
};
|
|
94
94
|
EIP712_TYPES = {
|
|
95
95
|
PullFundsForSettlement: [
|
|
@@ -141,7 +141,7 @@ function getChainId(network) {
|
|
|
141
141
|
}
|
|
142
142
|
const networkMap = {
|
|
143
143
|
"sepolia": 11155111,
|
|
144
|
-
"
|
|
144
|
+
"arbitrum_one": 42161
|
|
145
145
|
};
|
|
146
146
|
const chainId = networkMap[network];
|
|
147
147
|
if (!chainId) {
|
|
@@ -173,7 +173,7 @@ var init_utils = __esm({
|
|
|
173
173
|
init_errors();
|
|
174
174
|
CHAIN_MAP = {
|
|
175
175
|
sepolia: chains.sepolia,
|
|
176
|
-
|
|
176
|
+
arbitrum_one: chains.arbitrum
|
|
177
177
|
};
|
|
178
178
|
}
|
|
179
179
|
});
|
|
@@ -358,7 +358,8 @@ async function signD402Payment(params) {
|
|
|
358
358
|
value: paymentRequirement.maxAmountRequired,
|
|
359
359
|
validAfter,
|
|
360
360
|
validBefore,
|
|
361
|
-
nonce
|
|
361
|
+
nonce,
|
|
362
|
+
requestPath: paymentRequirement.resource || "/mcp"
|
|
362
363
|
}
|
|
363
364
|
}
|
|
364
365
|
};
|
|
@@ -5527,9 +5528,9 @@ var sepolia_default = {
|
|
|
5527
5528
|
}
|
|
5528
5529
|
};
|
|
5529
5530
|
|
|
5530
|
-
// src/contracts/abis/
|
|
5531
|
-
var
|
|
5532
|
-
|
|
5531
|
+
// src/contracts/abis/arbitrum_one.json
|
|
5532
|
+
var arbitrum_one_default = {
|
|
5533
|
+
arbitrum_one: {
|
|
5533
5534
|
IATPWallet: [
|
|
5534
5535
|
{
|
|
5535
5536
|
inputs: [],
|
|
@@ -10435,7 +10436,7 @@ var proxies_default = {
|
|
|
10435
10436
|
IATPSettlementLayer: "0xB82816BA396fB06aF7076202cb5d7D9e4dACBb15",
|
|
10436
10437
|
IATPWalletFactory: "0x2A95caE178142EC53864b42891828455f45a9E01"
|
|
10437
10438
|
},
|
|
10438
|
-
|
|
10439
|
+
arbitrum_one: {
|
|
10439
10440
|
RoleManager: "0x36db583518A2C92D371f075Ac39162bf4825Cbd0",
|
|
10440
10441
|
IATPSettlementLayer: "0x677028749258c728a8ECb2C7EeA29030e045E7A5",
|
|
10441
10442
|
IATPWalletFactory: "0x2887f721a7484d4b044410aEE3C73246Ac2062Df"
|
|
@@ -10452,7 +10453,7 @@ var ContractName = /* @__PURE__ */ ((ContractName2) => {
|
|
|
10452
10453
|
})(ContractName || {});
|
|
10453
10454
|
var ABIS = {
|
|
10454
10455
|
sepolia: sepolia_default.sepolia || {},
|
|
10455
|
-
|
|
10456
|
+
arbitrum_one: arbitrum_one_default.arbitrum_one || {}
|
|
10456
10457
|
};
|
|
10457
10458
|
var PROXY_ADDRESSES = proxies_default;
|
|
10458
10459
|
function getContractAddress(contractName, network = "sepolia") {
|