web3-core
Advanced tools
Comparing version 4.5.2-dev.9b32205.0 to 4.5.2-dev.a21078b.0
import { HexString, JsonRpcPayload, JsonRpcResponse, Transaction, Web3APIMethod, Web3APIReturnType } from 'web3-types'; | ||
import { Schema } from 'web3-validator'; | ||
export declare type TransactionTypeParser = (transaction: Transaction) => HexString | undefined; | ||
@@ -19,1 +20,5 @@ export interface Method { | ||
} | ||
export declare type CustomTransactionSchema = { | ||
type: string; | ||
properties: Record<string, Schema>; | ||
}; |
@@ -25,3 +25,5 @@ "use strict"; | ||
'request' in provider && | ||
provider.request.constructor.name === 'AsyncFunction' && 'isMetaMask' in provider && provider.isMetaMask; | ||
provider.request.constructor.name === 'AsyncFunction' && | ||
'isMetaMask' in provider && | ||
provider.isMetaMask; | ||
exports.isMetaMaskProvider = isMetaMaskProvider; | ||
@@ -28,0 +30,0 @@ const isLegacyRequestProvider = (provider) => typeof provider !== 'string' && |
import { Numbers, HexString, BlockNumberOrTag, Common, DataFormat } from 'web3-types'; | ||
import { TransactionTypeParser } from './types.js'; | ||
import { CustomTransactionSchema, TransactionTypeParser } from './types.js'; | ||
import { TransactionBuilder } from './web3_context.js'; | ||
@@ -31,2 +31,3 @@ import { Web3EventEmitter } from './web3_event_emitter.js'; | ||
transactionTypeParser?: TransactionTypeParser; | ||
customTransactionSchema?: CustomTransactionSchema; | ||
defaultReturnFormat: DataFormat; | ||
@@ -248,4 +249,6 @@ } | ||
set transactionTypeParser(val: TransactionTypeParser | undefined); | ||
get customTransactionSchema(): CustomTransactionSchema | undefined; | ||
set customTransactionSchema(schema: CustomTransactionSchema | undefined); | ||
private _triggerConfigChange; | ||
} | ||
export {}; |
@@ -58,2 +58,3 @@ "use strict"; | ||
transactionTypeParser: undefined, | ||
customTransactionSchema: undefined, | ||
defaultReturnFormat: web3_types_1.DEFAULT_RETURN_FORMAT, | ||
@@ -408,2 +409,9 @@ }; | ||
} | ||
get customTransactionSchema() { | ||
return this.config.customTransactionSchema; | ||
} | ||
set customTransactionSchema(schema) { | ||
this._triggerConfigChange('customTransactionSchema', schema); | ||
this.config.customTransactionSchema = schema; | ||
} | ||
_triggerConfigChange(config, newValue) { | ||
@@ -410,0 +418,0 @@ this.emit(Web3ConfigEvent.CONFIG_CHANGE, { |
@@ -52,3 +52,3 @@ "use strict"; | ||
} | ||
const { config, provider, requestManager, subscriptionManager, registeredSubscriptions, accountProvider, wallet, requestManagerMiddleware } = providerOrContext; | ||
const { config, provider, requestManager, subscriptionManager, registeredSubscriptions, accountProvider, wallet, requestManagerMiddleware, } = providerOrContext; | ||
this.setConfig(config !== null && config !== void 0 ? config : {}); | ||
@@ -55,0 +55,0 @@ this._requestManager = |
@@ -21,3 +21,5 @@ /* | ||
'request' in provider && | ||
provider.request.constructor.name === 'AsyncFunction' && 'isMetaMask' in provider && provider.isMetaMask; | ||
provider.request.constructor.name === 'AsyncFunction' && | ||
'isMetaMask' in provider && | ||
provider.isMetaMask; | ||
export const isLegacyRequestProvider = (provider) => typeof provider !== 'string' && | ||
@@ -24,0 +26,0 @@ 'request' in provider && |
@@ -55,2 +55,3 @@ /* | ||
transactionTypeParser: undefined, | ||
customTransactionSchema: undefined, | ||
defaultReturnFormat: DEFAULT_RETURN_FORMAT, | ||
@@ -405,2 +406,9 @@ }; | ||
} | ||
get customTransactionSchema() { | ||
return this.config.customTransactionSchema; | ||
} | ||
set customTransactionSchema(schema) { | ||
this._triggerConfigChange('customTransactionSchema', schema); | ||
this.config.customTransactionSchema = schema; | ||
} | ||
_triggerConfigChange(config, newValue) { | ||
@@ -407,0 +415,0 @@ this.emit(Web3ConfigEvent.CONFIG_CHANGE, { |
@@ -49,3 +49,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
const { config, provider, requestManager, subscriptionManager, registeredSubscriptions, accountProvider, wallet, requestManagerMiddleware } = providerOrContext; | ||
const { config, provider, requestManager, subscriptionManager, registeredSubscriptions, accountProvider, wallet, requestManagerMiddleware, } = providerOrContext; | ||
this.setConfig(config !== null && config !== void 0 ? config : {}); | ||
@@ -52,0 +52,0 @@ this._requestManager = |
import { HexString, JsonRpcPayload, JsonRpcResponse, Transaction, Web3APIMethod, Web3APIReturnType } from 'web3-types'; | ||
import { Schema } from 'web3-validator'; | ||
export declare type TransactionTypeParser = (transaction: Transaction) => HexString | undefined; | ||
@@ -19,2 +20,6 @@ export interface Method { | ||
} | ||
export declare type CustomTransactionSchema = { | ||
type: string; | ||
properties: Record<string, Schema>; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
import { Numbers, HexString, BlockNumberOrTag, Common, DataFormat } from 'web3-types'; | ||
import { TransactionTypeParser } from './types.js'; | ||
import { CustomTransactionSchema, TransactionTypeParser } from './types.js'; | ||
import { TransactionBuilder } from './web3_context.js'; | ||
@@ -31,2 +31,3 @@ import { Web3EventEmitter } from './web3_event_emitter.js'; | ||
transactionTypeParser?: TransactionTypeParser; | ||
customTransactionSchema?: CustomTransactionSchema; | ||
defaultReturnFormat: DataFormat; | ||
@@ -248,2 +249,4 @@ } | ||
set transactionTypeParser(val: TransactionTypeParser | undefined); | ||
get customTransactionSchema(): CustomTransactionSchema | undefined; | ||
set customTransactionSchema(schema: CustomTransactionSchema | undefined); | ||
private _triggerConfigChange; | ||
@@ -250,0 +253,0 @@ } |
{ | ||
"name": "web3-core", | ||
"version": "4.5.2-dev.9b32205.0+9b32205", | ||
"version": "4.5.2-dev.a21078b.0+a21078b", | ||
"description": "Web3 core tools for sub-packages. This is an internal package.", | ||
@@ -45,13 +45,13 @@ "main": "./lib/commonjs/index.js", | ||
"dependencies": { | ||
"web3-errors": "1.3.1-dev.9b32205.0+9b32205", | ||
"web3-eth-accounts": "4.2.2-dev.9b32205.0+9b32205", | ||
"web3-eth-iban": "4.0.8-dev.9b32205.0+9b32205", | ||
"web3-providers-http": "4.2.1-dev.9b32205.0+9b32205", | ||
"web3-providers-ws": "4.0.9-dev.9b32205.0+9b32205", | ||
"web3-types": "1.7.1-dev.9b32205.0+9b32205", | ||
"web3-utils": "4.3.2-dev.9b32205.0+9b32205", | ||
"web3-validator": "2.0.7-dev.9b32205.0+9b32205" | ||
"web3-errors": "1.3.1-dev.a21078b.0+a21078b", | ||
"web3-eth-accounts": "4.2.2-dev.a21078b.0+a21078b", | ||
"web3-eth-iban": "4.0.8-dev.a21078b.0+a21078b", | ||
"web3-providers-http": "4.2.1-dev.a21078b.0+a21078b", | ||
"web3-providers-ws": "4.0.9-dev.a21078b.0+a21078b", | ||
"web3-types": "1.7.1-dev.a21078b.0+a21078b", | ||
"web3-utils": "4.3.2-dev.a21078b.0+a21078b", | ||
"web3-validator": "2.0.7-dev.a21078b.0+a21078b" | ||
}, | ||
"optionalDependencies": { | ||
"web3-providers-ipc": "4.0.8-dev.9b32205.0+9b32205" | ||
"web3-providers-ipc": "4.0.8-dev.a21078b.0+a21078b" | ||
}, | ||
@@ -74,3 +74,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "9b322052ef266cc57b29080b20053991e0c9a0a9" | ||
"gitHead": "a21078b9c5bec437340296f519133b0ddbbc83ce" | ||
} |
@@ -26,2 +26,3 @@ /* | ||
} from 'web3-types'; | ||
import { Schema } from 'web3-validator'; | ||
@@ -54,1 +55,6 @@ export type TransactionTypeParser = (transaction: Transaction) => HexString | undefined; | ||
} | ||
export type CustomTransactionSchema = { | ||
type: string; | ||
properties: Record<string, Schema>; | ||
}; |
@@ -36,7 +36,8 @@ /* | ||
): provider is MetaMaskProvider<API> => | ||
typeof provider !== 'string' && | ||
'request' in provider && | ||
provider.request.constructor.name === 'AsyncFunction' && 'isMetaMask' in provider && provider.isMetaMask; | ||
typeof provider !== 'string' && | ||
'request' in provider && | ||
provider.request.constructor.name === 'AsyncFunction' && | ||
'isMetaMask' in provider && | ||
provider.isMetaMask; | ||
export const isLegacyRequestProvider = <API extends Web3APISpec>( | ||
@@ -66,3 +67,3 @@ provider: SupportedProviders<API>, | ||
provider: SupportedProviders<API>, | ||
): provider is SupportedProviders<API> => | ||
): provider is SupportedProviders<API> => | ||
provider && | ||
@@ -69,0 +70,0 @@ (isWeb3Provider(provider) || |
@@ -28,3 +28,3 @@ /* | ||
import { isNullish, toHex } from 'web3-utils'; | ||
import { TransactionTypeParser } from './types.js'; | ||
import { CustomTransactionSchema, TransactionTypeParser } from './types.js'; | ||
// eslint-disable-next-line import/no-cycle | ||
@@ -63,2 +63,3 @@ import { TransactionBuilder } from './web3_context.js'; | ||
transactionTypeParser?: TransactionTypeParser; | ||
customTransactionSchema?: CustomTransactionSchema; | ||
defaultReturnFormat: DataFormat; | ||
@@ -106,2 +107,3 @@ } | ||
transactionTypeParser: undefined, | ||
customTransactionSchema: undefined, | ||
defaultReturnFormat: DEFAULT_RETURN_FORMAT, | ||
@@ -121,6 +123,7 @@ }; | ||
if(!isNullish(options[key]) && | ||
if ( | ||
!isNullish(options[key]) && | ||
typeof options[key] === 'number' && | ||
key === 'maxListenersWarningThreshold' ) | ||
{ | ||
key === 'maxListenersWarningThreshold' | ||
) { | ||
// additionally set in event emitter | ||
@@ -526,2 +529,11 @@ this.setMaxListenerWarningThreshold(Number(options[key])); | ||
public get customTransactionSchema(): CustomTransactionSchema | undefined { | ||
return this.config.customTransactionSchema; | ||
} | ||
public set customTransactionSchema(schema: CustomTransactionSchema | undefined) { | ||
this._triggerConfigChange('customTransactionSchema', schema); | ||
this.config.customTransactionSchema = schema; | ||
} | ||
private _triggerConfigChange<K extends keyof Web3ConfigOptions>( | ||
@@ -528,0 +540,0 @@ config: K, |
@@ -21,4 +21,11 @@ /* | ||
EthExecutionAPI, | ||
HexString, Numbers, SupportedProviders, Transaction, Web3AccountProvider, Web3APISpec, Web3BaseProvider, Web3BaseWallet, | ||
Web3BaseWalletAccount | ||
HexString, | ||
Numbers, | ||
SupportedProviders, | ||
Transaction, | ||
Web3AccountProvider, | ||
Web3APISpec, | ||
Web3BaseProvider, | ||
Web3BaseWallet, | ||
Web3BaseWalletAccount, | ||
} from 'web3-types'; | ||
@@ -134,3 +141,3 @@ import { isNullish } from 'web3-utils'; | ||
wallet, | ||
requestManagerMiddleware | ||
requestManagerMiddleware, | ||
} = providerOrContext as Web3ContextInitOptions<API, RegisteredSubs>; | ||
@@ -145,3 +152,3 @@ | ||
config?.enableExperimentalFeatures?.useSubscriptionWhenCheckingBlockTimeout, | ||
requestManagerMiddleware | ||
requestManagerMiddleware, | ||
); | ||
@@ -227,3 +234,3 @@ | ||
this[ContextRef.name] = newContextChild; | ||
return newContextChild; | ||
@@ -366,6 +373,6 @@ } | ||
public setRequestManagerMiddleware(requestManagerMiddleware: RequestManagerMiddleware<API>){ | ||
public setRequestManagerMiddleware(requestManagerMiddleware: RequestManagerMiddleware<API>) { | ||
this.requestManager.setMiddleware(requestManagerMiddleware); | ||
} | ||
/** | ||
@@ -372,0 +379,0 @@ * Will return the {@link Web3BatchRequest} constructor. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
483594
8529
23
44
235