Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ typings/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
.idea

# User-specific stuff
.idea/**/workspace.xml
Expand Down Expand Up @@ -162,4 +163,4 @@ fabric.properties
.idea/caches/build_file_checksums.ser

.rts2_cache_cjs
.rts2_cache_esm
.rts2_cache_esm
24 changes: 23 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,27 @@ export class IFrameEthereumProvider extends EventEmitter<
}

/**
* EIP-1193 request interface to send request.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#request
* @param method
* @param params
*/
public async request<TParams = any[], TResult = any>(
method: string,
params?: TParams
): Promise<TResult> {
const response = await this.execute<TParams, TResult, any>(method, params);

if ('error' in response) {
throw new RpcError(response.error.code, response.error.message);
} else {
return response.result;
}
}

/**
* Depreciated. Backwards compatibility method for web3.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#appendix-iii-legacy-provider-api
* Send the JSON RPC and return the result.
* @param method method to send to the parent provider
* @param params parameters to send
Expand Down Expand Up @@ -271,7 +292,8 @@ export class IFrameEthereumProvider extends EventEmitter<
}

/**
* Backwards compatibility method for web3.
* Depreciated. Backwards compatibility method for web3.
* https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#appendix-iii-legacy-provider-api
* @param payload payload to send to the provider
* @param callback callback to be called when the provider resolves
*/
Expand Down