@@ -2,6 +2,11 @@ import { computeAddress } from '@ethersproject/transactions';
22import { ethers } from 'ethers' ;
33import { SiweMessage } from 'siwe' ;
44
5+ import {
6+ getFormattedAccessControlConditions ,
7+ getHashedAccessControlConditions ,
8+ validateAccessControlConditions ,
9+ } from '@lit-protocol/access-control-conditions' ;
510import {
611 createSiweMessage ,
712 createSiweMessageWithCapacityDelegation ,
@@ -34,6 +39,7 @@ import {
3439 UnsupportedMethodError ,
3540 WalletSignatureNotFoundError ,
3641} from '@lit-protocol/constants' ;
42+ import { getNodePrices } from '@lit-protocol/contracts-sdk' ;
3743import { composeLitUrl , LitCore } from '@lit-protocol/core' ;
3844import {
3945 combineSignatureShares ,
@@ -107,16 +113,17 @@ import {
107113 SigResponse ,
108114 SuccessNodePromises ,
109115} from '@lit-protocol/types' ;
116+ import { AuthMethod } from '@lit-protocol/types' ;
110117import {
111118 uint8arrayFromString ,
112119 uint8arrayToString ,
113120} from '@lit-protocol/uint8arrays' ;
114121
115- import { AuthMethod } from '@lit-protocol/types' ;
116122import { encodeCode } from './helpers/encode-code' ;
117123import { getBlsSignatures } from './helpers/get-bls-signatures' ;
118124import { getClaims } from './helpers/get-claims' ;
119125import { getClaimsList } from './helpers/get-claims-list' ;
126+ import { getExpiration } from './helpers/get-expiration' ;
120127import { getMaxPricesForNodeProduct } from './helpers/get-max-prices-for-node-product' ;
121128import { getSignatures } from './helpers/get-signatures' ;
122129import { normalizeArray } from './helpers/normalize-array' ;
@@ -126,12 +133,6 @@ import { parsePkpSignResponse } from './helpers/parse-pkp-sign-response';
126133import { processLitActionResponseStrategy } from './helpers/process-lit-action-response-strategy' ;
127134import { removeDoubleQuotes } from './helpers/remove-double-quotes' ;
128135import { blsSessionSigVerify } from './helpers/validate-bls-session-sig' ;
129- import {
130- getFormattedAccessControlConditions ,
131- getHashedAccessControlConditions ,
132- validateAccessControlConditions ,
133- } from '@lit-protocol/access-control-conditions' ;
134- import { getExpiration } from './helpers/get-expiration' ;
135136
136137export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
137138 /** Tracks the total max price a user is willing to pay for each supported product type
@@ -164,6 +165,15 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
164165 this . defaultMaxPriceByProduct [ product ] = price ;
165166 }
166167
168+ private _getNodePrices ( ) {
169+ return getNodePrices ( {
170+ realmId : 1 ,
171+ litNetwork : this . config . litNetwork ,
172+ networkContext : this . config . contractContext ,
173+ rpcUrl : this . config . rpcUrl ,
174+ nodeProtocol : this . config . nodeProtocol ,
175+ } ) ;
176+ }
167177 // ========== Rate Limit NFT ==========
168178
169179 // TODO: Add support for browser feature/lit-2321-js-sdk-add-browser-support-for-createCapacityDelegationAuthSig
@@ -673,7 +683,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
673683
674684 const requestId = this . _getNewRequestId ( ) ;
675685
676- const userMaxPrices = this . getMaxPricesForNodeProduct ( {
686+ const userMaxPrices = await this . getMaxPricesForNodeProduct ( {
677687 product : 'LIT_ACTION' ,
678688 userMaxPrice : params . userMaxPrice ,
679689 } ) ;
@@ -866,7 +876,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
866876
867877 const requestId = this . _getNewRequestId ( ) ;
868878
869- const targetNodePrices = this . getMaxPricesForNodeProduct ( {
879+ const targetNodePrices = await this . getMaxPricesForNodeProduct ( {
870880 product : 'SIGN' ,
871881 userMaxPrice : params . userMaxPrice ,
872882 } ) ;
@@ -1154,7 +1164,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
11541164 log ( 'identityParam' , identityParam ) ;
11551165
11561166 let sessionSigs : SessionSigsMap = { } ;
1157- const userMaxPrices = this . getMaxPricesForNodeProduct ( {
1167+ const userMaxPrices = await this . getMaxPricesForNodeProduct ( {
11581168 product : 'DECRYPTION' ,
11591169 userMaxPrice : params . userMaxPrice ,
11601170 } ) ;
@@ -1343,7 +1353,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
13431353
13441354 // This may seem a bit weird because we usually only care about prices for sessionSigs...
13451355 // But this also ensures we use the cheapest nodes and takes care of getting the minNodeCount of node URLs for the operation
1346- const targetNodePrices = this . getMaxPricesForNodeProduct ( {
1356+ const targetNodePrices = await this . getMaxPricesForNodeProduct ( {
13471357 product : 'LIT_ACTION' ,
13481358 } ) ;
13491359
@@ -1536,7 +1546,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
15361546 } ) ;
15371547 } ;
15381548
1539- getMaxPricesForNodeProduct = ( {
1549+ getMaxPricesForNodeProduct = async ( {
15401550 userMaxPrice,
15411551 product,
15421552 } : {
@@ -1564,7 +1574,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
15641574
15651575 console . log ( 'getMaxPricesForNodeProduct():' , { } ) ;
15661576 return getMaxPricesForNodeProduct ( {
1567- nodePrices : this . config . nodePrices ,
1577+ nodePrices : await this . _getNodePrices ( ) ,
15681578 userMaxPrice : getUserMaxPrice ( ) ,
15691579 productId : PRODUCT_IDS [ product ] ,
15701580 numRequiredNodes : this . _getThreshold ( ) ,
@@ -1914,7 +1924,7 @@ export class LitNodeClientNodeJs extends LitCore implements ILitNodeClient {
19141924
19151925 // This may seem a bit weird because we usually only care about prices for sessionSigs...
19161926 // But this also ensures we use the cheapest nodes and takes care of getting the minNodeCount of node URLs for the operation
1917- const targetNodePrices = this . getMaxPricesForNodeProduct ( {
1927+ const targetNodePrices = await this . getMaxPricesForNodeProduct ( {
19181928 product : 'LIT_ACTION' ,
19191929 } ) ;
19201930
0 commit comments