@attocash/n8n-nodes-atto 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @attocash/n8n-nodes-atto
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@attocash/n8n-nodes-atto.svg)](https://www.npmjs.com/package/@attocash/n8n-nodes-atto)
4
+ [![n8n Atto Node CI](https://github.com/attocash/integrations/actions/workflows/n8n-node-package.yml/badge.svg)](https://github.com/attocash/integrations/actions/workflows/n8n-node-package.yml)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/attocash/integrations/blob/main/LICENSE)
6
+
7
+ n8n community node package for Atto cryptocurrency wallet, transaction, account, and trigger automation. The nodes delegate address derivation, signing, node access, wallet operations, streams, and test mocks to Atto Commons packages instead of implementing Atto protocol logic locally.
8
+
9
+ ## Install in n8n
10
+
11
+ Install the npm package from **Settings** > **Community Nodes** in a self-hosted n8n instance:
12
+
13
+ ```text
14
+ @attocash/n8n-nodes-atto
15
+ ```
16
+
17
+ n8n's **Browse** button opens npm search for packages tagged with `n8n-community-node-package`. This package includes that keyword so it is discoverable from the n8n community-node flow after it is published to npm.
18
+
19
+ ## Nodes
20
+
21
+ ### Atto
22
+
23
+ - Address: Derive an Atto address and public key from a mnemonic or hex private key.
24
+ - Account: Get balance, representative, height, and frontier for an address.
25
+ - Receivable: Get receivable entries, receive the receivable from the incoming item, or wait for the next pending entry for the credentials address.
26
+ - Transaction: Get transactions by hash or bounded stream query, or send from the credentials-derived address.
27
+ - Account Entry: Get account entries by hash or bounded stream query.
28
+ - Representative: Change the representative for the credentials-derived address.
29
+
30
+ ### Atto Trigger
31
+
32
+ - Receivable: Trigger when a receivable is available for the credentials-derived address or manual addresses.
33
+ - Account Update: Trigger from account state updates.
34
+ - Transaction: Trigger from transactions by hash, address stream, or all stream.
35
+ - Account Entry: Trigger from account entries by hash, address stream, or all stream.
36
+
37
+ ## Credentials
38
+
39
+ Create an **Atto API** credential in n8n:
40
+
41
+ - Node Base URL: Atto node HTTP API, for example `http://localhost:8080`.
42
+ - Worker Base URL: Atto work server HTTP API, for example `http://localhost:8085`.
43
+ - API Key: optional key sent to both services.
44
+ - API Key Header and Prefix: defaults to `Authorization: Bearer <key>`.
45
+ - Wallet Secret Type: mnemonic phrase or private key. Atto Commons currently expects 24-word mnemonic phrases.
46
+ - Wallet Secret: encrypted by n8n and used only for signing.
47
+ - Key Index: derivation index for mnemonic secrets.
48
+
49
+ The n8n credential test performs a read-only `GET /` against **Node Base URL** to verify the configured node endpoint is reachable. It does not send the wallet secret.
50
+
51
+ For one-off derivation and tests, the action node can read the secret from node parameters instead of credentials. For real funds, prefer encrypted n8n credentials; workflow node parameters can appear in failed execution records depending on n8n redaction settings. Secrets are never returned in successful node output.
52
+
53
+ Signing actions derive the source address from the wallet secret and key index. Send, receive, and representative-change operations do not require a manual source address. Send and receive use a 60 second publish timeout by default.
54
+
55
+ ## Build And Test
56
+
57
+ ```bash
58
+ npm install
59
+ npm run build
60
+ npm test
61
+ npm run lint
62
+ ```
63
+
64
+ `npm test` builds the package and runs unit, smoke, and integration tests. The integration test uses `AttoNodeMockAsyncBuilder` and `AttoWorkerMockAsyncBuilder` from `@attocash/commons-test`. It uses Docker when available and falls back to a local Podman socket.
65
+
66
+ To require the mock-container integration path:
67
+
68
+ ```bash
69
+ ATTO_TEST_INTEGRATION=1 npm run test:integration
70
+ ```
71
+
72
+ ## Local n8n
73
+
74
+ Build first, then mount this package as a community node package:
75
+
76
+ ```bash
77
+ npm run build
78
+ mkdir -p /tmp/n8n-atto-local/.n8n/nodes/node_modules
79
+ podman run --rm -it \
80
+ --user 0 \
81
+ -p 5678:5678 \
82
+ -e N8N_USER_FOLDER=/home/node \
83
+ -e N8N_COMMUNITY_PACKAGES_ENABLED=true \
84
+ -e N8N_SECURE_COOKIE=false \
85
+ -v /tmp/n8n-atto-local:/home/node:Z \
86
+ -v "$PWD:/home/node/.n8n/nodes/node_modules/@attocash/n8n-nodes-atto:ro,Z" \
87
+ docker.io/n8nio/n8n:latest
88
+ ```
89
+
90
+ Open `http://localhost:5678`, create a workflow, and add the **Atto** or **Atto Trigger** node.
91
+
92
+ ### Install from a checkout inside the n8n container
93
+
94
+ If you have shell access inside the n8n container, clone this repository and run the installer from the package directory:
95
+
96
+ ```bash
97
+ cd /tmp
98
+ git clone https://github.com/attocash/integrations.git
99
+ cd integrations/n8n-node
100
+ npm run install:n8n
101
+ ```
102
+
103
+ The script installs build dependencies, builds and validates the package, packs it, and installs the generated `.tgz` into `${N8N_USER_FOLDER:-$HOME/.n8n}/nodes`. Override the destination with `N8N_NODES_DIR=/path/to/nodes npm run install:n8n`. Use `RUN_TESTS=1 npm run install:n8n` only when the container can run the test dependencies.
104
+
105
+ Restart n8n after the script finishes.
106
+
107
+ ## Usage
108
+
109
+ See `examples/send-transaction.json`, `examples/incoming-to-receive.json`, `examples/ping-pong-receivable.json`, and `examples/receivable-trigger.json` for importable workflow shapes. `incoming-to-receive.json` pipes the **Atto Trigger** receivable output into **Atto** → **Receivable** → **Receive Pending** with **Receivable Source** set to **Input Item**. Replace placeholder addresses and attach an **Atto API** credential before running transaction operations.
110
+
111
+ ## Release
112
+
113
+ The n8n package is versioned independently from other integrations in this repository. Update `n8n-node/package.json` with normal semver when you want to attempt a new release. Multiple commits can keep the same attempted version until the release is approved.
114
+
115
+ ```bash
116
+ cd n8n-node
117
+ npm version patch --no-git-tag-version
118
+ git add package.json package-lock.json
119
+ git commit -m "Release n8n Atto node vX.Y.Z"
120
+ git push origin main
121
+ ```
122
+
123
+ The GitHub Actions workflow runs lint, tests, and packing for pull requests and n8n-related pushes to `main`. Main pushes upload the attempted package artifact immediately, then wait for approval in the GitHub environment named `release`. After approval, the workflow creates the package-specific tag `n8n-node-vX.Y.Z`, publishes `@attocash/n8n-nodes-atto@X.Y.Z` to npm with provenance, and creates the GitHub Release with the `.tgz` attached. Configure npm Trusted Publishing for this repository and workflow file, or set the `NPM_TOKEN` repository secret as a fallback.
124
+
125
+ ## Implementation Notes
126
+
127
+ - Runtime protocol behavior comes from Atto Commons split packages: `@attocash/commons-core`, `@attocash/commons-node`, `@attocash/commons-node-remote`, `@attocash/commons-wallet`, and `@attocash/commons-worker-remote`.
128
+ - The Atto Commons package code is bundled into the action and trigger node files so the published n8n community node has no runtime dependencies beyond n8n.
129
+ - The aggregate `@attocash/commons-js@6.7.1-patch.1` package was not used because its published runtime entrypoint does not expose the APIs used by the current Commons JS example.
130
+ - Hex private keys should use the format accepted by `AttoPrivateKey.Companion.parse`.
@@ -0,0 +1,9 @@
1
+ import type { Icon, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class AttoApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ icon: Icon;
6
+ documentationUrl: string;
7
+ properties: INodeProperties[];
8
+ test: ICredentialTestRequest;
9
+ }
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AttoApi = void 0;
4
+ class AttoApi {
5
+ name = 'attoApi';
6
+ displayName = 'Atto API';
7
+ icon = 'file:../nodes/Atto/atto.svg';
8
+ documentationUrl = 'https://github.com/attocash/integrations/tree/main/n8n-node#credentials';
9
+ properties = [
10
+ {
11
+ displayName: 'Node Base URL',
12
+ name: 'nodeUrl',
13
+ type: 'string',
14
+ default: 'https://gatekeeper.live.application.atto.cash',
15
+ placeholder: 'https://my-node.example',
16
+ description: 'Base URL of the Atto node HTTP API',
17
+ },
18
+ {
19
+ displayName: 'Worker Base URL',
20
+ name: 'workerUrl',
21
+ type: 'string',
22
+ default: 'https://gatekeeper.live.application.atto.cash',
23
+ placeholder: 'https://my-work-server.example',
24
+ description: 'Base URL of the Atto work server HTTP API',
25
+ },
26
+ {
27
+ displayName: 'API Key',
28
+ name: 'apiKey',
29
+ type: 'string',
30
+ typeOptions: { password: true },
31
+ default: '',
32
+ description: 'Optional API key sent to both Atto node and worker requests',
33
+ },
34
+ {
35
+ displayName: 'API Key Header',
36
+ name: 'authHeaderName',
37
+ type: 'string',
38
+ default: 'Authorization',
39
+ displayOptions: {
40
+ hide: {
41
+ apiKey: [''],
42
+ },
43
+ },
44
+ description: 'Header name used when API Key is set',
45
+ },
46
+ {
47
+ displayName: 'API Key Prefix',
48
+ name: 'authHeaderPrefix',
49
+ type: 'string',
50
+ default: 'Bearer',
51
+ displayOptions: {
52
+ hide: {
53
+ apiKey: [''],
54
+ },
55
+ },
56
+ description: 'Optional prefix placed before the API key, for example Bearer',
57
+ },
58
+ {
59
+ displayName: 'Wallet Secret Type',
60
+ name: 'walletMaterialType',
61
+ type: 'options',
62
+ options: [
63
+ {
64
+ name: 'Mnemonic Phrase',
65
+ value: 'mnemonic',
66
+ },
67
+ {
68
+ name: 'Private Key',
69
+ value: 'privateKey',
70
+ },
71
+ ],
72
+ default: 'mnemonic',
73
+ description: 'Secret format used for signing Atto transactions',
74
+ },
75
+ {
76
+ displayName: 'Wallet Secret',
77
+ name: 'walletSecret',
78
+ type: 'string',
79
+ typeOptions: { password: true },
80
+ default: '',
81
+ description: 'Mnemonic phrase or private key. It is used only for signing and is never returned by this node.',
82
+ },
83
+ {
84
+ displayName: 'Key Index',
85
+ name: 'keyIndex',
86
+ type: 'number',
87
+ default: 0,
88
+ typeOptions: {
89
+ minValue: 0,
90
+ numberPrecision: 0,
91
+ },
92
+ displayOptions: {
93
+ show: {
94
+ walletMaterialType: ['mnemonic'],
95
+ },
96
+ },
97
+ description: 'Derivation index used when Wallet Secret Type is Mnemonic Phrase',
98
+ },
99
+ ];
100
+ test = {
101
+ request: {
102
+ baseURL: '={{$credentials.nodeUrl}}',
103
+ url: '/',
104
+ method: 'GET',
105
+ },
106
+ };
107
+ }
108
+ exports.AttoApi = AttoApi;
109
+ //# sourceMappingURL=AttoApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AttoApi.credentials.js","sourceRoot":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AC1B,IAAI,EAAE,SAAS;YACf,OAAO,EAAE;gBACR;oBACC,IAAI,EAAE,iBAAiB;oBACvB,KAAK,EAAE,UAAU;iBACjB;gBACD;oBACC,IAAI,EAAE,aAAa;oBACnB,KAAK,EAAE,YAAY;iBACnB;aACD;YACD,OAAO,EAAE,UAAU;YACnB,WAAW,EAAE,kDAAkD;SAC/D;QACD;YACC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,iGAAiG;SAC9G;QACD;YACC,WAAW,EAAE,WAAW;YACxB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,CAAC;YACV,WAAW,EAAE;gBACZ,QAAQ,EAAE,CAAC;gBACX,eAAe,EAAE,CAAC;aAClB;YACD,cAAc,EAAE;gBACf,IAAI,EAAE;oBACL,kBAAkB,EAAE,CAAC,UAAU,CAAC;iBAChC;aACD;YACD,WAAW,EAAE,kEAAkE;SAC/E;KACD,CAAC;IAEF,IAAI,GAA2B;QAC9B,OAAO,EAAE;YACR,OAAO,EAAE,2BAA2B;YACpC,GAAG,EAAE,GAAG;YACR,MAAM,EAAE,KAAK;SACb;KACD,CAAC;CACF;AA5GD,0BA4GC"}
@@ -0,0 +1,5 @@
1
+ import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Atto implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }