-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
1,278 additions
and
1,037 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<html> | ||
|
||
<head> | ||
<script type="text/javascript"> | ||
window.write = (html) => { | ||
document.open(); | ||
document.write(decodeURIComponent(html)); | ||
document.close(); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body></body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<html> | ||
|
||
<head> | ||
<script type="text/javascript"> | ||
window.write = (html) => { | ||
document.open(); | ||
document.write(decodeURIComponent(html)); | ||
document.close(); | ||
} | ||
</script> | ||
</head> | ||
|
||
<body></body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="initial-scale=1"><meta name="theme-color" content="#036873"><link rel="icon" type="image/png" sizes="512x512" href="icon-512.2f97593a.png"><link rel="stylesheet" href="all.min.a2971c96.css"><title>dappy</title><script src="src.106d7f24.js"></script><link rel="stylesheet" href="src.e84b4155.css"></head><body> <div id="root"></div> </body></html> | ||
<!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="initial-scale=1"><meta name="theme-color" content="#036873"><link rel="icon" type="image/png" sizes="512x512" href="icon-512.2f97593a.png"><link rel="stylesheet" href="all.min.a2971c96.css"><title>dappy</title><script src="src.efa4b2d6.js"></script><link rel="stylesheet" href="src.d4d5564e.css"></head><body> <div id="root"></div> </body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,180 @@ | ||
var DappyEthereum = (function () { | ||
'use strict'; | ||
|
||
var IDENTIFY_FROM_SANDBOX = '[Common] Identify from sandbox'; | ||
var SIGN_ETHEREUM_TRANSACTION_FROM_SANDBOX = '[Common] Sign Ethereum transaction from sandbox'; | ||
var SEND_ETHEREUM_PAYMENT_REQUEST_FROM_SANDBOX = '[Common] Send Ethereum payment request from sandbox'; | ||
var signEthereumTransactionFromSandboxAction = function (values) { | ||
return { | ||
type: SIGN_ETHEREUM_TRANSACTION_FROM_SANDBOX, | ||
payload: values, | ||
}; | ||
}; | ||
var sendEthereumPaymentRequestFromSandboxAction = function (values) { | ||
return { | ||
type: SEND_ETHEREUM_PAYMENT_REQUEST_FROM_SANDBOX, | ||
payload: values, | ||
}; | ||
}; | ||
var identifyFromSandboxAction = function (values) { | ||
return { | ||
type: IDENTIFY_FROM_SANDBOX, | ||
payload: values, | ||
}; | ||
}; | ||
|
||
var default_1 = /** @class */ (function () { | ||
function default_1() { | ||
var _this = this; | ||
this.identifications = {}; | ||
this.transactions = {}; | ||
this.sendMessageToHost = function (m) { | ||
return new Promise(function (resolve, reject) { | ||
var interProcess2 = new XMLHttpRequest(); | ||
interProcess2.open('POST', 'interprocessdapp://message-from-dapp-sandboxed'); | ||
interProcess2.setRequestHeader('Data', JSON.stringify({ | ||
action: m, | ||
})); | ||
interProcess2.send(); | ||
interProcess2.onloadend = function () { | ||
if (interProcess2.responseText && interProcess2.responseText.length) { | ||
reject(interProcess2.responseText); | ||
} | ||
else { | ||
resolve(undefined); | ||
} | ||
}; | ||
}); | ||
}; | ||
this.requestTransactions = function () { | ||
var interProcess = new XMLHttpRequest(); | ||
interProcess.open('POST', 'interprocessdapp://get-transactions'); | ||
interProcess.send(); | ||
interProcess.onload = function (a) { | ||
try { | ||
var r = JSON.parse(a.target.responseText); | ||
var payload = r; | ||
if (payload.transactions) { | ||
_this.updateTransactions(payload.transactions); | ||
} | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
}; | ||
}; | ||
this.requestIdentifications = function () { | ||
var interProcess = new XMLHttpRequest(); | ||
interProcess.open('POST', 'interprocessdapp://get-identifications'); | ||
interProcess.send(); | ||
interProcess.onload = function (a) { | ||
try { | ||
var r = JSON.parse(a.target.responseText); | ||
var payload = r; | ||
if (payload.identifications) { | ||
_this.updateIdentifications(payload.identifications); | ||
} | ||
} | ||
catch (e) { | ||
console.log(e); | ||
} | ||
}; | ||
}; | ||
} | ||
default_1.prototype.identify = function (parameters) { | ||
var _this = this; | ||
var promise = new Promise(function (resolve, reject) { | ||
var params = parameters; | ||
if (!params || !params.publicKey) { | ||
params = { | ||
publicKey: '', | ||
}; | ||
} | ||
var callId = new Date().valueOf().toString() + Math.round(Math.random() * 1000000).toString(); | ||
_this.sendMessageToHost(identifyFromSandboxAction({ | ||
parameters: params, | ||
callId: callId, | ||
resourceId: '', | ||
})).then(function () { | ||
_this.identifications[callId] = { | ||
resolve: resolve, | ||
reject: reject, | ||
}; | ||
}) | ||
.catch(function (err) { | ||
reject(err); | ||
}); | ||
}); | ||
return promise; | ||
}; | ||
default_1.prototype.signTransaction = function (txData) { | ||
var _this = this; | ||
var promise = new Promise(function (resolve, reject) { | ||
var callId = new Date().valueOf().toString() + Math.round(Math.random() * 1000000).toString(); | ||
_this.sendMessageToHost(signEthereumTransactionFromSandboxAction({ | ||
parameters: txData, | ||
callId: callId, | ||
})).then(function () { | ||
_this.transactions[callId] = { | ||
resolve: resolve, | ||
reject: reject, | ||
}; | ||
}) | ||
.catch(function (err) { | ||
reject(err); | ||
}); | ||
}); | ||
return promise; | ||
}; | ||
default_1.prototype.requestPayment = function (parameters) { | ||
var _this = this; | ||
var promise = new Promise(function (resolve, reject) { | ||
var callId = new Date().valueOf().toString() + Math.round(Math.random() * 1000000).toString(); | ||
_this.sendMessageToHost(sendEthereumPaymentRequestFromSandboxAction({ | ||
parameters: parameters, | ||
callId: callId, | ||
})); | ||
_this.transactions[callId] = { | ||
resolve: resolve, | ||
reject: reject, | ||
}; | ||
}); | ||
return promise; | ||
}; | ||
default_1.prototype.updateTransactions = function (transactions) { | ||
var _this = this; | ||
Object.keys(this.transactions).forEach(function (key) { | ||
var callTransaction = Object.values(transactions).find(function (t) { return t.origin.origin === 'dapp' && t.origin.callId === key; }); | ||
if (callTransaction) { | ||
if (callTransaction.status === 'abandonned' || callTransaction.status === 'failed') { | ||
_this.transactions[key].reject({ | ||
error: "transaction ".concat(callTransaction.status), | ||
transaction: callTransaction, | ||
}); | ||
} | ||
else { | ||
_this.transactions[key].resolve(callTransaction); | ||
} | ||
} | ||
}); | ||
}; | ||
default_1.prototype.updateIdentifications = function (identifications) { | ||
var _this = this; | ||
Object.keys(this.identifications).forEach(function (key) { | ||
var callIdentification = identifications[key]; | ||
if (callIdentification) { | ||
if (callIdentification.identified) { | ||
_this.identifications[key].resolve(callIdentification); | ||
} | ||
else { | ||
_this.identifications[key].reject(callIdentification); | ||
} | ||
} | ||
}); | ||
}; | ||
return default_1; | ||
}()); | ||
|
||
return default_1; | ||
|
||
}()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.