Skip to content

Commit

Permalink
Webhook support (#8)
Browse files Browse the repository at this point in the history
* Added rebranding

* Added Webhook support

* Fixed travis

* Fixed travis

* Fixed README
  • Loading branch information
dgarcia360 committed Mar 23, 2020
1 parent 2546951 commit 40a1de9
Show file tree
Hide file tree
Showing 17 changed files with 346 additions and 1,293 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ cache:
before_script:
- npm run build
script:
- npm run test:coverage
- npm run report-coverage
- npm run test:cov
- npm run lint:all
- npx embedme README.md --verify
- tslint --project .
- npm run coveralls-report
before_deploy:
- npx typedoc --out ts-docs src
- touch ./ts-docs/.nojekyll
Expand Down
26 changes: 13 additions & 13 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Contributing to nem2-uri-scheme
# Contributing to symbol-uri-scheme

First off, thank you for considering contributing to nem2-uri-scheme.
It’s people like you that make nem2-uri-scheme such a great tool.
First off, thank you for considering contributing to symbol-uri-scheme.
It’s people like you that make symbol-uri-scheme such a great tool.

nem2-uri-scheme is an open source project and we love to receive contributions from
symbol-uri-scheme is an open source project and we love to receive contributions from
our community — you! There are many ways to contribute, from writing tutorials or blog
posts, improving the documentation, submitting bug reports and feature requests or
writing code which can be incorporated into nem2-uri-scheme itself.
writing code which can be incorporated into symbol-uri-scheme itself.

Following these guidelines helps to communicate that you respect the time of
the developers managing and developing this open source project. In return,
Expand All @@ -17,8 +17,8 @@ Please, **don't use the issue tracker for support questions**.

## Bug reports

If you think you have found a bug in nem2-uri-scheme, first make sure that you
are testing against the latest version of nem2-uri-scheme - your issue may already
If you think you have found a bug in symbol-uri-scheme, first make sure that you
are testing against the latest version of symbol-uri-scheme - your issue may already
have been fixed. If not, search our issues list on GitHub in case a similar
issue has already been opened.

Expand All @@ -42,15 +42,15 @@ Open a new issue [here](github-issues).

## Feature requests

If you find yourself wishing for a feature that doesn't exist in nem2-uri-scheme,
If you find yourself wishing for a feature that doesn't exist in symbol-uri-scheme,
you are probably not alone. There are bound to be others out there with similar
needs. Many of the features that nem2-uri-scheme has today have been added because
needs. Many of the features that symbol-uri-scheme has today have been added because
our users saw the need. Open an [issue](github-issues) on our issues list on GitHub which describes
the feature you would like to see, why you need it, and how it should work.

## Contributing code and documentation changes

If you have a bugfix or new feature that you would like to contribute to nem2-uri-scheme, please find or open an issue
If you have a bugfix or new feature that you would like to contribute to symbol-uri-scheme, please find or open an issue
about it first. Talk about what you would like to do. It may be that somebody is already working on it, or that there
are particular issues that you should know about before implementing the change.

Expand All @@ -59,7 +59,7 @@ important to find the best approach before writing too much code.

### Fork and clone the repository

You will need to fork the main nem2-uri-scheme code repository and clone
You will need to fork the main symbol-uri-scheme code repository and clone
it to your local machine. See [github help page](https://help.github.com/articles/fork-a-repo/) for help.

### Submitting your changes
Expand All @@ -74,10 +74,10 @@ Once your changes and tests are ready to submit for review:

Push your local changes to your forked copy of the repository and [submit a pull request](https://help.github.com/articles/about-pull-requests/). In the pull request, choose a title which sums up the changes that you have made, and in the body provide more details about what your changes do. Also mention the number of the issue where discussion has taken place, eg "Closes #123".

Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into nem2-uri-scheme.
Then sit back and wait. There will probably be discussion about the pull request and, if any changes are needed, we would love to work with you to get your pull request merged into symbol-uri-scheme.

*CONTRIBUTING.md is based on [CONTRIBUTING-template.md](https://github.com/nayafia/contributing-template/blob/master/CONTRIBUTING-template.md)*
and [elasticsearch/CONTRIGUTING](https://github.com/elastic/elasticsearch/blob/master/CONTRIBUTING.md)

[pull-request]:https://help.github.com/articles/about-pull-requests/
[github-issues]:https://github.com/nemfoundation/nem2-uri-scheme/issues
[github-issues]:https://github.com/nemfoundation/symbol-uri-scheme/issues
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2019 NEM
Copyright 2019 - present NEM

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
33 changes: 18 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
# nem2-uri-scheme
# symbol-uri-scheme

[![npm version](https://badge.fury.io/js/nem2-uri-scheme.svg)](https://badge.fury.io/js/nem2-uri-scheme)
[![Build Status](https://travis-ci.org/nemfoundation/nem2-uri-scheme.svg?branch=master)](https://travis-ci.org/nemfoundation/nem2-uri-scheme)
[![Coverage Status](https://coveralls.io/repos/github/nemfoundation/nem2-uri-scheme/badge.svg?branch=master)](https://coveralls.io/github/nemfoundation/nem2-uri-scheme?branch=master)
[![Slack](https://img.shields.io/badge/chat-on%20slack-green.svg)](https://nem2.slack.com/messages/CB0UU89GS//)
[![npm version](https://badge.fury.io/js/symbol-uri-scheme.svg)](https://badge.fury.io/js/symbol-uri-scheme)
[![Build Status](https://travis-ci.org/nemfoundation/symbol-uri-scheme.svg?branch=master)](https://travis-ci.org/nemfoundation/symbol-uri-scheme)
[![Coverage Status](https://coveralls.io/repos/github/nemfoundation/symbol-uri-scheme/badge.svg?branch=master)](https://coveralls.io/github/nemfoundation/symbol-uri-scheme?branch=master)
[![Slack](https://img.shields.io/badge/chat-on%20slack-green.svg)](https://symbol.slack.com/messages/CB0UU89GS//)

Catapult URI Scheme generator to serve transactions ready to be signed.
Symbol URI Scheme generator to serve transactions ready to be signed.

This is a PoC to validate the proposed [NIP2 Transaction URI Scheme](https://github.com/nemtech/NIP/issues/6).

:warning: This library is experimental, use at your own risk.

## Requirements

## Important Notes

- [0.4.1](https://www.npmjs.com/package/nem2-uri-scheme) - **Fushicho3 Network Compatibility (catapult-server@0.9.1.1)**
- Node.js 12 LTS

## Installation

``npm install nem2-uri-scheme``
``npm install symbol-uri-scheme``

## Usage

Expand All @@ -27,19 +26,21 @@ This is a PoC to validate the proposed [NIP2 Transaction URI Scheme](https://git
```ts
// examples/TransactionToURI.ts

import {Account, Deadline, EmptyMessage, NetworkCurrencyMosaic, NetworkType, TransferTransaction} from 'nem2-sdk';
import {TransactionURI} from 'nem2-uri-scheme';
import {Account, Deadline, EmptyMessage, NetworkCurrencyPublic, NetworkType, TransferTransaction} from 'symbol-sdk';
import {TransactionURI} from "../src/uris/TransactionURI";

const serializedTransaction = TransferTransaction.create(
Deadline.create(),
Account.generateNewAccount(NetworkType.TEST_NET).address,
[NetworkCurrencyMosaic.createRelative(10)],
[NetworkCurrencyPublic.createRelative(10)],
EmptyMessage,
NetworkType.TEST_NET
).serialize();
const generationHash = ''; // replace with network generation hash

const generationHash = 'ABC'; // replace with network generation hash
const nodeUrl = 'http://localhost:3000';
const webhookUrl = 'http://myapp.local/id';

const transactionURI = new TransactionURI(serializedTransaction, generationHash, nodeUrl, webhookUrl);
console.log(transactionURI.build());

Expand All @@ -50,7 +51,7 @@ console.log(transactionURI.build());
```ts
// examples/URIToTransaction.ts

import {TransactionURI} from "nem2-uri-scheme";
import {TransactionURI} from "../src/uris/TransactionURI";

const serializedTransaction = 'B500000000000000406D262D78CE449BC743A2F27FFE05A677A922C6FBA0B6FD' +
'F7EE115E01F76A60D2B027C4F8F2826F727ADEC0E6406C2ECC7C67C49FED2DAD' +
Expand All @@ -62,7 +63,9 @@ const serializedTransaction = 'B500000000000000406D262D78CE449BC743A2F27FFE05A67
const URI = 'web+nem://transaction?data='+ serializedTransaction + '&generationHash=test' +
'&endpoint=http://localhost:3000&webhook=http://myapp.local/id';
const transactionURI = TransactionURI.fromURI(URI);

const transaction = transactionURI.toTransaction();
console.log(transaction);

```

Expand Down
10 changes: 6 additions & 4 deletions examples/TransactionToURI.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import {Account, Deadline, EmptyMessage, NetworkCurrencyMosaic, NetworkType, TransferTransaction} from 'nem2-sdk';
import {TransactionURI} from 'nem2-uri-scheme';
import {Account, Deadline, EmptyMessage, NetworkCurrencyPublic, NetworkType, TransferTransaction} from 'symbol-sdk';
import {TransactionURI} from "../src/uris/TransactionURI";

const serializedTransaction = TransferTransaction.create(
Deadline.create(),
Account.generateNewAccount(NetworkType.TEST_NET).address,
[NetworkCurrencyMosaic.createRelative(10)],
[NetworkCurrencyPublic.createRelative(10)],
EmptyMessage,
NetworkType.TEST_NET
).serialize();
const generationHash = ''; // replace with network generation hash

const generationHash = 'ABC'; // replace with network generation hash
const nodeUrl = 'http://localhost:3000';
const webhookUrl = 'http://myapp.local/id';

const transactionURI = new TransactionURI(serializedTransaction, generationHash, nodeUrl, webhookUrl);
console.log(transactionURI.build());
4 changes: 3 additions & 1 deletion examples/URIToTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {TransactionURI} from "nem2-uri-scheme";
import {TransactionURI} from "../src/uris/TransactionURI";

const serializedTransaction = 'B500000000000000406D262D78CE449BC743A2F27FFE05A677A922C6FBA0B6FD' +
'F7EE115E01F76A60D2B027C4F8F2826F727ADEC0E6406C2ECC7C67C49FED2DAD' +
Expand All @@ -10,4 +10,6 @@ const serializedTransaction = 'B500000000000000406D262D78CE449BC743A2F27FFE05A67
const URI = 'web+nem://transaction?data='+ serializedTransaction + '&generationHash=test' +
'&endpoint=http://localhost:3000&webhook=http://myapp.local/id';
const transactionURI = TransactionURI.fromURI(URI);

const transaction = transactionURI.toTransaction();
console.log(transaction);
Loading

0 comments on commit 40a1de9

Please sign in to comment.