0.36.0 • Published 8 months ago

@requestnetwork/transaction-manager v0.36.0

Weekly downloads
121
License
MIT
Repository
github
Last release
8 months ago

@requestnetwork/transaction-manager

@requestnetwork/transaction-manager is a typescript library part of the Request Network protocol. It is the default implementation of the Transaction layer. It creates transactions to be sent to Data Access. When privacy is implemented, this package will handle the encryption

Installation

npm install @requestnetwork/transaction-manager

Usage

Note on the decryption provider

In order to decrypt encrypted transactions, you must provide a decryption provider. You can see the specification of decryption provider here.

An example of implementation of a decryption provider is available in the package: epk-decryption

import EthereumPrivateKeyDecryptionProvider from '@requestnetwork/epk-decryption';
import { TransactionManager } from '@requestnetwork/transaction-manager';

// Decryption provider setup
const decryptionProvider = new EthereumPrivateKeyDecryptionProvider({
  key: '0x04674d2e53e0e14653487d7323cc5f0a7959c83067f5654cafe4094bde90fa8a',
  method: EncryptionTypes.METHOD.ECIES,
});

// Potentially add another decryption key
decryptionProvider.addDecryptionParameters({
  key: '0x0906ff14227cead2b25811514302d57706e7d5013fcc40eca5985b216baeb998',
  method: EncryptionTypes.METHOD.ECIES,
});

const transactionManager = new TransactionManager(dataAccess, decryptionProvider);

Persist a clear transaction

import { DataAccessTypes, SignatureTypes } from '@requestnetwork/types';
import { TransactionManager } from '@requestnetwork/transaction-manager';

const dataAccess: DataAccessTypes.IDataAccess; // A Data Access implementation, for example @requestnetwork/data-access

const transactionManager = new TransactionManager(dataAccess);

const data = '{ what: "ever", it: "is,", this: "must", work: true }';
const channelId = 'myRequest';
const channelTopics = ['stakeholder1','stakeholder2'];

const { result } = await transactionManager.persistTransaction(data, channelId, channelTopics);

Persist an encrypted transaction

import { DataAccessTypes, SignatureTypes } from '@requestnetwork/types';
import { TransactionManager } from '@requestnetwork/transaction-manager';

const dataAccess: DataAccessTypes.IDataAccess; // A Data Access implementation, for example @requestnetwork/data-access

const transactionManager = new TransactionManager(dataAccess, decryptionProvider);

const data = '{ what: "ever", it: "is,", this: "must", work: true }';
const channelId = 'myRequest';
const channelTopics = ['stakeholder1','stakeholder2'];
const encryptionParameters: EncryptionTypes.IEncryptionParameters[] = [
  {
    key:
      '299708c07399c9b28e9870c4e643742f65c94683f35d1b3fc05d0478344ee0cc5a6a5e23f78b5ff8c93a04254232b32350c8672d2873677060d5095184dad422',
    method: EncryptionTypes.METHOD.ECIES,
  },
  {
    key:
      '9008306d319755055226827c22f4b95552c799bae7af0e99780cf1b5500d9d1ecbdbcf6f27cdecc72c97fef3703c54b717bca613894212e0b2525cbb2d1161b9',
    method: EncryptionTypes.METHOD.ECIES,
  }
]);

const { result } = await transactionManager.persistTransaction(data, channelId, channelTopics, encryptionParameters);

Get Transactions from channel id

import EthereumPrivateKeyDecryptionProvider from '@requestnetwork/epk-decryption';
import { DataAccessTypes, SignatureTypes } from '@requestnetwork/types';
import { TransactionManager } from '@requestnetwork/transaction-manager';

const dataAccess: DataAccessTypes.IDataAccess; // A Data Access implementation, for example @requestnetwork/data-access

// Decryption provider setup if needed
const decryptionProvider = new EthereumPrivateKeyDecryptionProvider({
  key: '0x04674d2e53e0e14653487d7323cc5f0a7959c83067f5654cafe4094bde90fa8a',
  method: EncryptionTypes.METHOD.ECIES,
});

const transactionManager = new TransactionManager(dataAccess, decryptionProvider);

const channelId = 'myRequest';

const { result: {transactions} } = await transactionManager.getTransactionsByChannelId(channelId);

Get Transactions from topic

import EthereumPrivateKeyDecryptionProvider from '@requestnetwork/epk-decryption';
import { DataAccessTypes, SignatureTypes } from '@requestnetwork/types';
import { TransactionManager } from '@requestnetwork/transaction-manager';

const dataAccess: DataAccessTypes.IDataAccess; // A Data Access implementation, for example @requestnetwork/data-access

// Decryption provider setup if needed
const decryptionProvider = new EthereumPrivateKeyDecryptionProvider({
  key: '0x04674d2e53e0e14653487d7323cc5f0a7959c83067f5654cafe4094bde90fa8a',
  method: EncryptionTypes.METHOD.ECIES,
});

const transactionManager = new TransactionManager(dataAccess, decryptionProvider);

const channelTopic = 'stakeholder1';

const {
  result: { transactions },
} = await transactionManager.getTransactionsByTopic(channelTopic);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Read the contributing guide

License

MIT

0.36.1-next.2082

8 months ago

0.36.1-next.2081

8 months ago

0.36.1-next.2080

8 months ago

0.36.1-next.2079

8 months ago

0.36.1-next.2078

8 months ago

0.36.1-next.2077

8 months ago

0.36.1-next.2076

8 months ago

0.36.1-next.2075

9 months ago

0.36.1-next.2074

9 months ago

0.36.1-next.2073

9 months ago

0.36.1-next.2072

9 months ago

0.36.1-next.2069

9 months ago

0.36.1-next.2068

9 months ago

0.36.1-next.2071

9 months ago

0.36.1-next.2067

9 months ago

0.36.1-next.2066

9 months ago

0.36.1-next.2065

9 months ago

0.36.1-next.2064

9 months ago

0.36.1-next.2063

10 months ago

0.36.0

11 months ago

0.35.0

11 months ago

0.26.1-next.711

11 months ago

0.26.1-next.710

11 months ago

0.26.1-next.709

11 months ago

0.35.1-next.2057

11 months ago

0.34.1-next.2047

12 months ago

0.34.1-next.2046

12 months ago

0.34.1-next.2049

12 months ago

0.34.1-next.2048

12 months ago

0.34.1-next.2043

12 months ago

0.34.1-next.2042

12 months ago

0.34.1-next.2045

12 months ago

0.34.1-next.2044

12 months ago

0.34.1-next.2053

11 months ago

0.34.1-next.2050

12 months ago

0.34.1-next.2052

11 months ago

0.34.1-next.2051

11 months ago

0.36.1-next.2062

10 months ago

0.36.1-next.2061

11 months ago

0.33.0

1 year ago

0.32.0

1 year ago

0.31.0

1 year ago

0.30.1-next.1978

2 years ago

0.30.0

2 years ago

0.29.1-next.1976

2 years ago

0.30.1-next.1977

2 years ago

0.29.1-next.1974

2 years ago

0.29.1-next.1971

2 years ago

0.29.1-next.1973

2 years ago

0.29.1-next.1969

2 years ago

0.29.1-next.1957

2 years ago

0.29.1-next.1958

2 years ago

0.29.1-next.1959

2 years ago

0.29.1-next.1964

2 years ago

0.29.1-next.1965

2 years ago

0.29.1-next.1966

2 years ago

0.29.1-next.1967

2 years ago

0.29.1-next.1960

2 years ago

0.29.1-next.1961

2 years ago

0.29.1-next.1962

2 years ago

0.29.1-next.1963

2 years ago

0.28.1-next.1949

2 years ago

0.28.1-next.1948

2 years ago

0.28.1-next.1947

2 years ago

0.29.1-next.1955

2 years ago

0.29.1-next.1956

2 years ago

0.28.1-next.1953

2 years ago

0.28.1-next.1952

2 years ago

0.28.1-next.1950

2 years ago

0.27.1-next.1929

2 years ago

0.27.1-next.1928

2 years ago

0.27.1-next.1927

2 years ago

0.27.1-next.1926

2 years ago

0.29.0

2 years ago

0.27.1-next.1930

2 years ago

0.27.1-next.1918

2 years ago

0.27.1-next.1917

2 years ago

0.27.1-next.1916

2 years ago

0.27.1-next.1920

2 years ago

0.27.1-next.1925

2 years ago

0.27.1-next.1924

2 years ago

0.27.1-next.1923

2 years ago

0.27.1-next.1922

2 years ago

0.27.1-next.1907

2 years ago

0.27.1-next.1906

2 years ago

0.27.1-next.1905

2 years ago

0.27.1-next.1909

2 years ago

0.27.1-next.1908

2 years ago

0.27.1-next.1910

2 years ago

0.27.1-next.1913

2 years ago

0.27.1-next.1912

2 years ago

0.27.1-next.1911

2 years ago

0.28.0

2 years ago

0.28.1-next.1936

2 years ago

0.28.1-next.1937

2 years ago

0.28.1-next.1938

2 years ago

0.28.1-next.1939

2 years ago

0.28.1-next.1940

2 years ago

0.28.1-next.1941

2 years ago

0.28.1-next.1942

2 years ago

0.28.1-next.1943

2 years ago

0.28.1-next.1944

2 years ago

0.28.1-next.1945

2 years ago

0.28.1-next.1946

2 years ago

0.28.1-next.1933

2 years ago

0.27.1-next.1899

2 years ago

0.27.1-next.1898

2 years ago

0.27.1-next.1897

2 years ago

0.27.1-next.1895

2 years ago

0.27.1-next.1894

2 years ago

0.27.1-next.1893

2 years ago

0.27.1-next.1904

2 years ago

0.27.1-next.1903

2 years ago

0.27.1-next.1902

2 years ago

0.27.1-next.1901

2 years ago

0.27.1-next.1900

2 years ago

0.27.1-next.1890

2 years ago

0.27.1-next.1892

2 years ago

0.27.1-next.1888

2 years ago

0.27.1-next.1887

2 years ago

0.27.1-next.1886

2 years ago

0.27.1-next.1885

2 years ago

0.27.1-next.1889

2 years ago

0.27.1-next.1880

2 years ago

0.27.1-next.1884

2 years ago

0.27.1-next.1883

2 years ago

0.27.1-next.1882

2 years ago

0.27.1-next.1881

2 years ago

0.27.1-next.1877

2 years ago

0.27.1-next.1875

2 years ago

0.27.1-next.1874

2 years ago

0.27.1-next.1879

2 years ago

0.27.1-next.1878

2 years ago

0.27.1-next.1873

2 years ago

0.27.1-next.1872

2 years ago

0.27.1-next.1871

2 years ago

0.27.1-next.1870

2 years ago

0.27.1-next.1866

2 years ago

0.27.1-next.1864

2 years ago

0.27.1-next.1863

2 years ago

0.27.1-next.1869

2 years ago

0.27.1-next.1868

2 years ago

0.27.1-next.1867

2 years ago

0.27.1-next.1862

2 years ago

0.27.1-next.1861

2 years ago

0.27.1-next.1860

2 years ago

0.27.1-next.1849

2 years ago

0.27.1-next.1855

2 years ago

0.27.1-next.1854

2 years ago

0.27.1-next.1853

2 years ago

0.27.1-next.1852

2 years ago

0.27.1-next.1859

2 years ago

0.27.1-next.1857

2 years ago

0.27.1-next.1851

2 years ago

0.27.1-next.1850

2 years ago

0.27.1-next.1843

3 years ago

0.27.1-next.1842

3 years ago

0.27.1-next.1841

3 years ago

0.27.1-next.1848

3 years ago

0.27.1-next.1847

3 years ago

0.27.1-next.1846

3 years ago

0.27.1-next.1845

3 years ago

0.27.1-next.1840

3 years ago

0.27.1-next.1822

3 years ago

0.27.1-next.1826

3 years ago

0.27.1-next.1825

3 years ago

0.27.1-next.1824

3 years ago

0.27.1-next.1823

3 years ago

0.27.0

3 years ago

0.27.1-next.1839

3 years ago

0.27.1-next.1829

3 years ago

0.27.1-next.1828

3 years ago

0.27.1-next.1827

3 years ago

0.27.1-next.1833

3 years ago

0.27.1-next.1832

3 years ago

0.27.1-next.1831

3 years ago

0.27.1-next.1830

3 years ago

0.27.1-next.1837

3 years ago

0.27.1-next.1835

3 years ago

0.26.9

4 years ago

0.26.9-next.1462

4 years ago

0.26.9-next.1461

4 years ago

0.26.9-next.1458

4 years ago

0.26.9-next.1459

4 years ago

0.26.9-next.1457

4 years ago

0.26.9-next.1456

4 years ago

0.26.9-next.1455

4 years ago

0.26.7-next.1430

4 years ago

0.26.7-next.1432

4 years ago

0.26.7-next.1431

4 years ago

0.26.7-next.1429

4 years ago

0.26.8-next.1448

4 years ago

0.26.8-next.1447

4 years ago

0.26.8-next.1449

4 years ago

0.26.8

4 years ago

0.26.9-next.1450

4 years ago

0.26.9-next.1451

4 years ago

0.26.9-next.1452

4 years ago

0.26.9-next.1453

4 years ago

0.26.9-next.1454

4 years ago

0.26.8-next.1437

4 years ago

0.26.8-next.1436

4 years ago

0.26.8-next.1439

4 years ago

0.26.8-next.1438

4 years ago

0.26.8-next.1444

4 years ago

0.26.8-next.1443

4 years ago

0.26.8-next.1446

4 years ago

0.26.8-next.1445

4 years ago

0.26.8-next.1442

4 years ago

0.26.8-next.1441

4 years ago

0.26.8-next.1435

4 years ago

0.26.8-next.1434

4 years ago

0.26.7-next.1426

4 years ago

0.26.7-next.1428

4 years ago

0.26.7

4 years ago

0.26.7-next.1425

4 years ago

0.26.7-next.1424

4 years ago

0.26.7-next.1421

4 years ago

0.26.7-next.1423

4 years ago

0.26.7-next.1422

4 years ago

0.26.7-next.1420

4 years ago

0.26.7-next.1416

4 years ago

0.26.7-next.1418

4 years ago

0.26.7-next.1417

4 years ago

0.26.7-next.1419

4 years ago

0.26.7-next.1415

4 years ago

0.26.7-next.1414

4 years ago

0.26.7-next.1413

4 years ago

0.26.7-next.1412

4 years ago

0.26.7-next.1411

4 years ago

0.26.7-next.1410

4 years ago

0.26.7-next.1407

4 years ago

0.26.7-next.1409

4 years ago

0.26.7-next.1408

4 years ago

0.26.6-next.1403

4 years ago

0.26.6-next.1404

4 years ago

0.26.6

4 years ago

0.26.7-next.1405

4 years ago

0.26.5-next.1401

4 years ago

0.26.5-next.1402

4 years ago

0.26.5-next.1398

4 years ago

0.26.5-next.1393

4 years ago

0.26.5-next.1395

4 years ago

0.26.5-next.1394

4 years ago

0.26.5-next.1399

4 years ago

0.26.5-next.1392

4 years ago

0.26.5-next.1391

4 years ago

0.26.5-next.1397

4 years ago

0.26.5-next.1400

4 years ago

0.26.5

4 years ago

0.26.4

4 years ago

0.26.3

4 years ago

0.26.2

4 years ago

0.26.1

5 years ago

0.26.1-next.1351

5 years ago

0.26.0

5 years ago

0.9.0-next.1

5 years ago

0.25.0

5 years ago

0.24.1-next.1335

5 years ago

0.24.0

5 years ago

0.23.1-next.1332

5 years ago

0.23.1-next.1331

5 years ago

0.23.0

5 years ago

0.21.1-next.1326

5 years ago

0.22.1-next.1327

5 years ago

0.22.0

5 years ago

0.21.0

5 years ago

0.20.1-next.1322

5 years ago

0.20.0

5 years ago

0.19.1-next.1312

5 years ago

0.19.1-next.1310

5 years ago

0.19.0

5 years ago

0.18.0

5 years ago

0.17.0

5 years ago

0.17.1-next.1280

5 years ago

0.16.1-next.1278

5 years ago

0.16.0

5 years ago

0.15.1-next.1272

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.1-next.1231

5 years ago

0.12.1-next.1230

5 years ago

0.11.1-next.1227

5 years ago

0.12.0

5 years ago

0.11.1-next.1218

5 years ago

0.11.0

5 years ago

0.11.1-next.1217

5 years ago

0.10.1-next.1215

5 years ago

0.10.1-next.1207

5 years ago

0.10.1-next.1206

5 years ago

0.10.0

5 years ago

0.9.1-next.1203

5 years ago

0.9.1-next.1201

5 years ago

0.9.0

5 years ago

0.9.1-next.1192

5 years ago

0.8.5-next.1187

5 years ago

0.8.5-next.1186

5 years ago

0.8.5-next.1181

5 years ago

0.8.5-next.1176

5 years ago

0.8.5-next.1175

5 years ago

0.8.5-next.1173

5 years ago

0.8.5-next.1171

5 years ago

0.8.5-next.1164

5 years ago

0.8.5-next.1163

5 years ago

0.8.5-next.1161

5 years ago

0.8.4

5 years ago

0.8.4-next.1156

6 years ago

0.8.3

6 years ago

0.8.3-next.1142

6 years ago

0.8.3-next.1143

6 years ago

0.8.3-next.1140

6 years ago

0.8.3-next.1134

6 years ago

0.8.3-next.1130

6 years ago

0.8.3-next.1132

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

6 years ago

0.2.1-alpha.0

6 years ago

0.2.0

6 years ago

0.1.1-alpha.12

6 years ago

0.1.1-alpha.11

6 years ago

0.1.1-alpha.10

6 years ago

0.1.1-alpha.9

6 years ago

0.1.1-alpha.8

6 years ago

0.1.1-alpha.7

6 years ago

0.1.1-alpha.6

6 years ago

0.1.1-alpha.5

6 years ago

0.1.1-alpha.4

6 years ago

0.1.1-alpha.3

6 years ago

0.1.1-alpha.2

6 years ago

0.1.1-alpha.1

6 years ago

0.1.1-alpha.0

6 years ago