Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@moneybutton/paymail-client

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@moneybutton/paymail-client - npm Package Compare versions

Comparing version 0.34.0 to 0.35.0

46

dist/paymail-client.cjs.js

@@ -7,2 +7,3 @@ 'use strict';

var brfc = require('@moneybutton/brfc');
var AbortController = _interopDefault(require('abort-controller'));

@@ -15,6 +16,7 @@ var moment = _interopDefault(require('moment'));

paymentDestination: 'paymentDestination',
requestSenderValidation: '6745385c3fc0',
verifyPublicKeyOwner: 'a9f510c16bde',
publicProfile: 'f12f968c92d6',
receiveTransaction: 'receive-transactions-alpha-state'
requestSenderValidation: brfc.brfc('bsvalias Payment Addressing (Payer Validation)', ['andy (nChain)'], ''),
verifyPublicKeyOwner: brfc.brfc('bsvalias public key verify (Verify Public Key Owner)', [], ''),
publicProfile: brfc.brfc('Public Profile (Name & Avatar)', ['Ryan X. Charles (Money Button)'], '1'),
receiveTransaction: brfc.brfc('Send raw transaction', ['Miguel Duarte (Money Button)', 'Ryan X. Charles (Money Button)', 'Ivan Mlinaric (Handcash)', 'Rafa (Handcash)'], '1'),
p2pPaymentDestination: brfc.brfc('Get no monitored payment destination (p2p payment destination)', ['Miguel Duarte (Money Button)', 'Ryan X. Charles (Money Button)', 'Ivan Mlinaric (Handcash)', 'Rafa (Handcash)'], '1')
};

@@ -240,2 +242,10 @@

async getP2pPatmentDestinationUrlFor(aPaymail) {
const [alias, domain] = aPaymail.split('@');
await this.ensureCapabilityFor(domain, CapabilityCodes.p2pPaymentDestination);
const apiDescriptor = await this.getApiDescriptionFor(domain);
const url = apiDescriptor.capabilities[CapabilityCodes.p2pPaymentDestination].replace('{alias}', alias).replace('{domain.tld}', domain);
return url;
}
async domainHasCapability(aDomain, capability) {

@@ -371,2 +381,8 @@ const apiDescriptor = await this.getApiDescriptionFor(aDomain);

buildBodyP2pPaymentDestination(satoshis) {
return {
satoshis
};
}
}

@@ -597,2 +613,24 @@

async getP2pPaymentDestination(targetPaymail, satoshis) {
if (!satoshis) {
throw new Error('Amount in satohis needs to be specified');
}
let paymentDestinationUrl = await this.resolver.getP2pPatmentDestinationUrlFor(targetPaymail);
const response = await this.http.postJson(paymentDestinationUrl, this.requestBodyFactory.buildBodyP2pPaymentDestination(satoshis));
if (!response.ok) {
const body = await response.json();
throw new Error(`Server failed with: ${JSON.stringify(body)}`);
}
const body = await response.json();
if (!body.outputs) {
throw new Error('Server answered with a wrong format. Missing outputs');
}
return body.outputs;
}
}

@@ -599,0 +637,0 @@

@@ -0,1 +1,2 @@

import { brfc } from '@moneybutton/brfc';
import AbortController from 'abort-controller';

@@ -8,6 +9,7 @@ import moment from 'moment';

paymentDestination: 'paymentDestination',
requestSenderValidation: '6745385c3fc0',
verifyPublicKeyOwner: 'a9f510c16bde',
publicProfile: 'f12f968c92d6',
receiveTransaction: 'receive-transactions-alpha-state'
requestSenderValidation: brfc('bsvalias Payment Addressing (Payer Validation)', ['andy (nChain)'], ''),
verifyPublicKeyOwner: brfc('bsvalias public key verify (Verify Public Key Owner)', [], ''),
publicProfile: brfc('Public Profile (Name & Avatar)', ['Ryan X. Charles (Money Button)'], '1'),
receiveTransaction: brfc('Send raw transaction', ['Miguel Duarte (Money Button)', 'Ryan X. Charles (Money Button)', 'Ivan Mlinaric (Handcash)', 'Rafa (Handcash)'], '1'),
p2pPaymentDestination: brfc('Get no monitored payment destination (p2p payment destination)', ['Miguel Duarte (Money Button)', 'Ryan X. Charles (Money Button)', 'Ivan Mlinaric (Handcash)', 'Rafa (Handcash)'], '1')
};

@@ -233,2 +235,10 @@

async getP2pPatmentDestinationUrlFor(aPaymail) {
const [alias, domain] = aPaymail.split('@');
await this.ensureCapabilityFor(domain, CapabilityCodes.p2pPaymentDestination);
const apiDescriptor = await this.getApiDescriptionFor(domain);
const url = apiDescriptor.capabilities[CapabilityCodes.p2pPaymentDestination].replace('{alias}', alias).replace('{domain.tld}', domain);
return url;
}
async domainHasCapability(aDomain, capability) {

@@ -364,2 +374,8 @@ const apiDescriptor = await this.getApiDescriptionFor(aDomain);

buildBodyP2pPaymentDestination(satoshis) {
return {
satoshis
};
}
}

@@ -590,2 +606,24 @@

async getP2pPaymentDestination(targetPaymail, satoshis) {
if (!satoshis) {
throw new Error('Amount in satohis needs to be specified');
}
let paymentDestinationUrl = await this.resolver.getP2pPatmentDestinationUrlFor(targetPaymail);
const response = await this.http.postJson(paymentDestinationUrl, this.requestBodyFactory.buildBodyP2pPaymentDestination(satoshis));
if (!response.ok) {
const body = await response.json();
throw new Error(`Server failed with: ${JSON.stringify(body)}`);
}
const body = await response.json();
if (!body.outputs) {
throw new Error('Server answered with a wrong format. Missing outputs');
}
return body.outputs;
}
}

@@ -592,0 +630,0 @@

5

package.json
{
"name": "@moneybutton/paymail-client",
"version": "0.34.0",
"version": "0.35.0",
"description": "Money Button isomorphic Paymail utilities.",

@@ -30,2 +30,3 @@ "main": "dist/paymail-client.cjs.js",

"@babel/runtime": "7.5.5",
"@moneybutton/brfc": "^0.35.0",
"abort-controller": "3.0.0",

@@ -69,3 +70,3 @@ "bsv": "^1.3.0",

},
"gitHead": "924f8c35fb44d25117aea894876ace691b7c8fd8"
"gitHead": "fc61262b2d017ce59887ddd976d1f3f03526feff"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc