aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-10-10 08:04:54 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-10-10 08:04:54 +0800
commit8155d311af04339c105f1a29b74f1ddbced85197 (patch)
tree9b345f05561e806b6d89cec26b371aadafb109ed /packages/website
parentcd8e6d9cdf7d6aa1e811bb7d9d7017da342907ed (diff)
parentbd06ebde8d1a5caf138ad3b36f9a5c5f255f2312 (diff)
downloaddexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar.gz
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar.bz2
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar.lz
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar.xz
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.tar.zst
dexon-sol-tools-8155d311af04339c105f1a29b74f1ddbced85197.zip
Merge branch 'development' into feature/asset-buyer/api-tweaks
* development: Define bundlewatch.ci.repoBranchBase Stop accesing ethers private methods Fix merge conflicts Fix ethers build issue Upgrade ethers.js version Fix branch name Add max sizes Use bundlewatch instead of bundlesize Move Metamask Error to OrderErrors Update the exported types for the packages which touch RPC providers Throw and handle errors from Providers. Clarifies use of schemas outside of Javascript/TypeScript. Detect MM on signature validation failure. Return SignedOrder from signing utils. Update 0x.js Changelog Add eth_signTypedData support to our wallet subproviders Move SignTypedData to utils package Introduce Metamask Subprovider. Expose eth_signTypedData functionality for order signing
Diffstat (limited to 'packages/website')
-rw-r--r--packages/website/md/docs/json_schemas/1.0.0/introduction.md2
-rw-r--r--packages/website/ts/blockchain.ts30
2 files changed, 12 insertions, 20 deletions
diff --git a/packages/website/md/docs/json_schemas/1.0.0/introduction.md b/packages/website/md/docs/json_schemas/1.0.0/introduction.md
index a27f4b521..5b2e90387 100644
--- a/packages/website/md/docs/json_schemas/1.0.0/introduction.md
+++ b/packages/website/md/docs/json_schemas/1.0.0/introduction.md
@@ -1,3 +1,3 @@
Welcome to the [@0xproject/json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas) documentation! This package provides JSON schemas for validating 0x Protocol & Standard Relayer API data structures. It provides both the raw JSON schemas and a schema validator class to interact with them from a JS project.
-If you are not using a Javascript-based language for your project, you can copy-paste the JSON schemas within this package and use them together with a [JSON Schema](http://json-schema.org/) implementation in your [language of choice](http://json-schema.org/implementations.html) (e.g Python, Haskell, Go, C, C++, Rust, Ruby, Scala, etc...).
+If you are not using a Javascript-based language for your project, you can use a Javascript environment to render the JSON schemas within this package and use them together with a [JSON Schema](http://json-schema.org/) implementation in your [language of choice](http://json-schema.org/implementations.html) (e.g Python, Haskell, Go, C, C++, Rust, Ruby, Scala, etc...). All the schema files are currently TypeScript that require evaluation in order to be recognized as valid JSON.
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index c420bbf3a..b1181e4c6 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -9,11 +9,12 @@ import {
ExchangeFillEventArgs,
IndexedFilterValues,
} from '@0xproject/contract-wrappers';
-import { assetDataUtils, orderHashUtils, signatureUtils, SignerType } from '@0xproject/order-utils';
+import { assetDataUtils, orderHashUtils, signatureUtils } from '@0xproject/order-utils';
import { EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
import {
ledgerEthereumBrowserClientFactoryAsync,
LedgerSubprovider,
+ MetamaskSubprovider,
RedundantSubprovider,
RPCSubprovider,
SignerSubprovider,
@@ -27,8 +28,6 @@ import * as _ from 'lodash';
import * as moment from 'moment';
import * as React from 'react';
import contract = require('truffle-contract');
-import { tokenAddressOverrides } from 'ts/utils/token_address_overrides';
-
import { BlockchainWatcher } from 'ts/blockchain_watcher';
import { AssetSendCompleted } from 'ts/components/flash_messages/asset_send_completed';
import { TransactionSubmitted } from 'ts/components/flash_messages/transaction_submitted';
@@ -54,6 +53,7 @@ import { backendClient } from 'ts/utils/backend_client';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
import { errorReporter } from 'ts/utils/error_reporter';
+import { tokenAddressOverrides } from 'ts/utils/token_address_overrides';
import { utils } from 'ts/utils/utils';
import FilterSubprovider = require('web3-provider-engine/subproviders/filters');
@@ -161,7 +161,13 @@ export class Blockchain {
// We catch all requests involving a users account and send it to the injectedWeb3
// instance. All other requests go to the public hosted node.
const provider = new Web3ProviderEngine();
- provider.addProvider(new SignerSubprovider(injectedWeb3.currentProvider));
+ const providerName = this._getNameGivenProvider(injectedWeb3.currentProvider);
+ // Wrap Metamask in a compatability wrapper MetamaskSubprovider (to handle inconsistencies)
+ const signerSubprovider =
+ providerName === Providers.Metamask
+ ? new MetamaskSubprovider(injectedWeb3.currentProvider)
+ : new SignerSubprovider(injectedWeb3.currentProvider);
+ provider.addProvider(signerSubprovider);
provider.addProvider(new FilterSubprovider());
const rpcSubproviders = _.map(publicNodeUrlsIfExistsForNetworkId, publicNodeUrl => {
return new RPCSubprovider(publicNodeUrl);
@@ -432,21 +438,7 @@ export class Blockchain {
}
this._showFlashMessageIfLedger();
const provider = this._contractWrappers.getProvider();
- const isLedgerSigner = !_.isUndefined(this._ledgerSubprovider);
- const injectedProvider = Blockchain._getInjectedWeb3().currentProvider;
- const isMetaMaskSigner = utils.getProviderType(injectedProvider) === Providers.Metamask;
- let signerType = SignerType.Default;
- if (isLedgerSigner) {
- signerType = SignerType.Ledger;
- } else if (isMetaMaskSigner) {
- signerType = SignerType.Metamask;
- }
- const ecSignatureString = await signatureUtils.ecSignOrderHashAsync(
- provider,
- orderHash,
- makerAddress,
- signerType,
- );
+ const ecSignatureString = await signatureUtils.ecSignHashAsync(provider, orderHash, makerAddress);
this._dispatcher.updateSignature(ecSignatureString);
return ecSignatureString;
}