Skip to content

Commit

Permalink
Merge pull request #1 from dexon-foundation/change_to_dexon_wallet
Browse files Browse the repository at this point in the history
Change to dexon wallet
  • Loading branch information
Scott Chou authored Apr 25, 2019
2 parents 702be7e + 56a62fc commit a708c70
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 701 deletions.
30 changes: 30 additions & 0 deletions DexonWalletWeb3Provider.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Be sure to run `pod lib lint DexonWalletWeb3Provider.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'DexonWalletWeb3Provider'
s.version = '0.4.0'
s.summary = 'Web3 javascript wrapper provider for iOS and Android platforms.'

s.description = <<-DESC
Web3 javascript wrapper provider for iOS and Android platforms.
The magic behind the dApps browsers
DESC

s.homepage = 'https://github.com/dexon-foundation/dexon-wallet-web3-provider'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Scott Chou' => '[email protected]', 'hewigovens' => '[email protected]', 'Viktor Radchenko' => 'vikmeup' }
s.source = { :git => 'https://github.com/dexon-foundation/dexon-wallet-web3-provider.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/dexonfoundation'

s.ios.deployment_target = '8.0'

s.resource_bundles = {
'DexonWalletWeb3Provider' => ['dist/dexon-wallet-min.js']
}
end
30 changes: 0 additions & 30 deletions TrustWeb3Provider.podspec

This file was deleted.

12 changes: 12 additions & 0 deletions dist/dexon-wallet-min.js

Large diffs are not rendered by default.

656 changes: 0 additions & 656 deletions dist/trust-min.js

This file was deleted.

4 changes: 2 additions & 2 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ dependencies {
task copyJSProvider(type: Copy)

copyJSProvider{
from "../dist/trust-min.js"
rename 'trust-min.js', 'trust.js'
from "../dist/dexon-wallet-min.js"
rename 'dexon-wallet-min.js', 'dexon_wallet.js'
into 'src/main/res/raw'
}

Expand Down
2 changes: 0 additions & 2 deletions src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class FilterMgr {

uninstallFilter(filterId) {
let id = Utils.hexToInt(filterId);
console.log("uninstall filter ", this.filters.get(id));
this.filters.delete(id);
this.blockNumbers.delete(id);
this._clearTimer(id);
Expand Down Expand Up @@ -193,7 +192,6 @@ class FilterMgr {
_setupTimer(filterId) {
this._clearTimer(filterId);
let newTimer = setTimeout(() => {
console.log("filter timeout ", filterId);
this.filters.delete(filterId);
this.blockNumbers.delete(filterId);
}, this.timeoutInterval);
Expand Down
9 changes: 3 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"use strict";

import Web3 from "web3";
import FilterMgr from "./filter";
import RPCServer from "./rpc";
import Utils from "./utils";
import IdMapping from "./id_mapping";

class TrustWeb3Provider {
class DexonWalletWeb3Provider {
constructor(config) {
this.setConfig(config);

Expand Down Expand Up @@ -35,7 +34,7 @@ class TrustWeb3Provider {

enable() {
// this may be undefined somehow
var that = this
var that = this;
return that._sendAsync({
method: "eth_requestAccounts",
params: []
Expand Down Expand Up @@ -244,7 +243,6 @@ class TrustWeb3Provider {
}

sendError(id, error) {
console.log(`<== ${id} sendError ${error}`, id, error);
let callback = this.callbacks.get(id);
if (callback) {
callback(error instanceof Error ? error : new Error(error), null);
Expand All @@ -253,5 +251,4 @@ class TrustWeb3Provider {
}
}

window.DekuSan = TrustWeb3Provider;
window.Web3 = Web3;
window.DexonWallet = DexonWalletWeb3Provider;
4 changes: 2 additions & 2 deletions src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "Trust Web3 Provider",
"main": "index.js",
"scripts": {
"build": "rm -rf ../dist && parcel build index.js -o trust-min.js -d ../dist",
"watch": "rm -rf ../dist && parcel watch index.js -o trust-min.js -d ../dist",
"build": "rm -rf ../dist && parcel build index.js -o dexon-wallet-min.js -d ../dist",
"watch": "rm -rf ../dist && parcel watch index.js -o dexon-wallet-min.js -d ../dist",
"lint": "eslint . --fix",
"test": "jest"
},
Expand Down
3 changes: 0 additions & 3 deletions src/rpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class RPCServer {
}

call(payload) {
// console.log("==> call rpc ", payload);
this.idMapping.tryIntifyId(payload);
return fetch(this.rpcUrl, {
method: "POST",
Expand All @@ -35,9 +34,7 @@ class RPCServer {
})
.then(response => response.json())
.then(json => {
// console.log("<== rpc result", json);
if (!json.result && json.error) {
console.log("<== rpc error", json.error);
throw new Error(json.error.message || "rpc error");
}
this.idMapping.tryRestoreId(json);
Expand Down

0 comments on commit a708c70

Please sign in to comment.