Skip to content
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

Rosetta SDK 1.4.1 #2

Merged
merged 99 commits into from
Jan 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
f0a8f0c
Initial Commit of `openapi-generator` generated ExpressJS Server Stub
gto90 Jun 21, 2020
450d066
Enable OpenAPI Schema Validation
SmartArray Jun 22, 2020
e1ca99e
Updated Header in README
SmartArray Jun 22, 2020
0ee4c3f
Exported launchServer to a class, since this is going to be an SDK, n…
SmartArray Jun 22, 2020
18e7400
Added Run-Example script
SmartArray Jun 22, 2020
e8ccc3c
Changed terms in README
SmartArray Jun 22, 2020
9ed5514
Removed GO Coverage badges
SmartArray Jun 22, 2020
eadd29c
Changed repo to DigiByte-Core
SmartArray Jun 22, 2020
bd4cd5a
Added LICENSE
SmartArray Jun 22, 2020
8bb1fe6
Moved project files to lib subdirectory and created directory for the…
SmartArray Jun 22, 2020
b338245
Added an example project
SmartArray Jun 22, 2020
f2da32b
Use the same directory structure than the official Go Reference Project
SmartArray Jun 22, 2020
52e0a42
Changed default Port to 8080
SmartArray Jun 22, 2020
512363a
Beautified some controller files
SmartArray Jun 22, 2020
b630d09
Removed FILE UPLOADER
SmartArray Jun 22, 2020
f2252de
Fixed require path
SmartArray Jun 22, 2020
51454db
OpenAPI Generator did not pack the request properly. For some reason …
SmartArray Jun 22, 2020
c9d591f
Exported schema key extractor to a separate method
SmartArray Jun 22, 2020
0959579
Added Client-Stub (generated with OpenAPI)
SmartArray Jun 23, 2020
631e3f7
Removed node_modules from client
SmartArray Jun 23, 2020
59a39af
Finished Implementations for Syncer and Fetcher
SmartArray Jun 23, 2020
a6df1da
Added ESLint Configuration files
SmartArray Jun 23, 2020
3907aca
Added gitignore
SmartArray Jun 23, 2020
090c319
Asserter Implementation Started.
SmartArray Jun 23, 2020
7add408
Properly export AsserterError
SmartArray Jun 23, 2020
b170366
All Implemented Asserters: Account, Block, Construction, Mempool, Req…
SmartArray Jun 25, 2020
52dbabf
Removed static directives from Asserter Methods.
SmartArray Jun 25, 2020
e1cec75
Finalized Parser Draft
SmartArray Jun 27, 2020
47e3aa1
Exported static var to global var
SmartArray Jun 27, 2020
03f5dc3
Exported Reconciler and Parser in entrypoint
SmartArray Jun 27, 2020
1522ede
Finished draft for Reconciler
SmartArray Jun 27, 2020
f844070
Some syntax fixes
SmartArray Jun 27, 2020
9c7d02d
lookupBalanceByBlock defaults to true
SmartArray Jun 27, 2020
dc6905e
Added unit tests
SmartArray Jun 27, 2020
6a80c58
Completed first test
SmartArray Jun 29, 2020
d3518e6
Added close method of RosettaServer
SmartArray Jun 29, 2020
897ed8c
Deleted Client/Dist and removed from index
SmartArray Jun 29, 2020
6dd625f
Added promise versions of the different api requests
SmartArray Jun 29, 2020
02f3e4f
Created Test Classes for all components
SmartArray Jun 29, 2020
e6ba7eb
Easier API configuration
SmartArray Jun 29, 2020
5ace44b
Promisified Api calls in fetcher
SmartArray Jun 29, 2020
a238fdf
Added Fetcher README
SmartArray Jun 29, 2020
504fb7c
Changed lib name to 'rosetta-node-sdk'
SmartArray Jun 29, 2020
03bf45a
Completed first fetcher tests.
SmartArray Jun 29, 2020
d66aa87
Javascript Markdown Highlighting
SmartArray Jun 29, 2020
526c5b3
Finished Fetcher Unit Tests
SmartArray Jun 30, 2020
eb93fc7
Added MIT License
SmartArray Jun 30, 2020
5993afe
Changed the internal name of custom error instances
SmartArray Jul 1, 2020
6254986
Completed Syncer Unit Tests
SmartArray Jul 1, 2020
de2ed20
Syncer Unit Test file added
SmartArray Jul 1, 2020
db34de9
ESLint fix
SmartArray Jul 1, 2020
43e7405
Added test script
SmartArray Jul 1, 2020
a573497
Renamed test
SmartArray Jul 22, 2020
829740a
Added Asserter Unit tests
SmartArray Jul 22, 2020
b633dc3
Added unit test for parser, created new export called 'Utils'
SmartArray Jul 23, 2020
61779c0
A dozen Parser Bugfixes, and a bunch of parser tests completed
SmartArray Jul 23, 2020
46b92a1
More bugfixes, finalized Parser tests
SmartArray Jul 24, 2020
57085fd
Changed test titles
SmartArray Jul 24, 2020
f161289
Fixed Hasher to hash recursive objects
SmartArray Jul 24, 2020
49840fb
Asserter Bugfixes and Main Asserter Tests completed
SmartArray Jul 24, 2020
8d03239
More asserter bugfixes, more asserter test cases
SmartArray Jul 25, 2020
d09f9a9
More Asserter Tests (Block Tests) + Asserter Bugfixes
SmartArray Jul 26, 2020
13c50ad
Completed Network Asserter Tests + Asserter Bugfixes
SmartArray Jul 26, 2020
226b9f1
Finished Asserter Unit Tests
SmartArray Jul 27, 2020
69c12d7
Finished Reconciler Unit Test, several code improvements for Reconciler
SmartArray Jul 28, 2020
4f0a45d
Added timeouts
SmartArray Jul 28, 2020
e1e5dfb
Restored default timeout value for mocha
SmartArray Jul 28, 2020
1bde7e5
Added AsserterInitializer for Fetcher, and Fetcher example
SmartArray Jul 28, 2020
15acdae
Prepared skeleton for RosettaSDK Server Implementations
SmartArray Jul 28, 2020
1a6d530
Splitted examples up in two. One is a port of the official example,
SmartArray Jul 28, 2020
d2258cf
Completed port of official example
SmartArray Jul 29, 2020
ebc21aa
Commented Skeleton Example
SmartArray Jul 29, 2020
de4f552
New Server capabilities: registering asserters, beautifying responses
SmartArray Jul 29, 2020
a87dbf0
More improvements: Support for Request Assertions, changed some error…
SmartArray Jul 29, 2020
3444964
Exported Client to External Dependency
SmartArray Aug 2, 2020
525c436
Fixed Imports and Tests after replacing Client packge with external repo
SmartArray Aug 2, 2020
8506a1a
Replace error status code with 500 on negative error codes
SmartArray Aug 3, 2020
8efa13e
Changed invalid network error message
SmartArray Aug 3, 2020
1d4b6f8
Always respond with status code 500, on errors
SmartArray Aug 3, 2020
75d148d
Spelling fix for example server, better error handling
SmartArray Aug 4, 2020
7a28455
Implemented upstream changes until 1.4.1
SmartArray Aug 5, 2020
1cc9880
Removed Services
SmartArray Aug 5, 2020
1fe5628
Updated Server Example
SmartArray Aug 5, 2020
5b0477f
Always choose json as output encoding
SmartArray Aug 5, 2020
c6fe7e1
Updated Version
SmartArray Aug 5, 2020
6615caf
Fetcher and Syncer Bugfixes
SmartArray Aug 5, 2020
efa4cca
Initial attempt on documentation, and more bugfixes
SmartArray Aug 10, 2020
a121074
Updated example skeleton
SmartArray Aug 12, 2020
330158d
Several improvements: Server will not autolisten, launch() needs to b…
SmartArray Aug 12, 2020
8e4c639
Fixed log messages
SmartArray Aug 12, 2020
d424cea
Removed unused vars
SmartArray Aug 12, 2020
e3f450b
Create express server in constructor
SmartArray Aug 12, 2020
ea2f2cf
Use correct config
SmartArray Aug 12, 2020
fc526fd
Added ToDos
SmartArray Aug 13, 2020
f7be815
Bind the request and response objects into the service handler
SmartArray Aug 17, 2020
0c86d81
Pass the request and response object as args
SmartArray Aug 17, 2020
aef5ec7
Forwarded fetcher config `defaultHeaders`
SmartArray Aug 17, 2020
faf950a
Updated expressServer wrapper to accept host parameter
SmartArray Sep 6, 2020
2a2516f
Added warning
SmartArray May 15, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/node_modules/**
**/dist
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module"
},
"rules": {
"semi": "error"
}
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
**/node_modules
7 changes: 7 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright (c) 2020 DigiByte Foundation NZ Limited

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
90 changes: 88 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,88 @@
# digibyte-rosetta-nodeapi
Coinbase Rosetta Node API Implementation
<p align="center">
<a href="https://www.rosetta-api.org">
<img width="90%" alt="Rosetta" src="https://www.rosetta-api.org/img/rosetta_header.png">
</a>
</p>
<h3 align="center">
Rosetta SDK
</h3>
<p align="center">
NodeJS Rosetta SDK to create and interact with Rosetta API Implementations
</p>
<p align="center">
<!--<a href="https://circleci.com/gh/DigiByte-Core/digibyte-rosetta-nodeapi/tree/master"><img src="https://circleci.com/gh/DigiByte-Core/digibyte-rosetta-nodeapi/tree/master.svg?style=shield" /></a>-->
<a href="https://coveralls.io/github/DigiByte-Core/digibyte-rosetta-nodeapi"><img src="https://coveralls.io/repos/github/DigiByte-Core/digibyte-rosetta-nodeapi/badge.svg" /></a>
<a href="https://github.com/DigiByte-Core/digibyte-rosetta-nodeapi/blob/master/LICENSE.txt"><img src="https://img.shields.io/github/license/DigiByte-Core/digibyte-rosetta-nodeapi.svg" /></a>
</p>

# RosettaSDK (JS) [experimental]
Supported Rosetta Protocol Version: 1.4.1

This project is a port of the official Go reference implementation. All features, except a [few exceptions](docs/api_limitations.md), have been ported to JS.

⚠️ WARNING ⚠️
Due to the lack of funding, I wasn't able to continue the work on `rosetta-node-sdk`.

## Motivation
Coinbase's [Official Go Reference Implementation](https://github.com/coinbase/rosetta-sdk-go.git) is a thouroughly tested and wonderful SDK Implementation. However, as many developers are better suited to use NodeJS/Javascript, DigiByte decided to port the reference implementation to NodeJS while maintaining support for all it's core components.

## Documentation

### Prerequisites
- NodeJS >= 10.6
- NPM >= 6.10.0

The code was written on a Mac, so assuming all should work smoothly on Linux-based computers. However, there is no reason not to run this library on Windows-based machines. If you find an OS-related problem, please open an issue and it will be resolved.

### Installation
```bash
npm install --save rosetta-node-sdk
```

### Tests
This project is thoroughly tested using > 300 automated tests. Run `npm run test` to see how they all work out.

### Usage
All Core components are accessible as follows:
```Javascript
const RosettaSDK = require('rosetta-node-sdk');
const {
Asserter,
Server,
Reconciler,
Client,
Fetcher,
Syncer,
Parser,
SyncerEvents,
Errors,

Utils,
InternalModels,

logger,

version, // '1.4.1'
} = RosettaSDK;
```

### Components
- **Asserter** - Syntactical and semantical type validator. This Asserter can be used to validate Requests/Responses. Constructors exist that ease the creation of an asserter. For example, `NewClientWithResponses` can be used in order to create a server validator by only passing the network responses.
- **Server** - The Server Component eases the development of a custom server implementation. Examples on how to build such a server are located in [examples](./examples).
- **Reconciler** - Use the Reconciler in order to validate that the balances computed by parsing the blocks are the equal to the balances computed by a node.
- **Client** - Client request library [`rosetta-node-sdk-client`](https://github.com/SmartArray/rosetta-node-sdk-client)
- **Fetcher** - Convenience Wrapper Class for `Client`
- **Syncer** - Makes use of `Fetcher` class in order to download blocks in logical order.
- **Parser** - Parses and groups BalanceOperations of a block.
- **SyncerEvents** - Syncer Events. Mainly `BLOCK_ADDED`, `BLOCK_REMOVED`, `SYNC_CANCELLED`
- **Errors** - Error Classes for the different components: `AsserterError`, `FetcherError`, `InputError`, `ParserError`, `InternalError`, `ReconcilerError`, `SyncerError`.
- **Utils** - Utility functions, commonly used internally by the core components.
- **InternalModels** - Models, that are commonly used internally.
- **logger** - Default Logger Singleton Class.
- **version** - Specifies the version of this SDK. This semver is equal to the Rosetta API SDK for convencience.

### ToDos
- [ ] Setup CI (`npm run test` will execute 313 tests)
- [ ] Support `keys` (cryptographic API)
- [ ] Documentation
- [ ] Test Reconciler in live environment
14 changes: 14 additions & 0 deletions docs/api_limitations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# API Limitations
This Rosetta JS SDK contains a port of every essential core component that is available in the offical Go reference implementation, except a few exceptions:

☑️ Asserter
☑️ Controllers
☑️ Fetcher
☑️ Parser
☑️ Reconciler
☑️ Server
❌ Keys (may be ported to NodeJS in future)

# Client Package
This project makes extensive use of the Rosetta Client Library [`rosetta-node-sdk-client`](https://github.com/SmartArray/rosetta-node-sdk-client), that was generated with the OpenAPI Generator.
It does not contain TypeScript Wrappers. So if you want to use Typescript Classes for your server implementation, you should generate your own using the OpenAPI Generator Toolsuite.
12 changes: 12 additions & 0 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Basic Example Server
is directory demonstrates how to write a Rosetta Node server and how
to use either the Client package or Fetcher package to communicate
with that server.

Each subdirectory contains a separate project.
The projects were all ported from Go, to maintain maintability.

## Steps
1. Run `node server`
2. Run `node client` (in a new terminal window)
2. Run `node fetcher` (in a new terminal window)
86 changes: 86 additions & 0 deletions examples/basic/client/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/**
* Copyright (c) 2020 DigiByte Foundation NZ Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const RosettaSDK = require('../../..');
const RosettaClient = RosettaSDK.Client;

// Create an instance of APIClient and configure it.
const APIClient = new RosettaClient.ApiClient();
APIClient.basePath = 'http://localhost:8080';
APIClient.agent = 'rosetta-sdk-node';
APIClient.timeout = 10 * 1000; // 10 seconds

async function startClient() {
// Step1: Create an instance of RosettaSDK Client
const networkAPI = new RosettaClient.NetworkApi(APIClient).promises;

// Step 2: Get all available networks
const metadataRequest = new RosettaClient.MetadataRequest();
const networkList = await networkAPI.networkList(metadataRequest);
if (networkList.network_identifiers.length == 0) {
console.error('Server did not respond with any network identifier');
return;
}

// Step 3: Print the primary network
const primaryNetwork = networkList.network_identifiers[0];
console.log(`Primary Network: ${primaryNetwork}`);

// Step 4: Fetch the network status
const networkRequest = new RosettaClient.NetworkRequest(primaryNetwork);
const networkStatus = await networkAPI.networkStatus(networkRequest);

// Step 5: Print Network Status
console.log(`Network Status: ${networkStatus}`);

// Step 6: Asserter (ToDo?)
// Response Assertions are already handled by the server.

// Step 7: Fetch the Network Options
const networkOptions = await networkAPI.networkOptions(networkRequest);

// Step 8: Print Network Options
console.log(`Network Options: ${networkOptions}`);

// Step 9: Asserter (ToDo?), refer to step 6.
// Step 10: ClientAsserter, refer to step 6.
// ...

// Step 11: Fetch current block
const blockIdentifier = RosettaClient.PartialBlockIdentifier.constructFromObject({
hash: networkStatus.current_block_identifier,
});
const blockRequest = new RosettaClient.BlockRequest(primaryNetwork, blockIdentifier);
const block = await networkAPI.block(blockRequest);

// Step 12: Print the block
console.log(`Current Block: ${block}`);

// Step 13: Assert the block response is valid, refer to step 6

// Step 14: Print transactions in that block
block.OtherTransactions.forEach(tx => {
console.log(` Transaction: ${tx}`);
});
};

startClient()
.catch(e => console.error(e));
57 changes: 57 additions & 0 deletions examples/basic/fetcher/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2020 DigiByte Foundation NZ Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const RosettaSDK = require('../../..');

// Create an instance of Fetcher
const fetcher = new RosettaSDK.Fetcher({
server: {
protocol: 'http',
host: 'localhost',
port: '8080',
},
});

const main = (async function () {
const { primaryNetwork, networkStatus } = await fetcher.initializeAsserter();

console.log(`Primary Network: ${JSON.stringify(primaryNetwork)}`);
console.log(`Network Status: ${JSON.stringify(networkStatus)}`);

const block = await fetcher.blockRetry(
primaryNetwork,
new RosettaSDK.Utils.constructPartialBlockIdentifier(networkStatus.current_block_identifier),
);

console.log(`Current Block: ${JSON.stringify(block)}`);

const blockMap = fetcher.blockRange(
primaryNetwork,
networkStatus.genesis_block_identifier.index,
networkStatus.genesis_block_identifier.index + 10,
);

console.log(`Current Range: ${JSON.stringify(blockMap)}`);
});

main().catch(e => {
console.error(e);
})
48 changes: 48 additions & 0 deletions examples/basic/server/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright (c) 2020 DigiByte Foundation NZ Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const RosettaSDK = require('../../..');

const ServiceHandlers = require('./services');
const networkIdentifier = require('./network');

const asserter = RosettaSDK.Asserter.NewServer(
['Transfer', 'Reward'],
false,
[networkIdentifier],
);

/* Create a server configuration */
const Server = new RosettaSDK.Server({
URL_PORT: 8080,
});

// Register global asserter
Server.useAsserter(asserter);

/* Data API: Network */
Server.register('/network/list', ServiceHandlers.Network.networkList);
Server.register('/network/options', ServiceHandlers.Network.networkOptions);
Server.register('/network/status', ServiceHandlers.Network.networkStatus);

/* Data API: Block */
Server.register('/block', ServiceHandlers.Block.block);
Server.register('/block/transaction', ServiceHandlers.Block.blockTransaction);
25 changes: 25 additions & 0 deletions examples/basic/server/network.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2020 DigiByte Foundation NZ Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

const RosettaSDK = require('../../..');
const networkIdentifier = new RosettaSDK.Client.NetworkIdentifier('Rosetta', 'Testnet');

module.exports = networkIdentifier;
Loading