-
Notifications
You must be signed in to change notification settings - Fork 233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OpenCAP sending feature added #409
base: master
Are you sure you want to change the base?
Conversation
Thanks for your proposal. Our team will let you know. |
src/js/services/opencapService.js
Outdated
@@ -0,0 +1,160 @@ | |||
'use strict'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Your service doesn't follow our standards.
https://github.com/Bitcoin-com/Wallet/blob/master/src/js/services/shapeshift.service.js
The link below is an example of our standard for a service. - If you want to use a promise, use the promise from Angular1 provided by
$q
.
Example
var deferred = $q.defer(); ... deferred.resolve(res); deferred.reject(err); ... return deferred.promise;
- If you want make a http request, please use
$http
from Angular1 instead offetch
. - file naming convention
opencap.service.js
- declare your module in
bitcoincom.services
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect. I'll work on this, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just finished the update. I covered all of your points, let me know if there is anything else you want changed!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will review it and let you know. I don't guarantee anything, I will review technically if it is suitable to our app.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll keep an eye if you need more changes made.
Just finished adding the CashAddr format, as well as a more friendly UI/UX for aliases (they now use the same input field) |
Can one of the admins verify this patch? |
src/js/services/opencap.service.js
Outdated
|
||
var parseAddresses = function(respData, dnssec) { | ||
let addresses = {} | ||
return $q((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : =>
: lambda expression is not supported for old javascript engine.
Should be :
function onQ() {
}
src/js/services/opencap.service.js
Outdated
parseSRV(response.data) | ||
.then(data => getAddresses(alias, data.host, data.dnssec)) | ||
.catch(function(error) { | ||
return $q((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : =>
: lambda expression is not supported for old javascript engine.
Should be :
function onQ() {
}
src/js/services/opencap.service.js
Outdated
function getAddress(alias) { | ||
let aliasData = validateAlias(alias); | ||
if (aliasData.username === '' || aliasData.domain === '') { | ||
return $q((resolve, reject) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : =>
: lambda expression is not supported for old javascript engine.
Should be :
function onQ() {
}
src/js/services/opencap.service.js
Outdated
.then(function(response) { | ||
deferred.resolve( | ||
parseSRV(response.data) | ||
.then(data => getAddresses(alias, data.host, data.dnssec)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : =>
: lambda expression is not supported for old javascript engine.
Should be :
function onThen() {
}
popover.show(angular.element(document.querySelector('#search-input'))) | ||
}); | ||
}) | ||
.catch(status => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : =>
: lambda expression is not supported for old javascript engine.
Should be :
function onCatch() {
}
src/js/services/opencap.service.js
Outdated
return deferred.promise; | ||
} | ||
|
||
var parseSRV = function(respData) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : var parseSRV = function(
Should be : function parseSRV(
src/js/services/opencap.service.js
Outdated
}); | ||
}; | ||
|
||
var getAddresses = function(alias, host, dnssec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : var getAddresses = function(
Should be : function getAddresses(
src/js/services/opencap.service.js
Outdated
let deferred = $q.defer(); | ||
$http | ||
.get(`https://${host}/v1/addresses?alias=${alias}`) | ||
.then(function(response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : function(
Should be : function onThen(
src/js/services/opencap.service.js
Outdated
.then(function(response) { | ||
deferred.resolve(parseAddresses(response.data, dnssec).then()); | ||
}) | ||
.catch(function(response) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : function(
Should be : function onCatch(
src/js/services/opencap.service.js
Outdated
return deferred.promise; | ||
}; | ||
|
||
var parseAddresses = function(respData, dnssec) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now : var parseAddresses = function(
Should be : function parseAddresses(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I got it all addressed
We have written this |
I actually don't think it belongs there... Looks like that functions returns an object, where I need to return a promise right? |
Just fixed a merge conflict that came up recently. Have you had a chance to look at my question above? I think they way I have it may be correct (needs to be a promise returned) |
#374
Added the option for users to send directly to OpenCAP aliases. An OpenCAP alias is human-readable, looks like an email address, and can represent BTC/BCH addresses even as they update for each transaction. OpenCAP is an open-source protocol, and as such anyone can run their own OpenCAP server (it would be awesome if bitcoin.com hosted one at some point in the future)
For testing purposes, feel free to use https://ogdolo.com as it is a fully DNSSEC secured free OpenCAP server.
OpenCAP protocol: https://github.com/opencap/protocol